Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x4063B1BFfF4a92D3c786BFe2fC666C1cbFabb2FF
Balance 0 ETH
Nonce 1
Code Size 11441 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11441 bytes
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638da5cb5b116100de578063c771c39011610097578063e1ae37db11610071578063e1ae37db14610472578063e449f341146104a2578063ee947a7c146104be578063f2fde38b146104dc5761018e565b8063c771c390146103f5578063d3ea435014610411578063d5a44f86146104415761018e565b80638da5cb5b14610345578063913d05fe14610363578063a0f45b691461037f578063affed0e0146103af578063c4ae3168146103cd578063c59abf9f146103d75761018e565b80635eac62391161014b578063715018a611610125578063715018a6146102e35780637c0b8de2146102ed578063802e9c9e1461030b57806382bfefc8146103275761018e565b80635eac62391461027b578063624d7b721461029757806369d03738146102c75761018e565b80630a42f049146101935780630fbf0a93146101c3578063150b7a02146101df5780631a1cb01f1461020f5780635065299e1461022d5780635c975abb1461025d575b600080fd5b6101ad60048036038101906101a89190611fee565b6104f8565b6040516101ba919061256a565b60405180910390f35b6101dd60048036038101906101d89190611fa1565b610510565b005b6101f960048036038101906101f49190611ede565b610997565b6040516102069190612379565b60405180910390f35b610217610a19565b604051610224919061256a565b60405180910390f35b61024760048036038101906102429190611f61565b610a1f565b604051610254919061256a565b60405180910390f35b610265610a50565b604051610272919061235e565b60405180910390f35b61029560048036038101906102909190611fa1565b610a63565b005b6102b160048036038101906102ac9190611e84565b610d99565b6040516102be919061256a565b60405180910390f35b6102e160048036038101906102dc9190611e84565b610db1565b005b6102eb610e71565b005b6102f5610ef9565b6040516103029190612394565b60405180910390f35b61032560048036038101906103209190611e84565b610f1f565b005b61032f610fdf565b60405161033c91906123af565b60405180910390f35b61034d611005565b60405161035a91906122c1565b60405180910390f35b61037d60048036038101906103789190611fee565b61102e565b005b61039960048036038101906103949190611fee565b6110b4565b6040516103a691906122c1565b60405180910390f35b6103b76110e7565b6040516103c4919061256a565b60405180910390f35b6103d56110ed565b005b6103df611195565b6040516103ec919061256a565b60405180910390f35b61040f600480360381019061040a9190611fee565b61119f565b005b61042b60048036038101906104269190611fee565b611225565b604051610438919061256a565b60405180910390f35b61045b60048036038101906104569190611fee565b611458565b604051610469929190612585565b60405180910390f35b61048c60048036038101906104879190611e84565b61147c565b604051610499919061233c565b60405180910390f35b6104bc60048036038101906104b79190611fa1565b611513565b005b6104c661187d565b6040516104d3919061256a565b60405180910390f35b6104f660048036038101906104f19190611e84565b611883565b005b60026020528060005260406000206000915090505481565b600760009054906101000a900460ff1615610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610557906123ca565b60405180910390fd5b600082829050116105a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059d9061252a565b60405180910390fd5b60005b8282905081101561092d573373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e85858581811061061c5761061b61295f565b5b905060200201356040518263ffffffff1660e01b815260040161063f919061256a565b60206040518083038186803b15801561065757600080fd5b505afa15801561066b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068f9190611eb1565b73ffffffffffffffffffffffffffffffffffffffff16146106e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106dc9061254a565b60405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd33308686868181106107385761073761295f565b5b905060200201356040518463ffffffff1660e01b815260040161075d939291906122dc565b600060405180830381600087803b15801561077757600080fd5b505af115801561078b573d6000803e3d6000fd5b505050506040518060400160405280600b54426107a8919061264e565b6fffffffffffffffffffffffffffffffff168152602001436fffffffffffffffffffffffffffffffff16815250600560008585858181106107ec576107eb61295f565b5b905060200201358152602001908152602001600020600082015181600001556020820151816001015590505061088283838381811061082e5761082d61295f565b5b90506020020135600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061197b90919063ffffffff16565b50600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208383838181106108d5576108d461295f565b5b9050602002013590806001815401808255809150506001900390600052602060002001600090919091909150556009600081548092919061091590612889565b9190505550808061092590612889565b9150506105a9565b50600e604051806040016040528043815260200160095460085461095191906126a4565b8152509080600181540180825580915050600190039060005260206000209060020201600090919091909150600082015181600001556020820151816001015550505050565b60003073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614610a07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fe9061246a565b60405180910390fd5b63150b7a0260e01b9050949350505050565b60085481565b60046020528160005260406000208181548110610a3b57600080fd5b90600052602060002001600091509150505481565b600760009054906101000a900460ff1681565b600760009054906101000a900460ff1615610ab3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aaa906123ca565b60405180910390fd5b60008282905011610af9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af0906124ca565b60405180910390fd5b6000805b83839050811015610cfd57610b72848483818110610b1e57610b1d61295f565b5b90506020020135600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061199590919063ffffffff16565b610bb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba8906123ea565b60405180910390fd5b4260056000868685818110610bc957610bc861295f565b5b9050602002013581526020019081526020016000206000015410610c22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c199061250a565b60405180910390fd5b610c44848483818110610c3857610c3761295f565b5b90506020020135611225565b82610c4f919061264e565b9150436fffffffffffffffffffffffffffffffff1660056000868685818110610c7b57610c7a61295f565b5b90506020020135815260200190815260200160002060010181905550600b5442610ca5919061264e565b6fffffffffffffffffffffffffffffffff1660056000868685818110610cce57610ccd61295f565b5b905060200201358152602001908152602001600020600001819055508080610cf590612889565b915050610afd565b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663449a52f8610d446119af565b836040518363ffffffff1660e01b8152600401610d62929190612313565b600060405180830381600087803b158015610d7c57600080fd5b505af1158015610d90573d6000803e3d6000fd5b50505050505050565b60036020528060005260406000206000915090505481565b610db96119af565b73ffffffffffffffffffffffffffffffffffffffff16610dd7611005565b73ffffffffffffffffffffffffffffffffffffffff1614610e2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e24906124ea565b60405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610e796119af565b73ffffffffffffffffffffffffffffffffffffffff16610e97611005565b73ffffffffffffffffffffffffffffffffffffffff1614610eed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee4906124ea565b60405180910390fd5b610ef760006119b7565b565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610f276119af565b73ffffffffffffffffffffffffffffffffffffffff16610f45611005565b73ffffffffffffffffffffffffffffffffffffffff1614610f9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f92906124ea565b60405180910390fd5b80600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6110366119af565b73ffffffffffffffffffffffffffffffffffffffff16611054611005565b73ffffffffffffffffffffffffffffffffffffffff16146110aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a1906124ea565b60405180910390fd5b8060088190555050565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b6110f56119af565b73ffffffffffffffffffffffffffffffffffffffff16611113611005565b73ffffffffffffffffffffffffffffffffffffffff1614611169576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611160906124ea565b60405180910390fd5b600760009054906101000a900460ff1615600760006101000a81548160ff021916908315150217905550565b6000600954905090565b6111a76119af565b73ffffffffffffffffffffffffffffffffffffffff166111c5611005565b73ffffffffffffffffffffffffffffffffffffffff161461121b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611212906124ea565b60405180910390fd5b80600b8190555050565b60008060056000848152602001908152602001600020600101541415611280576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112779061248a565b60405180910390fd5b600a548214156112c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112bc9061244a565b60405180910390fd5b60008060006005600086815260200190815260200160002060010154905060008060005b600e8054905081101561144a576000600e8054905060018361130b919061264e565b10905084600e83815481106113235761132261295f565b5b90600052602060002090600202016000015410156113415784611368565b600e82815481106113555761135461295f565b5b9060005260206000209060020201600001545b93508061137557436113e8565b84600e600184611385919061264e565b815481106113965761139561295f565b5b90600052602060002090600202016000015410156113b457836113e7565b600e6001836113c3919061264e565b815481106113d4576113d361295f565b5b9060005260206000209060020201600001545b5b925083836113f6919061272f565b955085600e838154811061140d5761140c61295f565b5b90600052602060002090600202016001015461142991906126d5565b87611434919061264e565b965050808061144290612889565b9150506112e9565b508495505050505050919050565b60056020528060005260406000206000915090508060000154908060010154905082565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561150757602002820191906000526020600020905b8154815260200190600101908083116114f3575b50505050509050919050565b600760009054906101000a900460ff1615611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906123ca565b60405180910390fd5b600082829050116115a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a09061242a565b60405180910390fd5b60005b82829050811015611801576116218383838181106115cd576115cc61295f565b5b90506020020135600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061199590919063ffffffff16565b611660576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611657906124aa565b60405180910390fd5b6116ca8383838181106116765761167561295f565b5b90506020020135600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020611a7b90919063ffffffff16565b50600560008484848181106116e2576116e161295f565b5b9050602002013581526020019081526020016000206000808201600090556001820160009055505061172c8383838181106117205761171f61295f565b5b90506020020135611a95565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd303386868681811061177f5761177e61295f565b5b905060200201356040518463ffffffff1660e01b81526004016117a4939291906122dc565b600060405180830381600087803b1580156117be57600080fd5b505af11580156117d2573d6000803e3d6000fd5b50505050600960008154809291906117e99061282e565b919050555080806117f990612889565b9150506115ac565b50600e60405180604001604052804381526020016000600954146118275760095461182a565b60015b60085461183791906126a4565b8152509080600181540180825580915050600190039060005260206000209060020201600090919091909150600082015181600001556020820151816001015550505050565b600b5481565b61188b6119af565b73ffffffffffffffffffffffffffffffffffffffff166118a9611005565b73ffffffffffffffffffffffffffffffffffffffff16146118ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f6906124ea565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561196f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119669061240a565b60405180910390fd5b611978816119b7565b50565b600061198d836000018360001b611bd8565b905092915050565b60006119a7836000018360001b611c48565b905092915050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000611a8d836000018360001b611c6b565b905092915050565b60005b60046000611aa46119af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015611bd4578160046000611af66119af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611b4257611b4161295f565b5b90600052602060002001541415611bc157600a5460046000611b626119af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611bae57611bad61295f565b5b9060005260206000200181905550611bd4565b8080611bcc90612889565b915050611a98565b5050565b6000611be48383611c48565b611c3d578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611c42565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114611d73576000600182611c9d919061272f565b9050600060018660000180549050611cb5919061272f565b9050818114611d24576000866000018281548110611cd657611cd561295f565b5b9060005260206000200154905080876000018481548110611cfa57611cf961295f565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480611d3857611d37612930565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611d79565b60009150505b92915050565b6000611d92611d8d846125d3565b6125ae565b905082815260208101848484011115611dae57611dad6129cc565b5b611db984828561281f565b509392505050565b600081359050611dd081612c4d565b92915050565b600081519050611de581612c4d565b92915050565b60008083601f840112611e0157611e006129c2565b5b8235905067ffffffffffffffff811115611e1e57611e1d6129bd565b5b602083019150836020820283011115611e3a57611e396129c7565b5b9250929050565b600082601f830112611e5657611e556129c2565b5b8135611e66848260208601611d7f565b91505092915050565b600081359050611e7e81612c64565b92915050565b600060208284031215611e9a57611e996129d6565b5b6000611ea884828501611dc1565b91505092915050565b600060208284031215611ec757611ec66129d6565b5b6000611ed584828501611dd6565b91505092915050565b60008060008060808587031215611ef857611ef76129d6565b5b6000611f0687828801611dc1565b9450506020611f1787828801611dc1565b9350506040611f2887828801611e6f565b925050606085013567ffffffffffffffff811115611f4957611f486129d1565b5b611f5587828801611e41565b91505092959194509250565b60008060408385031215611f7857611f776129d6565b5b6000611f8685828601611dc1565b9250506020611f9785828601611e6f565b9150509250929050565b60008060208385031215611fb857611fb76129d6565b5b600083013567ffffffffffffffff811115611fd657611fd56129d1565b5b611fe285828601611deb565b92509250509250929050565b600060208284031215612004576120036129d6565b5b600061201284828501611e6f565b91505092915050565b600061202783836122a3565b60208301905092915050565b61203c81612763565b82525050565b600061204d82612614565b612057818561262c565b935061206283612604565b8060005b8381101561209357815161207a888261201b565b97506120858361261f565b925050600181019050612066565b5085935050505092915050565b6120a981612775565b82525050565b6120b881612781565b82525050565b6120c7816127d7565b82525050565b6120d6816127fb565b82525050565b60006120e960068361263d565b91506120f4826129ec565b602082019050919050565b600061210c601e8361263d565b915061211782612a15565b602082019050919050565b600061212f60268361263d565b915061213a82612a3e565b604082019050919050565b6000612152601a8361263d565b915061215d82612a8d565b602082019050919050565b600061217560158361263d565b915061218082612ab6565b602082019050919050565b6000612198601d8361263d565b91506121a382612adf565b602082019050919050565b60006121bb60108361263d565b91506121c682612b08565b602082019050919050565b60006121de60198361263d565b91506121e982612b31565b602082019050919050565b6000612201601f8361263d565b915061220c82612b5a565b602082019050919050565b600061222460208361263d565b915061222f82612b83565b602082019050919050565b600061224760278361263d565b915061225282612bac565b604082019050919050565b600061226a60188361263d565b915061227582612bfb565b602082019050919050565b600061228d60178361263d565b915061229882612c24565b602082019050919050565b6122ac816127cd565b82525050565b6122bb816127cd565b82525050565b60006020820190506122d66000830184612033565b92915050565b60006060820190506122f16000830186612033565b6122fe6020830185612033565b61230b60408301846122b2565b949350505050565b60006040820190506123286000830185612033565b61233560208301846122b2565b9392505050565b600060208201905081810360008301526123568184612042565b905092915050565b600060208201905061237360008301846120a0565b92915050565b600060208201905061238e60008301846120af565b92915050565b60006020820190506123a960008301846120be565b92915050565b60006020820190506123c460008301846120cd565b92915050565b600060208201905081810360008301526123e3816120dc565b9050919050565b60006020820190508181036000830152612403816120ff565b9050919050565b6000602082019050818103600083015261242381612122565b9050919050565b6000602082019050818103600083015261244381612145565b9050919050565b6000602082019050818103600083015261246381612168565b9050919050565b600060208201905081810360008301526124838161218b565b9050919050565b600060208201905081810360008301526124a3816121ae565b9050919050565b600060208201905081810360008301526124c3816121d1565b9050919050565b600060208201905081810360008301526124e3816121f4565b9050919050565b6000602082019050818103600083015261250381612217565b9050919050565b600060208201905081810360008301526125238161223a565b9050919050565b600060208201905081810360008301526125438161225d565b9050919050565b6000602082019050818103600083015261256381612280565b9050919050565b600060208201905061257f60008301846122b2565b92915050565b600060408201905061259a60008301856122b2565b6125a760208301846122b2565b9392505050565b60006125b86125c9565b90506125c48282612858565b919050565b6000604051905090565b600067ffffffffffffffff8211156125ee576125ed61298e565b5b6125f7826129db565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612659826127cd565b9150612664836127cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612699576126986128d2565b5b828201905092915050565b60006126af826127cd565b91506126ba836127cd565b9250826126ca576126c9612901565b5b828204905092915050565b60006126e0826127cd565b91506126eb836127cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612724576127236128d2565b5b828202905092915050565b600061273a826127cd565b9150612745836127cd565b925082821015612758576127576128d2565b5b828203905092915050565b600061276e826127ad565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006127e2826127e9565b9050919050565b60006127f4826127ad565b9050919050565b60006128068261280d565b9050919050565b6000612818826127ad565b9050919050565b82818337600083830152505050565b6000612839826127cd565b9150600082141561284d5761284c6128d2565b5b600182039050919050565b612861826129db565b810181811067ffffffffffffffff821117156128805761287f61298e565b5b80604052505050565b6000612894826127cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156128c7576128c66128d2565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5041555345440000000000000000000000000000000000000000000000000000600082015250565b7f436c61696d526577617264733a20746f6b656e206e6f74207374616b65640000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f556e7374616b653a20616d6f756e742070726f68696269746564000000000000600082015250565b7f6572723a20746f6b656e206e6f74207374616b65640000000000000000000000600082015250565b7f4f70657261746f72206e6f74207374616b696e6720636f6e7472616374000000600082015250565b7f746f6b656e206e6f74207374616b656400000000000000000000000000000000600082015250565b7f556e7374616b653a20746f6b656e206e6f74207374616b656400000000000000600082015250565b7f436c61696d526577617264733a206d697373696e6720746f6b656e2069647300600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f436c61696d526577617264733a206c6f636b757020706572696f64206e6f742060008201527f6578706972656400000000000000000000000000000000000000000000000000602082015250565b7f5374616b653a20616d6f756e742070726f686962697465640000000000000000600082015250565b7f5374616b653a2073656e646572206e6f74206f776e6572000000000000000000600082015250565b612c5681612763565b8114612c6157600080fd5b50565b612c6d816127cd565b8114612c7857600080fd5b5056fea2646970667358221220cf025fc21ba5686b44bcd83940cabce5ce53618efae2a64730cf6fa44d02812464736f6c63430008060033

