Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x9A5069CD9721a2570537BeDAa2b285B61404dd0D
Balance 0 ETH
Nonce 1
Code Size 10897 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

10897 bytes
0x608060405234801561001057600080fd5b506004361061030c5760003560e01c80635d44f4b41161019d578063a457c2d7116100e9578063d89135cd116100a2578063e7f632ae1161007c578063e7f632ae146106f8578063f2b9aa111461070b578063f6c38c481461072e578063ff1a318d1461080857600080fd5b8063d89135cd146106c9578063dd62ed3e146106d2578063e4dabf4e146106e557600080fd5b8063a457c2d714610661578063a9059cbb14610674578063c261c83914610687578063d453bec614610690578063d547741f146106a3578063d5c2e72b146106b657600080fd5b80638991d8661161015657806391d148541161013057806391d148541461062b57806395d89b411461063e5780639dc29fac14610646578063a217fddf1461065957600080fd5b80638991d866146105f25780638bc74ab8146106055780639164dd351461061857600080fd5b80635d44f4b4146105715780636d526798146105845780636ebcf6071461059757806370a08231146105b75780637c17357d146105e05780638867596f146105e957600080fd5b80632f2ff15d1161025c57806339509351116102155780633fa615b0116101ef5780633fa615b01461051657806346b68e481461051f5780634dacf3f5146105325780635992fbfa1461054657600080fd5b806339509351146104bd5780633e717f0b146104d05780633fa1410f146104f357600080fd5b80632f2ff15d1461044c578063313ce5671461045f578063316ff66a1461046e578063355274ea1461048157806336568abe1461048a578063374625081461049d57600080fd5b80631c4ba3ed116102c9578063248a9ca3116102a3578063248a9ca3146103f057806329687031146104135780632f2d0e82146104265780632f2e7a041461043957600080fd5b80631c4ba3ed146103b5578063202889d6146103ca57806323b872dd146103dd57600080fd5b806301ffc9a714610311578063062287491461033957806306fdde0314610364578063095ea7b3146103795780631733e0d71461038c57806318160ddd146103ad575b600080fd5b61032461031f3660046121ab565b61081b565b60405190151581526020015b60405180910390f35b60125461034c906001600160a01b031681565b6040516001600160a01b039091168152602001610330565b61036c610852565b60405161033091906121f9565b610324610387366004612248565b6108e4565b61039f61039a366004612289565b6108fc565b604051908152602001610330565b60025461039f565b6103c86103c33660046122a4565b610a99565b005b6103c86103d8366004612289565b610ac7565b6103246103eb3660046122bf565b610bd9565b61039f6103fe3660046122fb565b60009081526005602052604090206001015490565b6103c8610421366004612474565b610c08565b6103c8610434366004612528565b610f95565b61039f6104473660046122a4565b610fcc565b6103c861045a36600461255b565b611016565b60405160128152602001610330565b61039f61047c366004612289565b611040565b61039f60075481565b6103c861049836600461255b565b61108a565b6104b06104ab3660046122a4565b611108565b604051610330919061257e565b6103246104cb366004612248565b6111a6565b6103246104de3660046122a4565b60186020526000908152604090205460ff1681565b6103246105013660046122a4565b60146020526000908152604090205460ff1681565b61039f60085481565b6103c861052d3660046125cb565b6111c8565b601a5461032490600160401b900460ff1681565b6105596105543660046122fb565b61143e565b6040516001600160401b039091168152602001610330565b6103c861057f36600461263f565b61147b565b6103c86105923660046126c3565b611493565b61039f6105a53660046122a4565b60006020819052908152604090205481565b61039f6105c53660046122a4565b6001600160a01b031660009081526020819052604090205490565b61039f60095481565b61039f60135481565b6103c8610600366004612289565b6114b1565b6103c86106133660046126ff565b611568565b6103c8610626366004612729565b6115ad565b61032461063936600461255b565b61162d565b61036c611658565b6103c8610654366004612248565b611667565b61039f600081565b61032461066f366004612248565b6116e9565b610324610682366004612248565b611740565b61039f601b5481565b601a54610559906001600160401b031681565b6103c86106b136600461255b565b611759565b6103c86106c4366004612289565b61177e565b61039f600a5481565b61039f6106e036600461276d565b611812565b6103c86106f3366004612729565b61183d565b6103c8610706366004612789565b6118b7565b6103246107193660046122a4565b60156020526000908152604090205460ff1681565b6107ad61073c366004612289565b6001600160401b0316600090815260176020526040902080546001820154600283015460038401546004909401546001600160a01b0384169560ff600160a01b8604811696600160a81b870482169661ffff600160b01b8204811697600160c01b9092041695909490939290911691565b604080516001600160a01b03909a168a5260ff98891660208b0152979096169688019690965261ffff938416606088015292909116608086015260a085015260c084015290151560e083015261010082015261012001610330565b6103c86108163660046122fb565b611906565b60006001600160e01b03198216637965db0b60e01b148061084c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610861906127b3565b80601f016020809104026020016040519081016040528092919081815260200182805461088d906127b3565b80156108da5780601f106108af576101008083540402835291602001916108da565b820191906000526020600020905b8154815290600101906020018083116108bd57829003601f168201915b5050505050905090565b6000336108f2818585611ac4565b5060019392505050565b6001600160401b03811660009081526017602052604081208054600160a01b900460ff168261092e8262278d00612803565b60135461093b919061281a565b9050600061094886611040565b905060008085600201546000148015610965575060008660010154115b801561097c57508554600160c01b900461ffff1615155b156109be5785546001870154600091600160c01b900461ffff16906109a4906127109061282d565b6109ae9190612803565b90506109ba818361281a565b9150505b83421115610a8e578560040154600003610a0b5785546109eb90600160a81b900460ff166201518061284f565b62ffffff166109fa8542612876565b610a04919061282d565b9150610a46565b8554610a2490600160a81b900460ff166201518061284f565b62ffffff16866004015442610a399190612876565b610a43919061282d565b91505b610a508284612803565b610a5a908261281a565b905085600201548660010154610a709190612876565b811115610a8e5785600201548660010154610a8b9190612876565b90505b979650505050505050565b6000610aa481611b7a565b50601280546001600160a01b0319166001600160a01b0392909216919091179055565b610acf611b84565b6001600160401b038116600090815260176020526040902080546001600160a01b0316331480610b055750610b0560003361162d565b610b465760405162461bcd60e51b815260206004820152600d60248201526c3737ba103a34329037bbb732b960991b60448201526064015b60405180910390fd5b33610b825760405162461bcd60e51b815260206004820152600c60248201526b5a65726f206164647265737360a01b6044820152606401610b3d565b6000610b8d836108fc565b90508015610bca5780826002016000828254610ba9919061281a565b90915550508154610bc3906001600160a01b031682611bdd565b4260048301555b5050610bd66001600655565b50565b6000610be6848484611c13565b33610bf2858285611d39565b610bfd858585611d97565b506001949350505050565b6000610c1381611b7a565b8151835114610c5c5760405162461bcd60e51b8152602060048201526015602482015274105c9c985e49dcc81b5d5cdd08189948195c5d585b605a1b6044820152606401610b3d565b60005b83518161ffff161015610f8b57604051806101200160405280858361ffff1681518110610c8e57610c8e612889565b60200260200101516001600160a01b031681526020018960ff1681526020018860ff1681526020018761ffff1681526020018661ffff168152602001610cd2601290565b610cdd90600a612983565b858461ffff1681518110610cf357610cf3612889565b60200260200101516001600160401b0316610d0e9190612803565b81526000602080830182905260408084018390526060938401839052601a546001600160401b03168352601782528083208551815493870151928701519587015160808801516001600160a01b039092166001600160a81b031990951694909417600160a01b60ff948516021762ffffff60a81b1916600160a81b939096169290920261ffff60b01b191694909417600160b01b61ffff938416021761ffff60c01b1916600160c01b9183169190910217835560a0840151600184015560c0840151600284015560e084015160038401805460ff19169115159190911790556101009093015160049092019190915585516016928791908516908110610e1657610e16612889565b6020908102919091018101516001600160a01b03168252818101929092526040016000908120601a80548254600181018455928452938320600483040180546001600160401b0360039094166008026101000a8481021990911695841602949094179093558254169190610e8983612992565b91906101000a8154816001600160401b0302191690836001600160401b0316021790555050600754838261ffff1681518110610ec757610ec7612889565b60200260200101516001600160401b0316600954610ee5919061281a565b10610f255760405162461bcd60e51b815260206004820152601060248201526f43616e277420636c61696d206d6f726560801b6044820152606401610b3d565b610f316012600a612983565b838261ffff1681518110610f4757610f47612889565b60200260200101516001600160401b0316610f629190612803565b60096000828254610f73919061281a565b90915550819050610f83816129b8565b915050610c5f565b5050505050505050565b6000610fa081611b7a565b506001600160a01b03919091166000908152601860205260409020805460ff1916911515919091179055565b601a54600090600160401b900460ff16801561100157506001600160a01b03821660009081526018602052604090205460ff16155b1561100e575050601b5490565b506000919050565b60008281526005602052604090206001015461103181611b7a565b61103b8383611df6565b505050565b6001600160401b038116600090815260176020526040812080546001820154600160b01b90910461ffff1690611079906127109061282d565b6110839190612803565b9392505050565b6001600160a01b03811633146110fa5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b3d565b6111048282611e7c565b5050565b6001600160a01b03811660009081526016602090815260409182902080548351818402810184019094528084526060939283018282801561119a57602002820191906000526020600020906000905b82829054906101000a90046001600160401b03166001600160401b0316815260200190600801906020826007010492830192600103820291508084116111575790505b50505050509050919050565b6000336108f28185856111b98383611812565b6111c3919061281a565b611ac4565b60006111d381611b7a565b604051806101200160405280846001600160a01b031681526020018860ff1681526020018760ff1681526020018661ffff1681526020018561ffff16815260200161121c601290565b61122790600a612983565b61123a906001600160401b038616612803565b81526000602080830182905260408084018390526060938401839052601a80546001600160401b0390811685526017845282852087518154898701518a870151998b015160808c01516001600160a01b039485166001600160a81b031990941693909317600160a01b60ff938416021762ffffff60a81b1916600160a81b92909b169190910261ffff60b01b191699909917600160b01b61ffff9a8b16021761ffff60c01b1916600160c01b999091169890980297909717815560a088015160018083019190915560c0890151600283015560e08901516003808401805460ff191692151592909217909155610100998a0151600493840155978c168752601686529386208354815495860182559087529486209084040180549390961660080290960a808702199092169286169091029190911790925581549092169161138183612992565b91906101000a8154816001600160401b0302191690836001600160401b0316021790555050600754826001600160401b03166009546113c0919061281a565b106114005760405162461bcd60e51b815260206004820152601060248201526f43616e277420636c61696d206d6f726560801b6044820152606401610b3d565b61140c6012600a612983565b61141f906001600160401b038416612803565b60096000828254611430919061281a565b909155505050505050505050565b6019818154811061144e57600080fd5b9060005260206000209060049182820401919006600802915054906101000a90046001600160401b031681565b600061148681611b7a565b61103b600b83600761208f565b600061149e81611b7a565b815161103b9060199060208501906120e7565b60006114bc81611b7a565b6001600160401b0382166000908152601760205260409020600101541580159061150257506001600160401b03821660009081526017602052604090206003015460ff16155b6115405760405162461bcd60e51b815260206004820152600f60248201526e10d85b89dd0818db185a5b48139195608a1b6044820152606401610b3d565b506001600160401b03166000908152601760205260409020600301805460ff19166001179055565b600061157381611b7a565b506001600160401b0391909116600090815260176020526040902080546001600160a01b0319166001600160a01b03909216919091179055565b60006115b881611b7a565b60005b83518161ffff161015611627578260146000868461ffff16815181106115e3576115e3612889565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061161f816129b8565b9150506115bb565b50505050565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610861906127b3565b6008546007546116779190612876565b600a541015611104576008546007546116909190612876565b81600a5461169e919061281a565b11156116c457600a546008546007546116b79190612876565b6116c19190612876565b90505b6116ce8282611ee3565b80600a60008282546116e0919061281a565b90915550505050565b600033816116f78286611812565b90508381101561173357604051632983c0c360e21b81526001600160a01b03861660048201526024810182905260448101859052606401610b3d565b610bfd8286868403611ac4565b600061174d338484611c13565b336108f2818585611d97565b60008281526005602052604090206001015461177481611b7a565b61103b8383611e7c565b600061178981611b7a565b6001600160401b038216600090815260176020526040902060028101546001909101546117b69190612876565b600960008282546117c79190612876565b9091555050506001600160401b0316600090815260176020526040812080546001600160d01b0319168155600181018290556002810182905560038101805460ff1916905560040155565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600061184881611b7a565b60005b83518161ffff161015611627578260156000868461ffff168151811061187357611873612889565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806118af816129b8565b91505061184b565b60006118c281611b7a565b601a805468ff00000000000000001916600160401b8515150217905560126118eb90600a612983565b6118fe906001600160401b038416612803565b601b55505050565b600061191181611b7a565b50601355565b606061084c6001600160a01b03831660145b60606000611938836002612803565b61194390600261281a565b6001600160401b0381111561195a5761195a612337565b6040519080825280601f01601f191660200182016040528015611984576020820181803683370190505b509050600360fc1b8160008151811061199f5761199f612889565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106119ce576119ce612889565b60200101906001600160f81b031916908160001a90535060006119f2846002612803565b6119fd90600161281a565b90505b6001811115611a75576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611a3157611a31612889565b1a60f81b828281518110611a4757611a47612889565b60200101906001600160f81b031916908160001a90535060049490941c93611a6e816129cf565b9050611a00565b5083156110835760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b3d565b6001600160a01b038316611aee5760405163e602df0560e01b815260006004820152602401610b3d565b6001600160a01b038216611b1857604051634a1406b160e11b815260006004820152602401610b3d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b610bd68133611f19565b600260065403611bd65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b3d565b6002600655565b6001600160a01b038216611c075760405163ec442f0560e01b815260006004820152602401610b3d565b61110460008383611f72565b6001600160a01b03831660009081526014602052604090205460ff16158015611c5557506001600160a01b03821660009081526014602052604090205460ff16155b611c925760405162461bcd60e51b815260206004820152600e60248201526d1058d8c81a5cc8189b1bd8dad95960921b6044820152606401610b3d565b6000611c9d83610fcc565b90508015611627578082611cc6856001600160a01b031660009081526020819052604090205490565b611cd0919061281a565b11156116275760405162461bcd60e51b815260206004820152603260248201527f596f75722077616c6c657420686173207265616368656420697473206d6178696044820152711b5d5b481a1bdb191a5b99c8185b5bdd5b9d60721b6064820152608401610b3d565b6000611d458484611812565b905060001981146116275781811015611d8a57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610b3d565b6116278484848403611ac4565b6001600160a01b038316611dc157604051634b637e8f60e11b815260006004820152602401610b3d565b6001600160a01b038216611deb5760405163ec442f0560e01b815260006004820152602401610b3d565b61103b838383611f72565b611e00828261162d565b6111045760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611e383390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611e86828261162d565b156111045760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038216611f0d57604051634b637e8f60e11b815260006004820152602401610b3d565b61110482600083611f72565b611f23828261162d565b61110457611f3081611917565b611f3b836020611929565b604051602001611f4c9291906129e6565b60408051601f198184030181529082905262461bcd60e51b8252610b3d916004016121f9565b6001600160a01b038316611f9d578060026000828254611f92919061281a565b9091555061200f9050565b6001600160a01b03831660009081526020819052604090205481811015611ff05760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610b3d565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661202b5760028054829003905561204a565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611b6d91815260200190565b82600781019282156120d7579160200282015b828111156120d757825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906120a2565b506120e3929150612196565b5090565b828054828255906000526020600020906003016004900481019282156120d75791602002820160005b8382111561215a57835183826101000a8154816001600160401b0302191690836001600160401b031602179055509260200192600801602081600701049283019260010302612110565b801561218d5782816101000a8154906001600160401b03021916905560080160208160070104928301926001030261215a565b50506120e39291505b5b808211156120e35760008155600101612197565b6000602082840312156121bd57600080fd5b81356001600160e01b03198116811461108357600080fd5b60005b838110156121f05781810151838201526020016121d8565b50506000910152565b60208152600082518060208401526122188160408501602087016121d5565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461224357600080fd5b919050565b6000806040838503121561225b57600080fd5b6122648361222c565b946020939093013593505050565b80356001600160401b038116811461224357600080fd5b60006020828403121561229b57600080fd5b61108382612272565b6000602082840312156122b657600080fd5b6110838261222c565b6000806000606084860312156122d457600080fd5b6122dd8461222c565b92506122eb6020850161222c565b9150604084013590509250925092565b60006020828403121561230d57600080fd5b5035919050565b803560ff8116811461224357600080fd5b803561ffff8116811461224357600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561237557612375612337565b604052919050565b60006001600160401b0382111561239657612396612337565b5060051b60200190565b600082601f8301126123b157600080fd5b813560206123c66123c18361237d565b61234d565b82815260059290921b840181019181810190868411156123e557600080fd5b8286015b84811015612407576123fa8161222c565b83529183019183016123e9565b509695505050505050565b600082601f83011261242357600080fd5b813560206124336123c18361237d565b82815260059290921b8401810191818101908684111561245257600080fd5b8286015b848110156124075761246781612272565b8352918301918301612456565b60008060008060008060c0878903121561248d57600080fd5b61249687612314565b95506124a460208801612314565b94506124b260408801612325565b93506124c060608801612325565b925060808701356001600160401b03808211156124dc57600080fd5b6124e88a838b016123a0565b935060a08901359150808211156124fe57600080fd5b5061250b89828a01612412565b9150509295509295509295565b8035801515811461224357600080fd5b6000806040838503121561253b57600080fd5b6125448361222c565b915061255260208401612518565b90509250929050565b6000806040838503121561256e57600080fd5b823591506125526020840161222c565b6020808252825182820181905260009190848201906040850190845b818110156125bf5783516001600160401b03168352928401929184019160010161259a565b50909695505050505050565b60008060008060008060c087890312156125e457600080fd5b6125ed87612314565b95506125fb60208801612314565b945061260960408801612325565b935061261760608801612325565b92506126256080880161222c565b915061263360a08801612272565b90509295509295509295565b600060e0828403121561265157600080fd5b82601f83011261266057600080fd5b60405160e081018181106001600160401b038211171561268257612682612337565b6040528060e084018581111561269757600080fd5b845b818110156126b8576126aa8161222c565b835260209283019201612699565b509195945050505050565b6000602082840312156126d557600080fd5b81356001600160401b038111156126eb57600080fd5b6126f784828501612412565b949350505050565b6000806040838503121561271257600080fd5b61271b83612272565b91506125526020840161222c565b6000806040838503121561273c57600080fd5b82356001600160401b0381111561275257600080fd5b61275e858286016123a0565b92505061255260208401612518565b6000806040838503121561278057600080fd5b61271b8361222c565b6000806040838503121561279c57600080fd5b6127a583612518565b915061255260208401612272565b600181811c908216806127c757607f821691505b6020821081036127e757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761084c5761084c6127ed565b8082018082111561084c5761084c6127ed565b60008261284a57634e487b7160e01b600052601260045260246000fd5b500490565b62ffffff81811683821602808216919082811461286e5761286e6127ed565b505092915050565b8181038181111561084c5761084c6127ed565b634e487b7160e01b600052603260045260246000fd5b600181815b808511156128da5781600019048211156128c0576128c06127ed565b808516156128cd57918102915b93841c93908002906128a4565b509250929050565b6000826128f15750600161084c565b816128fe5750600061084c565b8160018114612914576002811461291e5761293a565b600191505061084c565b60ff84111561292f5761292f6127ed565b50506001821b61084c565b5060208310610133831016604e8410600b841016171561295d575081810a61084c565b612967838361289f565b806000190482111561297b5761297b6127ed565b029392505050565b600061108360ff8416836128e2565b60006001600160401b038083168181036129ae576129ae6127ed565b6001019392505050565b600061ffff8083168181036129ae576129ae6127ed565b6000816129de576129de6127ed565b506000190190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612a1e8160178501602088016121d5565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612a4f8160288401602088016121d5565b0160280194935050505056fea26469706673582212209719457eefee28f1e44f92420614ea0b64339885ec6aba3c22c3974470d7ff5e64736f6c63430008120033

