Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5
Balance 0 ETH
Nonce 1
Code Size 12996 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

12996 bytes
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80635c19a95c11610104578063981b24d0116100a2578063c3cda52011610071578063c3cda520146109b6578063dd62ed3e14610a2f578063e7a324dc14610aa7578063f851a44014610ac5576101cf565b8063981b24d014610854578063a457c2d714610896578063a9059cbb146108fa578063b4b5ea571461095e576101cf565b8063782d6fe1116100de578063782d6fe1146106f95780637ecebe001461075b57806395d89b41146107b35780639711715a14610836576101cf565b80635c19a95c146106055780636fcfff451461064957806370a08231146106a1576101cf565b80632678224711610171578063395093511161014b57806339509351146104775780634dd18bf5146104db5780634ee2cd7e14610535578063587cde1e14610597576101cf565b80632678224714610404578063313ce5671461043857806332cb6b0c14610459576101cf565b80630e18b681116101ad5780630e18b6811461032457806318160ddd1461034457806320606b701461036257806323b872dd14610380576101cf565b806306fdde03146101d4578063095ea7b3146102575780630cdfebfa146102bb575b600080fd5b6101dc610af9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561021c578082015181840152602081019050610201565b50505050905090810190601f1680156102495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102a36004803603604081101561026d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9b565b60405180821515815260200191505060405180910390f35b610307600480360360408110156102d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bb9565b604051808381526020018281526020019250505060405180910390f35b61032c610bea565b60405180821515815260200191505060405180910390f35b61034c610ebf565b6040518082815260200191505060405180910390f35b61036a610ec9565b6040518082815260200191505060405180910390f35b6103ec6004803603606081101561039657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eed565b60405180821515815260200191505060405180910390f35b61040c610fc6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610440610fec565b604051808260ff16815260200191505060405180910390f35b610461611003565b6040518082815260200191505060405180910390f35b6104c36004803603604081101561048d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611009565b60405180821515815260200191505060405180910390f35b61051d600480360360208110156104f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110bc565b60405180821515815260200191505060405180910390f35b6105816004803603604081101561054b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611230565b6040518082815260200191505060405180910390f35b6105d9600480360360208110156105ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112a0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106476004803603602081101561061b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112d3565b005b61068b6004803603602081101561065f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6106e3600480360360208110156106b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112f8565b6040518082815260200191505060405180910390f35b6107456004803603604081101561070f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611340565b6040518082815260200191505060405180910390f35b61079d6004803603602081101561077157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611649565b6040518082815260200191505060405180910390f35b6107bb611661565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107fb5780820151818401526020810190506107e0565b50505050905090810190601f1680156108285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61083e611703565b6040518082815260200191505060405180910390f35b6108806004803603602081101561086a57600080fd5b810190808035906020019092919050505061181e565b6040518082815260200191505060405180910390f35b6108e2600480360360408110156108ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061184f565b60405180821515815260200191505060405180910390f35b6109466004803603604081101561091057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061191c565b60405180821515815260200191505060405180910390f35b6109a06004803603602081101561097457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061193a565b6040518082815260200191505060405180910390f35b610a2d600480360360c08110156109cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506119ee565b005b610a9160048036036040811015610a4557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d52565b6040518082815260200191505060405180910390f35b610aaf611dd9565b6040518082815260200191505060405180910390f35b610acd611dfd565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b915780601f10610b6657610100808354040283529160200191610b91565b820191906000526020600020905b815481529060010190602001808311610b7457829003601f168201915b5050505050905090565b6000610baf610ba8611ebe565b8484611ec6565b6001905092915050565b600a602052816000526040600020602052806000526040600020600091509150508060000154908060010154905082565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580610c755750600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15610ccb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806131626022913960400191505060405180910390fd5b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc60405160405180910390a3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a960405160405180910390a360019250505090565b6000600254905090565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6000610efa8484846120bd565b610fbb84610f06611ebe565b610fb6856040518060600160405280602881526020016131a860289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610f6c611ebe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121969092919063ffffffff16565b611ec6565b600190509392505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560009054906101000a900460ff16905090565b60065481565b60006110b2611016611ebe565b846110ad8560016000611027611ebe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e2390919063ffffffff16565b611ec6565b6001905092915050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611164576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131146026913960400191505060405180910390fd5b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a960405160405180910390a36001915050919050565b600080600061127d84600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020612250565b91509150816112945761128f856112f8565b611296565b805b9250505092915050565b60096020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6112dd33826123a7565b50565b600b6020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600043821061139a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806132416029913960400191505060405180910390fd5b6000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008114156113f1576000915050611643565b82600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018403815260200190815260200160002060000154116114ad57600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018303815260200190815260200160002060010154915050611643565b82600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808152602001908152602001600020600001541115611512576000915050611643565b6000806001830390505b818111156115e957600060028383038161153257fe5b04820390506000600a60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060405180604001604052908160008201548152602001600182015481525050905086816000015114156115c757806020015195505050505050611643565b86816000015110156115db578193506115e2565b6001820392505b505061151c565b600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206001015493505050505b92915050565b600c6020528060005260406000206000915090505481565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116f95780601f106116ce576101008083540402835291602001916116f9565b820191906000526020600020905b8154815290600101906020018083116116dc57829003601f168201915b5050505050905090565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616c6c6572206973206e6f7420612061646d696e000000000000000000000081525060200191505060405180910390fd5b6117d26010612518565b60006117de6010611eb0565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb67816040518082815260200191505060405180910390a18091505090565b600080600061182e84600e612250565b91509150816118445761183f610ebf565b611846565b805b92505050919050565b600061191261185c611ebe565b8461190d8560405180606001604052806025815260200161326a6025913960016000611886611ebe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121969092919063ffffffff16565b611ec6565b6001905092915050565b6000611930611929611ebe565b84846120bd565b6001905092915050565b600080600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811161198e5760006119e6565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600183038152602001908152602001600020600101545b915050919050565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866611a19610af9565b80519060200120611a2861252e565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611bac573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061313a6028913960400191505060405180910390fd5b600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611ce3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806131846024913960400191505060405180910390fd5b87421115611d3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132196028913960400191505060405180910390fd5b611d46818b6123a7565b50505050505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080828401905083811015611ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600081600001549050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611f4c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806131f56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611fd2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806130cc6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6120c883838361253b565b612191600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836127fc565b505050565b6000838311158290612243576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122085780820151818401526020810190506121ed565b50505050905090810190601f1680156122355780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600080600084116122c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4552433230536e617073686f743a20696420697320300000000000000000000081525060200191505060405180910390fd5b6122d36010611eb0565b841115612348576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4552433230536e617073686f743a206e6f6e6578697374656e7420696400000081525060200191505060405180910390fd5b60006123608585600001612a5590919063ffffffff16565b9050836000018054905081141561237e5760008092509250506123a0565b600184600101828154811061238f57fe5b906000526020600020015492509250505b9250929050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000612416846112f8565b905082600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a46125128284836127fc565b50505050565b6001816000016000828254019250508190555050565b6000804690508091505090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156125c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131d06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612647576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806130736023913960400191505060405180910390fd5b612652838383612b06565b6126bd816040518060600160405280602681526020016130ee602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121969092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612750816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e2390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156128385750600081115b15612a5057600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612946576000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008082116128c557600061291d565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184038152602001908152602001600020600101545b905060006129348483612bc090919063ffffffff16565b905061294286848484612c43565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612a4f576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008082116129ce576000612a26565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184038152602001908152602001600020600101545b90506000612a3d8483611e2390919063ffffffff16565b9050612a4b85848484612c43565b5050505b5b505050565b60008083805490501415612a6c5760009050612b00565b600080848054905090505b80821015612ac0576000612a8b8383612e54565b905084868281548110612a9a57fe5b90600052602060002001541115612ab357809150612aba565b6001810192505b50612a77565b600082118015612ae8575083856001840381548110612adb57fe5b9060005260206000200154145b15612afa576001820392505050612b00565b81925050505b92915050565b612b11838383611eab565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612b5c57612b4f82612e96565b612b57612ee9565b612bbb565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612ba757612b9a83612e96565b612ba2612ee9565b612bba565b612bb083612e96565b612bb982612e96565b5b5b505050565b600082821115612c38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b6000612c674360405180606001604052806036815260200161309660369139612efd565b9050600084118015612cce575080600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018703815260200190815260200160002060000154145b15612d335781600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018703815260200190815260200160002060010181905550612df7565b604051806040016040528082815260200183815250600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000868152602001908152602001600020600082015181600001556020820151816001015590505060018401600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051808381526020018281526020019250505060405180910390a25050505050565b60006002808381612e6157fe5b0660028581612e6c57fe5b060181612e7557fe5b0460028381612e8057fe5b0460028581612e8b57fe5b040101905092915050565b612ee6600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020612ee1836112f8565b612fb8565b50565b612efb600e612ef6610ebf565b612fb8565b565b600064010000000083108290612fae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612f73578082015181840152602081019050612f58565b50505050905090810190601f168015612fa05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6000612fc46010611eb0565b905080612fd384600001613035565b10156130305782600001819080600181540180825580915050600190039060005260206000200160009091909190915055826001018290806001815401808255809150506001900390600052602060002001600090919091909150555b505050565b6000808280549050141561304c576000905061306d565b8160018380549050038154811061305f57fe5b906000526020600020015490505b91905056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737342697444414f3a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542697444414f3a73657450656e64696e6741646d696e3a696c6c6567616c206164647265737342697444414f3a3a64656c656761746542795369673a20696e76616c6964207369676e617475726542697444414f3a61636365707441646d696e3a696c6c6567616c206164647265737342697444414f3a3a64656c656761746542795369673a20696e76616c6964206e6f6e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737342697444414f3a3a64656c656761746542795369673a207369676e6174757265206578706972656442697444414f3a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212204a08a09076e0c538fe245a5fae8e37ece742292aa66ad71391baedd49f1beed364736f6c63430007060033

