Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x7b9a45E278b5B374bb2d96C65665d4360C97BF01
Balance 0 ETH
Nonce 1
Code Size 10245 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

10245 bytes
0x60806040526004361061012a5760003560e01c806373709417116100ab57806395e3b0de1161006f57806395e3b0de146103dc578063a980960014610406578063efef39a114610430578063f46321031461044d578063f7bd4b8814610477578063f9f96b9e146104a15761012a565b806373709417146103165780637e6906de146103405780637f38902b14610386578063891407c01461039b5780638f84aa09146103c75761012a565b806341da7555116100f257806341da755514610245578063462add461461025a57806356690aaf14610298578063569f6f92146102c257806362f7a7ed146102ec5761012a565b8063231c22811461012f578063331a6bf514610164578063393b011c146101975780633a4657b4146101c15780633c34b9f01461020c575b600080fd5b34801561013b57600080fd5b506101626004803603604081101561015257600080fd5b508035906020013560ff166104cb565b005b34801561017057600080fd5b506101626004803603602081101561018757600080fd5b50356001600160a01b0316610599565b3480156101a357600080fd5b50610162600480360360208110156101ba57600080fd5b5035610671565b3480156101cd57600080fd5b506101fa600480360360408110156101e457600080fd5b506001600160a01b03813516906020013561072c565b60408051918252519081900360200190f35b34801561021857600080fd5b506101626004803603604081101561022f57600080fd5b50803590602001356001600160a01b0316610749565b34801561025157600080fd5b506101fa610847565b34801561026657600080fd5b506102846004803603602081101561027d57600080fd5b503561084d565b604080519115158252519081900360200190f35b3480156102a457600080fd5b506101fa600480360360208110156102bb57600080fd5b5035610862565b3480156102ce57600080fd5b50610162600480360360208110156102e557600080fd5b5035610874565b3480156102f857600080fd5b506101fa6004803603602081101561030f57600080fd5b503561094a565b34801561032257600080fd5b506102846004803603602081101561033957600080fd5b503561095c565b34801561034c57600080fd5b5061036a6004803603602081101561036357600080fd5b5035610971565b604080516001600160a01b039092168252519081900360200190f35b34801561039257600080fd5b5061036a61098c565b6101fa600480360360408110156103b157600080fd5b506001600160a01b03813516906020013561099b565b3480156103d357600080fd5b5061036a61135f565b3480156103e857600080fd5b50610162600480360360208110156103ff57600080fd5b503561136e565b34801561041257600080fd5b506101fa6004803603602081101561042957600080fd5b503561145e565b6101fa6004803603602081101561044657600080fd5b5035611551565b34801561045957600080fd5b506101fa6004803603602081101561047057600080fd5b503561155d565b34801561048357600080fd5b506101626004803603602081101561049a57600080fd5b5035611623565b3480156104ad57600080fd5b50610284600480360360208110156104c457600080fd5b5035611881565b60005460408051633af32abf60e01b815233600482015290516001600160a01b0390921691633af32abf91602480820192602092909190829003018186803b15801561051657600080fd5b505afa15801561052a573d6000803e3d6000fd5b505050506040513d602081101561054057600080fd5b5051610581576040805162461bcd60e51b815260206004820152601860248201526000805160206127b1833981519152604482015290519081900360640190fd5b60009182526007602052604090912060ff9091169055565b60005460408051633af32abf60e01b815233600482015290516001600160a01b0390921691633af32abf91602480820192602092909190829003018186803b1580156105e457600080fd5b505afa1580156105f8573d6000803e3d6000fd5b505050506040513d602081101561060e57600080fd5b505161064f576040805162461bcd60e51b815260206004820152601860248201526000805160206127b1833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60005460408051633af32abf60e01b815233600482015290516001600160a01b0390921691633af32abf91602480820192602092909190829003018186803b1580156106bc57600080fd5b505afa1580156106d0573d6000803e3d6000fd5b505050506040513d60208110156106e657600080fd5b5051610727576040805162461bcd60e51b815260206004820152601860248201526000805160206127b1833981519152604482015290519081900360640190fd5b600255565b600660209081526000928352604080842090915290825290205481565b6000546040805163a47d29cb60e01b81526004810185905290516001600160a01b039092169163a47d29cb91602480820192602092909190829003018186803b15801561079557600080fd5b505afa1580156107a9573d6000803e3d6000fd5b505050506040513d60208110156107bf57600080fd5b50516001600160a01b03163314610819576040805162461bcd60e51b815260206004820152601960248201527818d85b881bdb9b1e481899481cd95d08189e48185c9d1a5cdd603a1b604482015290519081900360640190fd5b60009182526004602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b60025481565b60086020526000908152604090205460ff1681565b60096020526000908152604090205481565b60005460408051633af32abf60e01b815233600482015290516001600160a01b0390921691633af32abf91602480820192602092909190829003018186803b1580156108bf57600080fd5b505afa1580156108d3573d6000803e3d6000fd5b505050506040513d60208110156108e957600080fd5b505161092a576040805162461bcd60e51b815260206004820152601860248201526000805160206127b1833981519152604482015290519081900360640190fd5b6000908152600560205260409020805460ff19811660ff90911615179055565b60076020526000908152604090205481565b60036020526000908152604090205460ff1681565b6004602052600090815260409020546001600160a01b031681565b6000546001600160a01b031681565b60008181526008602052604081205460ff16156109e95760405162461bcd60e51b815260040180806020018281038252602581526020018061278c6025913960400191505060405180910390fd5b604080516208aa8960eb1b602080830191909152825180830360030181526023830180855281519190920120600080546320927ec960e01b90935260278401879052935190936001600160a01b03909216926320927ec9926047808301939192829003018186803b158015610a5d57600080fd5b505afa158015610a71573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610a9a57600080fd5b8101908080516040519392919084600160201b821115610ab957600080fd5b908301906020820185811115610ace57600080fd5b8251600160201b811182820188101715610ae757600080fd5b82525081516020918201929091019080838360005b83811015610b14578181015183820152602001610afc565b50505050905090810190601f168015610b415780820380516001836020036101000a031916815260200191505b506040525050506040516020018082805190602001908083835b60208310610b7a5780518252601f199092019160209182019101610b5b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012014610f5b573415610bf75760405162461bcd60e51b815260040180806020018281038252603f81526020018061274d603f913960400191505060405180910390fd5b60005460408051633dc303c160e21b81526004810185905290516001600160a01b039092169163f70c0f0491602480820192602092909190829003018186803b158015610c4357600080fd5b505afa158015610c57573d6000803e3d6000fd5b505050506040513d6020811015610c6d57600080fd5b50516000546040805163498dd0c160e01b81526004810186905290516001600160a01b039092169163498dd0c191602480820192602092909190829003018186803b158015610cbb57600080fd5b505afa158015610ccf573d6000803e3d6000fd5b505050506040513d6020811015610ce557600080fd5b505160408051636eb1769f60e11b815233600482015230602482015290516001600160a01b039092169163dd62ed3e91604480820192602092909190829003018186803b158015610d3557600080fd5b505afa158015610d49573d6000803e3d6000fd5b505050506040513d6020811015610d5f57600080fd5b50511015610d9e5760405162461bcd60e51b815260040180806020018281038252602281526020018061270a6022913960400191505060405180910390fd5b60005460408051633dc303c160e21b81526004810185905290516001600160a01b039092169163f70c0f0491602480820192602092909190829003018186803b158015610dea57600080fd5b505afa158015610dfe573d6000803e3d6000fd5b505050506040513d6020811015610e1457600080fd5b50516000546040805163498dd0c160e01b81526004810186905290516001600160a01b039092169163498dd0c191602480820192602092909190829003018186803b158015610e6257600080fd5b505afa158015610e76573d6000803e3d6000fd5b505050506040513d6020811015610e8c57600080fd5b5051604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610ed657600080fd5b505afa158015610eea573d6000803e3d6000fd5b505050506040513d6020811015610f0057600080fd5b50511015610f4d576040805162461bcd60e51b815260206004820152601560248201527424b739bab33334b1b4b2b73a103130b630b731b29760591b604482015290519081900360640190fd5b610f5682611896565b611030565b60005460408051633dc303c160e21b81526004810185905290516001600160a01b039092169163f70c0f0491602480820192602092909190829003018186803b158015610fa757600080fd5b505afa158015610fbb573d6000803e3d6000fd5b505050506040513d6020811015610fd157600080fd5b5051341015611027576040805162461bcd60e51b815260206004820181905260248201527f4d7573742073656e64206d696e696d756d2076616c756520746f206d696e7421604482015290519081900360640190fd5b6110308261207d565b60008281526005602052604090205460ff161561108e5733321461108e576040805162461bcd60e51b815260206004820152601060248201526f4e6f20436f6e7472616374204275797360801b604482015290519081900360640190fd5b6000828152600760205260409020541561113457600082815260076020908152604080832054338452600683528184208685529092529091205410611112576040805162461bcd60e51b815260206004820152601560248201527414995858da1959081b5a5b9d1a5b99c81b1a5b5a5d605a1b604482015290519081900360640190fd5b3360009081526006602090815260408083208584529091529020805460010190555b6000805460408051630d4d151360e01b81526001600160a01b0387811660048301526024820187905233604483015291519190921691630d4d151391606480830192602092919082900301818787803b15801561119057600080fd5b505af11580156111a4573d6000803e3d6000fd5b505050506040513d60208110156111ba57600080fd5b505160008481526009602052604090205490915060001901620f4240820614156111f8576000838152600860205260409020805460ff191660011790555b60008381526003602052604090205460ff1615611356576000838152600460208181526040928390205483516305e667fd60e21b815293516001600160a01b03909116936317999ff493818101939291829003018186803b15801561125c57600080fd5b505afa158015611270573d6000803e3d6000fd5b505050506040513d602081101561128657600080fd5b50516112d0576040805162461bcd60e51b8152602060048201526014602482015273626f6e7573206d7573742062652061637469766560601b604482015290519081900360640190fd5b600083815260046020818152604080842054815163f473237d60e01b8152339481019490945290516001600160a01b039091169363f473237d936024808201949392918390030190829087803b15801561132957600080fd5b505af115801561133d573d6000803e3d6000fd5b505050506040513d602081101561135357600080fd5b50505b90505b92915050565b6001546001600160a01b031681565b6000546040805163a47d29cb60e01b81526004810184905290516001600160a01b039092169163a47d29cb91602480820192602092909190829003018186803b1580156113ba57600080fd5b505afa1580156113ce573d6000803e3d6000fd5b505050506040513d60208110156113e457600080fd5b50516001600160a01b0316331461143e576040805162461bcd60e51b815260206004820152601960248201527818d85b881bdb9b1e481899481cd95d08189e48185c9d1a5cdd603a1b604482015290519081900360640190fd5b6000908152600360205260409020805460ff19811660ff90911615179055565b600080546040805163498dd0c160e01b815260048101859052905183926001600160a01b03169163498dd0c1916024808301926020929190829003018186803b1580156114aa57600080fd5b505afa1580156114be573d6000803e3d6000fd5b505050506040513d60208110156114d457600080fd5b5051604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561151e57600080fd5b505afa158015611532573d6000803e3d6000fd5b505050506040513d602081101561154857600080fd5b50519392505050565b6000611359338361099b565b600080546040805163498dd0c160e01b815260048101859052905183926001600160a01b03169163498dd0c1916024808301926020929190829003018186803b1580156115a957600080fd5b505afa1580156115bd573d6000803e3d6000fd5b505050506040513d60208110156115d357600080fd5b505160408051636eb1769f60e11b815233600482015230602482015290516001600160a01b039092169163dd62ed3e91604480820192602092909190829003018186803b15801561151e57600080fd5b60005460408051633af32abf60e01b815233600482015290516001600160a01b0390921691633af32abf91602480820192602092909190829003018186803b15801561166e57600080fd5b505afa158015611682573d6000803e3d6000fd5b505050506040513d602081101561169857600080fd5b50516116d9576040805162461bcd60e51b815260206004820152601860248201526000805160206127b1833981519152604482015290519081900360640190fd5b60008054604080516346161b1160e11b815260048101859052905183926001600160a01b031691638c2c36229160248083019286929190829003018186803b15801561172457600080fd5b505afa158015611738573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261012081101561176257600080fd5b815160208301516040808501516060860151608087015160a088015160c089015160e08a0180519651989a979995989497939692959194939182019284600160201b8211156117b057600080fd5b9083019060208201858111156117c557600080fd5b8251600160201b8111828201881017156117de57600080fd5b82525081516020918201929091019080838360005b8381101561180b5781810151838201526020016117f3565b50505050905090810190601f1680156118385780820380516001836020036101000a031916815260200191505b50604090815260008f815260096020522088905550959a5095985050505086861015945061187c9350505050576000838152600860205260409020805460ff191690555b505050565b60056020526000908152604090205460ff1681565b6000805460408051633dc303c160e21b81526004810185905290516001600160a01b039092169163f70c0f0491602480820192602092909190829003018186803b1580156118e357600080fd5b505afa1580156118f7573d6000803e3d6000fd5b505050506040513d602081101561190d57600080fd5b50516000805460408051632e9eb74f60e01b8152905193945091926119a6926001600160a01b0390921691632e9eb74f916004808301926020929190829003018186803b15801561195d57600080fd5b505afa158015611971573d6000803e3d6000fd5b505050506040513d602081101561198757600080fd5b505161199a84606463ffffffff6125e916565b9063ffffffff61265316565b90508015611b26576000546040805163498dd0c160e01b81526004810186905290516001600160a01b039092169163498dd0c191602480820192602092909190829003018186803b1580156119fa57600080fd5b505afa158015611a0e573d6000803e3d6000fd5b505050506040513d6020811015611a2457600080fd5b50516000546040805163cfbf4d9760e01b815290516001600160a01b03938416936323b872dd93339391169163cfbf4d9791600480820192602092909190829003018186803b158015611a7657600080fd5b505afa158015611a8a573d6000803e3d6000fd5b505050506040513d6020811015611aa057600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152929091166024830152604482018590525160648083019260209291908290030181600087803b158015611af957600080fd5b505af1158015611b0d573d6000803e3d6000fd5b505050506040513d6020811015611b2357600080fd5b50505b6000611b38838363ffffffff6126ac16565b90506000611b5660025461199a6064856125e990919063ffffffff16565b90508015611c5f576000546040805163498dd0c160e01b81526004810188905290516001600160a01b039092169163498dd0c191602480820192602092909190829003018186803b158015611baa57600080fd5b505afa158015611bbe573d6000803e3d6000fd5b505050506040513d6020811015611bd457600080fd5b5051600154604080516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101859052905191909216916323b872dd9160648083019260209291908290030181600087803b158015611c3257600080fd5b505af1158015611c46573d6000803e3d6000fd5b505050506040513d6020811015611c5c57600080fd5b50505b6000611c8182611c75878763ffffffff6126ac16565b9063ffffffff6126ac16565b600080546040805163cc74234b60e01b8152600481018b90529051939450919283926001600160a01b039092169163cc74234b916024808301926020929190829003018186803b158015611cd457600080fd5b505afa158015611ce8573d6000803e3d6000fd5b505050506040513d6020811015611cfe57600080fd5b50511115611eda576000546040805163cc74234b60e01b8152600481018a90529051611d53926001600160a01b03169163cc74234b916024808301926020929190829003018186803b15801561195d57600080fd5b90508015611eda576000546040805163498dd0c160e01b8152600481018a905290516001600160a01b039092169163498dd0c191602480820192602092909190829003018186803b158015611da757600080fd5b505afa158015611dbb573d6000803e3d6000fd5b505050506040513d6020811015611dd157600080fd5b505160005460408051636bd8225b60e11b8152600481018b905290516001600160a01b03938416936323b872dd93339391169163d7b044b691602480820192602092909190829003018186803b158015611e2a57600080fd5b505afa158015611e3e573d6000803e3d6000fd5b505050506040513d6020811015611e5457600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152929091166024830152604482018590525160648083019260209291908290030181600087803b158015611ead57600080fd5b505af1158015611ec1573d6000803e3d6000fd5b505050506040513d6020811015611ed757600080fd5b50505b6000611eec838363ffffffff6126ac16565b90508015612073576000546040805163498dd0c160e01b8152600481018b905290516001600160a01b039092169163498dd0c191602480820192602092909190829003018186803b158015611f4057600080fd5b505afa158015611f54573d6000803e3d6000fd5b505050506040513d6020811015611f6a57600080fd5b50516000546040805163a47d29cb60e01b8152600481018c905290516001600160a01b03938416936323b872dd93339391169163a47d29cb91602480820192602092909190829003018186803b158015611fc357600080fd5b505afa158015611fd7573d6000803e3d6000fd5b505050506040513d6020811015611fed57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152929091166024830152604482018590525160648083019260209291908290030181600087803b15801561204657600080fd5b505af115801561205a573d6000803e3d6000fd5b505050506040513d602081101561207057600080fd5b50505b5050505050505050565b34156125e6576000805460408051633dc303c160e21b81526004810185905290516001600160a01b039092169163f70c0f0491602480820192602092909190829003018186803b1580156120d057600080fd5b505afa1580156120e4573d6000803e3d6000fd5b505050506040513d60208110156120fa57600080fd5b50516000805460408051633dc303c160e21b8152600481018790529051939450919261218a926001600160a01b039092169163f70c0f04916024808301926020929190829003018186803b15801561215157600080fd5b505afa158015612165573d6000803e3d6000fd5b505050506040513d602081101561217b57600080fd5b5051349063ffffffff6126ac16565b905080156121c157604051339082156108fc029083906000818181858888f193505050501580156121bf573d6000803e3d6000fd5b505b6000805460408051632e9eb74f60e01b81529051612245926001600160a01b031691632e9eb74f916004808301926020929190829003018186803b15801561220857600080fd5b505afa15801561221c573d6000803e3d6000fd5b505050506040513d602081101561223257600080fd5b505161199a85606463ffffffff6125e916565b905080156122ff576000809054906101000a90046001600160a01b03166001600160a01b031663cfbf4d976040518163ffffffff1660e01b815260040160206040518083038186803b15801561229a57600080fd5b505afa1580156122ae573d6000803e3d6000fd5b505050506040513d60208110156122c457600080fd5b50516040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156122fd573d6000803e3d6000fd5b505b6000612311848363ffffffff6126ac16565b9050600061232f60025461199a6064856125e990919063ffffffff16565b90508015612373576001546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015612371573d6000803e3d6000fd5b505b600061238982611c75888763ffffffff6126ac16565b600080546040805163cc74234b60e01b8152600481018c90529051939450919283926001600160a01b039092169163cc74234b916024808301926020929190829003018186803b1580156123dc57600080fd5b505afa1580156123f0573d6000803e3d6000fd5b505050506040513d602081101561240657600080fd5b50511115612514576000546040805163cc74234b60e01b8152600481018b9052905161245b926001600160a01b03169163cc74234b916024808301926020929190829003018186803b15801561195d57600080fd5b905080156125145760005460408051636bd8225b60e11b8152600481018b905290516001600160a01b039092169163d7b044b691602480820192602092909190829003018186803b1580156124af57600080fd5b505afa1580156124c3573d6000803e3d6000fd5b505050506040513d60208110156124d957600080fd5b50516040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015612512573d6000803e3d6000fd5b505b6000612526838363ffffffff6126ac16565b905080156125dd576000546040805163a47d29cb60e01b8152600481018c905290516001600160a01b039092169163a47d29cb91602480820192602092909190829003018186803b15801561257a57600080fd5b505afa15801561258e573d6000803e3d6000fd5b505050506040513d60208110156125a457600080fd5b50516040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015612070573d6000803e3d6000fd5b50505050505050505b50565b600080821161263f576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161264a57fe5b04949350505050565b60008261266257506000611359565b8282028284828161266f57fe5b04146113565760405162461bcd60e51b815260040180806020018281038252602181526020018061272c6021913960400191505060405180910390fd5b600082821115612703576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe496e73756666696369656e742046756e647320417070726f76656420666f72205458536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77746869732070726f6a6563742061636365707473206120646966666572656e742063757272656e637920616e642063616e6e6f7420616363657074204554484d6178696d756d206e756d626572206f6620696e766f636174696f6e73207265616368656463616e206f6e6c79206265207365742062792061646d696e0000000000000000a265627a7a7231582016666e73c295793851671a336e33a16324e95611e8a7afdb3a293da763d4b4ab64736f6c63430005110032