Verified Source Code Partial Match

Compiler: v0.8.6+commit.11564f7e EVM: berlin Optimization: No
POWERSTONES.sol 37 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.6;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./Administration.sol";

contract POWERSTONES is ERC20, Administration {

    uint256 private _initialTokens = 750000000 ether;
    
    constructor() ERC20("POWERSTONES", "POWR") {}
    
    function initialMint() external onlyAdmin {
        require(totalSupply() == 0, "ERROR: Assets found");
        _mint(owner(), _initialTokens);
    }

    function mintTokens(uint amount) public onlyAdmin {
        _mint(owner(), amount * (10**18));
    }

    function mintTo(address to, uint amount) public onlyAdmin {
        _mint(to, amount * (10**18));
    }
    
    function burnTokens(uint amount) external onlyAdmin {
        _burn(owner(), amount * (10**18));
    }

    function buy(address from, uint amount) external onlyAdmin {
        _burn(from, amount * (10**18));
    }

    function withdraw() external onlyOwner {
        payable(_msgSender()).transfer(address(this).balance);
    }
}
METAG_STAKING.sol 184 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.6;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./POWERSTONES.sol";

contract METAG_STAKING is Ownable, IERC721Receiver {
    using EnumerableSet for EnumerableSet.UintSet; 

    mapping(uint => address) public ownership;
    mapping(uint => uint) public stakeTime;
    mapping(address => uint) public lastWithdraw;
    mapping(address => uint[]) public _qty;
    mapping(uint256 => Stake) public stakes;
    mapping(address => EnumerableSet.UintSet) private stakedTokens;

    bool public paused = false;
    uint public tokensPerBlock;
    uint256 public nonce = 0;
    uint nullToken = 1 ether;
    uint256 public lockupPeriod = 604800; // 1 week

    IERC721 public NFT;
    POWERSTONES public TOKEN;

    struct Stake {
        uint256 lockupExpires;
        uint256 lastClaimedBlock;
    }

    struct RewardChanged {
        uint256 block;
        uint256 rewardPerBlock;
    }

    RewardChanged[] rewardChanges;

    modifier notPaused(){
        require(!paused, "PAUSED");
        _;
    }

    constructor(uint128 _tokensPerBlock) {
        tokensPerBlock = _tokensPerBlock;
    }

    function getStaked() public view returns (uint) {
        return nonce;
    }

    function setTokensPerBlock(uint new_) external onlyOwner {
        tokensPerBlock = new_;
    }

    function setLockupPeriod(uint new_) external onlyOwner {
        lockupPeriod = new_;
    }

    function togglePause() public onlyOwner {
        paused = !paused;
    }

    function setNFTAddress(address new_) external onlyOwner {
        NFT = IERC721(new_);
    }

    function setCOINAddress(address new_) external onlyOwner {
        TOKEN = POWERSTONES(new_);
    }

    function getAssetsByHolder(address holder) public view returns (uint[] memory){
        return _qty[holder];
    }

    function claimRewards(uint256[] calldata tokenIds) external notPaused {
        require(tokenIds.length > 0, "ClaimRewards: missing token ids");

        uint256 rewards;

        for (uint256 i; i < tokenIds.length; i++) {
            require(
                stakedTokens[msg.sender].contains(tokenIds[i]), 
                "ClaimRewards: token not staked"
            );
            require(
                stakes[tokenIds[i]].lockupExpires < block.timestamp, 
                "ClaimRewards: lockup period not expired"
            );            
            
            rewards += calculateRewards(tokenIds[i]);
            stakes[tokenIds[i]].lastClaimedBlock = uint128(block.number);
            stakes[tokenIds[i]].lockupExpires = uint128(block.timestamp + lockupPeriod);
        }

        TOKEN.mintTo(_msgSender(), rewards);
    }  

    function calculateRewards(uint256 tokenID) public view returns (uint256) {
        require(stakes[tokenID].lastClaimedBlock != 0, "token not staked");
        require(tokenID != nullToken, "err: token not staked");

        uint256 rewards;
        uint256 blocksPassed;

        uint256 lastClaimedBlock = stakes[tokenID].lastClaimedBlock;

        uint256 from;
        uint256 last;

        for(uint256 i=0; i < rewardChanges.length; i++) {
            bool hasNext = i+1 < rewardChanges.length;

            from = rewardChanges[i].block >= lastClaimedBlock ? 
                   rewardChanges[i].block : 
                   lastClaimedBlock;
            
            last = hasNext ? 
                   (rewardChanges[i+1].block >= lastClaimedBlock ? 
                      rewardChanges[i+1].block : 
                      from 
                   ) : 
                   block.number;

            blocksPassed = last - from;
            rewards += rewardChanges[i].rewardPerBlock * blocksPassed;         
        }
        return rewards;
    }  

    function stake(uint256[] calldata tokenIds) external notPaused {
        require(tokenIds.length > 0, "Stake: amount prohibited");

        for (uint256 i; i < tokenIds.length; i++) {
            require(NFT.ownerOf(tokenIds[i]) == msg.sender, "Stake: sender not owner");

            NFT.transferFrom(msg.sender, address(this), tokenIds[i]);

            stakes[tokenIds[i]] = Stake(uint128(block.timestamp + lockupPeriod), uint128(block.number));
            stakedTokens[msg.sender].add(tokenIds[i]);
            _qty[msg.sender].push(tokenIds[i]);
            nonce++;
        }
        
        rewardChanges.push(RewardChanged(uint256(block.number), tokensPerBlock / nonce));
    }   

    function unstake(uint256[] calldata tokenIds) external notPaused {
        require(tokenIds.length > 0, "Unstake: amount prohibited");

        for (uint256 i; i < tokenIds.length; i++) {
            require(
                stakedTokens[msg.sender].contains(tokenIds[i]), 
                "Unstake: token not staked"
            );
            
            stakedTokens[msg.sender].remove(tokenIds[i]);
            delete stakes[tokenIds[i]];
            removeToken(tokenIds[i]);
            NFT.transferFrom(address(this), msg.sender, tokenIds[i]);
            nonce--;
        }

        rewardChanges.push(RewardChanged(uint256(block.number), tokensPerBlock / (nonce == 0 ? 1 : nonce)));
    }

    function removeToken(uint tokenId) internal {
        for(uint i=0;i<_qty[_msgSender()].length;i++){
            if(_qty[_msgSender()][i] == tokenId){
                _qty[_msgSender()][i] = nullToken;
                break;
            }
        }
    }

    function onERC721Received(address operator, address, uint256, bytes memory) public view override returns (bytes4) {
        require(operator == address(this), "Operator not staking contract");

        return this.onERC721Received.selector;
    }

}
Administration.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";