Verified Source Code Partial Match

Compiler: v0.7.6+commit.7338295f EVM: istanbul Optimization: No
BitDAO.sol 1068 lines
// Dependency file: @openzeppelin/contracts/math/SafeMath.sol

// SPDX-License-Identifier: MIT

// pragma solidity >=0.6.0 <0.8.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, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @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");
        return a - b;
    }

    /**
     * @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) {
        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, reverting 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) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting 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) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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;
    }
}


// Dependency file: @openzeppelin/contracts/math/Math.sol


// pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @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, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}


// Dependency file: @openzeppelin/contracts/utils/Arrays.sol


// pragma solidity >=0.6.0 <0.8.0;

// import "@openzeppelin/contracts/math/Math.sol";

/**
 * @dev Collection of functions related to array types.
 */
library Arrays {
   /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * `array` is expected to be sorted in ascending order, and to contain no
     * repeated elements.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        if (array.length == 0) {
            return 0;
        }

        uint256 low = 0;
        uint256 high = array.length;

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds down (it does integer division with truncation).
            if (array[mid] > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && array[low - 1] == element) {
            return low - 1;
        } else {
            return low;
        }
    }
}


// Dependency file: @openzeppelin/contracts/utils/Counters.sol


// pragma solidity >=0.6.0 <0.8.0;