Verified Source Code Full Match

Compiler: v0.8.18+commit.87f61d96 EVM: paris Optimization: Yes (200 runs)
CMFeth.sol 288 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../mock/ERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; 
import "../interfaces/iToken.sol";

//____________________________________________________________________________________________________//
contract CyberMetaFarmETH is ERC20,AccessControl,ReentrancyGuard {
    uint  public cap =1000000000*10**decimals(); 
    uint  public minCap=88888888*10**decimals();
    uint  public totalVesting;
    uint  public totalBurned;

// [0-staking,1-team,2-marketing,3-advisor,4-foundation,5-NFThold,6-lp]    
    address[7] teamWallets=[
        0x184Da7Ca591F6865f5B89C6621529D447Ed575f5,
        0x270CD1663d48988033De769BcFF4887A4319a351,
        0xAa0dE4259fCB03F97b510b0ba97BE5195996f2D4,
        0x8c0bCe3992edEb75563D5a27431727fF3f698B11,
        0x5f659618947f0D61b9C4d73a89AF3274ea8F4558,
        0x080E8716243d7bec27174fd165605e00DA63b263,
        0xD024920b6Ce6aF8415f9F5d91Fe62Cd33ea74E60
    ]; 
    
    address public burnWallet=0x60b6d0B987474460a3563767E7B915118aa0C229;
    uint    public TGE=1686625620; //june 13 

    struct Vesting { 
        address user; 
        uint8   cliff;
        uint8   delay;
        uint16  monthlyPercent;
        uint16  percentOnTge;   
        uint256 totalAmount;
        uint256 releasedAmount;
        bool    NFT;
        uint    lastWithdraw;
    }

    mapping (address=>bool)  public antiBot;
    mapping (address=>bool)  public taxFree;
    mapping (address=>uint64[])     userVestings;
    mapping (uint64 => Vesting)     vesting;
    mapping (address=>bool)  public whaleNoLimits;
    uint64[]public teamVestings=[0,1,2,3,4];
    uint64  public vestingId;
    
    bool    public antiWhale;
    uint    public maxTokenHold;

    constructor() ERC20("CyberMetaFarm", "CMF") {
        _grantRole(DEFAULT_ADMIN_ROLE,0xD024920b6Ce6aF8415f9F5d91Fe62Cd33ea74E60);
        _grantRole(DEFAULT_ADMIN_ROLE,0x0d4A7Aef4AaB9A507E227215a523817233f18E0e);
        _grantRole(DEFAULT_ADMIN_ROLE,msg.sender);
        createVesting(0,30,200, 0,teamWallets[0],400000000);
        createVesting(24,30,500,0,teamWallets[1],100000000);
        createVesting(0,30,400, 0,teamWallets[2],50000000);
        createVesting(20,30,625,0,teamWallets[3],50000000);
        createVesting(3,1,10000,0,teamWallets[4],100000000);

        createVesting(0,1,0,10000,teamWallets[6],5000000);
        claimVesting(5);

        createVesting(12,30,500,500,teamWallets[1],30660000);
        taxFree[address(this)]=true;
        setAntiWhale(true,300);
    }

//BURN____________________________________________________________________________________________________//
    function burn(address from, uint amount) public {
        if(totalBurned<(cap-minCap)){
            if(totalBurned+amount>(cap-minCap))
                amount=(cap-minCap)-totalBurned;
            _burn(from,amount);
            totalBurned+=amount;
        }
    }

//ADMIN___________________________________________________________________________________________________//
    function createVestings(
        uint8  cliff_,
        uint8  delay_,
        uint16 monthlyPercent_,
        uint16 percentOnTge_,
        address[] memory users_,
        uint64[] memory totalAmount_
    ) 
    external onlyRole(DEFAULT_ADMIN_ROLE){          
        require(users_.length==totalAmount_.length,"Array's must be equal");
        for(uint16 i;i<users_.length;i++){
            vesting[vestingId]=Vesting(
                users_[i],
                cliff_,
                delay_,
                monthlyPercent_,
                percentOnTge_,
                totalAmount_[i]*10**decimals(),
                0,
                false,
                0
            );
            userVestings[users_[i]].push(vestingId);
            vestingId++;
            require(totalVesting+totalAmount_[i]<cap,"Can't claim more");
            totalVesting+=totalAmount_[i]*10**decimals();
        }
    }

    function createVesting(
        uint8   cliff_,
        uint8   delay_,
        uint16  monthlyPercent_,
        uint16  percentOnTge_,
        address user_,
        uint64  totalAmount_
    ) 
    public onlyRole(DEFAULT_ADMIN_ROLE){              
        vesting[vestingId]=Vesting(
            user_,
            cliff_,
            delay_,
            monthlyPercent_,
            percentOnTge_,
            totalAmount_*10**decimals(),
            0,
            false,
            0
        );
        userVestings[user_].push(vestingId);
        vestingId++;
        require(totalVesting+totalAmount_<cap,"Can't claim more");
        totalVesting+=totalAmount_*10**decimals();
    }
    

    function deleteVesting(uint64 vestingId_) external onlyRole(DEFAULT_ADMIN_ROLE){
        totalVesting-=vesting[vestingId_].totalAmount-vesting[vestingId_].releasedAmount;
        delete vesting[vestingId_];
    }

    function setTGE(uint TGE_) external onlyRole(DEFAULT_ADMIN_ROLE){
        TGE=TGE_;
    } 

    function setTeamVesting(uint64[] memory teamVestings_) external onlyRole(DEFAULT_ADMIN_ROLE){
        teamVestings=teamVestings_;
    }

    function setAntiWhale(bool antiWhale_, uint64 maxTokenHold_) public onlyRole(DEFAULT_ADMIN_ROLE){
        antiWhale=antiWhale_;
        maxTokenHold=maxTokenHold_*10**decimals();
    }

    function setWhaleNoLimits(address user_, bool limited) external onlyRole(DEFAULT_ADMIN_ROLE){
        whaleNoLimits[user_]=limited;
    }

    function setBurnWallet(address burnWallet_) external onlyRole(DEFAULT_ADMIN_ROLE){
        burnWallet=burnWallet_;
    }

    function setTeamWallets(address[7] memory wallets) external onlyRole(DEFAULT_ADMIN_ROLE){
        teamWallets=wallets;
    }

    function setTaxFreeWallets(address[] memory users_, bool taxFree_) external onlyRole(DEFAULT_ADMIN_ROLE){
        for(uint16 i;i<users_.length;i++)
            taxFree[users_[i]]=taxFree_;
    }

    function setBotWallets(address[] memory users_, bool antiBot_) external onlyRole(DEFAULT_ADMIN_ROLE){
        for(uint16 i;i<users_.length;i++)
            antiBot[users_[i]]=antiBot_;
    }

    function setVestingWallet(uint64 vestingId_, address newUser_) external onlyRole(DEFAULT_ADMIN_ROLE){
        vesting[vestingId_].user=newUser_;
    }

    function receivedNft(uint64 vestingId_) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(vesting[vestingId_].totalAmount>0 && !vesting[vestingId_].NFT,"Can't claim NFT");
        vesting[vestingId_].NFT=true;
    }