Verified Source Code Full Match

Compiler: v0.5.17+commit.d19bba13 EVM: istanbul Optimization: Yes (100 runs)
Strings.sol 95 lines
// SPDX-License-Identifier: MIT
// File: contracts/Strings.sol
// Source: https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol

// **Please Note**: This library is not necessary for ^0.8.0 contracts and thus
//                  only exists for posterity reasons for compatibility with
//                  existing already-deployed ^0.5.0 PBAB contracts.

pragma solidity ^0.5.0;

library Strings {
    function strConcat(string memory _a, string memory _b)
        internal
        pure
        returns (string memory _concatenatedString)
    {
        return strConcat(_a, _b, "", "", "");
    }

    function strConcat(
        string memory _a,
        string memory _b,
        string memory _c
    ) internal pure returns (string memory _concatenatedString) {
        return strConcat(_a, _b, _c, "", "");
    }

    function strConcat(
        string memory _a,
        string memory _b,
        string memory _c,
        string memory _d
    ) internal pure returns (string memory _concatenatedString) {
        return strConcat(_a, _b, _c, _d, "");
    }

    function strConcat(
        string memory _a,
        string memory _b,
        string memory _c,
        string memory _d,
        string memory _e
    ) internal pure returns (string memory _concatenatedString) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(
            _ba.length + _bb.length + _bc.length + _bd.length + _be.length
        );
        bytes memory babcde = bytes(abcde);
        uint256 k = 0;
        uint256 i = 0;
        for (i = 0; i < _ba.length; i++) {
            babcde[k++] = _ba[i];
        }
        for (i = 0; i < _bb.length; i++) {
            babcde[k++] = _bb[i];
        }
        for (i = 0; i < _bc.length; i++) {
            babcde[k++] = _bc[i];
        }
        for (i = 0; i < _bd.length; i++) {
            babcde[k++] = _bd[i];
        }
        for (i = 0; i < _be.length; i++) {
            babcde[k++] = _be[i];
        }
        return string(babcde);
    }

    function uint2str(uint256 _i)
        internal
        pure
        returns (string memory _uintAsString)
    {
        if (_i == 0) {
            return "0";
        }
        uint256 j = _i;
        uint256 len;
        while (j != 0) {
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint256 k = len - 1;
        while (_i != 0) {
            bstr[k--] = bytes1(uint8(48 + (_i % 10)));
            _i /= 10;
        }
        return string(bstr);
    }
}
SafeMath.sol 98 lines
// SPDX-License-Identifier: MIT
// File: openzeppelin-solidity/contracts/math/SafeMath.sol

