Address Contract Verified
Address
0xBEdA58401038C864c9fc9145F28e47b7b00a0E86
Balance
0 ETH
Nonce
1
Code Size
18972 bytes
Creator
0x8241873a...8293 at tx 0xd8081010...587811
Last Active
Indexed Transactions
3 (24,312,558 → 24,318,571)
Gas Used (indexed)
1,604,624
Contract Bytecode
18972 bytes
0x6080604052600436106103765760003560e01c8063728cce7c116101d1578063a348f57011610102578063d20bc0a5116100a0578063e985e9c51161006f578063e985e9c51461099b578063ed750f45146109e4578063eed8367d14610a04578063f2fde38b14610a2457600080fd5b8063d20bc0a51461093b578063d258941f1461095a578063d2b3996f14610970578063e8a3d4851461098657600080fd5b8063b88d4fde116100dc578063b88d4fde146108c5578063c0220347146108e5578063c87b56dd14610905578063cd08bdf71461092557600080fd5b8063a348f5701461085e578063a660ab6414610874578063b10e1c6c146108af57600080fd5b806385e11dfc1161016f578063900cf0cf11610149578063900cf0cf146107f357806395d89b4114610809578063a1470e1a1461081e578063a22cb4651461083e57600080fd5b806385e11dfc1461079f578063899486e1146107b55780638da5cb5b146107d557600080fd5b80637b2469fd116101ab5780637b2469fd1461072f57806382f785321461074957806383c1c69f14610769578063842b83fa1461078957600080fd5b8063728cce7c146106fc57806374da546b1461071257806378c3a6921461072757600080fd5b806337496f40116102ab5780635ccba0521161024957806364ca6e201161022357806364ca6e201461068457806369013efa1461069a57806370a08231146106c7578063715018a6146106e757600080fd5b80635ccba052146106155780635dce15a9146106445780636352211e1461066457600080fd5b806348a7e4661161028557806348a7e466146105aa5780634b423d02146105ca5780634f6ccce7146105df57806350f7c204146105ff57600080fd5b806337496f401461054757806342842e0e1461057457806346e46e2a1461059457600080fd5b80631dc2fd6d116103185780632445391a116102f25780632445391a146104db5780632685fd14146104fb57806327827ae8146105115780632f745c591461052757600080fd5b80631dc2fd6d1461048557806323b872dd1461049b57806323bb02f1146104bb57600080fd5b8063081812fc11610354578063081812fc1461040a578063095ea7b31461042a57806317d70f7c1461044c57806318160ddd1461047057600080fd5b806301ffc9a71461037b578063060bd1d4146103b057806306fdde03146103e8575b600080fd5b34801561038757600080fd5b5061039b610396366004613c1c565b610a44565b60405190151581526020015b60405180910390f35b3480156103bc57600080fd5b50601c546103d0906001600160a01b031681565b6040516001600160a01b0390911681526020016103a7565b3480156103f457600080fd5b506103fd610a55565b6040516103a79190613c98565b34801561041657600080fd5b506103d0610425366004613cab565b610ae7565b34801561043657600080fd5b5061044a610445366004613ce0565b610b92565b005b34801561045857600080fd5b5061046260245481565b6040519081526020016103a7565b34801561047c57600080fd5b50601454610462565b34801561049157600080fd5b50610462602b5481565b3480156104a757600080fd5b5061044a6104b6366004613d0a565b610cc4565b3480156104c757600080fd5b5061044a6104d6366004613cab565b610d4b565b3480156104e757600080fd5b5061044a6104f6366004613d46565b610d98565b34801561050757600080fd5b50610462601e5481565b34801561051d57600080fd5b50610462601f5481565b34801561053357600080fd5b50610462610542366004613ce0565b610ee4565b34801561055357600080fd5b50610567610562366004613cab565b610f8c565b6040516103a79190613d61565b34801561058057600080fd5b5061044a61058f366004613d0a565b610ff1565b3480156105a057600080fd5b50610462602c5481565b3480156105b657600080fd5b5061044a6105c5366004613e34565b61100c565b3480156105d657600080fd5b5061044a61109f565b3480156105eb57600080fd5b506104626105fa366004613cab565b6112b6565b34801561060b57600080fd5b5061046260275481565b34801561062157600080fd5b5061039b610630366004613d46565b602080526000908152604090205460ff1681565b34801561065057600080fd5b5061044a61065f366004613d46565b61135a565b34801561067057600080fd5b506103d061067f366004613cab565b611425565b34801561069057600080fd5b5061046260265481565b3480156106a657600080fd5b506106ba6106b5366004613d46565b6114b0565b6040516103a79190613e7d565b3480156106d357600080fd5b506104626106e2366004613d46565b611552565b3480156106f357600080fd5b5061044a6115ec565b34801561070857600080fd5b50610462602a5481565b34801561071e57600080fd5b5061044a611652565b61044a6116bb565b34801561073b57600080fd5b50602f5461039b9060ff1681565b34801561075557600080fd5b5061044a610764366004613ec1565b611818565b34801561077557600080fd5b5061044a610784366004613d46565b611971565b34801561079557600080fd5b5061046260285481565b3480156107ab57600080fd5b5061046260255481565b3480156107c157600080fd5b5061044a6107d0366004613f6e565b611a12565b3480156107e157600080fd5b506016546001600160a01b03166103d0565b3480156107ff57600080fd5b5061046260215481565b34801561081557600080fd5b506103fd611a53565b34801561082a57600080fd5b5061044a610839366004613d46565b611a62565b34801561084a57600080fd5b5061044a610859366004613f9a565b611b26565b34801561086a57600080fd5b5061046260225481565b34801561088057600080fd5b5061039b61088f366004613fd6565b603060209081526000928352604080842090915290825290205460ff1681565b3480156108bb57600080fd5b50610462602d5481565b3480156108d157600080fd5b5061044a6108e0366004613ff8565b611b31565b3480156108f157600080fd5b50601d546103d0906001600160a01b031681565b34801561091157600080fd5b506103fd610920366004613cab565b611bbf565b34801561093157600080fd5b50610462602e5481565b34801561094757600080fd5b50602f5461039b90610100900460ff1681565b34801561096657600080fd5b5061046260295481565b34801561097c57600080fd5b5061046260235481565b34801561099257600080fd5b506103fd611c55565b3480156109a757600080fd5b5061039b6109b6366004614074565b6001600160a01b03918216600090815260116020908152604080832093909416825291909152205460ff1690565b3480156109f057600080fd5b50601b546103d0906001600160a01b031681565b348015610a1057600080fd5b5061044a610a1f36600461409e565b611c64565b348015610a3057600080fd5b5061044a610a3f366004613d46565b611e20565b6000610a4f82611eff565b92915050565b6060600c8054610a64906140d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610a90906140d0565b8015610add5780601f10610ab257610100808354040283529160200191610add565b820191906000526020600020905b815481529060010190602001808311610ac057829003601f168201915b5050505050905090565b6000818152600e60205260408120546001600160a01b0316610b765760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152601060205260409020546001600160a01b031690565b6000610b9d82611425565b9050806001600160a01b0316836001600160a01b03161415610c275760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610b6d565b336001600160a01b0382161480610c435750610c4381336109b6565b610cb55760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610b6d565b610cbf8383611f55565b505050565b610cce3382611fdb565b610d405760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610b6d565b610cbf8383836120e3565b602660008154610d5a9061411b565b90915550610d67816122d3565b610d76602454826021546126fa565b60248054610d95913391906000610d8c8361411b565b9190505561273d565b50565b60215415610de85760405162461bcd60e51b815260206004820152600b60248201527f6572726f722065706f63680000000000000000000000000000000000000000006044820152606401610b6d565b33600090815260208052604090205460ff16610e465760405162461bcd60e51b815260206004820152601060248201527f6572726f72206d73672e73656e646572000000000000000000000000000000006044820152606401610b6d565b6001600160a01b038116600090815260208052604090205460ff1615610eae5760405162461bcd60e51b815260206004820152600860248201527f6572726f7220746f0000000000000000000000000000000000000000000000006044820152606401610b6d565b336000908152602080526040808220805460ff199081169091556001600160a01b03939093168252902080549091166001179055565b6000610eef83611552565b8210610f635760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610b6d565b506001600160a01b03919091166000908152601260209081526040808320938352929052205490565b610f94613b36565b60015b6028548111610feb57600083815260306020908152604080832084845290915290205460ff16828260d28110610fcf57610fcf614136565b9115156020909202015280610fe38161411b565b915050610f97565b50919050565b610cbf83838360405180602001604052806000815250611b31565b6016546001600160a01b031633146110665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b80604051602001611077919061414c565b604051602081830303815290604052601a908051906020019061109b929190613b55565b5050565b6016546001600160a01b031633146110f95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b6002601754141561114c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b6d565b6002601755604080518082018252601c546001600160a01b039081168252601d541660208201528151808301909252601e5447926000918190606490611193908790614191565b61119d91906141c6565b8152602001606485601f546111b29190614191565b6111bc91906141c6565b9052905060005b60028110156112ab578281600281106111de576111de614136565b60200201516001600160a01b03166108fc83836002811061120157611201614136565b60200201516040518115909202916000818181858888f1935050505061122657600080fd5b81816002811061123857611238614136565b60200201517f8353ffcac0876ad14e226d9783c04540bfebf13871e868157d2a391cad98e91884836002811061127057611270614136565b602002015160405161129191906001600160a01b0391909116815260200190565b60405180910390a2806112a38161411b565b9150506111c3565b505060016017555050565b60006112c160145490565b82106113355760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610b6d565b6014828154811061134857611348614136565b90600052602060002001549050919050565b601d546001600160a01b031633146113b45760405162461bcd60e51b815260206004820152601060248201527f6572726f72206d73672e73656e646572000000000000000000000000000000006044820152606401610b6d565b601d80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316908117909155601f54604051918252907fd55c67f866c4c04a58b4b7e9e1cf11af5f87afbc2530cfde3c580d675cac8191906020015b60405180910390a250565b6000818152600e60205260408120546001600160a01b031680610a4f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610b6d565b606060006114bd83611552565b905060008167ffffffffffffffff8111156114da576114da613d95565b604051908082528060200260200182016040528015611503578160200160208202803683370190505b50905060005b8281101561154a5761151b8582610ee4565b82828151811061152d5761152d614136565b6020908102919091010152806115428161411b565b915050611509565b509392505050565b60006001600160a01b0382166115d05760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610b6d565b506001600160a01b03166000908152600f602052604090205490565b6016546001600160a01b031633146116465760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b6116506000612829565b565b6016546001600160a01b031633146116ac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b602f805460ff19166001179055565b60006025600081546116cc9061411b565b91905081905590506116e3602454826021546126fa565b6116ec81612893565b602f5460ff1661173e5760405162461bcd60e51b815260206004820152601860248201527f6572726f722067656e657369734d696e74416c6c6f77656400000000000000006044820152606401610b6d565b33600090815260208052604090205460ff1661179c5760405162461bcd60e51b815260206004820152600f60248201527f6572726f7220616c6c6f774c69737400000000000000000000000000000000006044820152606401610b6d565b34602a54146117ed5760405162461bcd60e51b815260206004820152601260248201527f6572726f722067656e65736973507269636500000000000000000000000000006044820152606401610b6d565b3360008181526020805260408120805460ff1916905560248054610d959392909190610d8c8361411b565b6016546001600160a01b031633146118725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b8051806118c15760405162461bcd60e51b815260206004820152600960248201527f6572726f72206c656e00000000000000000000000000000000000000000000006044820152606401610b6d565b60005b81811015610cbf57602060008483815181106118e2576118e2614136565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16611914576001611917565b60005b6020600085848151811061192d5761192d614136565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806119698161411b565b9150506118c4565b6016546001600160a01b031633146119cb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b60006025600081546119dc9061411b565b91905081905590506119f3602454826021546126fa565b6119fc81612893565b6024805461109b918491906000610d8c8361411b565b602660008154611a219061411b565b90915550611a2e826122d3565b611a3d602454836021546126fa565b6024805461109b918391906000610d8c8361411b565b6060600d8054610a64906140d0565b601c546001600160a01b03163314611abc5760405162461bcd60e51b815260206004820152601060248201527f6572726f72206d73672e73656e646572000000000000000000000000000000006044820152606401610b6d565b601c80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316908117909155601e54604051918252907fd55c67f866c4c04a58b4b7e9e1cf11af5f87afbc2530cfde3c580d675cac81919060200161141a565b61109b338383612a21565b611b3b3383611fdb565b611bad5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610b6d565b611bb984848484612af0565b50505050565b6000818152600e60205260409020546060906001600160a01b0316611c4c5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610b6d565b610a4f82612b79565b6060601a8054610a64906140d0565b6016546001600160a01b03163314611cbe5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b600060215411611d105760405162461bcd60e51b815260206004820152600b60248201527f6572726f722065706f63680000000000000000000000000000000000000000006044820152606401610b6d565b60008411611d605760405162461bcd60e51b815260206004820152600c60248201527f6572726f72205f65706f636800000000000000000000000000000000000000006044820152606401610b6d565b6024546027541015611db45760405162461bcd60e51b815260206004820152601460248201527f6572726f72206d6178546f6b656e537570706c790000000000000000000000006044820152606401610b6d565b60218490556023839055602d829055602e819055611dd0612bd4565b602154602354602d54602e5460408051938452602084019290925282820152517fe429a061e726c5f893806d65f0737ea93687ff05658c3a5d3ec6b23a04d3c9419181900360600190a250505050565b6016546001600160a01b03163314611e7a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b6d565b6001600160a01b038116611ef65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610b6d565b610d9581612829565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d63000000000000000000000000000000000000000000000000000000001480610a4f5750610a4f82612c6f565b600081815260106020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384169081179091558190611fa282611425565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600e60205260408120546001600160a01b03166120655760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610b6d565b600061207083611425565b9050806001600160a01b0316846001600160a01b031614806120ab5750836001600160a01b03166120a084610ae7565b6001600160a01b0316145b806120db57506001600160a01b0380821660009081526011602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166120f682611425565b6001600160a01b0316146121725760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610b6d565b6001600160a01b0382166121ed5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610b6d565b6121f8838383612d52565b612203600082611f55565b6001600160a01b0383166000908152600f6020526040812080546001929061222c9084906141da565b90915550506001600160a01b0382166000908152600f6020526040812080546001929061225a9084906141f1565b90915550506000818152600e602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000602c54116123255760405162461bcd60e51b815260206004820152601260248201527f6572726f7220626c6f636b47656e6573697300000000000000000000000000006044820152606401610b6d565b6000602d54116123775760405162461bcd60e51b815260206004820152600f60248201527f6572726f7220626c6f636b4d65746100000000000000000000000000000000006044820152606401610b6d565b6000602b54116123c95760405162461bcd60e51b815260206004820152601060248201527f6572726f7220626c6f636b4f6d656761000000000000000000000000000000006044820152606401610b6d565b602d5443106123e0576123da612d5d565b60016026555b602d54431080156123f5575060295460265411155b1561240a57602f805461ff0019166101001790555b602454602754101561245e5760405162461bcd60e51b815260206004820152601460248201527f6572726f72206d6178546f6b656e537570706c790000000000000000000000006044820152606401610b6d565b60006021541180156124735750602254602154105b6124bf5760405162461bcd60e51b815260206004820152600b60248201527f6572726f722065706f63680000000000000000000000000000000000000000006044820152606401610b6d565b336124c982611425565b6001600160a01b03161461251f5760405162461bcd60e51b815260206004820152600d60248201527f6572726f72206f776e65724f66000000000000000000000000000000000000006044820152606401610b6d565b602f54610100900460ff166125765760405162461bcd60e51b815260206004820152601b60248201527f6572726f722067656e65726174696f6e4d696e74416c6c6f77656400000000006044820152606401610b6d565b60295460265411156125ca5760405162461bcd60e51b815260206004820152601260248201527f6572726f722067656e65726174696f6e496400000000000000000000000000006044820152606401610b6d565b60008181527f686dc217b182b1fe88c7defdc5cd77807fc691ce05a160638669d7322051eee0602052604090205460ff166126475760405162461bcd60e51b815260206004820152601a60248201527f6572726f722065706f63684d696e74696e6752656769737472790000000000006044820152606401610b6d565b602154600090815260306020908152604080832084845290915290205460ff16156126b45760405162461bcd60e51b815260206004820152601a60248201527f6572726f722065706f63684d696e74696e6752656769737472790000000000006044820152606401610b6d565b60215460009081526030602090815260408083208484529091529020805460ff191660011790556029546026541415610d9557602f805461ff0019169055600060265550565b6127048382612e28565b61270f838383612fd8565b61271983826130b3565b6127238382613103565b600380549060006127338361411b565b9190505550505050565b807fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b5565720761276883612b79565b6040516127759190613c98565b60405180910390a2601b54612793906001600160a01b031682613153565b602154604051439183917f5d2845c74a4574297574ee578da4d65786a4dbf9463ea1804b22b2c2c64fb4f790600090a4601b546040805160208101909152600081526127ec916001600160a01b03169084908490612af0565b6021546040516001600160a01b0384169183917f259eb7b480b3d449f506927269e4665c83c69e4cd797143eaa8f84632dc7a02b90600090a45050565b601680546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b602154156128e35760405162461bcd60e51b815260206004820152600b60248201527f6572726f722065706f63680000000000000000000000000000000000000000006044820152606401610b6d565b60285460255411156129375760405162461bcd60e51b815260206004820152600f60248201527f6572726f722067656e65736973496400000000000000000000000000000000006044820152606401610b6d565b602154600090815260306020908152604080832084845290915290205460ff16156129a45760405162461bcd60e51b815260206004820152601a60248201527f6572726f722065706f63684d696e74696e6752656769737472790000000000006044820152606401610b6d565b60215460009081526030602090815260408083208484529091529020805460ff191660011790556028546025541415610d955743602c819055602d819055602154604051918252907fe559639e5f0abd25b32a111f3613319a30983ce2b2e20856119686a35fdbd0a69060200160405180910390a2610d95612d5d565b816001600160a01b0316836001600160a01b03161415612a835760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b6d565b6001600160a01b03838116600081815260116020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612afb8484846120e3565b612b078484848461316d565b611bb95760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b6d565b60606002612bad612b898461330b565b604051602001612b999190614209565b60405160208183030381529060405261334a565b604051602001612bbe9291906142be565b6040516020818303038152906040529050919050565b60235460009081905b602254831015610cbf578215612bfd57602e54612bfa9082614191565b90505b8260091415612c515781602c54612c1491906141f1565b602b8190556040519081527f149f31bf4e26f1f31339fab90ed780caa2d00b9f06c89ac475776a5bd3c7d58e9060200160405180910390a1505050565b612c5b81836141f1565b915082612c678161411b565b935050612bdd565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480612d0257507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610a4f57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610a4f565b610cbf838383613505565b602154612d6c57612d6c612bd4565b60215415612d8e57602e5460236000828254612d889190614191565b90915550505b602354602d6000828254612da291906141f1565b9091555050602154602d546040519081527f3bd829f14cf58e594b8eeb192fb124cbac882efaf36deb370a4d14174f6206d39060200160405180910390a260218054906000612df08361411b565b9190505550602d544310158015612e0a5750602254602154105b15612e1757612e17612d5d565b602f805461ff001916610100179055565b60008115612f6057612e43612e3e8360016141f1565b6135bd565b612e4e8360016141f1565b600214612f0457612e608360016141f1565b600314612ec9576003612e748460016141f1565b11612e8e5760405180602001604052806000815250612f3b565b6040518060400160405280600281526020017f7468000000000000000000000000000000000000000000000000000000000000815250612f3b565b6040518060400160405280600281526020017f7264000000000000000000000000000000000000000000000000000000000000815250612f3b565b6040518060400160405280600281526020017f6e640000000000000000000000000000000000000000000000000000000000008152505b604051602001612f4c9291906142e3565b604051602081830303815290604052612f97565b6040518060400160405280600f81526020017f47656e657369732045646974696f6e00000000000000000000000000000000008152505b604051602001612fa892919061433a565b60408051601f198184030181529181526000848152600860209081529190208251610cbf93919290910190613b55565b801561301057612fec612e3e8260016141f1565b604051602001612ffc9190614388565b60405160208183030381529060405261302a565b6040518060600160405280602b815260200161494e602b91395b811561304e576040518060600160405280602e81526020016149b9602e9139613068565b6040518060600160405280602e8152602001614920602e91395b613071846136ef565b6040516020016130839392919061441a565b60408051601f198184030181529181526000858152600960209081529190208251611bb993919290910190613b55565b80156130c05760056130c3565b60045b6040516020016130d391906145e3565b60408051601f198184030181529181526000848152600a60209081529190208251610cbf93919290910190613b55565b8015613110576007613113565b60065b60405160200161312391906145e3565b60408051601f198184030181529181526000848152600b60209081529190208251610cbf93919290910190613b55565b61109b8282604051806020016040528060008152506137b7565b60006001600160a01b0384163b15613300576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a02906131ca903390899088908890600401614615565b6020604051808303816000875af1925050508015613205575060408051601f3d908101601f1916820190925261320291810190614647565b60015b6132b5573d808015613233576040519150601f19603f3d011682016040523d82523d6000602084013e613238565b606091505b5080516132ad5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b6d565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506120db565b506001949350505050565b600081815260086020908152604080832060098352818420600a8452828520600b8552948390209251606095612bbe9593946001949192909101614664565b80516060908061336a575050604080516020810190915260008152919050565b600060036133798360026141f1565b61338391906141c6565b61338e906004614191565b9050600061339d8260206141f1565b67ffffffffffffffff8111156133b5576133b5613d95565b6040519080825280601f01601f1916602001820160405280156133df576020820181803683370190505b5090506000604051806060016040528060408152602001614979604091399050600181016020830160005b8681101561346b576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161340a565b50600386066001811461348557600281146134cf576134f7565b7f3d3d0000000000000000000000000000000000000000000000000000000000007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe8301526134f7565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b6001600160a01b0383166135605761355b81601480546000838152601560205260408120829055600182018355919091527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec0155565b613583565b816001600160a01b0316836001600160a01b031614613583576135838382613840565b6001600160a01b03821661359a57610cbf816138dd565b826001600160a01b0316826001600160a01b031614610cbf57610cbf828261398c565b6060816135fd57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561362757806136118161411b565b91506136209050600a836141c6565b9150613601565b60008167ffffffffffffffff81111561364257613642613d95565b6040519080825280601f01601f19166020018201604052801561366c576020820181803683370190505b5090505b84156120db576136816001836141da565b915061368e600a86614833565b6136999060306141f1565b60f81b8183815181106136ae576136ae614136565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506136e8600a866141c6565b9450613670565b6060806103e883101561372757613705836135bd565b6040516020016137159190614209565b60405160208183030381529060405290505b606483101561375b57613739836135bd565b6040516020016137499190614847565b60405160208183030381529060405290505b600a83101561378f5761376d836135bd565b60405160200161377d919061488c565b60405160208183030381529060405290505b806040516020016137a091906148d1565b604051602081830303815290604052915050919050565b6137c183836139d0565b6137ce600084848461316d565b610cbf5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610b6d565b6000600161384d84611552565b61385791906141da565b6000838152601360205260409020549091508082146138aa576001600160a01b03841660009081526012602090815260408083208584528252808320548484528184208190558352601390915290208190555b5060009182526013602090815260408084208490556001600160a01b039094168352601281528383209183525290812055565b6014546000906138ef906001906141da565b6000838152601560205260408120546014805493945090928490811061391757613917614136565b90600052602060002001549050806014838154811061393857613938614136565b600091825260208083209091019290925582815260159091526040808220849055858252812055601480548061397057613970614909565b6001900381819060005260206000200160009055905550505050565b600061399783611552565b6001600160a01b039093166000908152601260209081526040808320868452825280832085905593825260139052919091209190915550565b6001600160a01b038216613a265760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b6d565b6000818152600e60205260409020546001600160a01b031615613a8b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610b6d565b613a9760008383612d52565b6001600160a01b0382166000908152600f60205260408120805460019290613ac09084906141f1565b90915550506000818152600e602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60405180611a40016040528060d2906020820280368337509192915050565b828054613b61906140d0565b90600052602060002090601f016020900481019282613b835760008555613bc9565b82601f10613b9c57805160ff1916838001178555613bc9565b82800160010185558215613bc9579182015b82811115613bc9578251825591602001919060010190613bae565b50613bd5929150613bd9565b5090565b5b80821115613bd55760008155600101613bda565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610d9557600080fd5b600060208284031215613c2e57600080fd5b8135613c3981613bee565b9392505050565b60005b83811015613c5b578181015183820152602001613c43565b83811115611bb95750506000910152565b60008151808452613c84816020860160208601613c40565b601f01601f19169290920160200192915050565b602081526000613c396020830184613c6c565b600060208284031215613cbd57600080fd5b5035919050565b80356001600160a01b0381168114613cdb57600080fd5b919050565b60008060408385031215613cf357600080fd5b613cfc83613cc4565b946020939093013593505050565b600080600060608486031215613d1f57600080fd5b613d2884613cc4565b9250613d3660208501613cc4565b9150604084013590509250925092565b600060208284031215613d5857600080fd5b613c3982613cc4565b611a408101818360005b60d2811015613d8c5781511515835260209283019290910190600101613d6b565b50505092915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613dd457613dd4613d95565b604052919050565b600067ffffffffffffffff831115613df657613df6613d95565b613e096020601f19601f86011601613dab565b9050828152838383011115613e1d57600080fd5b828260208301376000602084830101529392505050565b600060208284031215613e4657600080fd5b813567ffffffffffffffff811115613e5d57600080fd5b8201601f81018413613e6e57600080fd5b6120db84823560208401613ddc565b6020808252825182820181905260009190848201906040850190845b81811015613eb557835183529284019291840191600101613e99565b50909695505050505050565b60006020808385031215613ed457600080fd5b823567ffffffffffffffff80821115613eec57600080fd5b818501915085601f830112613f0057600080fd5b813581811115613f1257613f12613d95565b8060051b9150613f23848301613dab565b8181529183018401918481019088841115613f3d57600080fd5b938501935b83851015613f6257613f5385613cc4565b82529385019390850190613f42565b98975050505050505050565b60008060408385031215613f8157600080fd5b82359150613f9160208401613cc4565b90509250929050565b60008060408385031215613fad57600080fd5b613fb683613cc4565b915060208301358015158114613fcb57600080fd5b809150509250929050565b60008060408385031215613fe957600080fd5b50508035926020909101359150565b6000806000806080858703121561400e57600080fd5b61401785613cc4565b935061402560208601613cc4565b925060408501359150606085013567ffffffffffffffff81111561404857600080fd5b8501601f8101871361405957600080fd5b61406887823560208401613ddc565b91505092959194509250565b6000806040838503121561408757600080fd5b61409083613cc4565b9150613f9160208401613cc4565b600080600080608085870312156140b457600080fd5b5050823594602084013594506040840135936060013592509050565b600181811c908216806140e457607f821691505b60208210811415610feb57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561412f5761412f614105565b5060010190565b634e487b7160e01b600052603260045260246000fd5b7f697066733a2f2f00000000000000000000000000000000000000000000000000815260008251614184816007850160208701613c40565b9190910160070192915050565b60008160001904831182151516156141ab576141ab614105565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826141d5576141d56141b0565b500490565b6000828210156141ec576141ec614105565b500390565b6000821982111561420457614204614105565b500190565b6000825161421b818460208701613c40565b9190910192915050565b8054600090600181811c908083168061423f57607f831692505b602080841082141561426157634e487b7160e01b600052602260045260246000fd5b8180156142755760018114614286576142b2565b60ff198616895284890196506142b2565b876000528160002060005b868110156142aa5781548b820152908501908301614291565b505084890196505b50505050505092915050565b60006142ca8285614225565b83516142da818360208801613c40565b01949350505050565b600083516142f5818460208801613c40565b835190830190614309818360208801613c40565b7f2045646974696f6e0000000000000000000000000000000000000000000000009101908152600801949350505050565b60006143468285614225565b7f202d2000000000000000000000000000000000000000000000000000000000008152835161437c816003840160208801613c40565b01600301949350505050565b7f7b2274726169745f74797065223a2245646974696f6e222c2276616c7565223a81527f22230000000000000000000000000000000000000000000000000000000000006020820152600082516143e6816022850160208701613c40565b7f227d2c00000000000000000000000000000000000000000000000000000000006022939091019283015250602501919050565b6000845161442c818460208901613c40565b845190830190614440818360208901613c40565b7f7b2274726169745f74797065223a2253657269616c222c2276616c7565223a2291019081528351614479816020808501908801613c40565b7f227d2c0000000000000000000000000000000000000000000000000000000000910160208101919091527f7b2274726169745f74797065223a22436861726163746572222c2276616c756560238201527f223a22446f7269616e204e616b616d6f746f227d2c000000000000000000000060438201527f7b2274726169745f74797065223a22456666656374222c2276616c7565223a2260588201527f42525252227d2c0000000000000000000000000000000000000000000000000060788201527f7b2274726169745f74797065223a2255534420506f727472616974222c227661607f8201527f6c7565223a222331202d2057686f206973205361746f736869227d2c00000000609f8201527f7b2274726169745f74797065223a224d656469756d222c2276616c7565223a2260bb8201527f446f6c6c61722062696c6c7320676c756564206f6e2063616e766173227d000060db82015260f981015b9695505050505050565b7f697066733a2f2f0000000000000000000000000000000000000000000000000081526000613c396007830184614225565b60006001600160a01b038087168352808616602084015250836040830152608060608301526145d96080830184613c6c565b60006020828403121561465957600080fd5b8151613c3981613bee565b7f7b0000000000000000000000000000000000000000000000000000000000000081527f226e616d65223a22000000000000000000000000000000000000000000000000600182015260006146bc6009830188614225565b7f222c0000000000000000000000000000000000000000000000000000000000008082527f226465736372697074696f6e223a22000000000000000000000000000000000060028301526147136011830189614225565b91508082527f2261747472696275746573223a5b000000000000000000000000000000000000600283015261474b6010830188614225565b91507f5d2c00000000000000000000000000000000000000000000000000000000000082527f22696d616765223a22000000000000000000000000000000000000000000000060028301526147a3600b830187614225565b9081527f22616e696d6174696f6e5f75726c223a22000000000000000000000000000000600282015290506147db6013820185614225565b7f220000000000000000000000000000000000000000000000000000000000000081527f7d00000000000000000000000000000000000000000000000000000000000000600182015260020198975050505050505050565b600082614842576148426141b0565b500690565b7f300000000000000000000000000000000000000000000000000000000000000081526000825161487f816001850160208701613c40565b9190910160010192915050565b7f30300000000000000000000000000000000000000000000000000000000000008152600082516148c4816002850160208701613c40565b9190910160020192915050565b7f230000000000000000000000000000000000000000000000000000000000000081526000825161487f816001850160208701613c40565b634e487b7160e01b600052603160045260246000fdfe7b2274726169745f74797065223a224e46542054797065222c2276616c7565223a2247656e657261746f72227d2c7b2274726169745f74797065223a2245646974696f6e222c2276616c7565223a2247656e65736973227d2c4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f7b2274726169745f74797065223a224e46542054797065222c2276616c7565223a2247656e657261746564227d2ca2646970667358221220627efb7c58e0f1a820013031c32ab417b2b86eb0e16948f99bf7e29ad6e5040764736f6c634300080a0033
Verified Source Code Full Match
Compiler: v0.8.10+commit.fc410830
EVM: london
Optimization: Yes (5000 runs)
USDSat.sol 531 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
import "./USDSatMetadata.sol";
import "./openzeppelin/access/Ownable.sol";
import "./openzeppelin/token/ERC721/ERC721.sol";
import "./openzeppelin/security/ReentrancyGuard.sol";
import "./openzeppelin/token/ERC721/extensions/ERC721Enumerable.sol";
/// ``..
/// `.` `````.``.-````-`` `.`
/// ` ``````.`..///.-..----. --..--`.-....`..-.```` ```
/// `` `.`..--...`:::/::-``..``..:-.://///---..-....-----
/// ``-:::/+++:::/-.-///://oso+::++/--:--../+:/:..:-....-://:/:-``
/// `-+/++/+o+://+::-:soo+oosss+s+//o:/:--`--:://://:ooso/-.--.-:-.`
/// ``.+ooso++o+:+:+sosyhsyshhddyo+:/sds/yoo++/+:--/--.--:..--..``.````
/// ``:++/---:+/::::///oyhhyy+++:hddhhNNho///ohosyhs+/-:/+/---.....-.. `
/// ``-:-...-/+///++///+o+:-:o+o/oydmNmNNdddhsoyo/oyyyho///:-.--.-.``. ``
/// ```--`..-:+/:--:::-.-///++++ydsdNNMNdmMNMmNysddyoooosso+//-.-`....````` ..`
/// .```:-:::/-.-+o++/+:/+/o/hNNNNhmdNMMNNMMdyydNNmdyys+++oo++-`--.:.-.`````...
/// ..--.`-..`.-`-hh++-/:+shho+hsysyyhhhmNNmmNMMmNNNdmmy+:+sh/o+y/+-`+./::.```` `
/// -/` ``.-``.//o++y+//ssyh+hhdmmdmmddmhdmNdmdsh+oNNMmmddoodh/s:yss.--+.//+`.` `.
/// `.`-.` -`..+h+yo++ooyyyyyoyhy+shmNNmmdhhdhyyhymdyyhdmshoohs+y:oy+/+o/:/++.`- .`
/// ``.`.``-.-++syyyhhhhhhhhmhysosyyoooosssdhhhdmmdhdmdsy+ss+/+ho/hody-s+-:+::--`` `
/// .`` ``-//s+:ohmdmddNmNmhhshhddNNNhyyhhhdNNhmNNmNNmmyso+yhhso++hhdy.:/ ::-:--``.`
/// .```.-`.//shdmNNmddyysohmMmdmNNmmNshdmNhso+-/ohNoyhmmsysosd++hy/osss/.:-o/-.:/--.
/// ``..:++-+hhy/syhhhdhdNNddNMmNsNMNyyso+//:-.`-/..+hmdsmdy+ossos:+o/h/+..//-s.`.:::o/
/// `.-.oy//hm+o:-..-+/shdNNNNNNhsNdo/oyoyyhoh+/so//+/mNmyhh+/s+dy/+s::+:`-`-:s--:-.::+`-`
/// .`:h-`+y+./oyhhdddhyohMMNmmNmdhoo/oyyhddhmNNNmhsoodmdhs+///++:+-:.:/--/-/o/--+//...:`
/// ``+o``yoodNNNNNMhdyyo+ymhsymyshhyys+sssssNmdmmdmy+oso/++:://+/-`::-:--:/::+.//o:-.--:
/// `:-:-`oNhyhdNNNmyys+/:://oohy++/+hmmmmNNNNhohydmmyhy++////ooy./----.-:---/::-o+:...-/
/// ``-.-` yms+mmNmMMmNho/:o++++hhh++:mMmNmmmNMNdhdms+ysyy//:-+o:.-.`.``.-:/::-:-+/y/.- -`
/// ..:` hh+oNNmMNNNmss/:-+oyhs+o+.-yhdNmdhmmydmms+o///:///+/+--/`-``.o::/:-o//-/y::/.-
/// `.-``hh+yNdmdohdy:++/./myhds/./shNhhyy++o:oyos/s+:s//+////.:- ...`--`..`-.:--o:+::`
/// `-/+yyho.`.-+oso///+/Nmddh//y+:s:.../soy+:o+.:sdyo++++o:.-. `.:.:-```:.`:``/o:`:`
/// ./.`..sMN+:::yh+s+ysyhhddh+ymdsd/:/+o+ysydhohoh/o+/so++o+/o.--..`-:::``:-`+-`:+--.`
/// ``:``..-NNy++/yyysohmo+NNmy/+:+hMNmy+yydmNMNddhs:yyydmmmso:o///..-.-+-:o:/.o/-/+-``
/// ``+.`..-mMhsyo+++oo+yoshyyo+/`+hNmhyy+sdmdssssho-MMMNMNh//+/oo+/+:-....`.s+/`..-`
/// .+ `oNMmdhhsohhmmydmNms/yy.oNmmdy+++/+ss+odNm+mNmdddo-s+:+/++/-:--//`/o+s/.-``
/// `/` dNNNhooddNmNymMNNdsoo+y+shhhmyymhss+hddms+hdhmdo+/+-/oo+/.///+sh:-/-s/`
/// `::`hdNmh+ooNmdohNNMMmsooohh+oysydhdooo/syysodmNmys+/o+//+y/:.+/hmso.-//s-
/// -+ohdmmhyhdysysyyhmysoyddhhoo+shdhdyddmddmNmmhssds/::/oo/..:/+Nmo+`-:so
/// .oyhdmmNNdm+s:/:os/+/ssyyds+/ssdNNyhdmmhdmmdymymy///o:/``/+-dmdoo++:o`
/// `ysyMNhhmoo+h-:/+o/+:.:/:/+doo+dNdhddmhmmmy++yhds/+-+::..o/+Nmosyhs+-
/// s+dNNyNhsdhNhsy:+:oo/soo+dNmmooyosohMhsymmhyy+++:+:/+/-/o+yNh+hMNs.
/// +yhNNMd+dmydmdy/+/sshydmhdNNmNooyhhhhshohmNh+:+oso++ssy+/odyhhNmh`
/// `yyhdms+dMh+oyshhyhysdmNd+ohyNN+++mNddmNy+yo//+o/hddddymmyhosNmms`
/// oydos:oMmhoyyhysssysdmMmNmhNmNNh/+mmNmddh+/+o+::+s+hmhmdyNNNNy:
/// `/dNm/+Ndhy+oshdhhdyo::ohmdyhhNysy:smshmdo/o:so//:s++ymhyohdy-`
/// `sNNN/hNm/:do+o:+/++++s:/+shyymmddy/ydmmh/s/+oss//oysy++o+o+`
/// oNNMNmm:/hyy/:/o/+hhsosysoo-ohhhss/hmmhd/dyh++/soyooy++o+:.
/// :/dMNh/smhh+//+s+--:+/so+ohhy/:sydmmmmm+/mdddhy++/ohs//-o/`
/// `/odmhyhsyh++/-:+:::/:/o/:ooddy/+yodNNh+ydhmmmy++/hhyo+://`
/// `:os/+o//oshss/yhs+//:+/-/:soooo/+sso+dddydss+:+sy///+:++
/// ./o/s//hhNho+shyyyoyyso+/ys+/+-:y+:/soooyyh++sNyo++/:/+
/// -/:osmmhyo:++++/+/osshdssooo/:/h//://++oyhsshmdo+//s/-
/// .osmhydh::/+++/o+ohhysddyoo++os+-+++///yhhhmNs+o/://
/// -.++yss//////+/+/+soo++shyhsyy+::/:+y+yhdmdoo//:/:-
/// ``.oss/:////++://+o//:://+oo-:o++/shhhmmh+o+++///-`
/// ..:+++oo/+///ys:///://+::-sy+osh+osdyo+o/::/s:/y-`
/// `odoyhds+/yysyydss+///+/:+oshdmNo+:+/oo/+++++:hy//`
/// `://hyoyy/o/++shhy:+y:/:o/+omNmhsoohhsso+++:+o+sy:/++
/// -/---oddooss+oosy+ohNdo+++oyNhsdo/++shhhoo:s+oydmyo//o+
/// :y.`.``yyd++shoyydhhyymdhyyhyhhs+////+/+s/+:odmmyso.:ohy.
/// .yy/o-..+h/+o/+//++ssoohhhssso+++:/:/yy+//sydmNddo+/./ohy+.
/// .dmmhs+osdoos///o//++/+shdsoshoys+ssss++shmNNNyyds+:-s-//:+.
/// -shmNmyhddsyss++/+ysddhyyydhdmyssNddyydyhNmdNmddso/::s:--`.-.`
/// `+dmNhhdmddsooyyooossysshdhmoss+/+mNdyymydMdyMdyoo+/--/:/:`...-.`
/// .:smNNMmsMNNmdhyyo/yymmdmdyo+ooooshysyysNNNmmmNyss/+o-`-:-/:```.`` ```
/// `.-+o/sdNNNmhdddNmmdsso/sdshyyyyhsdddyohymdmNdmmmmmyoo+/.... -os.`.``-.``
/// `/-:-/+.hymmmmdhmyNdMNmmhhs+sosoyhddyddmmho/ooymhddhdhyos-.oy..-:o+:..`` ```` `
/// ..::``--.-hoymmdNNNNNNMmhyNh+oo+soyNdmNmmmysooooymhy+so++yo..:+.--`..:.`.` `-- ``.` `
/// ```-.-.``..`:ddymmmNNdmNNNNmhN: -/oys/sdmmNdydsydmhhsmdso+/yo:/-..`.``.` ``:.`.````-. `
/// ````-:/.```:::syyydmddNhNNdsdMMs`./oddmd./odNdy+yssss++ooo/o+//-`:/:..:`-.```/-:.`.```..`` `
/// ```..-`` --.`.--o+sNhoyMmho+omhmo+Ns::dhdmmdy:.oNoyhhs+/o+o++s+hhoo+.`-:....``.-:-`..-````.-``.``
/// @title Dollars Nakamoto by Pascal Boyart
/// @author jolan.eth
/// @notice This contract will allow you to yield farm Dollars Nakamoto NFT.
/// During epoch 0 you will be able to mint a Genesis NFT,
/// Over time, epoch will increment allowing you to mint more editions.
/// Minting generations editions is allowed only 1 time per epoch and per Genesis NFT.
/// Generations editions do not allow you to mint other generations.
contract USDSat is USDSatMetadata, ERC721, ERC721Enumerable, Ownable, ReentrancyGuard {
string SYMBOL = "USDSat";
string NAME = "Dollars Nakamoto";
string ContractCID;
/// @notice Address used to sign NFT on mint
address public ADDRESS_SIGN = 0x1Af70e564847bE46e4bA286c0b0066Da8372F902;
/// @notice Ether shareholder address
address public ADDRESS_PBOY = 0x709e17B3Ec505F80eAb064d0F2A71c743cE225B3;
/// @notice Ether shareholder address
address public ADDRESS_JOLAN = 0x51BdFa2Cbb25591AF58b202aCdcdB33325a325c2;
/// @notice Equity per shareholder in %
uint256 public SHARE_PBOY = 90;
/// @notice Equity per shareholder in %
uint256 public SHARE_JOLAN = 10;
/// @notice Mapping used to represent allowed addresses to call { mintGenesis }
mapping (address => bool) public _allowList;
/// @notice Represent the current epoch
uint256 public epoch = 0;
/// @notice Represent the maximum epoch possible
uint256 public epochMax = 10;
/// @notice Represent the block length of an epoch
uint256 public epochLen = 41016;
/// @notice Index of the NFT
/// @dev Start at 1 because var++
uint256 public tokenId = 1;
/// @notice Index of the Genesis NFT
/// @dev Start at 0 because ++var
uint256 public genesisId = 0;
/// @notice Index of the Generation NFT
/// @dev Start at 0 because ++var
uint256 public generationId = 0;
/// @notice Maximum total supply
uint256 public maxTokenSupply = 2100;
/// @notice Maximum Genesis supply
uint256 public maxGenesisSupply = 210;
/// @notice Maximum supply per generation
uint256 public maxGenerationSupply = 210;
/// @notice Price of the Genesis NFT (Generations NFT are free)
uint256 public genesisPrice = 0.5 ether;
/// @notice Define the ending block
uint256 public blockOmega;
/// @notice Define the starting block
uint256 public blockGenesis;
/// @notice Define in which block the Meta must occur
uint256 public blockMeta;
/// @notice Used to inflate blockMeta each epoch incrementation
uint256 public inflateRatio = 2;
/// @notice Open Genesis mint when true
bool public genesisMintAllowed = false;
/// @notice Open Generation mint when true
bool public generationMintAllowed = false;
/// @notice Multi dimensionnal mapping to keep a track of the minting reentrancy over epoch
mapping(uint256 => mapping(uint256 => bool)) public epochMintingRegistry;
event Omega(uint256 _blockNumber);
event Genesis(uint256 indexed _epoch, uint256 _blockNumber);
event Meta(uint256 indexed _epoch, uint256 _blockNumber);
event Withdraw(uint256 indexed _share, address _shareholder);
event Shareholder(uint256 indexed _sharePercent, address _shareholder);
event Securized(uint256 indexed _epoch, uint256 _epochLen, uint256 _blockMeta, uint256 _inflateRatio);
event PermanentURI(string _value, uint256 indexed _id);
event Minted(uint256 indexed _epoch, uint256 indexed _tokenId, address indexed _owner);
event Signed(uint256 indexed _epoch, uint256 indexed _tokenId, uint256 indexed _blockNumber);
constructor() ERC721(NAME, SYMBOL) {}
// Withdraw functions *************************************************
/// @notice Allow Pboy to modify ADDRESS_PBOY
/// This function is dedicated to the represented shareholder according to require().
function setPboy(address PBOY)
public {
require(msg.sender == ADDRESS_PBOY, "error msg.sender");
ADDRESS_PBOY = PBOY;
emit Shareholder(SHARE_PBOY, ADDRESS_PBOY);
}
/// @notice Allow Jolan to modify ADDRESS_JOLAN
/// This function is dedicated to the represented shareholder according to require().
function setJolan(address JOLAN)
public {
require(msg.sender == ADDRESS_JOLAN, "error msg.sender");
ADDRESS_JOLAN = JOLAN;
emit Shareholder(SHARE_JOLAN, ADDRESS_JOLAN);
}
/// @notice Used to withdraw ETH balance of the contract, this function is dedicated
/// to contract owner according to { onlyOwner } modifier.
function withdrawEquity()
public onlyOwner nonReentrant {
uint256 balance = address(this).balance;
address[2] memory shareholders = [
ADDRESS_PBOY,
ADDRESS_JOLAN
];
uint256[2] memory _shares = [
SHARE_PBOY * balance / 100,
SHARE_JOLAN * balance / 100
];
uint i = 0;
while (i < 2) {
require(payable(shareholders[i]).send(_shares[i]));
emit Withdraw(_shares[i], shareholders[i]);
i++;
}
}
// Epoch functions ****************************************************
/// @notice Used to manage authorization and reentrancy of the genesis NFT mint
/// @param _genesisId Used to increment { genesisId } and write { epochMintingRegistry }
function genesisController(uint256 _genesisId)
private {
require(epoch == 0, "error epoch");
require(genesisId <= maxGenesisSupply, "error genesisId");
require(!epochMintingRegistry[epoch][_genesisId], "error epochMintingRegistry");
/// @dev Set { _genesisId } for { epoch } as true
epochMintingRegistry[epoch][_genesisId] = true;
/// @dev When { genesisId } reaches { maxGenesisSupply } the function
/// will compute the data to increment the epoch according
///
/// { blockGenesis } is set only once, at this time
/// { blockMeta } is set to { blockGenesis } because epoch=0
/// Then it is computed into the function epochRegulator()
///
/// Once the epoch is regulated, the new generation start
/// straight away, { generationMintAllowed } is set to true
if (genesisId == maxGenesisSupply) {
blockGenesis = block.number;
blockMeta = blockGenesis;
emit Genesis(epoch, blockGenesis);
epochRegulator();
}
}
/// @notice Used to manage authorization and reentrancy of the Generation NFT mint
/// @param _genesisId Used to write { epochMintingRegistry } and verify minting allowance
function generationController(uint256 _genesisId)
private {
require(blockGenesis > 0, "error blockGenesis");
require(blockMeta > 0, "error blockMeta");
require(blockOmega > 0, "error blockOmega");
/// @dev If { block.number } >= { blockMeta } the function
/// will compute the data to increment the epoch according
///
/// Once the epoch is regulated, the new generation start
/// straight away, { generationMintAllowed } is set to true
///
/// { generationId } is reset to 1
if (block.number >= blockMeta) {
epochRegulator();
generationId = 1;
}
/// @dev Be sure the mint is open if condition are favorable
if (block.number < blockMeta && generationId <= maxGenerationSupply) {
generationMintAllowed = true;
}
require(maxTokenSupply >= tokenId, "error maxTokenSupply");
require(epoch > 0 && epoch < epochMax, "error epoch");
require(ownerOf(_genesisId) == msg.sender, "error ownerOf");
require(generationMintAllowed, "error generationMintAllowed");
require(generationId <= maxGenerationSupply, "error generationId");
require(epochMintingRegistry[0][_genesisId], "error epochMintingRegistry");
require(!epochMintingRegistry[epoch][_genesisId], "error epochMintingRegistry");
/// @dev Set { _genesisId } for { epoch } as true
epochMintingRegistry[epoch][_genesisId] = true;
/// @dev If { generationId } reaches { maxGenerationSupply } the modifier
/// will set { generationMintAllowed } to false to stop the mint
/// on this generation
///
/// { generationId } is reset to 0
///
/// This condition will not block the function because as long as
/// { block.number } >= { blockMeta } minting will reopen
/// according and this condition will become obsolete until
/// the condition is reached again
if (generationId == maxGenerationSupply) {
generationMintAllowed = false;
generationId = 0;
}
}
/// @notice Used to protect epoch block length from difficulty bomb of the
/// Ethereum network. A difficulty bomb heavily increases the difficulty
/// on the network, likely also causing an increase in block time.
/// If the block time increases too much, the epoch generation could become
/// exponentially higher than what is desired, ending with an undesired Ice-Age.
/// To protect against this, the emergencySecure() function is allowed to
/// manually reconfigure the epoch block length and the block Meta
/// to match the network conditions if necessary.
///
/// It can also be useful if the block time decreases for some reason with consensus change.
///
/// This function is dedicated to contract owner according to { onlyOwner } modifier
function emergencySecure(uint256 _epoch, uint256 _epochLen, uint256 _blockMeta, uint256 _inflateRatio)
public onlyOwner {
require(epoch > 0, "error epoch");
require(_epoch > 0, "error _epoch");
require(maxTokenSupply >= tokenId, "error maxTokenSupply");
epoch = _epoch;
epochLen = _epochLen;
blockMeta = _blockMeta;
inflateRatio = _inflateRatio;
computeBlockOmega();
emit Securized(epoch, epochLen, blockMeta, inflateRatio);
}
/// @notice Used to compute blockOmega() function, { blockOmega } represents
/// the block when it won't ever be possible to mint another Dollars Nakamoto NFT.
/// It is possible to be computed because of the deterministic state of the current protocol
/// The following algorithm simulate the 10 epochs of the protocol block computation to result blockOmega
function computeBlockOmega()
private {
uint256 i = 0;
uint256 _blockMeta = 0;
uint256 _epochLen = epochLen;
while (i < epochMax) {
if (i > 0) _epochLen *= inflateRatio;
if (i == 9) {
blockOmega = blockGenesis + _blockMeta;
emit Omega(blockOmega);
break;
}
_blockMeta += _epochLen;
i++;
}
}
/// @notice Used to regulate the epoch incrementation and block computation, known as Metas
/// @dev When epoch=0, the { blockOmega } will be computed
/// When epoch!=0 the block length { epochLen } will be multiplied
/// by { inflateRatio } thus making the block length required for each
/// epoch longer according
///
/// { blockMeta } += { epochLen } result the exact block of the next Meta
/// Allow generation mint after incrementing the epoch
function epochRegulator()
private {
if (epoch == 0) computeBlockOmega();
if (epoch > 0) epochLen *= inflateRatio;
blockMeta += epochLen;
emit Meta(epoch, blockMeta);
epoch++;
if (block.number >= blockMeta && epoch < epochMax) {
epochRegulator();
}
generationMintAllowed = true;
}
// Mint functions *****************************************************
/// @notice Used to add/remove address from { _allowList }
function setBatchGenesisAllowance(address[] memory batch)
public onlyOwner {
uint len = batch.length;
require(len > 0, "error len");
uint i = 0;
while (i < len) {
_allowList[batch[i]] = _allowList[batch[i]] ?
false : true;
i++;
}
}
/// @notice Used to transfer { _allowList } slot to another address
function transferListSlot(address to)
public {
require(epoch == 0, "error epoch");
require(_allowList[msg.sender], "error msg.sender");
require(!_allowList[to], "error to");
_allowList[msg.sender] = false;
_allowList[to] = true;
}
/// @notice Used to open the mint of Genesis NFT
function setGenesisMint()
public onlyOwner {
genesisMintAllowed = true;
}
/// @notice Used to gift Genesis NFT, this function is dedicated
/// to contract owner according to { onlyOwner } modifier
function giftGenesis(address to)
public onlyOwner {
uint256 _genesisId = ++genesisId;
setMetadata(tokenId, _genesisId, epoch);
genesisController(_genesisId);
mintUSDSat(to, tokenId++);
}
/// @notice Used to mint Genesis NFT, this function is payable
/// the price of this function is equal to { genesisPrice },
/// require to be present on { _allowList } to call
function mintGenesis()
public payable {
uint256 _genesisId = ++genesisId;
setMetadata(tokenId, _genesisId, epoch);
genesisController(_genesisId);
require(genesisMintAllowed, "error genesisMintAllowed");
require(_allowList[msg.sender], "error allowList");
require(genesisPrice == msg.value, "error genesisPrice");
_allowList[msg.sender] = false;
mintUSDSat(msg.sender, tokenId++);
}
/// @notice Used to gift Generation NFT, you need a Genesis NFT to call this function
function giftGenerations(uint256 _genesisId, address to)
public {
++generationId;
generationController(_genesisId);
setMetadata(tokenId, _genesisId, epoch);
mintUSDSat(to, tokenId++);
}
/// @notice Used to mint Generation NFT, you need a Genesis NFT to call this function
function mintGenerations(uint256 _genesisId)
public {
++generationId;
generationController(_genesisId);
setMetadata(tokenId, _genesisId, epoch);
mintUSDSat(msg.sender, tokenId++);
}
/// @notice Token is minted on { ADDRESS_SIGN } and instantly transferred to { msg.sender } as { to },
/// this is to ensure the token creation is signed with { ADDRESS_SIGN }
/// This function is private and can be only called by the contract
function mintUSDSat(address to, uint256 _tokenId)
private {
emit PermanentURI(_compileMetadata(_tokenId), _tokenId);
_safeMint(ADDRESS_SIGN, _tokenId);
emit Signed(epoch, _tokenId, block.number);
_safeTransfer(ADDRESS_SIGN, to, _tokenId, "");
emit Minted(epoch, _tokenId, to);
}
// Contract URI functions *********************************************
/// @notice Used to set the { ContractCID } metadata from ipfs,
/// this function is dedicated to contract owner according
/// to { onlyOwner } modifier
function setContractCID(string memory CID)
public onlyOwner {
ContractCID = string(abi.encodePacked("ipfs://", CID));
}
/// @notice Used to render { ContractCID } as { contractURI } according to
/// Opensea contract metadata standard
function contractURI()
public view virtual returns (string memory) {
return ContractCID;
}
// Utilitaries functions **********************************************
/// @notice Used to fetch all entry for { epoch } into { epochMintingRegistry }
function getMapRegisteryForEpoch(uint256 _epoch)
public view returns (bool[210] memory result) {
uint i = 1;
while (i <= maxGenesisSupply) {
result[i] = epochMintingRegistry[_epoch][i];
i++;
}
}
/// @notice Used to fetch all { tokenIds } from { owner }
function exposeHeldIds(address owner)
public view returns(uint[] memory) {
uint tokenCount = balanceOf(owner);
uint[] memory tokenIds = new uint[](tokenCount);
uint i = 0;
while (i < tokenCount) {
tokenIds[i] = tokenOfOwnerByIndex(owner, i);
i++;
}
return tokenIds;
}
// ERC721 Spec functions **********************************************
/// @notice Used to render metadata as { tokenURI } according to ERC721 standard
function tokenURI(uint256 _tokenId)
public view virtual override returns (string memory) {
require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token");
return _compileMetadata(_tokenId);
}
/// @dev ERC721 required override
function _beforeTokenTransfer(address from, address to, uint256 _tokenId)
internal override(ERC721, ERC721Enumerable) {
super._beforeTokenTransfer(from, to, _tokenId);
}
/// @dev ERC721 required override
function supportsInterface(bytes4 interfaceId)
public view override(ERC721, ERC721Enumerable) returns (bool) {
return super.supportsInterface(interfaceId);
}
}
Base64.sol 63 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) { } { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } }
USDSatMetadata.sol 148 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
import "./lib/Base64.sol";
import "./openzeppelin/utils/Strings.sol";
contract USDSatMetadata {
string tokenName = "Dollars Nakamoto";
string tokenDescription = "Multiple Edition - Dollars Nakamoto by Pascal Boyart is a farming NFT collection based on the original artwork made with hundreds of real USD Bills glued on canvas in 2018.";
string JSON = 'data:application/json;base64,';
uint256 metadataId = 1;
string DollarsNakamotoGenesisGifCID = "QmP3asJxMbCMrN6aDKN4iZpcUJw2zEHTfJuV8sh5XhUSAv";
string DollarsNakamotoGenerationGifCID = "QmZ71ajdHPS7NofbK3rpNAJqnxq29mfdNSPaecy3bHUD9G";
string DollarsNakamotoGenesisMp4CID = "QmRmvo1wDxSV2uBm1KNqJ9z6UayzickLKhMKJYfdhMGCbf";
string DollarsNakamotoGenerationMp4CID = "QmWBAS7pmRbWZQ3wkiuw918zVtz9eS6oajpkq9hUVBFiwo";
mapping (uint256 => string) _metadataName;
mapping (uint256 => string) _metadataAttributes;
mapping (uint256 => string) _metadataImageCID;
mapping (uint256 => string) _metadataVideoCID;
constructor() {}
function _serialize(uint256 _tokenId)
private pure returns(string memory result) {
string memory tmp;
if (_tokenId < 1000) tmp = string(abi.encodePacked('', Strings.toString(_tokenId)));
if (_tokenId < 100) tmp = string(abi.encodePacked('0', Strings.toString(_tokenId)));
if (_tokenId < 10) tmp = string(abi.encodePacked('00', Strings.toString(_tokenId)));
result = string(
abi.encodePacked(
'#', tmp
)
);
}
function setMetadata(uint256 _tokenId, uint256 _epochId, uint256 _epoch)
internal {
_setMetadataName(_tokenId, _epoch);
_setMetadataOrigins(_tokenId, _epochId, _epoch);
_setMetadataImageCID(_tokenId, _epoch);
_setMetadataVideoCID(_tokenId, _epoch);
metadataId++;
}
function _setMetadataImageCID(uint256 _tokenId, uint256 _epoch)
internal {
_metadataImageCID[_tokenId] = string(
abi.encodePacked(
"ipfs://",
_epoch == 0 ?
DollarsNakamotoGenesisGifCID :
DollarsNakamotoGenerationGifCID
)
);
}
function _setMetadataVideoCID(uint256 _tokenId, uint256 _epoch)
internal {
_metadataVideoCID[_tokenId] = string(
abi.encodePacked(
"ipfs://",
_epoch == 0 ?
DollarsNakamotoGenesisMp4CID :
DollarsNakamotoGenerationMp4CID
)
);
}
function _setMetadataName(uint256 _tokenId, uint256 _epoch)
internal {
_metadataName[_tokenId] = string(
abi.encodePacked(
tokenName, ' - ', _epoch == 0 ? 'Genesis Edition' : string(
abi.encodePacked(
Strings.toString(_epoch + 1), (
(_epoch + 1) == 2 ? 'nd' :
(_epoch + 1) == 3 ? 'rd' :
(_epoch + 1) > 3 ? 'th' :
''
), ' Edition'
)
)
)
);
}
function _setMetadataOrigins(uint256 _tokenId, uint256 _epochId, uint256 _epoch)
internal {
_metadataAttributes[_tokenId] = string(
abi.encodePacked(
_epoch == 0 ?
'{"trait_type":"Edition","value":"Genesis"},' :
string(
abi.encodePacked(
'{"trait_type":"Edition","value":"#', Strings.toString(_epoch + 1),'"},'
)
),
_epoch == 0 ?
'{"trait_type":"NFT Type","value":"Generator"},' : '{"trait_type":"NFT Type","value":"Generated"},',
'{"trait_type":"Serial","value":"',_serialize(_epochId),'"},',
'{"trait_type":"Character","value":"Dorian Nakamoto"},',
'{"trait_type":"Effect","value":"BRRR"},',
'{"trait_type":"USD Portrait","value":"#1 - Who is Satoshi"},',
'{"trait_type":"Medium","value":"Dollar bills glued on canvas"}'
)
);
}
function _tokenData(uint256 _tokenId)
internal view returns (string memory result) {
result = string(
abi.encodePacked(
'{',
'"name":"',_metadataName[_tokenId],'",',
'"description":"',tokenDescription,'",',
'"attributes":[',_metadataAttributes[_tokenId],'],',
'"image":"',_metadataImageCID[_tokenId],'",',
'"animation_url":"',_metadataVideoCID[_tokenId],'"',
'}'
)
);
}
function _compileMetadata(uint256 _tokenId)
internal view returns (
string memory result) {
result = string(abi.encodePacked(
JSON,
Base64.encode(
bytes (
string(
abi.encodePacked(
_tokenData(_tokenId)
)
)
)
)
)
);
}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 424 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 making 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;
}
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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);
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 163 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @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);
}
Read Contract
ADDRESS_JOLAN 0xc0220347 → address
ADDRESS_PBOY 0x060bd1d4 → address
ADDRESS_SIGN 0xed750f45 → address
SHARE_JOLAN 0x27827ae8 → uint256
SHARE_PBOY 0x2685fd14 → uint256
_allowList 0x5ccba052 → bool
balanceOf 0x70a08231 → uint256
blockGenesis 0x46e46e2a → uint256
blockMeta 0xb10e1c6c → uint256
blockOmega 0x1dc2fd6d → uint256
contractURI 0xe8a3d485 → string
epoch 0x900cf0cf → uint256
epochLen 0xd2b3996f → uint256
epochMax 0xa348f570 → uint256
epochMintingRegistry 0xa660ab64 → bool
exposeHeldIds 0x69013efa → uint256[]
generationId 0x64ca6e20 → uint256
generationMintAllowed 0xd20bc0a5 → bool
genesisId 0x85e11dfc → uint256
genesisMintAllowed 0x7b2469fd → bool
genesisPrice 0x728cce7c → uint256
getApproved 0x081812fc → address
getMapRegisteryForEpoch 0x37496f40 → bool[210]
inflateRatio 0xcd08bdf7 → uint256
isApprovedForAll 0xe985e9c5 → bool
maxGenerationSupply 0xd258941f → uint256
maxGenesisSupply 0x842b83fa → uint256
maxTokenSupply 0x50f7c204 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenId 0x17d70f7c → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
emergencySecure 0xeed8367d
uint256 _epoch
uint256 _epochLen
uint256 _blockMeta
uint256 _inflateRatio
giftGenerations 0x899486e1
uint256 _genesisId
address to
giftGenesis 0x83c1c69f
address to
mintGenerations 0x23bb02f1
uint256 _genesisId
mintGenesis 0x78c3a692
No parameters
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBatchGenesisAllowance 0x82f78532
address[] batch
setContractCID 0x48a7e466
string CID
setGenesisMint 0x74da546b
No parameters
setJolan 0x5dce15a9
address JOLAN
setPboy 0xa1470e1a
address PBOY
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferListSlot 0x2445391a
address to
transferOwnership 0xf2fde38b
address newOwner
withdrawEquity 0x4b423d02
No parameters
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0x0Ef49685...4b9d | 1 | 1 | |
| 0x9aE65FFA...3A13 | 1 | 1 | |
| 0x87bF447a...303a | 1 | 1 |
Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0xf4b7c96b...59107c | 24,318,571 | IN | 0x0Ef49685...4b9d | 0 ETH | |
| 0x29899a75...f5c82a | 24,318,468 | IN | 0x9aE65FFA...3A13 | 0 ETH | |
| 0x38e6119f...35fa26 | 24,312,558 | IN | 0x87bF447a...303a | 0 ETH |