Address Contract Partially Verified
Address
0xCfFCFDAda28ab44D5440301470dCD410E75C4765
Balance
0 ETH
Nonce
1
Code Size
9925 bytes
Creator
0x794c0727...84DE at tx 0xf9705b1c...e18e5a
Indexed Transactions
0
Contract Bytecode
9925 bytes
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636fcfff45116100f9578063b4b5ea5711610097578063dd62ed3e11610071578063dd62ed3e1461035b578063e7a324dc1461036e578063f1127ed814610376578063fca3b5aa14610397576101a9565b8063b4b5ea5714610322578063c3cda52014610335578063d505accf14610348576101a9565b8063782d6fe1116100d3578063782d6fe1146102d45780637ecebe00146102f457806395d89b4114610307578063a9059cbb1461030f576101a9565b80636fcfff45146102a657806370a08231146102b957806376c71ca1146102cc576101a9565b806330adf81f1161016657806340c10f191161014057806340c10f1914610256578063587cde1e1461026b5780635c11d62f1461027e5780635c19a95c14610293576101a9565b806330adf81f1461023157806330b36cef14610239578063313ce56714610241576101a9565b806306fdde03146101ae57806307546172146101cc578063095ea7b3146101e157806318160ddd1461020157806320606b701461021657806323b872dd1461021e575b600080fd5b6101b66103aa565b6040516101c39190612324565b60405180910390f35b6101d46103cc565b6040516101c391906121f7565b6101f46101ef366004611abf565b6103db565b6040516101c39190612220565b6102096104b7565b6040516101c3919061222e565b6102096104bd565b6101f461022c3660046119d6565b6104d4565b610209610637565b610209610643565b610249610649565b6040516101c3919061245e565b610269610264366004611abf565b61064e565b005b6101d4610279366004611976565b61089f565b6102866108ba565b6040516101c39190612435565b6102696102a1366004611976565b6108c2565b6102866102b4366004611976565b6108cf565b6102096102c7366004611976565b6108e7565b61024961090b565b6102e76102e2366004611abf565b610910565b6040516101c3919061247a565b610209610302366004611976565b610b1e565b6101b6610b30565b6101f461031d366004611abf565b610b4f565b6102e7610330366004611976565b610ba8565b610269610343366004611aef565b610c18565b610269610356366004611a23565b610e00565b61020961036936600461199c565b611107565b61020961113b565b610389610384366004611b76565b611147565b6040516101c3929190612443565b6102696103a5366004611976565b61117c565b6040518060400160405280600681526020016550617269666960d01b81525081565b6001546001600160a01b031681565b6000806000198314156103f15750600019610433565b610430836040518060400160405280601f81526020017f617070726f76653a20616d6f756e74206578636565647320393620626974730081525061120f565b90505b3360008181526003602090815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104a390859061246c565b60405180910390a360019150505b92915050565b60005481565b6040516104c9906121e1565b604051809103902081565b6001600160a01b038316600090815260036020908152604080832033808552908352818420548251808401909352601f83527f617070726f76653a20616d6f756e74206578636565647320393620626974730093830193909352916001600160601b031690839061054690869061120f565b9050866001600160a01b0316836001600160a01b03161415801561057357506001600160601b0382811614155b1561061d57600061059d838360405180606001604052806037815260200161258a6037913961123e565b6001600160a01b038981166000818152600360209081526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061061390859061246c565b60405180910390a3505b61062887878361127d565b600193505050505b9392505050565b6040516104c9906121d6565b60025481565b601281565b6001546001600160a01b031633146106815760405162461bcd60e51b815260040161067890612355565b60405180910390fd5b6002544210156106a35760405162461bcd60e51b8152600401610678906123f5565b6001600160a01b0382166106c95760405162461bcd60e51b815260040161067890612405565b6106d7426301e13380611423565b600281905550600061071e826040518060400160405280601c81526020017f6d696e743a20616d6f756e74206578636565647320393620626974730000000081525061120f565b905061073a610733600054600160ff16611448565b6064611482565b816001600160601b031611156107625760405162461bcd60e51b815260040161067890612425565b61079861077a600054836001600160601b0316611423565b6040518060600160405280602181526020016125c16021913961120f565b6001600160601b0390811660009081556001600160a01b038516815260046020908152604091829020548251808401909352601f83527f6d696e743a207472616e7366657220616d6f756e74206f766572666c6f7773009183019190915261080392169083906114c4565b6001600160a01b03841660008181526004602052604080822080546001600160601b0319166001600160601b03959095169490941790935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061086d90859061246c565b60405180910390a36001600160a01b0380841660009081526005602052604081205461089a921683611500565b505050565b6005602052600090815260409020546001600160a01b031681565b6301e1338081565b6108cc3382611692565b50565b60076020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600460205260409020546001600160601b031690565b600181565b60004382106109315760405162461bcd60e51b815260040161067890612335565b6001600160a01b03831660009081526007602052604090205463ffffffff168061095f5760009150506104b1565b6001600160a01b038416600090815260066020908152604080832063ffffffff6000198601811685529252909120541683106109db576001600160a01b03841660009081526006602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b031690506104b1565b6001600160a01b038416600090815260066020908152604080832083805290915290205463ffffffff16831015610a165760009150506104b1565b600060001982015b8163ffffffff168163ffffffff161115610ad957600282820363ffffffff16048103610a48611933565b506001600160a01b038716600090815260066020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610ab4576020015194506104b19350505050565b805163ffffffff16871115610acb57819350610ad2565b6001820392505b5050610a1e565b506001600160a01b038516600090815260066020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60086020526000908152604090205481565b6040518060400160405280600381526020016228292360e91b81525081565b600080610b91836040518060400160405280602081526020017f7472616e736665723a20616d6f756e742065786365656473203936206269747381525061120f565b9050610b9e33858361127d565b5060019392505050565b6001600160a01b03811660009081526007602052604081205463ffffffff1680610bd3576000610630565b6001600160a01b0383166000908152600660209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b6000604051610c26906121e1565b60408051918290038220828201909152600682526550617269666960d01b6020909201919091527f9096468fdff2b4c093288ab07481e35de8213b0ea9b168174607288a1202d1f3610c7661171c565b30604051602001610c8a94939291906122d4565b6040516020818303038152906040528051906020012090506000604051610cb0906121ec565b604051908190038120610ccb918a908a908a90602001612296565b60405160208183030381529060405280519060200120905060008282604051602001610cf89291906121a5565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610d359493929190612309565b6020604051602081039080840390855afa158015610d57573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610d8a5760405162461bcd60e51b815260040161067890612375565b6001600160a01b03811660009081526008602052604090208054600181019091558914610dc95760405162461bcd60e51b8152600401610678906123e5565b87421115610de95760405162461bcd60e51b815260040161067890612395565b610df3818b611692565b505050505b505050505050565b6000600019861415610e155750600019610e57565b610e54866040518060400160405280601e81526020017f7065726d69743a20616d6f756e7420657863656564732039362062697473000081525061120f565b90505b6000604051610e65906121e1565b60408051918290038220828201909152600682526550617269666960d01b6020909201919091527f9096468fdff2b4c093288ab07481e35de8213b0ea9b168174607288a1202d1f3610eb561171c565b30604051602001610ec994939291906122d4565b6040516020818303038152906040528051906020012090506000604051610eef906121d6565b604080519182900382206001600160a01b038d16600090815260086020908152929020805460018101909155610f319391928e928e928e9290918e910161223c565b60405160208183030381529060405280519060200120905060008282604051602001610f5e9291906121a5565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051610f9b9493929190612309565b6020604051602081039080840390855afa158015610fbd573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610ff05760405162461bcd60e51b815260040161067890612385565b8b6001600160a01b0316816001600160a01b0316146110215760405162461bcd60e51b8152600401610678906123a5565b884211156110415760405162461bcd60e51b815260040161067890612415565b84600360008e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925876040516110f1919061246c565b60405180910390a3505050505050505050505050565b6001600160a01b0391821660009081526003602090815260408083209390941682529190915220546001600160601b031690565b6040516104c9906121ec565b600660209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b6001546001600160a01b031633146111a65760405162461bcd60e51b815260040161067890612345565b6001546040517f3b0007eb941cf645526cbb3a4fdaecda9d28ce4843167d9263b536a1f1edc0f6916111e5916001600160a01b03909116908490612205565b60405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b600081600160601b84106112365760405162461bcd60e51b81526004016106789190612324565b509192915050565b6000836001600160601b0316836001600160601b0316111582906112755760405162461bcd60e51b81526004016106789190612324565b505050900390565b6001600160a01b0383166112a35760405162461bcd60e51b8152600401610678906123b5565b6001600160a01b0382166112c95760405162461bcd60e51b8152600401610678906123d5565b6001600160a01b038316600090815260046020908152604091829020548251606081019093526030808452611314936001600160601b0390921692859291906125e29083013961123e565b6001600160a01b03848116600090815260046020908152604080832080546001600160601b0319166001600160601b0396871617905592861682529082902054825160608101909352602a80845261137c9491909116928592909190612560908301396114c4565b6001600160a01b038381166000818152600460205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113e990859061246c565b60405180910390a36001600160a01b0380841660009081526005602052604080822054858416835291205461089a92918216911683611500565b6000828201838110156106305760405162461bcd60e51b815260040161067890612365565b600082611457575060006104b1565b8282028284828161146457fe5b04146106305760405162461bcd60e51b8152600401610678906123c5565b600061063083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611720565b6000838301826001600160601b0380871690831610156114f75760405162461bcd60e51b81526004016106789190612324565b50949350505050565b816001600160a01b0316836001600160a01b03161415801561152b57506000816001600160601b0316115b1561089a576001600160a01b038316156115e3576001600160a01b03831660009081526007602052604081205463ffffffff16908161156b5760006115aa565b6001600160a01b0385166000908152600660209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006115d182856040518060600160405280602281526020016126406022913961123e565b90506115df86848484611757565b5050505b6001600160a01b0382161561089a576001600160a01b03821660009081526007602052604081205463ffffffff16908161161e57600061165d565b6001600160a01b0384166000908152600660209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006116848285604051806060016040528060218152602001612662602191396114c4565b9050610df885848484611757565b6001600160a01b03808316600081815260056020818152604080842080546004845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611716828483611500565b50505050565b4690565b600081836117415760405162461bcd60e51b81526004016106789190612324565b50600083858161174d57fe5b0495945050505050565b600061177b436040518060600160405280602e8152602001612612602e913961190c565b905060008463ffffffff161180156117c457506001600160a01b038516600090815260066020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611823576001600160a01b0385166000908152600660209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556118c2565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600683528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600790935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72484846040516118fd929190612488565b60405180910390a25050505050565b600081600160201b84106112365760405162461bcd60e51b81526004016106789190612324565b604080518082019091526000808252602082015290565b80356104b181612530565b80356104b181612544565b80356104b18161254d565b80356104b181612556565b60006020828403121561198857600080fd5b6000611994848461194a565b949350505050565b600080604083850312156119af57600080fd5b60006119bb858561194a565b92505060206119cc8582860161194a565b9150509250929050565b6000806000606084860312156119eb57600080fd5b60006119f7868661194a565b9350506020611a088682870161194a565b9250506040611a1986828701611955565b9150509250925092565b600080600080600080600060e0888a031215611a3e57600080fd5b6000611a4a8a8a61194a565b9750506020611a5b8a828b0161194a565b9650506040611a6c8a828b01611955565b9550506060611a7d8a828b01611955565b9450506080611a8e8a828b0161196b565b93505060a0611a9f8a828b01611955565b92505060c0611ab08a828b01611955565b91505092959891949750929550565b60008060408385031215611ad257600080fd5b6000611ade858561194a565b92505060206119cc85828601611955565b60008060008060008060c08789031215611b0857600080fd5b6000611b14898961194a565b9650506020611b2589828a01611955565b9550506040611b3689828a01611955565b9450506060611b4789828a0161196b565b9350506080611b5889828a01611955565b92505060a0611b6989828a01611955565b9150509295509295509295565b60008060408385031215611b8957600080fd5b6000611b95858561194a565b92505060206119cc85828601611960565b611baf816124b5565b82525050565b611baf816124c0565b611baf816124c5565b611baf611bd3826124c5565b6124c5565b6000611be3826124a3565b611bed81856124a7565b9350611bfd8185602086016124fa565b611c0681612526565b9093019392505050565b6000611c1d6021836124a7565b7f6765745072696f72566f7465733a206e6f74207965742064657465726d696e658152601960fa1b602082015260400192915050565b6000611c606038836124a7565b7f7365744d696e7465723a206f6e6c7920746865206d696e7465722063616e206381527f68616e676520746865206d696e74657220616464726573730000000000000000602082015260400192915050565b6000611cbf601e836124a7565b7f6d696e743a206f6e6c7920746865206d696e7465722063616e206d696e740000815260200192915050565b6000611cf86002836124b0565b61190160f01b815260020192915050565b6000611d16601b836124a7565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000611d4f6020836124a7565b7f64656c656761746542795369673a20696e76616c6964207369676e6174757265815260200192915050565b6000611d886052836124b0565b7f5065726d69742861646472657373206f776e65722c616464726573732073706581527f6e6465722c75696e743235362076616c75652c75696e74323536206e6f6e63656020820152712c75696e7432353620646561646c696e652960701b604082015260520192915050565b6000611e026019836124a7565b7f7065726d69743a20696e76616c6964207369676e617475726500000000000000815260200192915050565b6000611e3b6020836124a7565b7f64656c656761746542795369673a207369676e61747572652065787069726564815260200192915050565b6000611e746014836124a7565b731c195c9b5a5d0e881d5b985d5d1a1bdc9a5e995960621b815260200192915050565b6000611ea46043836124b0565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b6000611f0f6036836124a7565b7f5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665728152752066726f6d20746865207a65726f206164647265737360501b602082015260400192915050565b6000611f676021836124a7565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b6000611faa6034836124a7565b7f5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657281527320746f20746865207a65726f206164647265737360601b602082015260400192915050565b6000612000601c836124a7565b7f64656c656761746542795369673a20696e76616c6964206e6f6e636500000000815260200192915050565b6000612039601d836124a7565b7f6d696e743a206d696e74696e67206e6f7420616c6c6f77656420796574000000815260200192915050565b60006120726029836124a7565b7f6d696e743a2063616e6e6f74207472616e7366657220746f20746865207a65728152686f206164647265737360b81b602082015260400192915050565b60006120bd603a836124b0565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b600061211c6019836124a7565b7f7065726d69743a207369676e6174757265206578706972656400000000000000815260200192915050565b60006121556017836124a7565b7f6d696e743a206578636565646564206d696e7420636170000000000000000000815260200192915050565b611baf816124d4565b611baf816124dd565b611baf816124ef565b611baf816124e3565b60006121b082611ceb565b91506121bc8285611bc7565b6020820191506121cc8284611bc7565b5060200192915050565b60006104b182611d7b565b60006104b182611e97565b60006104b1826120b0565b602081016104b18284611ba6565b604081016122138285611ba6565b6106306020830184611ba6565b602081016104b18284611bb5565b602081016104b18284611bbe565b60c0810161224a8289611bbe565b6122576020830188611ba6565b6122646040830187611ba6565b6122716060830186611bbe565b61227e6080830185611bbe565b61228b60a0830184611bbe565b979650505050505050565b608081016122a48287611bbe565b6122b16020830186611ba6565b6122be6040830185611bbe565b6122cb6060830184611bbe565b95945050505050565b608081016122e28287611bbe565b6122ef6020830186611bbe565b6122fc6040830185611bbe565b6122cb6060830184611ba6565b608081016123178287611bbe565b6122b1602083018661218a565b602080825281016106308184611bd8565b602080825281016104b181611c10565b602080825281016104b181611c53565b602080825281016104b181611cb2565b602080825281016104b181611d09565b602080825281016104b181611d42565b602080825281016104b181611df5565b602080825281016104b181611e2e565b602080825281016104b181611e67565b602080825281016104b181611f02565b602080825281016104b181611f5a565b602080825281016104b181611f9d565b602080825281016104b181611ff3565b602080825281016104b18161202c565b602080825281016104b181612065565b602080825281016104b18161210f565b602080825281016104b181612148565b602081016104b18284612181565b604081016124518285612181565b610630602083018461219c565b602081016104b1828461218a565b602081016104b18284612193565b602081016104b1828461219c565b604081016124968285612193565b6106306020830184612193565b5190565b90815260200190565b919050565b60006104b1826124c8565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b60006104b1826124e3565b60005b838110156125155781810151838201526020016124fd565b838111156117165750506000910152565b601f01601f191690565b612539816124b5565b81146108cc57600080fd5b612539816124c5565b612539816124d4565b612539816124dd56fe5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77737472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63656d696e743a20746f74616c537570706c79206578636565647320393620626974735f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63655f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974735f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77735f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a365627a7a723158208413d2995caaa9908284b4777a3482c9a3a1d34ba1a809e9789d1ab42332dad66c6578706572696d656e74616cf564736f6c63430005100040
Verified Source Code Partial Match
Compiler: v0.5.16+commit.9c3226ce
EVM: istanbul
Optimization: Yes (200 runs)
SafeMath.sol 186 lines
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @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 addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
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-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
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, string memory errorMessage) 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-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
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) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
ParifiToken.sol 405 lines
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
// Parifi Token Contract
// Based on the Uniswap ERC20 token implementation (Uni.sol)
// Original Source: https://github.com/Uniswap/governance/blob/eabd8c71ad01f61fb54ed6945162021ee419998e/contracts/Uni.sol
// Modifications:
// 1. Replaced all instances of 'Uni' with 'PRF' to reflect the Parifi Token (PRF) identity.
// 2. Adjusted the token minting percentage from 2% to 1%.
// 3. Removed all instances of the constant "Uni" string in revert messages to maintain consistency with the PRF branding.
// No other changes were made to the original Uniswap ERC20 token implementation.
contract ParifiToken {
/// @notice EIP-20 token name for this token
string public constant name = "Parifi";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "PRF";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public totalSupply = 1_000_000_000e18; // 1 billion PRF
/// @notice Address which may mint new tokens
address public minter;
/// @notice The timestamp after which minting may occur
uint public mintingAllowedAfter;
/// @notice Minimum time between mints
uint32 public constant minimumTimeBetweenMints = 1 days * 365;
/// @notice Cap on the percentage of totalSupply that can be minted at each mint
uint8 public constant mintCap = 1;
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when the minter address is changed
event MinterChanged(address minter, address newMinter);
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Uni token
* @param account The initial account to grant all the tokens
* @param minter_ The account with minting ability
* @param mintingAllowedAfter_ The timestamp after which minting may occur
*/
constructor(address account, address minter_, uint mintingAllowedAfter_) public {
require(mintingAllowedAfter_ >= block.timestamp, "constructor: minting can only begin after deployment");
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
minter = minter_;
emit MinterChanged(address(0), minter);
mintingAllowedAfter = mintingAllowedAfter_;
}
/**
* @notice Change the minter address
* @param minter_ The address of the new minter
*/
function setMinter(address minter_) external {
require(msg.sender == minter, "setMinter: only the minter can change the minter address");
emit MinterChanged(minter, minter_);
minter = minter_;
}
/**
* @notice Mint new tokens
* @param dst The address of the destination account
* @param rawAmount The number of tokens to be minted
*/
function mint(address dst, uint rawAmount) external {
require(msg.sender == minter, "mint: only the minter can mint");
require(block.timestamp >= mintingAllowedAfter, "mint: minting not allowed yet");
require(dst != address(0), "mint: cannot transfer to the zero address");
// record the mint
mintingAllowedAfter = SafeMath.add(block.timestamp, minimumTimeBetweenMints);
// mint the amount
uint96 amount = safe96(rawAmount, "mint: amount exceeds 96 bits");
require(amount <= SafeMath.div(SafeMath.mul(totalSupply, mintCap), 100), "mint: exceeded mint cap");
totalSupply = safe96(SafeMath.add(totalSupply, amount), "mint: totalSupply exceeds 96 bits");
// transfer the amount to the recipient
balances[dst] = add96(balances[dst], amount, "mint: transfer amount overflows");
emit Transfer(address(0), dst, amount);
// move delegates
_moveDelegates(address(0), delegates[dst], amount);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Triggers an approval from owner to spends
* @param owner The address to approve from
* @param spender The address to be approved
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @param deadline The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "permit: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "permit: invalid signature");
require(signatory == owner, "permit: unauthorized");
require(now <= deadline, "permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "delegateBySig: invalid nonce");
require(now <= expiry, "delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
Read Contract
DELEGATION_TYPEHASH 0xe7a324dc → bytes32
DOMAIN_TYPEHASH 0x20606b70 → bytes32
PERMIT_TYPEHASH 0x30adf81f → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
checkpoints 0xf1127ed8 → uint32, uint96
decimals 0x313ce567 → uint8
delegates 0x587cde1e → address
getCurrentVotes 0xb4b5ea57 → uint96
getPriorVotes 0x782d6fe1 → uint96
minimumTimeBetweenMints 0x5c11d62f → uint32
mintCap 0x76c71ca1 → uint8
minter 0x07546172 → address
mintingAllowedAfter 0x30b36cef → uint256
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
numCheckpoints 0x6fcfff45 → uint32
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 8 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 rawAmount
returns: bool
delegate 0x5c19a95c
address delegatee
delegateBySig 0xc3cda520
address delegatee
uint256 nonce
uint256 expiry
uint8 v
bytes32 r
bytes32 s
mint 0x40c10f19
address dst
uint256 rawAmount
permit 0xd505accf
address owner
address spender
uint256 rawAmount
uint256 deadline
uint8 v
bytes32 r
bytes32 s
setMinter 0xfca3b5aa
address minter_
transfer 0xa9059cbb
address dst
uint256 rawAmount
returns: bool
transferFrom 0x23b872dd
address src
address dst
uint256 rawAmount
returns: bool
Recent Transactions
No transactions found for this address