contract Administration is Ownable {
    
    event SetAdmin(address indexed admin, bool active);
    
    mapping (address => bool) private admins;
    
    modifier onlyAdmin(){
        require(admins[_msgSender()] || owner() == _msgSender(), "Admin: caller is not an admin");
        _;
    }
    
    function setAdmin(address admin, bool active) external onlyOwner {
        admins[admin] = active;
        emit SetAdmin(admin, active);
    }
    
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT

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;
    }
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
ERC20.sol 355 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens 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 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}
IERC20.sol 81 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT

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;
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT

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);
}
EnumerableSet.sol 356 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT

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);
}
IERC20Metadata.sol 27 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

Read Contract

NFT 0x7c0b8de2 → address
TOKEN 0x82bfefc8 → address
_qty 0x5065299e → uint256
calculateRewards 0xd3ea4350 → uint256
getAssetsByHolder 0xe1ae37db → uint256[]
getStaked 0xc59abf9f → uint256
lastWithdraw 0x624d7b72 → uint256
lockupPeriod 0xee947a7c → uint256
nonce 0xaffed0e0 → uint256
onERC721Received 0x150b7a02 → bytes4
owner 0x8da5cb5b → address
ownership 0xa0f45b69 → address
paused 0x5c975abb → bool
stakeTime 0x0a42f049 → uint256
stakes 0xd5a44f86 → uint256, uint256
tokensPerBlock 0x1a1cb01f → uint256

Write Contract 10 functions

These functions modify contract state and require a wallet transaction to execute.

claimRewards 0x5eac6239
uint256[] tokenIds
renounceOwnership 0x715018a6
No parameters
setCOINAddress 0x802e9c9e
address new_
setLockupPeriod 0xc771c390
uint256 new_
setNFTAddress 0x69d03738
address new_
setTokensPerBlock 0x913d05fe
uint256 new_
stake 0x0fbf0a93
uint256[] tokenIds
togglePause 0xc4ae3168
No parameters
transferOwnership 0xf2fde38b
address newOwner
unstake 0xe449f341
uint256[] tokenIds

Recent Transactions

No transactions found for this address