// **Please Note**: This library is not necessary for ^0.8.0 contracts and thus
//                  only exists for posterity reasons for compatibility with
//                  existing already-deployed ^0.5.0 PBAB contracts.

pragma solidity ^0.5.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, "SafeMath: division by zero");
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }
}
IGenArt721CoreV2_PBAB.sol 95 lines
// SPDX-License-Identifier: LGPL-3.0-only
// Creatd By: Art Blocks Inc.

pragma solidity ^0.5.0;

interface IGenArt721CoreV2_PBAB {
    /**
     * @notice Token ID `_tokenId` minted on project ID `_projectId` to `_to`.
     * @dev NatSpec for events not supported in Solidity ^0.5.0
     */
    event Mint(
        address indexed _to,
        uint256 indexed _tokenId,
        uint256 indexed _projectId
    );

    // getter function of public variable
    function admin() external view returns (address);

    // getter function of public variable
    function nextProjectId() external view returns (uint256);

    // getter function of public mapping
    function tokenIdToProjectId(uint256 tokenId)
        external
        view
        returns (uint256 projectId);

    function isWhitelisted(address sender) external view returns (bool);

    function projectIdToCurrencySymbol(uint256 _projectId)
        external
        view
        returns (string memory);

    function projectIdToCurrencyAddress(uint256 _projectId)
        external
        view
        returns (address);

