Address Contract Verified
Address
0x14Ed588A2df7b37BAF1676982B218b79a113bF68
Balance
0 ETH
Nonce
1
Code Size
18719 bytes
Creator
0x3Aec3113...0c25 at tx 0x83004e66...6a4f8b
Indexed Transactions
0
Contract Bytecode
18719 bytes
0x6080604052600436106101695760003560e01c80635e7ff0cc116100d1578063bd85b0391161008a578063e985e9c511610064578063e985e9c5146105bd578063eb8d2444146105fa578063f242432a14610625578063f7b5e3171461064e57610170565b8063bd85b03914610518578063c34f72b214610555578063e278fe6f1461059257610170565b80635e7ff0cc146103e25780637362377b1461041f5780638a19c8bc1461044a578063937eb61a146104755780639f3bee9a146104b2578063a22cb465146104ef57610170565b80632a764b47116101235780632a764b47146102c25780632eb2c2d6146102ed57806342966c68146103165780634615102c1461033f5780634cf23a1b1461037c5780634e1273f4146103a557610170565b8062fdd58e1461017557806301ffc9a7146101b25780630e89341c146101ef5780631846c6d41461022c57806318e97fd1146102695780631ee081df1461029257610170565b3661017057005b600080fd5b34801561018157600080fd5b5061019c60048036038101906101979190612dc1565b610679565b6040516101a99190612e10565b60405180910390f35b3480156101be57600080fd5b506101d960048036038101906101d49190612e83565b610742565b6040516101e69190612ecb565b60405180910390f35b3480156101fb57600080fd5b5061021660048036038101906102119190612ee6565b610824565b6040516102239190612fac565b60405180910390f35b34801561023857600080fd5b50610253600480360381019061024e9190612ee6565b610909565b6040516102609190612ecb565b60405180910390f35b34801561027557600080fd5b50610290600480360381019061028b9190613103565b610929565b005b6102ac60048036038101906102a79190612ee6565b610a4a565b6040516102b99190612e10565b60405180910390f35b3480156102ce57600080fd5b506102d7610b73565b6040516102e49190612e10565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f91906132c8565b610b79565b005b34801561032257600080fd5b5061033d60048036038101906103389190612ee6565b610c1a565b005b34801561034b57600080fd5b5061036660048036038101906103619190612ee6565b610c53565b6040516103739190612ecb565b60405180910390f35b34801561038857600080fd5b506103a3600480360381019061039e9190613397565b610e25565b005b3480156103b157600080fd5b506103cc60048036038101906103c791906134a3565b610f44565b6040516103d991906135d9565b60405180910390f35b3480156103ee57600080fd5b5061040960048036038101906104049190612ee6565b61105d565b6040516104169190612e10565b60405180910390f35b34801561042b57600080fd5b506104346111cf565b6040516104419190612ecb565b60405180910390f35b34801561045657600080fd5b5061045f611376565b60405161046c9190612e10565b60405180910390f35b34801561048157600080fd5b5061049c600480360381019061049791906135fb565b611387565b6040516104a99190612ecb565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612ee6565b6114e6565b6040516104e69190612ecb565b60405180910390f35b3480156104fb57600080fd5b5061051660048036038101906105119190613667565b611641565b005b34801561052457600080fd5b5061053f600480360381019061053a9190612ee6565b611657565b60405161054c9190612e10565b60405180910390f35b34801561056157600080fd5b5061057c60048036038101906105779190612ee6565b611674565b6040516105899190612ecb565b60405180910390f35b34801561059e57600080fd5b506105a761186d565b6040516105b49190612ecb565b60405180910390f35b3480156105c957600080fd5b506105e460048036038101906105df91906136a7565b6119da565b6040516105f19190612ecb565b60405180910390f35b34801561060657600080fd5b5061060f611a6e565b60405161061c9190612ecb565b60405180910390f35b34801561063157600080fd5b5061064c600480360381019061064791906136e7565b611a81565b005b34801561065a57600080fd5b50610663611b22565b6040516106709190612e10565b60405180910390f35b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e1906137f0565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061080d57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061081d575061081c82611b28565b5b9050919050565b606060006004600084815260200190815260200160002080546108469061383f565b80601f01602080910402602001604051908101604052809291908181526020018280546108729061383f565b80156108bf5780601f10610894576101008083540402835291602001916108bf565b820191906000526020600020905b8154815290600101906020018083116108a257829003601f168201915b5050505050905060008151116108dd576108d883611b92565b610901565b6003816040516020016108f1929190613941565b6040516020818303038152906040525b915050919050565b60086020528060005260406000206000915054906101000a900460ff1681565b6000600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe0174bd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561099357600080fd5b505afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb919061397a565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a32906139f3565b60405180910390fd5b610a458383611c26565b505050565b600080610a576005611c92565b9050600660009054906101000a900460ff16610aa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9f90613a5f565b60405180910390fd5b3483600754610ab79190613aae565b1115610af8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aef90613b54565b60405180910390fd5b82600960008381526020019081526020016000206000828254610b1b9190613b74565b925050819055506103e8610b2e82611657565b10610b4f576000600660006101000a81548160ff0219169083151502179055505b610b6a33828560405180602001604052806000815250611ca0565b82915050919050565b6103e881565b610b81611e51565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610bc75750610bc685610bc1611e51565b6119da565b5b610c06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfd90613c3c565b60405180910390fd5b610c138585858585611e59565b5050505050565b80600960008081526020019081526020016000206000828254610c3d9190613c5c565b92505081905550610c503360008361217b565b50565b600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad9b44cd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cbe57600080fd5b505afa158015610cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf6919061397a565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5d90613d02565b60405180910390fd5b600660009054906101000a900460ff1615610db6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dad90613d6e565b60405180910390fd5b610dc060056123c2565b6001600660006101000a81548160ff021916908315150217905550826007819055507f602d52a424ba31c8904768b40efd585d7c78b61530cebd288dc8fc0be871a3c64384604051610e13929190613d8e565b60405180910390a16001915050919050565b6000600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe0174bd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8f57600080fd5b505afa158015610ea3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec7919061397a565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2e906139f3565b60405180910390fd5b610f40826123d8565b5050565b60608151835114610f8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8190613e29565b60405180910390fd5b6000835167ffffffffffffffff811115610fa757610fa6612fd8565b5b604051908082528060200260200182016040528015610fd55781602001602082028036833780820191505090505b50905060005b845181101561105257611022858281518110610ffa57610ff9613e49565b5b602002602001015185838151811061101557611014613e49565b5b6020026020010151610679565b82828151811061103557611034613e49565b5b6020026020010181815250508061104b90613e78565b9050610fdb565b508091505092915050565b60006008600083815260200190815260200160002060009054906101000a900460ff166110bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b690613f0d565b60405180910390fd5b60006110cb3384610679565b905060008111611110576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110790613f79565b60405180910390fd5b806009600085815260200190815260200160002060008282546111339190613c5c565b925050819055508060096000808152602001908152602001600020600082825461115d9190613b74565b9250508190555061116f33848361217b565b61118b3360008360405180602001604052806000815250611ca0565b7f3c3d4a0f5668c5384fb3e5d7002dfa7a80e56ca2efb4232f9b383f89669422e13384836040516111be93929190613fa8565b60405180910390a180915050919050565b600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad9b44cd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561123a57600080fd5b505afa15801561124e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611272919061397a565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d990613d02565b60405180910390fd5b600047905060003390508073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611332573d6000803e3d6000fd5b507fdb35132c111efe920cede025e819975671cfd1b8fcc1174762c8670c4e94c2113383604051611364929190613fdf565b60405180910390a16001935050505090565b60006113826005611c92565b905090565b6000600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166385811fbf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156113f157600080fd5b505afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611429919061397a565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611496576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148d90614054565b60405180910390fd5b826009600080815260200190815260200160002060008282546114b99190613b74565b925050819055506114dc8260008560405180602001604052806000815250611ca0565b6001905092915050565b600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad9b44cd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561155157600080fd5b505afa158015611565573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611589919061397a565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f090613d02565b60405180910390fd5b826007819055507f15417be8a232afca58f2c0e365330bf076defb7c391ddefee008cad30810ec4a8360405161162f9190612e10565b60405180910390a16001915050919050565b61165361164c611e51565b83836123f2565b5050565b600060096000838152602001908152602001600020549050919050565b600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad9b44cd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116df57600080fd5b505afa1580156116f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611717919061397a565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611787576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177e90613d02565b60405180910390fd5b6103e8600960008581526020019081526020016000205410156117df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d6906140c0565b60405180910390fd5b60016008600085815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2ae68ba3c4f72c2701df6ab20e6559ace39aa4beda26e4e10a76435fa85377d5834360405161183c929190613d8e565b60405180910390a16008600084815260200190815260200160002060009054906101000a900460ff16915050919050565b600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad9b44cd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118d857600080fd5b505afa1580156118ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611910919061397a565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611980576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197790613d02565b60405180910390fd5b6000600660006101000a81548160ff0219169083151502179055507fd1014bd15f738385a79c60003df93dec366bb7fe82c8796e4e5167d26f67005a436040516119ca9190612e10565b60405180910390a1600191505090565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600660009054906101000a900460ff1681565b611a89611e51565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480611acf5750611ace85611ac9611e51565b6119da565b5b611b0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0590614152565b60405180910390fd5b611b1b858585858561255f565b5050505050565b60075481565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b606060028054611ba19061383f565b80601f0160208091040260200160405190810160405280929190818152602001828054611bcd9061383f565b8015611c1a5780601f10611bef57610100808354040283529160200191611c1a565b820191906000526020600020905b815481529060010190602001808311611bfd57829003601f168201915b50505050509050919050565b80600460008481526020019081526020016000209080519060200190611c4d929190612c76565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b611c7984610824565b604051611c869190612fac565b60405180910390a25050565b600081600001549050919050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611d10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d07906141e4565b60405180910390fd5b6000611d1a611e51565b90506000611d27856127fb565b90506000611d34856127fb565b9050611d4583600089858589612875565b8460008088815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611da49190613b74565b925050819055508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628989604051611e22929190613d8e565b60405180910390a4611e398360008985858961287d565b611e4883600089898989612885565b50505050505050565b600033905090565b8151835114611e9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9490614276565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611f0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0490614308565b60405180910390fd5b6000611f17611e51565b9050611f27818787878787612875565b60005b84518110156120d8576000858281518110611f4857611f47613e49565b5b602002602001015190506000858381518110611f6757611f66613e49565b5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612008576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fff9061439a565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546120bd9190613b74565b92505081905550505050806120d190613e78565b9050611f2a565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161214f9291906143ba565b60405180910390a461216581878787878761287d565b612173818787878787612a6c565b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156121eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e290614463565b60405180910390fd5b60006121f5611e51565b90506000612202846127fb565b9050600061220f846127fb565b905061222f83876000858560405180602001604052806000815250612875565b600080600087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050848110156122c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122bd906144f5565b60405180910390fd5b84810360008088815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628989604051612393929190613d8e565b60405180910390a46123b98488600086866040518060200160405280600081525061287d565b50505050505050565b6001816000016000828254019250508190555050565b80600290805190602001906123ee929190612c76565b5050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245890614587565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516125529190612ecb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156125cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c690614308565b60405180910390fd5b60006125d9611e51565b905060006125e6856127fb565b905060006125f3856127fb565b9050612603838989858589612875565b600080600088815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508581101561269a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126919061439a565b60405180910390fd5b85810360008089815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560008089815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461274f9190613b74565b925050819055508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628a8a6040516127cc929190613d8e565b60405180910390a46127e2848a8a86868a61287d565b6127f0848a8a8a8a8a612885565b505050505050505050565b60606000600167ffffffffffffffff81111561281a57612819612fd8565b5b6040519080825280602002602001820160405280156128485781602001602082028036833780820191505090505b50905082816000815181106128605761285f613e49565b5b60200260200101818152505080915050919050565b505050505050565b505050505050565b6128a48473ffffffffffffffffffffffffffffffffffffffff16612c53565b15612a64578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b81526004016128ea9594939291906145fc565b602060405180830381600087803b15801561290457600080fd5b505af192505050801561293557506040513d601f19601f82011682018060405250810190612932919061466b565b60015b6129db576129416146a5565b806308c379a0141561299e57506129566146c7565b8061296157506129a0565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129959190612fac565b60405180910390fd5b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129d2906147cf565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612a62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a5990614861565b60405180910390fd5b505b505050505050565b612a8b8473ffffffffffffffffffffffffffffffffffffffff16612c53565b15612c4b578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401612ad1959493929190614881565b602060405180830381600087803b158015612aeb57600080fd5b505af1925050508015612b1c57506040513d601f19601f82011682018060405250810190612b19919061466b565b60015b612bc257612b286146a5565b806308c379a01415612b855750612b3d6146c7565b80612b485750612b87565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7c9190612fac565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bb9906147cf565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612c49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c4090614861565b60405180910390fd5b505b505050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b828054612c829061383f565b90600052602060002090601f016020900481019282612ca45760008555612ceb565b82601f10612cbd57805160ff1916838001178555612ceb565b82800160010185558215612ceb579182015b82811115612cea578251825591602001919060010190612ccf565b5b509050612cf89190612cfc565b5090565b5b80821115612d15576000816000905550600101612cfd565b5090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612d5882612d2d565b9050919050565b612d6881612d4d565b8114612d7357600080fd5b50565b600081359050612d8581612d5f565b92915050565b6000819050919050565b612d9e81612d8b565b8114612da957600080fd5b50565b600081359050612dbb81612d95565b92915050565b60008060408385031215612dd857612dd7612d23565b5b6000612de685828601612d76565b9250506020612df785828601612dac565b9150509250929050565b612e0a81612d8b565b82525050565b6000602082019050612e256000830184612e01565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612e6081612e2b565b8114612e6b57600080fd5b50565b600081359050612e7d81612e57565b92915050565b600060208284031215612e9957612e98612d23565b5b6000612ea784828501612e6e565b91505092915050565b60008115159050919050565b612ec581612eb0565b82525050565b6000602082019050612ee06000830184612ebc565b92915050565b600060208284031215612efc57612efb612d23565b5b6000612f0a84828501612dac565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612f4d578082015181840152602081019050612f32565b83811115612f5c576000848401525b50505050565b6000601f19601f8301169050919050565b6000612f7e82612f13565b612f888185612f1e565b9350612f98818560208601612f2f565b612fa181612f62565b840191505092915050565b60006020820190508181036000830152612fc68184612f73565b905092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61301082612f62565b810181811067ffffffffffffffff8211171561302f5761302e612fd8565b5b80604052505050565b6000613042612d19565b905061304e8282613007565b919050565b600067ffffffffffffffff82111561306e5761306d612fd8565b5b61307782612f62565b9050602081019050919050565b82818337600083830152505050565b60006130a66130a184613053565b613038565b9050828152602081018484840111156130c2576130c1612fd3565b5b6130cd848285613084565b509392505050565b600082601f8301126130ea576130e9612fce565b5b81356130fa848260208601613093565b91505092915050565b6000806040838503121561311a57613119612d23565b5b600061312885828601612dac565b925050602083013567ffffffffffffffff81111561314957613148612d28565b5b613155858286016130d5565b9150509250929050565b600067ffffffffffffffff82111561317a57613179612fd8565b5b602082029050602081019050919050565b600080fd5b60006131a361319e8461315f565b613038565b905080838252602082019050602084028301858111156131c6576131c561318b565b5b835b818110156131ef57806131db8882612dac565b8452602084019350506020810190506131c8565b5050509392505050565b600082601f83011261320e5761320d612fce565b5b813561321e848260208601613190565b91505092915050565b600067ffffffffffffffff82111561324257613241612fd8565b5b61324b82612f62565b9050602081019050919050565b600061326b61326684613227565b613038565b90508281526020810184848401111561328757613286612fd3565b5b613292848285613084565b509392505050565b600082601f8301126132af576132ae612fce565b5b81356132bf848260208601613258565b91505092915050565b600080600080600060a086880312156132e4576132e3612d23565b5b60006132f288828901612d76565b955050602061330388828901612d76565b945050604086013567ffffffffffffffff81111561332457613323612d28565b5b613330888289016131f9565b935050606086013567ffffffffffffffff81111561335157613350612d28565b5b61335d888289016131f9565b925050608086013567ffffffffffffffff81111561337e5761337d612d28565b5b61338a8882890161329a565b9150509295509295909350565b6000602082840312156133ad576133ac612d23565b5b600082013567ffffffffffffffff8111156133cb576133ca612d28565b5b6133d7848285016130d5565b91505092915050565b600067ffffffffffffffff8211156133fb576133fa612fd8565b5b602082029050602081019050919050565b600061341f61341a846133e0565b613038565b905080838252602082019050602084028301858111156134425761344161318b565b5b835b8181101561346b57806134578882612d76565b845260208401935050602081019050613444565b5050509392505050565b600082601f83011261348a57613489612fce565b5b813561349a84826020860161340c565b91505092915050565b600080604083850312156134ba576134b9612d23565b5b600083013567ffffffffffffffff8111156134d8576134d7612d28565b5b6134e485828601613475565b925050602083013567ffffffffffffffff81111561350557613504612d28565b5b613511858286016131f9565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61355081612d8b565b82525050565b60006135628383613547565b60208301905092915050565b6000602082019050919050565b60006135868261351b565b6135908185613526565b935061359b83613537565b8060005b838110156135cc5781516135b38882613556565b97506135be8361356e565b92505060018101905061359f565b5085935050505092915050565b600060208201905081810360008301526135f3818461357b565b905092915050565b6000806040838503121561361257613611612d23565b5b600061362085828601612dac565b925050602061363185828601612d76565b9150509250929050565b61364481612eb0565b811461364f57600080fd5b50565b6000813590506136618161363b565b92915050565b6000806040838503121561367e5761367d612d23565b5b600061368c85828601612d76565b925050602061369d85828601613652565b9150509250929050565b600080604083850312156136be576136bd612d23565b5b60006136cc85828601612d76565b92505060206136dd85828601612d76565b9150509250929050565b600080600080600060a0868803121561370357613702612d23565b5b600061371188828901612d76565b955050602061372288828901612d76565b945050604061373388828901612dac565b935050606061374488828901612dac565b925050608086013567ffffffffffffffff81111561376557613764612d28565b5b6137718882890161329a565b9150509295509295909350565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b60006137da602b83612f1e565b91506137e58261377e565b604082019050919050565b60006020820190508181036000830152613809816137cd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061385757607f821691505b6020821081141561386b5761386a613810565b5b50919050565b600081905092915050565b60008190508160005260206000209050919050565b6000815461389e8161383f565b6138a88186613871565b945060018216600081146138c357600181146138d457613907565b60ff19831686528186019350613907565b6138dd8561387c565b60005b838110156138ff578154818901526001820191506020810190506138e0565b838801955050505b50505092915050565b600061391b82612f13565b6139258185613871565b9350613935818560208601612f2f565b80840191505092915050565b600061394d8285613891565b91506139598284613910565b91508190509392505050565b60008151905061397481612d5f565b92915050565b6000602082840312156139905761398f612d23565b5b600061399e84828501613965565b91505092915050565b7f46726163746f6e3a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006139dd602083612f1e565b91506139e8826139a7565b602082019050919050565b60006020820190508181036000830152613a0c816139d0565b9050919050565b7f46726163746f6e3a2073616c65206e6f74206163746976650000000000000000600082015250565b6000613a49601883612f1e565b9150613a5482613a13565b602082019050919050565b60006020820190508181036000830152613a7881613a3c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613ab982612d8b565b9150613ac483612d8b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613afd57613afc613a7f565b5b828202905092915050565b7f46726163746f6e3a2045746865722076616c7565206e6f7420656e6f75676800600082015250565b6000613b3e601f83612f1e565b9150613b4982613b08565b602082019050919050565b60006020820190508181036000830152613b6d81613b31565b9050919050565b6000613b7f82612d8b565b9150613b8a83612d8b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613bbf57613bbe613a7f565b5b828201905092915050565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b6000613c26603283612f1e565b9150613c3182613bca565b604082019050919050565b60006020820190508181036000830152613c5581613c19565b9050919050565b6000613c6782612d8b565b9150613c7283612d8b565b925082821015613c8557613c84613a7f565b5b828203905092915050565b7f46726163746f6e3a2063616c6c6572206973206e6f742046726163746f6e204460008201527f414f000000000000000000000000000000000000000000000000000000000000602082015250565b6000613cec602283612f1e565b9150613cf782613c90565b604082019050919050565b60006020820190508181036000830152613d1b81613cdf565b9050919050565b7f46726163746f6e3a206163746976652073616c65206578697374730000000000600082015250565b6000613d58601b83612f1e565b9150613d6382613d22565b602082019050919050565b60006020820190508181036000830152613d8781613d4b565b9050919050565b6000604082019050613da36000830185612e01565b613db06020830184612e01565b9392505050565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b6000613e13602983612f1e565b9150613e1e82613db7565b604082019050919050565b60006020820190508181036000830152613e4281613e06565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000613e8382612d8b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eb657613eb5613a7f565b5b600182019050919050565b7f46726163746f6e3a20726f756e64206973206e6f742073756363656564000000600082015250565b6000613ef7601d83612f1e565b9150613f0282613ec1565b602082019050919050565b60006020820190508181036000830152613f2681613eea565b9050919050565b7f46726163746f6e3a206e6f20626c696e64626f7820746f20636c61696d000000600082015250565b6000613f63601d83612f1e565b9150613f6e82613f2d565b602082019050919050565b60006020820190508181036000830152613f9281613f56565b9050919050565b613fa281612d4d565b82525050565b6000606082019050613fbd6000830186613f99565b613fca6020830185612e01565b613fd76040830184612e01565b949350505050565b6000604082019050613ff46000830185613f99565b6140016020830184612e01565b9392505050565b7f46726163746f6e3a2063616c6c6572206973206e6f7420737761700000000000600082015250565b600061403e601b83612f1e565b915061404982614008565b602082019050919050565b6000602082019050818103600083015261406d81614031565b9050919050565b7f46726163746f6e3a204e6f742061636869657665207965740000000000000000600082015250565b60006140aa601883612f1e565b91506140b582614074565b602082019050919050565b600060208201905081810360008301526140d98161409d565b9050919050565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b600061413c602983612f1e565b9150614147826140e0565b604082019050919050565b6000602082019050818103600083015261416b8161412f565b9050919050565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006141ce602183612f1e565b91506141d982614172565b604082019050919050565b600060208201905081810360008301526141fd816141c1565b9050919050565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b6000614260602883612f1e565b915061426b82614204565b604082019050919050565b6000602082019050818103600083015261428f81614253565b9050919050565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006142f2602583612f1e565b91506142fd82614296565b604082019050919050565b60006020820190508181036000830152614321816142e5565b9050919050565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b6000614384602a83612f1e565b915061438f82614328565b604082019050919050565b600060208201905081810360008301526143b381614377565b9050919050565b600060408201905081810360008301526143d4818561357b565b905081810360208301526143e8818461357b565b90509392505050565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061444d602383612f1e565b9150614458826143f1565b604082019050919050565b6000602082019050818103600083015261447c81614440565b9050919050565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b60006144df602483612f1e565b91506144ea82614483565b604082019050919050565b6000602082019050818103600083015261450e816144d2565b9050919050565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b6000614571602983612f1e565b915061457c82614515565b604082019050919050565b600060208201905081810360008301526145a081614564565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006145ce826145a7565b6145d881856145b2565b93506145e8818560208601612f2f565b6145f181612f62565b840191505092915050565b600060a0820190506146116000830188613f99565b61461e6020830187613f99565b61462b6040830186612e01565b6146386060830185612e01565b818103608083015261464a81846145c3565b90509695505050505050565b60008151905061466581612e57565b92915050565b60006020828403121561468157614680612d23565b5b600061468f84828501614656565b91505092915050565b60008160e01c9050919050565b600060033d11156146c45760046000803e6146c1600051614698565b90505b90565b600060443d10156146d75761475a565b6146df612d19565b60043d036004823e80513d602482011167ffffffffffffffff8211171561470757505061475a565b808201805167ffffffffffffffff811115614725575050505061475a565b80602083010160043d03850181111561474257505050505061475a565b61475182602001850186613007565b82955050505050505b90565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b60006147b9603483612f1e565b91506147c48261475d565b604082019050919050565b600060208201905081810360008301526147e8816147ac565b9050919050565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b600061484b602883612f1e565b9150614856826147ef565b604082019050919050565b6000602082019050818103600083015261487a8161483e565b9050919050565b600060a0820190506148966000830188613f99565b6148a36020830187613f99565b81810360408301526148b5818661357b565b905081810360608301526148c9818561357b565b905081810360808301526148dd81846145c3565b9050969550505050505056fea2646970667358221220d1b160928bac913f175f5ae80c8eb5b00e53da50c3ca33396aa8bba0db7b21bd64736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: No
IFractonMiniNFT.sol 36 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
interface IFractonMiniNFT {
event StartNewRound(uint256 blockNumber, uint256 sellingPrice);
event CloseRound(uint256 blockNumber);
event ClaimBlindBox(address owner, uint256 tokenID, uint256 amount);
event WithdrawEther(address caller, uint256 amount);
event UpdateRoundSucceed(uint256 round, uint256 blockNumber);
event UpdateBlindBoxPrice(uint256 price);
function startNewRound(uint256 sellingPrice) external returns (bool);
function closeRound() external returns (bool);
function mintBlindBox(uint256 amount) external payable returns (uint256);
function claimBlindBox(uint256 tokenID) external returns (uint256);
function withdrawEther() external returns (bool);
function updateRoundSucceed(uint256 round) external returns (bool);
function updateBlindBoxPrice(uint256 BBoxPrice) external returns (bool);
function totalSupply(uint256 id) external view returns (uint256);
function burn(uint256 amount) external;
function swapmint(uint256 amount, address to) external returns (bool);
}
FractonMiniNFT.sol 179 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol';
import '../interface/IFractonMiniNFT.sol';
import '../interface/IFractonTokenFactory.sol';
contract FractonMiniNFT is ERC1155URIStorage, IFractonMiniNFT {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds; //counter of round. 0 reserves for people's NFT
bool public saleIsActive; //is open for blindbox mint
address private _factory; //factory deployer address
uint256 public blindBoxPrice = 1E17; //blindbox price
uint256 public constant ROUND_CAP = 1000;
mapping(uint256 => bool) public roundSucceed; //is round succeed for users' claiming into people's NFT
mapping(uint256 => uint256) private _totalAmount;
modifier onlyDAO() {
address dao = IFractonTokenFactory(_factory).getDAOAddress();
require(msg.sender == dao, 'Fracton: caller is not Fracton DAO');
_;
}
modifier onlyOwner() {
address owner = IFractonTokenFactory(_factory).getowner();
require(msg.sender == owner, 'Fracton: caller is not the owner');
_;
}
/**
* @dev Total amount of tokens in with a given id.
*/
constructor(string memory uri_) ERC1155(uri_) {
_factory = msg.sender;
}
receive() external payable {}
function startNewRound(uint256 sellingPrice)
external
override
onlyDAO
returns (bool)
{
require(!saleIsActive, 'Fracton: active sale exists');
_tokenIds.increment();
saleIsActive = true;
blindBoxPrice = sellingPrice;
emit StartNewRound(block.number, sellingPrice);
return true;
}
function closeRound() external override onlyDAO returns (bool) {
saleIsActive = false;
emit CloseRound(block.number);
return true;
}
function mintBlindBox(uint256 amount)
external
payable
override
returns (uint256)
{
uint256 round = _tokenIds.current();
require(saleIsActive, 'Fracton: sale not active');
require(
blindBoxPrice * amount <= msg.value,
'Fracton: Ether value not enough'
);
_totalAmount[round] += amount;
if (totalSupply(round) >= ROUND_CAP) {
saleIsActive = false;
}
_mint(msg.sender, round, amount, '');
return amount;
}
function claimBlindBox(uint256 tokenID) external override returns (uint256) {
require(roundSucceed[tokenID], 'Fracton: round is not succeed');
uint256 amount = balanceOf(msg.sender, tokenID);
require(amount > 0, 'Fracton: no blindbox to claim');
_totalAmount[tokenID] -= amount;
_totalAmount[0] += amount;
_burn(msg.sender, tokenID, amount);
_mint(msg.sender, 0, amount, '');
emit ClaimBlindBox(msg.sender, tokenID, amount);
return amount;
}
// Withdraw fundrasing ethers for purchasing NFT
function withdrawEther() external override onlyDAO returns (bool) {
uint256 amount = address(this).balance;
address dao = msg.sender;
payable(dao).transfer(amount);
emit WithdrawEther(msg.sender, amount);
return true;
}
function updateDefaultURI(string memory defaultURI) external onlyOwner {
_setURI(defaultURI);
}
function updateTokenURI(uint256 tokenId, string memory tokenURI)
external
onlyOwner
{
_setURI(tokenId, tokenURI);
}
function updateRoundSucceed(uint256 round)
external
override
onlyDAO
returns (bool)
{
require(_totalAmount[round] >= ROUND_CAP, 'Fracton: Not achieve yet');
roundSucceed[round] = true;
emit UpdateRoundSucceed(round, block.number);
return roundSucceed[round];
}
function updateBlindBoxPrice(uint256 newPrice)
external
override
onlyDAO
returns (bool)
{
blindBoxPrice = newPrice;
emit UpdateBlindBoxPrice(newPrice);
return true;
}
function totalSupply(uint256 id) public view override returns (uint256) {
return _totalAmount[id];
}
function burn(uint256 amount) external {
_totalAmount[0] -= amount;
_burn(msg.sender, 0, amount);
}
function currentRound() public view returns (uint256) {
return _tokenIds.current();
}
function swapmint(uint256 amount, address to)
external
virtual
override
returns (bool)
{
require(
msg.sender == IFractonTokenFactory(_factory).getSwapAddress(),
'Fracton: caller is not swap'
);
_totalAmount[0] += amount;
_mint(to, 0, amount, '');
return true;
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
IFractonTokenFactory.sol 14 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
interface IFractonTokenFactory {
function getowner() external view returns (address);
function getDAOAddress() external view returns (address);
function getVaultAddress() external view returns (address);
function getSwapAddress() external view returns (address);
function getPoolFundingVaultAddress() external view returns (address);
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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`.
*
* 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;
/**
* @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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}
ERC1155.sol 511 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @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, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC1155URIStorage.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)
pragma solidity ^0.8.0;
import "../../../utils/Strings.sol";
import "../ERC1155.sol";
/**
* @dev ERC1155 token with storage based token URI management.
* Inspired by the ERC721URIStorage extension
*
* _Available since v4.6._
*/
abstract contract ERC1155URIStorage is ERC1155 {
using Strings for uint256;
// Optional base URI
string private _baseURI = "";
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the concatenation of the `_baseURI`
* and the token-specific uri if the latter is set
*
* This enables the following behaviors:
*
* - if `_tokenURIs[tokenId]` is set, then the result is the concatenation
* of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`
* is empty per default);
*
* - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`
* which in most cases will contain `ERC1155._uri`;
*
* - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a
* uri value set, then the result is empty.
*/
function uri(uint256 tokenId) public view virtual override returns (string memory) {
string memory tokenURI = _tokenURIs[tokenId];
// If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).
return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);
}
/**
* @dev Sets `tokenURI` as the tokenURI of `tokenId`.
*/
function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {
_tokenURIs[tokenId] = tokenURI;
emit URI(uri(tokenId), tokenId);
}
/**
* @dev Sets `baseURI` as the `_baseURI` for all tokens
*/
function _setBaseURI(string memory baseURI) internal virtual {
_baseURI = baseURI;
}
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
ROUND_CAP 0x2a764b47 → uint256
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
blindBoxPrice 0xf7b5e317 → uint256
currentRound 0x8a19c8bc → uint256
isApprovedForAll 0xe985e9c5 → bool
roundSucceed 0x1846c6d4 → bool
saleIsActive 0xeb8d2444 → bool
supportsInterface 0x01ffc9a7 → bool
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
burn 0x42966c68
uint256 amount
claimBlindBox 0x5e7ff0cc
uint256 tokenID
returns: uint256
closeRound 0xe278fe6f
No parameters
returns: bool
mintBlindBox 0x1ee081df
uint256 amount
returns: uint256
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
startNewRound 0x4615102c
uint256 sellingPrice
returns: bool
swapmint 0x937eb61a
uint256 amount
address to
returns: bool
updateBlindBoxPrice 0x9f3bee9a
uint256 newPrice
returns: bool
updateDefaultURI 0x4cf23a1b
string defaultURI
updateRoundSucceed 0xc34f72b2
uint256 round
returns: bool
updateTokenURI 0x18e97fd1
uint256 tokenId
string tokenURI
withdrawEther 0x7362377b
No parameters
returns: bool
Recent Transactions
No transactions found for this address