//USER___________________________________________________________________________________________________//
    function claimVesting(uint64 vestingId_) public nonReentrant(){
        Vesting storage vest=vesting[vestingId_];
        require(vest.user==msg.sender || hasRole(DEFAULT_ADMIN_ROLE,msg.sender),"not the owner");
        require(msg.sender!=address(0),"Zero address");

        uint amount=getCurrentClaim(vestingId_);
        if (amount>0){
            vest.releasedAmount+=amount;
            _mint(vest.user,amount);     
            vest.lastWithdraw=block.timestamp;   
        }    
    }

    function transfer(address to, uint256 amount) public override virtual returns (bool) {
        _checkLimits(msg.sender,to,amount);
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) public override virtual returns (bool) {
        _checkLimits(from,to,amount);
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

//INTERNAL_______________________________________________________________________________________________//    
    function _checkLimits(address from,address to, uint amount) private view{
        require(!antiBot[from] && !antiBot[to],"Acc is blocked");
        uint maxHold=getMaxHold(to);
        if(maxHold>0){
            require((balanceOf(to)+amount)<=maxHold,"Your wallet has reached its maximum holding amount");
        }
    }

//VIEW___________________________________________________________________________________________________//
    function getMonthlyClaim(uint64 vestingId_) public view returns (uint claimPerMonth_) {
        Vesting storage vest=vesting[vestingId_];
        return ((vest.totalAmount/10000)*vest.monthlyPercent);
    }

    function getMaxHold(address user_) public view returns(uint maxHold) {
        if(antiWhale && !whaleNoLimits[user_])
            return maxTokenHold;
        return 0;
    } 
    
    function getCurrentClaim(uint64 vestingId_) public view returns (uint claim_){
        Vesting storage vest=vesting[vestingId_];
        uint cliff_=vest.cliff;
        uint cliffTime=TGE+(30 days*cliff_); 
        uint claimPerMonth=getMonthlyClaim(vestingId_);
        uint month;
        uint amount;
        if(vest.releasedAmount==0 && vest.totalAmount>0 && vest.percentOnTge>0){
            uint tge=(vest.totalAmount/10000)*vest.percentOnTge;
            amount+=tge;
        }
        if(block.timestamp>cliffTime){
            if(vest.lastWithdraw==0)
                month=(block.timestamp-cliffTime)/(vest.delay*1 days);
            else
                month=(block.timestamp-vest.lastWithdraw)/(vest.delay*1 days);
            amount+=claimPerMonth*month;
            if(amount>(vest.totalAmount-vest.releasedAmount))
                amount=vest.totalAmount-vest.releasedAmount;
        }
        return(amount);
    }

    function getVestingInfo(uint64 vestingId_) external view returns (
        address user_,
        uint8   cliff_,
        uint8   delay_,
        uint16  monthlyPercent_,
        uint16  percentOnTge_,
        uint    totalAmount_,
        uint    releasedAmount_,
        bool    getNFT_,
        uint    lastWithdraw_ 
    ){
        Vesting storage vest=vesting[vestingId_];
    return(
        vest.user,
        vest.cliff,
        vest.delay,
        vest.monthlyPercent,
        vest.percentOnTge,
        vest.totalAmount,
        vest.releasedAmount,
        vest.NFT,
        vest.lastWithdraw
    );
    }

    function getUsersVestings(address user_) external view returns (uint64[] memory ids){
        return userVestings[user_];
    }
}
ERC20.sol 343 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "../interfaces/draft-IERC6093.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}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * 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, IERC20Errors {
    mapping(address => uint256) public _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error ERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * 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 returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual 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 default value returned by this function, unless
     * it's 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 returns (uint8) {
        return 18;
    }

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, 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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, 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) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, 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
     * `requestedDecrease`.
     */
    function decreaseAllowance(address spender, uint256 requestedDecrease) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < requestedDecrease) {
            revert ERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
        }
        unchecked {
            _approve(owner, spender, currentAllowance - requestedDecrease);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * 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.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 amount) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, amount);
    }

    /**
     * @dev Transfers `amount` of tokens from `from` to `to`, or alternatively mints (or burns) if `from` (or `to`) is
     * the zero address. All customizations to transfers, mints, and burns should be done by overriding this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 amount) internal virtual {
        if (from == address(0)) {
            _totalSupply += amount;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < amount) {
                revert ERC20InsufficientBalance(from, fromBalance, amount);
            }
            unchecked {
                // Overflow not possible: amount <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - amount;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: amount <= totalSupply or amount <= fromBalance <= totalSupply.
                _totalSupply -= amount;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + amount is at most totalSupply, which we know fits into a uint256.
                _balances[to] += amount;
            }
        }

        emit Transfer(from, to, amount);
    }

    /**
     * @dev Creates `amount` tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 amount) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, by transferring it to address(0).
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 amount) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(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 {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < amount) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, amount);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }
}
iToken.sol 20 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.16;

interface iToken {

    function mint(address to,uint id) external;

    function safeTransferFrom(address from,address to,uint256 id,uint256 amount,bytes memory data) external;

    function transferFrom(address from,address to,uint amount) external;

    function decimals() external view returns (uint8);

    function balanceOf20(address account) external view returns (uint256);

    function balanceOf(address account, uint256 id) external view returns (uint256);

    function getNftPrice(uint32 tokenId) external view returns(uint256);
}
draft-IERC6093.sol 162 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

/**
 * @dev Standard ERC20 Errors
 * Interface of the ERC6093 custom errors for ERC20 tokens
 * as defined in https://eips.ethereum.org/EIPS/eip-6093
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the ERC6093 custom errors for ERC721 tokens
 * as defined in https://eips.ethereum.org/EIPS/eip-6093
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the ERC6093 custom errors for ERC1155 tokens
 * as defined in https://eips.ethereum.org/EIPS/eip-6093
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155InsufficientApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
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 70 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
Math.sol 345 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev 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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}
AccessControl.sol 247 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}
IAccessControl.sol 88 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}
ReentrancyGuard.sol 69 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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);
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

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

DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
TGE 0x8867596f → uint256
_balances 0x6ebcf607 → uint256
allowance 0xdd62ed3e → uint256
antiBot 0x3fa1410f → bool
antiWhale 0x4dacf3f5 → bool
balanceOf 0x70a08231 → uint256
burnWallet 0x06228749 → address
cap 0x355274ea → uint256
decimals 0x313ce567 → uint8
getCurrentClaim 0x1733e0d7 → uint256
getMaxHold 0x2f2e7a04 → uint256
getMonthlyClaim 0x316ff66a → uint256
getRoleAdmin 0x248a9ca3 → bytes32
getUsersVestings 0x37462508 → uint64[]
getVestingInfo 0xf6c38c48 → address, uint8, uint8, uint16, uint16, uint256, uint256, bool, uint256
hasRole 0x91d14854 → bool
maxTokenHold 0xc261c839 → uint256
minCap 0x3fa615b0 → uint256
name 0x06fdde03 → string
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
taxFree 0xf2b9aa11 → bool
teamVestings 0x5992fbfa → uint64
totalBurned 0xd89135cd → uint256
totalSupply 0x18160ddd → uint256
totalVesting 0x7c17357d → uint256
vestingId 0xd453bec6 → uint64
whaleNoLimits 0x3e717f0b → bool

Write Contract 23 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x9dc29fac
address from
uint256 amount
claimVesting 0x202889d6
uint64 vestingId_
createVesting 0x46b68e48
uint8 cliff_
uint8 delay_
uint16 monthlyPercent_
uint16 percentOnTge_
address user_
uint64 totalAmount_
createVestings 0x29687031
uint8 cliff_
uint8 delay_
uint16 monthlyPercent_
uint16 percentOnTge_
address[] users_
uint64[] totalAmount_
decreaseAllowance 0xa457c2d7
address spender
uint256 requestedDecrease
returns: bool
deleteVesting 0xd5c2e72b
uint64 vestingId_
grantRole 0x2f2ff15d
bytes32 role
address account
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
receivedNft 0x8991d866
uint64 vestingId_
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
setAntiWhale 0xe7f632ae
bool antiWhale_
uint64 maxTokenHold_
setBotWallets 0x9164dd35
address[] users_
bool antiBot_
setBurnWallet 0x1c4ba3ed
address burnWallet_
setTGE 0xff1a318d
uint256 TGE_
setTaxFreeWallets 0xe4dabf4e
address[] users_
bool taxFree_
setTeamVesting 0x6d526798
uint64[] teamVestings_
setTeamWallets 0x5d44f4b4
address[7] wallets
setVestingWallet 0x8bc74ab8
uint64 vestingId_
address newUser_
setWhaleNoLimits 0x2f2d0e82
address user_
bool limited
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool

Recent Transactions

No transactions found for this address