    function projectIdToArtistAddress(uint256 _projectId)
        external
        view
        returns (address payable);

    function projectIdToPricePerTokenInWei(uint256 _projectId)
        external
        view
        returns (uint256);

    function projectIdToAdditionalPayee(uint256 _projectId)
        external
        view
        returns (address payable);

    function projectIdToAdditionalPayeePercentage(uint256 _projectId)
        external
        view
        returns (uint256);

    function projectTokenInfo(uint256 _projectId)
        external
        view
        returns (
            address,
            uint256,
            uint256,
            uint256,
            bool,
            address,
            uint256,
            string memory,
            address
        );

    function renderProviderAddress() external view returns (address payable);

    function renderProviderPercentage() external view returns (uint256);

    function mint(
        address _to,
        uint256 _projectId,
        address _by
    ) external returns (uint256 tokenId);

    function getRoyaltyData(uint256 _tokenId)
        external
        view
        returns (
            address artistAddress,
            address additionalPayee,
            uint256 additionalPayeePercentage,
            uint256 royaltyFeeByID
        );
}
GenArt721Minter_BrightMoments.sol 353 lines
// SPDX-License-Identifier: LGPL-3.0-only
// Creatd By: Art Blocks Inc.

pragma solidity ^0.5.0;

import "../../libs/0.5.x/SafeMath.sol";
import "../../libs/0.5.x/Strings.sol";

