Address Contract Partially Verified
Address
0x74cEDb4F333cB2e554349f498145e02952b920a9
Balance
0 ETH
Nonce
1
Code Size
13955 bytes
Creator
0x2E35a61f...3c14 at tx 0xaa0ea150...c9dcb1
Indexed Transactions
0
Contract Bytecode
13955 bytes
0x60806040526004361061021a5760003560e01c8063715018a611610123578063aad2946f116100ab578063d7224ba01161006f578063d7224ba014610620578063da39f8cf14610635578063dc33e68114610648578063e985e9c514610668578063f2fde38b146106885761021a565b8063aad2946f1461058b578063b88d4fde146105a0578063c87b56dd146105c0578063cd17919e146105e0578063ced4a5f2146106005761021a565b80639231ab2a116100f25780639231ab2a146104e957806395d89b41146105165780639f57f5a01461052b578063a084d0581461054b578063a22cb4651461056b5761021a565b8063715018a61461047f57806372b00677146104945780637354fc7e146104b45780638da5cb5b146104d45761021a565b80633ccfd60b116101a657806354d77e0e1161017557806354d77e0e146103ea57806355f804b31461040a5780636352211e1461042a5780636817c76c1461044a57806370a082311461045f5761021a565b80633ccfd60b1461037557806341e5fb401461038a57806342842e0e146103aa5780634f6ccce7146103ca5761021a565b806318160ddd116101ed57806318160ddd146102c657806323b872dd146102e85780632d20fb60146103085780632f745c5914610328578063331ee446146103485761021a565b806301ffc9a71461021f57806306fdde0314610255578063081812fc14610277578063095ea7b3146102a4575b600080fd5b34801561022b57600080fd5b5061023f61023a366004612902565b6106a8565b60405161024c9190612b9b565b60405180910390f35b34801561026157600080fd5b5061026a61070b565b60405161024c9190612baf565b34801561028357600080fd5b50610297610292366004612aac565b61079e565b60405161024c9190612b4a565b3480156102b057600080fd5b506102c46102bf36600461282c565b6107ea565b005b3480156102d257600080fd5b506102db610883565b60405161024c9190612ba6565b3480156102f457600080fd5b506102c4610303366004612700565b610889565b34801561031457600080fd5b506102c4610323366004612aac565b610894565b34801561033457600080fd5b506102db61034336600461282c565b61090c565b34801561035457600080fd5b5061036861036336600461293a565b610a07565b60405161024c9190613443565b34801561038157600080fd5b506102c4610a1f565b34801561039657600080fd5b506102db6103a536600461293a565b610a91565b3480156103b657600080fd5b506102c46103c5366004612700565b610aa3565b3480156103d657600080fd5b506102db6103e5366004612aac565b610abe565b3480156103f657600080fd5b506102c461040536600461296f565b610aea565b34801561041657600080fd5b506102c4610425366004612a40565b610b82565b34801561043657600080fd5b50610297610445366004612aac565b610bcd565b34801561045657600080fd5b506102db610bdf565b34801561046b57600080fd5b506102db61047a3660046126b4565b610ca3565b34801561048b57600080fd5b506102c4610cf0565b3480156104a057600080fd5b506102c46104af366004612a0d565b610d3b565b3480156104c057600080fd5b5061023f6104cf36600461293a565b610dee565b3480156104e057600080fd5b50610297610fcc565b3480156104f557600080fd5b50610509610504366004612aac565b610fdb565b60405161024c919061341a565b34801561052257600080fd5b5061026a610fec565b34801561053757600080fd5b506102db61054636600461293a565b610ffb565b34801561055757600080fd5b506102db61056636600461293a565b611217565b34801561057757600080fd5b506102c46105863660046127f2565b611307565b34801561059757600080fd5b506103686113d5565b3480156105ac57600080fd5b506102c46105bb36600461273b565b6113dc565b3480156105cc57600080fd5b5061026a6105db366004612aac565b611415565b3480156105ec57600080fd5b506102db6105fb366004612954565b611498565b34801561060c57600080fd5b506102c461061b366004612855565b6114b5565b34801561062c57600080fd5b506102db61159d565b6102c461064336600461298a565b6115a3565b34801561065457600080fd5b506102db6106633660046126b4565b6117de565b34801561067457600080fd5b5061023f6106833660046126ce565b6117e9565b34801561069457600080fd5b506102c46106a33660046126b4565b611817565b60006001600160e01b031982166380ac58cd60e01b14806106d957506001600160e01b03198216635b5e139f60e01b145b806106f457506001600160e01b0319821663780e9d6360e01b145b80610703575061070382611888565b90505b919050565b60606002805461071a9061358b565b80601f01602080910402602001604051908101604052809291908181526020018280546107469061358b565b80156107935780601f1061076857610100808354040283529160200191610793565b820191906000526020600020905b81548152906001019060200180831161077657829003601f168201915b505050505090505b90565b60006107a9826118a1565b6107ce5760405162461bcd60e51b81526004016107c59061338b565b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006107f582610bcd565b9050806001600160a01b0316836001600160a01b031614156108295760405162461bcd60e51b81526004016107c5906130f1565b806001600160a01b031661083b6118a8565b6001600160a01b031614806108575750610857816106836118a8565b6108735760405162461bcd60e51b81526004016107c590612e2e565b61087e8383836118ac565b505050565b60015490565b61087e838383611908565b61089c6118a8565b6001600160a01b03166108ad610fcc565b6001600160a01b0316146108d35760405162461bcd60e51b81526004016107c590612fb6565b600260095414156108f65760405162461bcd60e51b81526004016107c5906132c2565b600260095561090481611c1a565b506001600955565b600061091783610ca3565b82106109355760405162461bcd60e51b81526004016107c590612bc2565b600061093f610883565b905060008060005b838110156109e8576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160401b0316918301919091521561099957805192505b876001600160a01b0316836001600160a01b031614156109d557868414156109c757509350610a0192505050565b836109d1816135c6565b9450505b50806109e0816135c6565b915050610947565b5060405162461bcd60e51b81526004016107c59061322e565b92915050565b600b6020526000908152604090205463ffffffff1681565b610a276118a8565b6001600160a01b0316610a38610fcc565b6001600160a01b031614610a5e5760405162461bcd60e51b81526004016107c590612fb6565b6040514790339082156108fc029083906000818181858888f19350505050158015610a8d573d6000803e3d6000fd5b5050565b600c6020526000908152604090205481565b61087e838383604051806020016040528060008152506113dc565b6000610ac8610883565b8210610ae65760405162461bcd60e51b81526004016107c590612ce7565b5090565b610af26118a8565b6001600160a01b0316610b03610fcc565b6001600160a01b031614610b295760405162461bcd60e51b81526004016107c590612fb6565b80600c6000846004811115610b4e57634e487b7160e01b600052602160045260246000fd5b6004811115610b6d57634e487b7160e01b600052602160045260246000fd5b81526020810191909152604001600020555050565b610b8a6118a8565b6001600160a01b0316610b9b610fcc565b6001600160a01b031614610bc15760405162461bcd60e51b81526004016107c590612fb6565b61087e600d83836125e2565b6000610bd882611da4565b5192915050565b60036000908152600b6020527f64c15cc42be7899b001f818cf4433057002112c418d1d3a67cd5cb453051d33e5463ffffffff168015801590610c2857508063ffffffff164210155b15610c3d5766d529ae9e86000091505061079b565b6001600052600b6020527f72c6bfb7988af3a1efa6568f02a999bc52252641c659d85961ca3d372b57d5cf5463ffffffff168015801590610c8457508063ffffffff164210155b15610c9a57666a94d74f4300009250505061079b565b60009250505090565b60006001600160a01b038216610ccb5760405162461bcd60e51b81526004016107c590612ef9565b506001600160a01b03166000908152600560205260409020546001600160801b031690565b610cf86118a8565b6001600160a01b0316610d09610fcc565b6001600160a01b031614610d2f5760405162461bcd60e51b81526004016107c590612fb6565b610d396000611eb6565b565b610d436118a8565b6001600160a01b0316610d54610fcc565b6001600160a01b031614610d7a5760405162461bcd60e51b81526004016107c590612fb6565b80600b6000846004811115610d9f57634e487b7160e01b600052602160045260246000fd5b6004811115610dbe57634e487b7160e01b600052602160045260246000fd5b815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505050565b6000600b6000836004811115610e1457634e487b7160e01b600052602160045260246000fd5b6004811115610e3357634e487b7160e01b600052602160045260246000fd5b815260208101919091526040016000205463ffffffff16610e5657506000610706565b600080836004811115610e7957634e487b7160e01b600052602160045260246000fd5b1480610ea457506001836004811115610ea257634e487b7160e01b600052602160045260246000fd5b145b80610ece57506003836004811115610ecc57634e487b7160e01b600052602160045260246000fd5b145b15610f3e576202a300600b6000856004811115610efb57634e487b7160e01b600052602160045260246000fd5b6004811115610f1a57634e487b7160e01b600052602160045260246000fd5b8152602081019190915260400160002054610f3b919063ffffffff166134b7565b90505b63ffffffff811615801590610f5957508063ffffffff164210155b15610f68576000915050610706565b600b6000846004811115610f8c57634e487b7160e01b600052602160045260246000fd5b6004811115610fab57634e487b7160e01b600052602160045260246000fd5b815260208101919091526040016000205463ffffffff164210159392505050565b6000546001600160a01b031690565b610fe3612662565b61070382611da4565b60606003805461071a9061358b565b6000808083600481111561101f57634e487b7160e01b600052602160045260246000fd5b141561105a57503360009081527f13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e360205260409020546111d0565b600183600481111561107c57634e487b7160e01b600052602160045260246000fd5b14806110a7575060028360048111156110a557634e487b7160e01b600052602160045260246000fd5b145b15611117573360009081527fbff4442b8ed600beeb8e26b1279a0f0d14c6edfaec26d968ee13c86f7d4c2ba860209081526040808320547fbbc70db1b6c7afd11e79c0fb0051300458f1a3acb8ee9789d9b6b26c61ad9bc790925290912054611110919061349f565b90506111d0565b600383600481111561113957634e487b7160e01b600052602160045260246000fd5b14806111645750600483600481111561116257634e487b7160e01b600052602160045260246000fd5b145b156111d0573360009081527fe1eb2b2161a492c07c5a334e48012567cba93ec021043f53c1955516a3c5a84160209081526040808320547fa856840544dc26124927add067d799967eac11be13e14d82cc281ea46fa39759909252909120546111cd919061349f565b90505b6000808460048111156111f357634e487b7160e01b600052602160045260246000fd5b141561120157506001611205565b5060025b61120f8282613531565b949350505050565b60008082600481111561123a57634e487b7160e01b600052602160045260246000fd5b141561124957506103e8610706565b600182600481111561126b57634e487b7160e01b600052602160045260246000fd5b14806112965750600282600481111561129457634e487b7160e01b600052602160045260246000fd5b145b156112a45750610fa0610706565b60038260048111156112c657634e487b7160e01b600052602160045260246000fd5b14806112f1575060048260048111156112ef57634e487b7160e01b600052602160045260246000fd5b145b156112ff5750612328610706565b506000919050565b61130f6118a8565b6001600160a01b0316826001600160a01b031614156113405760405162461bcd60e51b81526004016107c59061303a565b806007600061134d6118a8565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556113916118a8565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516113c99190612b9b565b60405180910390a35050565b6202a30081565b6113e7848484611908565b6113f384848484611f06565b61140f5760405162461bcd60e51b81526004016107c590613133565b50505050565b6060611420826118a1565b61143c5760405162461bcd60e51b81526004016107c590612feb565b6000611446612021565b905060008151116114665760405180602001604052806000815250611491565b8061147084612030565b604051602001611481929190612b1b565b6040516020818303038152906040525b9392505050565b600a60209081526000928352604080842090915290825290205481565b6114bd6118a8565b6001600160a01b03166114ce610fcc565b6001600160a01b0316146114f45760405162461bcd60e51b81526004016107c590612fb6565b7f0000000000000000000000000000000000000000000000000000000000002328815161151f610883565b611529919061349f565b11156115475760405162461bcd60e51b81526004016107c590612f44565b60005b8151811015610a8d57600082828151811061157557634e487b7160e01b600052603260045260246000fd5b6020026020010151905061158a81600161214a565b5080611595816135c6565b91505061154a565b60085481565b3233146115c25760405162461bcd60e51b81526004016107c590612df7565b600083116115e25760405162461bcd60e51b81526004016107c590612c04565b6115eb84610dee565b6116075760405162461bcd60e51b81526004016107c590612d6f565b61161084611217565b83611619610883565b611623919061349f565b11156116415760405162461bcd60e51b81526004016107c590613348565b7f00000000000000000000000000000000000000000000000000000000000023288361166b610883565b611675919061349f565b11156116935760405162461bcd60e51b81526004016107c590612f44565b348361169d610bdf565b6116a791906134ea565b146116c45760405162461bcd60e51b81526004016107c590612ec2565b6116cd84610ffb565b8311156116ec5760405162461bcd60e51b81526004016107c5906131fe565b6117298483838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061216492505050565b6117455760405162461bcd60e51b81526004016107c5906130c3565b61174f338461214a565b82600a600086600481111561177457634e487b7160e01b600052602160045260246000fd5b600481111561179357634e487b7160e01b600052602160045260246000fd5b81526020019081526020016000206000336001600160a01b03166001600160a01b0316815260200190815260200160002060008282546117d3919061349f565b909155505050505050565b600061070382612247565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b61181f6118a8565b6001600160a01b0316611830610fcc565b6001600160a01b0316146118565760405162461bcd60e51b81526004016107c590612fb6565b6001600160a01b03811661187c5760405162461bcd60e51b81526004016107c590612c57565b61188581611eb6565b50565b6001600160e01b031981166301ffc9a760e01b14919050565b6001541190565b3390565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061191382611da4565b9050600081600001516001600160a01b031661192d6118a8565b6001600160a01b0316148061196257506119456118a8565b6001600160a01b03166119578461079e565b6001600160a01b0316145b8061197657508151611976906106836118a8565b9050806119955760405162461bcd60e51b81526004016107c590613071565b846001600160a01b031682600001516001600160a01b0316146119ca5760405162461bcd60e51b81526004016107c590612f70565b6001600160a01b0384166119f05760405162461bcd60e51b81526004016107c590612d2a565b6119fd858585600161140f565b611a0d60008484600001516118ac565b6001600160a01b0385166000908152600560205260408120805460019290611a3f9084906001600160801b0316613509565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b03861660009081526005602052604081208054600194509092611a8b9185911661347d565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b0380871682526001600160401b03428116602080850191825260008981526004909152948520935184549151909216600160a01b0267ffffffffffffffff60a01b19929093166001600160a01b03199091161716179055611b2084600161349f565b6000818152600460205260409020549091506001600160a01b0316611bc457611b48816118a1565b15611bc45760408051808201825284516001600160a01b0390811682526020808701516001600160401b0390811682850190815260008781526004909352949091209251835494516001600160a01b031990951692169190911767ffffffffffffffff60a01b1916600160a01b93909116929092029190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611c12868686600161140f565b505050505050565b60085481611c3a5760405162461bcd60e51b81526004016107c590612e8b565b60006001611c48848461349f565b611c529190613531565b9050611c7f60017f0000000000000000000000000000000000000000000000000000000000002328613531565b811115611cb457611cb160017f0000000000000000000000000000000000000000000000000000000000002328613531565b90505b611cbd816118a1565b611cd95760405162461bcd60e51b81526004016107c59061327c565b815b818111611d90576000818152600460205260409020546001600160a01b0316611d7e576000611d0982611da4565b60408051808201825282516001600160a01b0390811682526020938401516001600160401b0390811685840190815260008881526004909652939094209151825493516001600160a01b031990941691161767ffffffffffffffff60a01b1916600160a01b9290931691909102919091179055505b80611d88816135c6565b915050611cdb565b50611d9c81600161349f565b600855505050565b611dac612662565b611db5826118a1565b611dd15760405162461bcd60e51b81526004016107c590612c9d565b60007f00000000000000000000000000000000000000000000000000000000000000028310611e3257611e247f000000000000000000000000000000000000000000000000000000000000000284613531565b611e2f90600161349f565b90505b825b818110611e9d576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160401b03169183019190915215611e8a579250610706915050565b5080611e9581613574565b915050611e34565b5060405162461bcd60e51b81526004016107c5906132f9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611f1a846001600160a01b031661229b565b1561201657836001600160a01b031663150b7a02611f366118a8565b8786866040518563ffffffff1660e01b8152600401611f589493929190612b5e565b602060405180830381600087803b158015611f7257600080fd5b505af1925050508015611fa2575060408051601f3d908101601f19168201909252611f9f9181019061291e565b60015b611ffc573d808015611fd0576040519150601f19603f3d011682016040523d82523d6000602084013e611fd5565b606091505b508051611ff45760405162461bcd60e51b81526004016107c590613133565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061120f565b506001949350505050565b6060600d805461071a9061358b565b60608161205557506040805180820190915260018152600360fc1b6020820152610706565b8160005b811561207f5780612069816135c6565b91506120789050600a836134d6565b9150612059565b6000816001600160401b038111156120a757634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156120d1576020820181803683370190505b5090505b841561120f576120e6600183613531565b91506120f3600a866135e1565b6120fe90603061349f565b60f81b81838151811061212157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612143600a866134d6565b94506120d5565b610a8d8282604051806020016040528060008152506122a1565b6000600283600481111561218857634e487b7160e01b600052602160045260246000fd5b14806121b3575060048360048111156121b157634e487b7160e01b600052602160045260246000fd5b145b156121c057506001610a01565b6000336040516020016121d39190612af0565b60405160208183030381529060405280519060200120905061120f83600c600087600481111561221357634e487b7160e01b600052602160045260246000fd5b600481111561223257634e487b7160e01b600052602160045260246000fd5b81526020019081526020016000205483612514565b60006001600160a01b03821661226f5760405162461bcd60e51b81526004016107c590612da6565b506001600160a01b0316600090815260056020526040902054600160801b90046001600160801b031690565b3b151590565b6001546001600160a01b0384166122ca5760405162461bcd60e51b81526004016107c5906131bd565b6122d3816118a1565b156122f05760405162461bcd60e51b81526004016107c590613186565b7f00000000000000000000000000000000000000000000000000000000000000028311156123305760405162461bcd60e51b81526004016107c5906133d8565b61233d600085838661140f565b6001600160a01b0384166000908152600560209081526040918290208251808401845290546001600160801b038082168352600160801b909104169181019190915281518083019092528051909190819061239990879061347d565b6001600160801b031681526020018583602001516123b7919061347d565b6001600160801b039081169091526001600160a01b03808816600081815260056020908152604080832087518154988401518816600160801b029088166fffffffffffffffffffffffffffffffff199099169890981790961696909617909455845180860186529182526001600160401b034281168386019081528883526004909552948120915182549451909516600160a01b0267ffffffffffffffff60a01b19959093166001600160a01b031990941693909317939093161790915582905b858110156125015760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46124c56000888488611f06565b6124e15760405162461bcd60e51b81526004016107c590613133565b816124eb816135c6565b92505080806124f9906135c6565b915050612478565b506001819055611c12600087858861140f565b600082612521858461252a565b14949350505050565b600081815b84518110156125da57600085828151811061255a57634e487b7160e01b600052603260045260246000fd5b6020026020010151905080831161259b57828160405160200161257e929190612b0d565b6040516020818303038152906040528051906020012092506125c7565b80836040516020016125ae929190612b0d565b6040516020818303038152906040528051906020012092505b50806125d2816135c6565b91505061252f565b509392505050565b8280546125ee9061358b565b90600052602060002090601f0160209004810192826126105760008555612656565b82601f106126295782800160ff19823516178555612656565b82800160010185558215612656579182015b8281111561265657823582559160200191906001019061263b565b50610ae6929150612679565b604080518082019091526000808252602082015290565b5b80821115610ae6576000815560010161267a565b80356001600160a01b038116811461070657600080fd5b80356005811061070657600080fd5b6000602082840312156126c5578081fd5b6114918261268e565b600080604083850312156126e0578081fd5b6126e98361268e565b91506126f76020840161268e565b90509250929050565b600080600060608486031215612714578081fd5b61271d8461268e565b925061272b6020850161268e565b9150604084013590509250925092565b60008060008060808587031215612750578081fd5b6127598561268e565b9350602061276881870161268e565b93506040860135925060608601356001600160401b038082111561278a578384fd5b818801915088601f83011261279d578384fd5b8135818111156127af576127af613621565b6127c1601f8201601f19168501613454565b915080825289848285010111156127d6578485fd5b8084840185840137810190920192909252939692955090935050565b60008060408385031215612804578182fd5b61280d8361268e565b915060208301358015158114612821578182fd5b809150509250929050565b6000806040838503121561283e578182fd5b6128478361268e565b946020939093013593505050565b60006020808385031215612867578182fd5b82356001600160401b038082111561287d578384fd5b818501915085601f830112612890578384fd5b8135818111156128a2576128a2613621565b83810291506128b2848301613454565b8181528481019084860184860187018a10156128cc578788fd5b8795505b838610156128f5576128e18161268e565b8352600195909501949186019186016128d0565b5098975050505050505050565b600060208284031215612913578081fd5b813561149181613637565b60006020828403121561292f578081fd5b815161149181613637565b60006020828403121561294b578081fd5b611491826126a5565b60008060408385031215612966578182fd5b6126e9836126a5565b60008060408385031215612981578182fd5b612847836126a5565b6000806000806060858703121561299f578182fd5b6129a8856126a5565b93506020850135925060408501356001600160401b03808211156129ca578384fd5b818701915087601f8301126129dd578384fd5b8135818111156129eb578485fd5b88602080830285010111156129fe578485fd5b95989497505060200194505050565b60008060408385031215612a1f578182fd5b612a28836126a5565b9150602083013563ffffffff81168114612821578182fd5b60008060208385031215612a52578182fd5b82356001600160401b0380821115612a68578384fd5b818501915085601f830112612a7b578384fd5b813581811115612a89578485fd5b866020828501011115612a9a578485fd5b60209290920196919550909350505050565b600060208284031215612abd578081fd5b5035919050565b60008151808452612adc816020860160208601613548565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b918252602082015260400190565b60008351612b2d818460208801613548565b835190830190612b41818360208801613548565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612b9190830184612ac4565b9695505050505050565b901515815260200190565b90815260200190565b6000602082526114916020830184612ac4565b60208082526022908201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b60208082526033908201527f4e756d626572206f6620746f6b656e732063616e206e6f74206265206c6573736040820152720207468616e206f7220657175616c20746f203606c1b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252602a908201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736040820152693a32b73a103a37b5b2b760b11b606082015260800190565b60208082526023908201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756040820152626e647360e81b606082015260800190565b60208082526025908201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526018908201527f73616c6520686173206e6f742073746172746564207965740000000000000000604082015260600190565b60208082526031908201527f455243373231413a206e756d626572206d696e74656420717565727920666f7260408201527020746865207a65726f206164647265737360781b606082015260800190565b6020808252601e908201527f5468652063616c6c657220697320616e6f7468657220636f6e74726163740000604082015260600190565b60208082526039908201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60408201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000606082015260800190565b60208082526018908201527f7175616e74697479206d757374206265206e6f6e7a65726f0000000000000000604082015260600190565b6020808252601d908201527f53656e742065746865722076616c756520697320696e636f7272656374000000604082015260600190565b6020808252602b908201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60408201526a65726f206164647265737360a81b606082015260800190565b60208082526012908201527172656163686564206d617820737570706c7960701b604082015260600190565b60208082526026908201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746040820152651037bbb732b960d11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b6020808252601a908201527f455243373231413a20617070726f766520746f2063616c6c6572000000000000604082015260600190565b60208082526032908201527f455243373231413a207472616e736665722063616c6c6572206973206e6f74206040820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606082015260800190565b602080825260149082015273139bdd081a5b881d1a19481dda1a5d195b1a5cdd60621b604082015260600190565b60208082526022908201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60408201526132b960f11b606082015260800190565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b6020808252601d908201527f455243373231413a20746f6b656e20616c7265616479206d696e746564000000604082015260600190565b60208082526021908201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526016908201527563616e206e6f74206d696e742074686973206d616e7960501b604082015260600190565b6020808252602e908201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060408201526d0deeedccae440c4f240d2dcc8caf60931b606082015260800190565b60208082526026908201527f6e6f7420656e6f756768206d696e7465642079657420666f722074686973206360408201526506c65616e75760d41b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602f908201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560408201526e1037bbb732b91037b3103a37b5b2b760891b606082015260800190565b60208082526023908201527f63616e206e6f74206d696e742074686973206d616e7920696e2074686520726f6040820152621d5b9960ea1b606082015260800190565b6020808252602d908201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560408201526c3c34b9ba32b73a103a37b5b2b760991b606082015260800190565b60208082526022908201527f455243373231413a207175616e7469747920746f206d696e7420746f6f2068696040820152610ced60f31b606082015260800190565b81516001600160a01b031681526020918201516001600160401b03169181019190915260400190565b63ffffffff91909116815260200190565b6040518181016001600160401b038111828210171561347557613475613621565b604052919050565b60006001600160801b03808316818516808303821115612b4157612b416135f5565b600082198211156134b2576134b26135f5565b500190565b600063ffffffff808316818516808303821115612b4157612b416135f5565b6000826134e5576134e561360b565b500490565b6000816000190483118215151615613504576135046135f5565b500290565b60006001600160801b0383811690831681811015613529576135296135f5565b039392505050565b600082821015613543576135436135f5565b500390565b60005b8381101561356357818101518382015260200161354b565b8381111561140f5750506000910152565b600081613583576135836135f5565b506000190190565b60028104600182168061359f57607f821691505b602082108114156135c057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156135da576135da6135f5565b5060010190565b6000826135f0576135f061360b565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461188557600080fdfea26469706673582212207bd4d816cce01044e593675d74ac923c854e2959c7bfdcabd19d196baf3e25f264736f6c63430008000033
Verified Source Code Partial Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: Yes (200 runs)
PECFriends.sol 1479 lines
// File: utils/MerkleProof.sol
pragma solidity ^0.8.0;
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash;
}
}
// File: utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File: utils/Address.sol
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: token/ERC721/IERC721Receiver.sol
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: utils/introspection/ERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: token/ERC721/IERC721.sol
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: token/ERC721/extensions/IERC721Enumerable.sol
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
// File: token/ERC721/extensions/IERC721Metadata.sol
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: security/ReentrancyGuard.sol
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File: utils/Context.sol
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: ERC721A.sol
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
*
* Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
*
* Does not support burning tokens to address(0).
*/
contract ERC721A is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
uint256 private currentIndex = 0;
uint256 internal immutable collectionSize;
uint256 internal immutable maxBatchSize;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) private _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev
* `maxBatchSize` refers to how much a minter can mint at a time.
* `collectionSize_` refers to how many tokens are in the collection.
*/
constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
) {
require(
collectionSize_ > 0,
"ERC721A: collection must have a nonzero supply"
);
require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
_name = name_;
_symbol = symbol_;
maxBatchSize = maxBatchSize_;
collectionSize = collectionSize_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return currentIndex;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view override returns (uint256) {
require(index < totalSupply(), "ERC721A: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
* This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
revert("ERC721A: unable to get token of owner by index");
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721A: balance query for the zero address");
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
require(
owner != address(0),
"ERC721A: number minted query for the zero address"
);
return uint256(_addressData[owner].numberMinted);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
uint256 lowestTokenToCheck;
if (tokenId >= maxBatchSize) {
lowestTokenToCheck = tokenId - maxBatchSize + 1;
}
for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
TokenOwnership memory ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
revert("ERC721A: unable to determine the owner of token");
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor approved for all"
);
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), "ERC721A: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - there must be `quantity` tokens remaining unminted in the total collection.
* - `to` cannot be the zero address.
* - `quantity` cannot be larger than the max batch size.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
require(
_checkOnERC721Received(address(0), to, updatedIndex, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
updatedIndex++;
}
currentIndex = updatedIndex;
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSender()));
require(
isApprovedOrOwner,
"ERC721A: transfer caller is not owner nor approved"
);
require(
prevOwnership.addr == from,
"ERC721A: transfer from incorrect owner"
);
require(to != address(0), "ERC721A: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (_exists(nextTokenId)) {
_ownerships[nextTokenId] = TokenOwnership(
prevOwnership.addr,
prevOwnership.startTimestamp
);
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
uint256 public nextOwnerToExplicitlySet = 0;
/**
* @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
*/
function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (endIndex > collectionSize - 1) {
endIndex = collectionSize - 1;
}
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ownership.startTimestamp
);
}
}
nextOwnerToExplicitlySet = endIndex + 1;
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721A: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
// File: access/Ownable.sol
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: PECFriends.sol
pragma solidity ^0.8.0;
contract PECFriends is Ownable, ERC721A, ReentrancyGuard {
enum MintType { Round1WL, Round2WL, Round2Pub, Round3WL, Round3Pub }
mapping (MintType => mapping (address => uint256)) public roundMintedNumber;
uint32 public constant EXPIRE_SECONDS = 172800; // 2 day
/**
* @dev Config start time of each turn
*/
mapping (MintType => uint32) public startTimes;
function setStartTimes(MintType mintType, uint32 _startTime) external onlyOwner {
startTimes[mintType] = _startTime;
}
function isSaleOn(MintType mintType) public view returns (bool) {
if (startTimes[mintType] == 0) {
return false;
}
uint32 expireTime = 0;
if (mintType == MintType.Round1WL || mintType == MintType.Round2WL || mintType == MintType.Round3WL) {
expireTime = startTimes[mintType] + EXPIRE_SECONDS;
}
if (expireTime != 0 && block.timestamp >= expireTime) {
return false;
}
return block.timestamp >= startTimes[mintType];
}
/**
* @dev Config merkle root of each turn
*/
mapping (MintType => bytes32) public merkleRoots;
function setMerkleRoot(MintType mintType, bytes32 _merkleRoot) external onlyOwner {
merkleRoots[mintType] = _merkleRoot;
}
function verifyProof(MintType mintType, bytes32[] memory _merkleProof) internal view returns (bool) {
if (mintType == MintType.Round2Pub || mintType == MintType.Round3Pub) {
return true;
}
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
return MerkleProof.verify(_merkleProof, merkleRoots[mintType], leaf);
}
function maxMintNumber(MintType mintType) public view returns (uint256) {
uint256 mintedNumber = 0;
if (mintType == MintType.Round1WL) {
mintedNumber = roundMintedNumber[MintType.Round1WL][msg.sender];
} else if (mintType == MintType.Round2WL || mintType == MintType.Round2Pub) {
mintedNumber = roundMintedNumber[MintType.Round2WL][msg.sender] + roundMintedNumber[MintType.Round2Pub][msg.sender];
} else if (mintType == MintType.Round3WL || mintType == MintType.Round3Pub) {
mintedNumber = roundMintedNumber[MintType.Round3WL][msg.sender] + roundMintedNumber[MintType.Round3Pub][msg.sender];
}
uint maxMintNumberOfAddress;
if (mintType == MintType.Round1WL) {
maxMintNumberOfAddress = 1;
} else {
maxMintNumberOfAddress = 2;
}
return maxMintNumberOfAddress - mintedNumber;
}
function mintPrice() public view returns (uint256) {
uint32 round3StartTime = startTimes[MintType.Round3WL];
if (round3StartTime != 0 && block.timestamp >= round3StartTime) {
return 0.06 ether;
}
uint32 round2StartTime = startTimes[MintType.Round2WL];
if (round2StartTime != 0 && block.timestamp >= round2StartTime) {
return 0.03 ether;
}
return 0;
}
function roundMax(MintType mintType) public pure returns (uint256) {
if (mintType == MintType.Round1WL) {
return 1000;
} else if (mintType == MintType.Round2WL || mintType == MintType.Round2Pub) {
return 4000;
} else if (mintType == MintType.Round3WL || mintType == MintType.Round3Pub) {
return 9000;
}
return 0;
}
constructor() ERC721A("PECFriends", "PECFREN", 2, 9000) {}
modifier callerIsUser() {
require(tx.origin == msg.sender, "The caller is another contract");
_;
}
function mint(MintType mintType, uint256 quantity, bytes32[] calldata proof) external callerIsUser payable {
require(quantity > 0, "Number of tokens can not be less than or equal to 0");
require(isSaleOn(mintType), "sale has not started yet");
require(totalSupply() + quantity <= roundMax(mintType), "can not mint this many in the round");
require(totalSupply() + quantity <= collectionSize, "reached max supply");
require(mintPrice() * quantity == msg.value, "Sent ether value is incorrect");
require(
quantity <= maxMintNumber(mintType),
"can not mint this many"
);
require(verifyProof(mintType, proof), "Not in the whitelist");
_safeMint(msg.sender, quantity);
roundMintedNumber[mintType][msg.sender] += quantity;
}
// metadata URI
string private _baseTokenURI;
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function setBaseURI(string calldata baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant {
_setOwnersExplicit(quantity);
}
function numberMinted(address owner) public view returns (uint256) {
return _numberMinted(owner);
}
function getOwnershipData(uint256 tokenId) external view returns (TokenOwnership memory) {
return ownershipOf(tokenId);
}
function reserveTokens(address[] memory _owners) public onlyOwner {
require(totalSupply() + _owners.length <= collectionSize, "reached max supply");
uint i;
for (i = 0; i < _owners.length; i++) {
address to = _owners[i];
_safeMint(to, 1);
}
}
function withdraw() public onlyOwner {
uint balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
}
Read Contract
EXPIRE_SECONDS 0xaad2946f → uint32
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getOwnershipData 0x9231ab2a → tuple
isApprovedForAll 0xe985e9c5 → bool
isSaleOn 0x7354fc7e → bool
maxMintNumber 0x9f57f5a0 → uint256
merkleRoots 0x41e5fb40 → bytes32
mintPrice 0x6817c76c → uint256
name 0x06fdde03 → string
nextOwnerToExplicitlySet 0xd7224ba0 → uint256
numberMinted 0xdc33e681 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
roundMax 0xa084d058 → uint256
roundMintedNumber 0xcd17919e → uint256
startTimes 0x331ee446 → uint32
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mint 0xda39f8cf
uint8 mintType
uint256 quantity
bytes32[] proof
renounceOwnership 0x715018a6
No parameters
reserveTokens 0xced4a5f2
address[] _owners
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI
setMerkleRoot 0x54d77e0e
uint8 mintType
bytes32 _merkleRoot
setOwnersExplicit 0x2d20fb60
uint256 quantity
setStartTimes 0x72b00677
uint8 mintType
uint32 _startTime
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address