// import "@openzeppelin/contracts/math/SafeMath.sol";

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}


// Dependency file: @openzeppelin/contracts/utils/Context.sol


// pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}


// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol


// pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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


// Dependency file: @openzeppelin/contracts/token/ERC20/ERC20.sol


// pragma solidity >=0.6.0 <0.8.0;

// import "@openzeppelin/contracts/utils/Context.sol";
// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/math/SafeMath.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of 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 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

    /**
     * @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 value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * 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 _decimals;
    }

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

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

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

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

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

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

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

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

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

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}


// Root file: contracts/BitDAO.sol

pragma solidity >=0.6.5 <0.8.0;

// import '/Users/stone/Desktop/BitDAO/node_modules/@openzeppelin/contracts/math/SafeMath.sol';
// import '/Users/stone/Desktop/BitDAO/node_modules/@openzeppelin/contracts/utils/Arrays.sol';
// import '/Users/stone/Desktop/BitDAO/node_modules/@openzeppelin/contracts/utils/Counters.sol';
// import '/Users/stone/Desktop/BitDAO/node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol';

contract BitDAO is ERC20 {
	using SafeMath for uint256;
	using Arrays for uint256[];
	using Counters for Counters.Counter;

	uint256 public MAX_SUPPLY = 1e28; // 1e10 * 1e18

	address public admin;

	address public pendingAdmin;

	mapping(address => address) public delegates;

	struct Checkpoint {
		uint256 fromBlock;
		uint256 votes;
	}

	mapping(address => mapping(uint256 => Checkpoint)) public checkpoints;

	mapping(address => uint256) public numCheckpoints;

	bytes32 public constant DOMAIN_TYPEHASH =
		keccak256('EIP712Domain(string name,uint256 chainId,address verifyingContract)');

	bytes32 public constant DELEGATION_TYPEHASH =
		keccak256('Delegation(address delegatee,uint256 nonce,uint256 expiry)');

	mapping(address => uint256) public nonces;

	struct Snapshots {
		uint256[] ids;
		uint256[] values;
	}

	mapping(address => Snapshots) private _accountBalanceSnapshots;

	Snapshots private _totalSupplySnapshots;

	Counters.Counter private _currentSnapshotId;

	event Snapshot(uint256 id);

	event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

	event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

	event NewPendingAdmin(address indexed oldPendingAdmin, address indexed newPendingAdmin);

	event NewAdmin(address indexed oldAdmin, address indexed newAdmin);

	modifier onlyAdmin {
		require(msg.sender == admin, 'Caller is not a admin');
		_;
	}

	constructor(address _admin) ERC20('BitDAO', 'BIT') {
		admin = _admin;
		_mint(_admin, MAX_SUPPLY);
	}

	function setPendingAdmin(address newPendingAdmin) external returns (bool) {
		if (msg.sender != admin) {
			revert('BitDAO:setPendingAdmin:illegal address');
		}
		address oldPendingAdmin = pendingAdmin;
		pendingAdmin = newPendingAdmin;

		emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);

		return true;
	}

	function acceptAdmin() external returns (bool) {
		if (msg.sender != pendingAdmin || msg.sender == address(0)) {
			revert('BitDAO:acceptAdmin:illegal address');
		}
		address oldAdmin = admin;
		address oldPendingAdmin = pendingAdmin;
		admin = pendingAdmin;
		pendingAdmin = address(0);

		emit NewAdmin(oldAdmin, admin);
		emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);

		return true;
	}

	function snapshot() external virtual onlyAdmin returns (uint256) {
		_currentSnapshotId.increment();

		uint256 currentId = _currentSnapshotId.current();
		emit Snapshot(currentId);
		return currentId;
	}

	function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {
		(bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);

		return snapshotted ? value : balanceOf(account);
	}

	function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {
		(bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);

		return snapshotted ? value : totalSupply();
	}

	function _beforeTokenTransfer(
		address from,
		address to,
		uint256 amount
	) internal virtual override {
		super._beforeTokenTransfer(from, to, amount);
		if (from == address(0)) {
			// mint
			_updateAccountSnapshot(to);
			_updateTotalSupplySnapshot();
		} else if (to == address(0)) {
			// burn
			_updateAccountSnapshot(from);
			_updateTotalSupplySnapshot();
		} else {
			// transfer
			_updateAccountSnapshot(from);
			_updateAccountSnapshot(to);
		}
	}

	function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {
		require(snapshotId > 0, 'ERC20Snapshot: id is 0');
		require(snapshotId <= _currentSnapshotId.current(), 'ERC20Snapshot: nonexistent id');

		uint256 index = snapshots.ids.findUpperBound(snapshotId);

		if (index == snapshots.ids.length) {
			return (false, 0);
		} else {
			return (true, snapshots.values[index]);
		}
	}

	function _updateAccountSnapshot(address account) private {
		_updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));
	}

	function _updateTotalSupplySnapshot() private {
		_updateSnapshot(_totalSupplySnapshots, totalSupply());
	}

	function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {
		uint256 currentId = _currentSnapshotId.current();
		if (_lastSnapshotId(snapshots.ids) < currentId) {
			snapshots.ids.push(currentId);
			snapshots.values.push(currentValue);
		}
	}

	function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {
		if (ids.length == 0) {
			return 0;
		} else {
			return ids[ids.length - 1];
		}
	}

	function delegate(address delegatee) external {
		return _delegate(msg.sender, delegatee);
	}

	function delegateBySig(
		address delegatee,
		uint256 nonce,
		uint256 expiry,
		uint8 v,
		bytes32 r,
		bytes32 s
	) external {
		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), 'BitDAO::delegateBySig: invalid signature');
		require(nonce == nonces[signatory]++, 'BitDAO::delegateBySig: invalid nonce');
		require(block.timestamp <= expiry, 'BitDAO::delegateBySig: signature expired');
		return _delegate(signatory, delegatee);
	}

	function getCurrentVotes(address account) external view returns (uint256) {
		uint256 nCheckpoints = numCheckpoints[account];
		return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
	}

	function getPriorVotes(address account, uint256 blockNumber) public view returns (uint256) {
		require(blockNumber < block.number, 'BitDAO::getPriorVotes: not yet determined');

		uint256 nCheckpoints = numCheckpoints[account];
		if (nCheckpoints == 0) {
			return 0;
		}

		if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
			return checkpoints[account][nCheckpoints - 1].votes;
		}

		if (checkpoints[account][0].fromBlock > blockNumber) {
			return 0;
		}

		uint256 lower = 0;
		uint256 upper = nCheckpoints - 1;
		while (upper > lower) {
			uint256 center = upper - (upper - lower) / 2;
			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];
		uint256 delegatorBalance = balanceOf(delegator);
		delegates[delegator] = delegatee;

		emit DelegateChanged(delegator, currentDelegate, delegatee);

		_moveDelegates(currentDelegate, delegatee, delegatorBalance);
	}

	function _transfer(
		address sender,
		address recipient,
		uint256 amount
	) internal virtual override {
		super._transfer(sender, recipient, amount);
		_moveDelegates(delegates[sender], delegates[recipient], amount);
	}

	function _moveDelegates(
		address srcRep,
		address dstRep,
		uint256 amount
	) internal {
		if (srcRep != dstRep && amount > 0) {
			if (srcRep != address(0)) {
				uint256 srcRepNum = numCheckpoints[srcRep];
				uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
				uint256 srcRepNew = srcRepOld.sub(amount);
				_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
			}

			if (dstRep != address(0)) {
				uint256 dstRepNum = numCheckpoints[dstRep];
				uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
				uint256 dstRepNew = dstRepOld.add(amount);
				_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
			}
		}
	}

	function _writeCheckpoint(
		address delegatee,
		uint256 nCheckpoints,
		uint256 oldVotes,
		uint256 newVotes
	) internal {
		uint256 blockNumber = safe32(block.number, 'BitDAO::_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(uint256 n, string memory errorMessage) internal pure returns (uint256) {
		require(n < 2**32, errorMessage);
		return uint256(n);
	}

	function getChainId() internal pure returns (uint256) {
		uint256 chainId;
		assembly {
			chainId := chainid()
		}
		return chainId;
	}
}

Read Contract

DELEGATION_TYPEHASH 0xe7a324dc → bytes32
DOMAIN_TYPEHASH 0x20606b70 → bytes32
MAX_SUPPLY 0x32cb6b0c → uint256
admin 0xf851a440 → address
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
balanceOfAt 0x4ee2cd7e → uint256
checkpoints 0x0cdfebfa → uint256, uint256
decimals 0x313ce567 → uint8
delegates 0x587cde1e → address
getCurrentVotes 0xb4b5ea57 → uint256
getPriorVotes 0x782d6fe1 → uint256
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
numCheckpoints 0x6fcfff45 → uint256
pendingAdmin 0x26782247 → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
totalSupplyAt 0x981b24d0 → uint256

Write Contract 10 functions

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

acceptAdmin 0x0e18b681
No parameters
returns: bool
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
delegate 0x5c19a95c
address delegatee
delegateBySig 0xc3cda520
address delegatee
uint256 nonce
uint256 expiry
uint8 v
bytes32 r
bytes32 s
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
setPendingAdmin 0x4dd18bf5
address newPendingAdmin
returns: bool
snapshot 0x9711715a
No parameters
returns: uint256
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool

Recent Transactions

No transactions found for this address