import "../../interfaces/0.5.x/IGenArt721CoreV2_PBAB.sol";

interface ERC20 {
    function balanceOf(address _owner) external view returns (uint256 balance);

    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) external returns (bool success);

    function allowance(address _owner, address _spender)
        external
        view
        returns (uint256 remaining);
}

interface BonusContract {
    function triggerBonus(address _to) external returns (bool);

    function bonusIsActive() external view returns (bool);
}

contract GenArt721Minter_BrightMoments {
    using SafeMath for uint256;

    IGenArt721CoreV2_PBAB public genArtCoreContract;

    uint256 constant ONE_MILLION = 1_000_000;

    address payable public ownerAddress;
    uint256 public ownerPercentage;

    mapping(uint256 => bool) public projectIdToBonus;
    mapping(uint256 => address) public projectIdToBonusContractAddress;
    mapping(uint256 => bool) public contractFilterProject;
    mapping(address => mapping(uint256 => uint256)) public projectMintCounter;
    mapping(uint256 => uint256) public projectMintLimit;
    mapping(uint256 => bool) public projectMaxHasBeenInvoked;
    mapping(uint256 => uint256) public projectMaxInvocations;

    constructor(address _genArt721Address) public {
        genArtCoreContract = IGenArt721CoreV2_PBAB(_genArt721Address);
    }

    function getYourBalanceOfProjectERC20(uint256 _projectId)
        public
        view
        returns (uint256)
    {
        uint256 balance = ERC20(
            genArtCoreContract.projectIdToCurrencyAddress(_projectId)
        ).balanceOf(msg.sender);
        return balance;
    }

    function checkYourAllowanceOfProjectERC20(uint256 _projectId)
        public
        view
        returns (uint256)
    {
        uint256 remaining = ERC20(
            genArtCoreContract.projectIdToCurrencyAddress(_projectId)
        ).allowance(msg.sender, address(this));
        return remaining;
    }

    function setProjectMintLimit(uint256 _projectId, uint8 _limit) public {
        require(
            genArtCoreContract.isWhitelisted(msg.sender),
            "can only be set by admin"
        );
        projectMintLimit[_projectId] = _limit;
    }

    function setProjectMaxInvocations(uint256 _projectId) public {
        require(
            genArtCoreContract.isWhitelisted(msg.sender),
            "can only be set by admin"
        );
        uint256 maxInvocations;
        uint256 invocations;
        (, , invocations, maxInvocations, , , , , ) = genArtCoreContract
            .projectTokenInfo(_projectId);
        projectMaxInvocations[_projectId] = maxInvocations;
        if (invocations < maxInvocations) {
            projectMaxHasBeenInvoked[_projectId] = false;
        }
    }

    function setOwnerAddress(address payable _ownerAddress) public {
        require(
            genArtCoreContract.isWhitelisted(msg.sender),
            "can only be set by admin"
        );
        ownerAddress = _ownerAddress;
    }

    function setOwnerPercentage(uint256 _ownerPercentage) public {
        require(
            genArtCoreContract.isWhitelisted(msg.sender),
            "can only be set by admin"
        );
        ownerPercentage = _ownerPercentage;
    }

    function toggleContractFilter(uint256 _projectId) public {
        require(
            genArtCoreContract.isWhitelisted(msg.sender),
            "can only be set by admin"
        );
        contractFilterProject[_projectId] = !contractFilterProject[_projectId];
    }

    function artistToggleBonus(uint256 _projectId) public {
        require(
            msg.sender ==
                genArtCoreContract.projectIdToArtistAddress(_projectId),
            "can only be set by artist"
        );
        projectIdToBonus[_projectId] = !projectIdToBonus[_projectId];
    }

    function artistSetBonusContractAddress(
        uint256 _projectId,
        address _bonusContractAddress
    ) public {
        require(
            msg.sender ==
                genArtCoreContract.projectIdToArtistAddress(_projectId),
            "can only be set by artist"
        );
        projectIdToBonusContractAddress[_projectId] = _bonusContractAddress;
    }

    function purchase(uint256 _projectId)
        public
        payable
        returns (uint256 _tokenId)
    {
        return purchaseTo(msg.sender, _projectId);
    }

    // Remove `public`` and `payable`` to prevent public use
    // of the `purchaseTo`` function.
    function purchaseTo(address _to, uint256 _projectId)
        public
        payable
        returns (uint256 _tokenId)
    {
        require(
            !projectMaxHasBeenInvoked[_projectId],
            "Maximum number of invocations reached"
        );
        if (
            keccak256(
                abi.encodePacked(
                    genArtCoreContract.projectIdToCurrencySymbol(_projectId)
                )
            ) != keccak256(abi.encodePacked("ETH"))
        ) {
            require(
                msg.value == 0,
                "this project accepts a different currency and cannot accept ETH"
            );
            require(
                ERC20(genArtCoreContract.projectIdToCurrencyAddress(_projectId))
                    .allowance(msg.sender, address(this)) >=
                    genArtCoreContract.projectIdToPricePerTokenInWei(
                        _projectId
                    ),
                "Insufficient Funds Approved for TX"
            );
            require(
                ERC20(genArtCoreContract.projectIdToCurrencyAddress(_projectId))
                    .balanceOf(msg.sender) >=
                    genArtCoreContract.projectIdToPricePerTokenInWei(
                        _projectId
                    ),
                "Insufficient balance."
            );
            _splitFundsERC20(_projectId);
        } else {
            require(
                msg.value >=
                    genArtCoreContract.projectIdToPricePerTokenInWei(
                        _projectId
                    ),
                "Must send minimum value to mint!"
            );
            _splitFundsETH(_projectId);
        }

        // if contract filter is active prevent calls from another contract
        if (contractFilterProject[_projectId])
            require(msg.sender == tx.origin, "No Contract Buys");

        // limit mints per address by project
        if (projectMintLimit[_projectId] > 0) {
            require(
                projectMintCounter[msg.sender][_projectId] <
                    projectMintLimit[_projectId],
                "Reached minting limit"
            );
            projectMintCounter[msg.sender][_projectId]++;
        }

        uint256 tokenId = genArtCoreContract.mint(_to, _projectId, msg.sender);

        // What if this overflows, since default value of uint256 is 0?
        // That is intended, so that by default the minter allows infinite
        // transactions, allowing the `genArtCoreContract` to stop minting
        // `uint256 tokenInvocation = tokenId % ONE_MILLION;`
        if (tokenId % ONE_MILLION == projectMaxInvocations[_projectId] - 1) {
            projectMaxHasBeenInvoked[_projectId] = true;
        }

        if (projectIdToBonus[_projectId]) {
            require(
                BonusContract(projectIdToBonusContractAddress[_projectId])
                    .bonusIsActive(),
                "bonus must be active"
            );
            BonusContract(projectIdToBonusContractAddress[_projectId])
                .triggerBonus(msg.sender);
        }

        return tokenId;
    }

    function _splitFundsETH(uint256 _projectId) internal {
        if (msg.value > 0) {
            uint256 pricePerTokenInWei = genArtCoreContract
                .projectIdToPricePerTokenInWei(_projectId);
            uint256 refund = msg.value.sub(
                genArtCoreContract.projectIdToPricePerTokenInWei(_projectId)
            );
            if (refund > 0) {
                msg.sender.transfer(refund);
            }
            uint256 renderProviderAmount = pricePerTokenInWei.div(100).mul(
                genArtCoreContract.renderProviderPercentage()
            );
            if (renderProviderAmount > 0) {
                genArtCoreContract.renderProviderAddress().transfer(
                    renderProviderAmount
                );
            }

            uint256 remainingFunds = pricePerTokenInWei.sub(
                renderProviderAmount
            );

            uint256 ownerFunds = remainingFunds.div(100).mul(ownerPercentage);
            if (ownerFunds > 0) {
                ownerAddress.transfer(ownerFunds);
            }

            uint256 projectFunds = pricePerTokenInWei
                .sub(renderProviderAmount)
                .sub(ownerFunds);
            uint256 additionalPayeeAmount;
            if (
                genArtCoreContract.projectIdToAdditionalPayeePercentage(
                    _projectId
                ) > 0
            ) {
                additionalPayeeAmount = projectFunds.div(100).mul(
                    genArtCoreContract.projectIdToAdditionalPayeePercentage(
                        _projectId
                    )
                );
                if (additionalPayeeAmount > 0) {
                    genArtCoreContract
                        .projectIdToAdditionalPayee(_projectId)
                        .transfer(additionalPayeeAmount);
                }
            }
            uint256 creatorFunds = projectFunds.sub(additionalPayeeAmount);
            if (creatorFunds > 0) {
                genArtCoreContract
                    .projectIdToArtistAddress(_projectId)
                    .transfer(creatorFunds);
            }
        }
    }

    function _splitFundsERC20(uint256 _projectId) internal {
        uint256 pricePerTokenInWei = genArtCoreContract
            .projectIdToPricePerTokenInWei(_projectId);
        uint256 renderProviderAmount = pricePerTokenInWei.div(100).mul(
            genArtCoreContract.renderProviderPercentage()
        );
        if (renderProviderAmount > 0) {
            ERC20(genArtCoreContract.projectIdToCurrencyAddress(_projectId))
                .transferFrom(
                    msg.sender,
                    genArtCoreContract.renderProviderAddress(),
                    renderProviderAmount
                );
        }
        uint256 remainingFunds = pricePerTokenInWei.sub(renderProviderAmount);

        uint256 ownerFunds = remainingFunds.div(100).mul(ownerPercentage);
        if (ownerFunds > 0) {
            ERC20(genArtCoreContract.projectIdToCurrencyAddress(_projectId))
                .transferFrom(msg.sender, ownerAddress, ownerFunds);
        }

        uint256 projectFunds = pricePerTokenInWei.sub(renderProviderAmount).sub(
            ownerFunds
        );
        uint256 additionalPayeeAmount;
        if (
            genArtCoreContract.projectIdToAdditionalPayeePercentage(
                _projectId
            ) > 0
        ) {
            additionalPayeeAmount = projectFunds.div(100).mul(
                genArtCoreContract.projectIdToAdditionalPayeePercentage(
                    _projectId
                )
            );
            if (additionalPayeeAmount > 0) {
                ERC20(genArtCoreContract.projectIdToCurrencyAddress(_projectId))
                    .transferFrom(
                        msg.sender,
                        genArtCoreContract.projectIdToAdditionalPayee(
                            _projectId
                        ),
                        additionalPayeeAmount
                    );
            }
        }
        uint256 creatorFunds = projectFunds.sub(additionalPayeeAmount);
        if (creatorFunds > 0) {
            ERC20(genArtCoreContract.projectIdToCurrencyAddress(_projectId))
                .transferFrom(
                    msg.sender,
                    genArtCoreContract.projectIdToArtistAddress(_projectId),
                    creatorFunds
                );
        }
    }
}

Read Contract

checkYourAllowanceOfProjectERC20 0xf4632103 → uint256
contractFilterProject 0xf9f96b9e → bool
genArtCoreContract 0x7f38902b → address
getYourBalanceOfProjectERC20 0xa9809600 → uint256
ownerAddress 0x8f84aa09 → address
ownerPercentage 0x41da7555 → uint256
projectIdToBonus 0x73709417 → bool
projectIdToBonusContractAddress 0x7e6906de → address
projectMaxHasBeenInvoked 0x462add46 → bool
projectMaxInvocations 0x56690aaf → uint256
projectMintCounter 0x3a4657b4 → uint256
projectMintLimit 0x62f7a7ed → uint256

Write Contract 9 functions

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

artistSetBonusContractAddress 0x3c34b9f0
uint256 _projectId
address _bonusContractAddress
artistToggleBonus 0x95e3b0de
uint256 _projectId
purchase 0xefef39a1
uint256 _projectId
returns: uint256
purchaseTo 0x891407c0
address _to
uint256 _projectId
returns: uint256
setOwnerAddress 0x331a6bf5
address _ownerAddress
setOwnerPercentage 0x393b011c
uint256 _ownerPercentage
setProjectMaxInvocations 0xf7bd4b88
uint256 _projectId
setProjectMintLimit 0x231c2281
uint256 _projectId
uint8 _limit
toggleContractFilter 0x569f6f92
uint256 _projectId

Recent Transactions

No transactions found for this address