Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8
Balance 0.000010000 ETH
Nonce 1
Code Size 14282 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

14282 bytes
0x60806040526004361061023b5760003560e01c80637b3c71d31161012e578063da95691a116100ab578063e9c714f21161006f578063e9c714f214610637578063f4e102681461064c578063f851a44014610661578063f96dae0a14610676578063fe0d94c11461068b5761023b565b8063da95691a146105a0578063ddf0b009146105c0578063deaaa7cc146105e0578063e23a9a52146105f5578063e48083fe146106225761023b565b8063b1126263116100f2578063b11262631461035a578063b58131b014610541578063b71d1a0c14610556578063d33219b414610576578063da35c6641461058b5761023b565b80637b3c71d3146104b75780637bdbe4d0146104d757806386d37e8b146104ec57806387bae18f1461050c578063a64e024a1461052c5761023b565b806325fd935a116101bc5780633e4f49e6116101805780633e4f49e61461042057806340e58ee51461044d578063567813881461046d5780636979c9511461048d578063791f5d23146104a25761023b565b806325fd935a146103845780632678224714610399578063328dd982146103bb5780633932abb1146103eb5780633bccf4fd146104005761023b565b806317ba1b8b1161020357806317ba1b8b146103055780631dfb1b5a1461032557806320606b7014610345578063215809ca1461035a57806324bc1a641461036f5761023b565b8063013cf08b1461024057806302a251a31461027f57806306fdde03146102a15780630ea2d98c146102c357806317977c61146102e5575b600080fd5b34801561024c57600080fd5b5061026061025b366004612813565b61069e565b6040516102769a9998979695949392919061364b565b60405180910390f35b34801561028b57600080fd5b50610294610700565b6040516102769190612c64565b3480156102ad57600080fd5b506102b6610706565b6040516102769190612cdc565b3480156102cf57600080fd5b506102e36102de366004612813565b61072e565b005b3480156102f157600080fd5b506102946103003660046126d7565b6107d1565b34801561031157600080fd5b506102e3610320366004612813565b6107e3565b34801561033157600080fd5b506102e3610340366004612813565b61088c565b34801561035157600080fd5b50610294610925565b34801561036657600080fd5b5061029461093c565b34801561037b57600080fd5b50610294610942565b34801561039057600080fd5b50610294610948565b3480156103a557600080fd5b506103ae610956565b6040516102769190612b17565b3480156103c757600080fd5b506103db6103d6366004612813565b610965565b6040516102769493929190612c0d565b3480156103f757600080fd5b50610294610bf4565b34801561040c57600080fd5b506102e361041b366004612908565b610bfa565b34801561042c57600080fd5b5061044061043b366004612813565b610dca565b6040516102769190612cc8565b34801561045957600080fd5b506102e3610468366004612813565b610ea2565b34801561047957600080fd5b506102e361048836600461285a565b6110e6565b34801561049957600080fd5b50610294611130565b3480156104ae57600080fd5b5061029461113e565b3480156104c357600080fd5b506102e36104d2366004612883565b61114b565b3480156104e357600080fd5b5061029461119b565b3480156104f857600080fd5b506102e3610507366004612813565b6111a0565b34801561051857600080fd5b506102e36105273660046126d7565b61124a565b34801561053857600080fd5b506102946114c1565b34801561054d57600080fd5b506102946114c7565b34801561056257600080fd5b506102e36105713660046126d7565b6114cd565b34801561058257600080fd5b506103ae61154a565b34801561059757600080fd5b50610294611559565b3480156105ac57600080fd5b506102946105bb36600461270f565b61155f565b3480156105cc57600080fd5b506102e36105db366004612813565b6119d3565b3480156105ec57600080fd5b50610294611baf565b34801561060157600080fd5b5061061561061036600461282b565b611bbb565b6040516102769190613586565b34801561062e57600080fd5b50610294611c28565b34801561064357600080fd5b506102e3611c2d565b34801561065857600080fd5b50610294611d0b565b34801561066d57600080fd5b506103ae611d19565b34801561068257600080fd5b506103ae611d28565b6102e3610699366004612813565b611d37565b60096020819052600091825260409091208054600182015460028301546007840154600885015495850154600a860154600b870154600c9097015495976001600160a01b03909516969395929493919290919060ff808216916101009004168a565b60035481565b6040518060400160405280600c81526020016b2920a49023b7bb32b93737b960a11b81525081565b6000546001600160a01b031633146107615760405162461bcd60e51b815260040161075890612d8b565b60405180910390fd5b6119c88110158015610775575061b5a48111155b6107915760405162461bcd60e51b815260040161075890612e6e565b7f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828600354826040516107c492919061369d565b60405180910390a1600355565b600a6020526000908152604090205481565b6000546001600160a01b0316331461080d5760405162461bcd60e51b8152600401610758906134be565b683635c9adc5dea000008110158015610830575069032d26d12e980b6000008111155b61084c5760405162461bcd60e51b8152600401610758906130e1565b7fccb45da8d5717e6c4544694297c4ba5cf151d455c9bb0ed4fc7a38411bc054616005548260405161087f92919061369d565b60405180910390a1600555565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161075890612dd6565b600181101580156108c957506119c88111155b6108e55760405162461bcd60e51b815260040161075890612f69565b7fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a936002548260405161091892919061369d565b60405180910390a1600255565b60405161093190612abc565b604051809103902081565b6119c881565b60045481565b69032d26d12e980b60000081565b6001546001600160a01b031681565b606080606080600060096000878152602001908152602001600020905080600301816004018260050183600601838054806020026020016040519081016040528092919081815260200182805480156109e757602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116109c9575b5050505050935082805480602002602001604051908101604052809291908181526020018280548015610a3957602002820191906000526020600020905b815481526020019060010190808311610a25575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b82821015610b0c5760008481526020908190208301805460408051601f6002600019610100600187161502019094169390930492830185900485028101850190915281815292830182828015610af85780601f10610acd57610100808354040283529160200191610af8565b820191906000526020600020905b815481529060010190602001808311610adb57829003601f168201915b505050505081526020019060010190610a61565b50505050915080805480602002602001604051908101604052809291908181526020016000905b82821015610bde5760008481526020908190208301805460408051601f6002600019610100600187161502019094169390930492830185900485028101850190915281815292830182828015610bca5780601f10610b9f57610100808354040283529160200191610bca565b820191906000526020600020905b815481529060010190602001808311610bad57829003601f168201915b505050505081526020019060010190610b33565b5050505090509450945094509450509193509193565b60025481565b6000604051610c0890612abc565b60408051918290038220828201909152600c82526b2920a49023b7bb32b93737b960a11b6020909201919091527f86a8a2803f85d2d7534be2692f330e01cd261f0730c2e9caf712fa9612813162610c5e611faf565b30604051602001610c729493929190612c6d565b6040516020818303038152906040528051906020012090506000604051610c9890612a67565b604051908190038120610cb19189908990602001612c91565b60405160208183030381529060405280519060200120905060008282604051602001610cde929190612aa1565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610d1b9493929190612caa565b6020604051602081039080840390855afa158015610d3d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610d705760405162461bcd60e51b815260040161075890613028565b806001600160a01b03167fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda48a8a610da8858e8e611fb4565b604051610db7939291906136fb565b60405180910390a2505050505050505050565b6000816006541015610dee5760405162461bcd60e51b81526004016107589061350e565b6000828152600960205260409020600c81015460ff1615610e13576002915050610e9d565b80600701544311610e28576000915050610e9d565b80600801544311610e3d576001915050610e9d565b80600a01548160090154111580610e5957506004548160090154105b15610e68576003915050610e9d565b6002810154610e7b576004915050610e9d565b600c810154610100900460ff1615610e97576007915050610e9d565b60059150505b919050565b6007610ead82610dca565b6007811115610eb857fe5b1415610ed65760405162461bcd60e51b815260040161075890613468565b600081815260096020526040902060018101546001600160a01b0316331480610f9557506005546008546001838101546001600160a01b039283169263782d6fe192911690610f269043906121aa565b6040518363ffffffff1660e01b8152600401610f43929190612b2b565b60206040518083038186803b158015610f5b57600080fd5b505afa158015610f6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9391906127fb565b105b610fb15760405162461bcd60e51b81526004016107589061326e565b600c8101805460ff191660011790556005610fcb83610dca565b6007811115610fd657fe5b14156110ab57600080805b60038401548110156110a757836003018181548110610ffc57fe5b6000918252602090912001546007546006860180546001600160a01b03938416803f975095509190921691635c8bb90a91859187918690811061103b57fe5b9060005260206000200188600201546040518563ffffffff1660e01b81526004016110699493929190612b5e565b600060405180830381600087803b15801561108357600080fd5b505af1158015611097573d6000803e3d6000fd5b505060019092019150610fe19050565b5050505b7f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c826040516110da9190612c64565b60405180910390a15050565b337fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda48383611115848383611fb4565b604051611124939291906136fb565b60405180910390a25050565b69152d02c7e14af680000081565b683635c9adc5dea0000081565b337fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4858561117a848383611fb4565b868660405161118d9594939291906136ab565b60405180910390a250505050565b600a81565b6000546001600160a01b031633146111ca5760405162461bcd60e51b8152600401610758906134be565b69021e19e0c9bab240000081101580156111ee575069152d02c7e14af68000008111155b61120a5760405162461bcd60e51b815260040161075890612e20565b7fffff0a251408cb8f05a4fc2ab0bdffe28e1519cb8ee5bdb6531e5d6ca51aaf756004548260405161123d92919061369d565b60405180910390a1600455565b6000546001600160a01b031633146112745760405162461bcd60e51b8152600401610758906134be565b600760009054906101000a90046001600160a01b03166001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b1580156112c257600080fd5b505afa1580156112d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fa91906126f3565b6000546001600160a01b039081169116141561145857806001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b15801561134957600080fd5b505afa15801561135d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138191906126f3565b600080546001600160a01b0319166001600160a01b039283161790556007546040805163ec55688960e01b815290517ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc93929092169163ec55688991600480820192602092909190829003018186803b1580156113fd57600080fd5b505afa158015611411573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143591906126f3565b60005460405161144f92916001600160a01b031690612b44565b60405180910390a15b6007546040517f46ef4bfeb470de422469ae24ee0b12ecd77cf8bd15d6c5d562644a2ea03ed87991611497916001600160a01b03909116908490612b44565b60405180910390a1600780546001600160a01b0319166001600160a01b0392909216919091179055565b61b5a481565b60055481565b6000546001600160a01b031633146114f75760405162461bcd60e51b815260040161075890612d41565b600180546001600160a01b038381166001600160a01b03198316179092556040519116907fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9906110da9083908590612b44565b6007546001600160a01b031681565b60065481565b600554600854600091906001600160a01b031663782d6fe1336115834360016121aa565b6040518363ffffffff1660e01b81526004016115a0929190612b2b565b60206040518083038186803b1580156115b857600080fd5b505afa1580156115cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f091906127fb565b1161160d5760405162461bcd60e51b81526004016107589061340b565b825186511461162e5760405162461bcd60e51b815260040161075890613077565b855161164c5760405162461bcd60e51b8152600401610758906131d4565b600a8651111561166e5760405162461bcd60e51b8152600401610758906132bd565b336000908152600a602052604090205480156116eb57600061168f82610dca565b9050600181600781111561169f57fe5b14156116bd5760405162461bcd60e51b815260040161075890613388565b60008160078111156116cb57fe5b14156116e95760405162461bcd60e51b815260040161075890613305565b505b60006116f9436002546121d2565b90506000611709826003546121d2565b600680546001019055905061171c6121fe565b604080516101c08101825260065481523360208201526000918101829052606081018c9052906080820190604051908082528060200260200182016040528015611770578160200160208202803683370190505b50815260200160006040519080825280602002602001820160405280156117ab57816020015b60608152602001906001900390816117965790505b50815260208082018a90526040808301879052606080840187905260006080850181905260a0850181905260c0850181905260e0850181905261010090940184905284518452600983529281902084518155848301516001820180546001600160a01b0319166001600160a01b039092169190911790559084015160028201559183015180519394508493611846926003850192019061227a565b50608082015180516118629160048401916020909101906122df565b5060a0820151805161187e916005840191602090910190612326565b5060c0820151805161189a91600684019160209091019061237f565b5060e082015160078201556101008083015160088301556101208301516009830155610140830151600a80840191909155610160840151600b840155610180840151600c90930180546101a09095015160ff199095169315159390931761ff00191693151590910292909217905581516020808401516001600160a01b03166000908152929052604082205581517f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e09133908d90604051908082528060200260200182016040528015611977578160200160208202803683370190505b5060408051600080825260208201909252906119a3565b606081526020019060019003908161198e5790505b508c89898e6040516119bd999897969594939291906135b5565b60405180910390a1519998505050505050505050565b60046119de82610dca565b60078111156119e957fe5b14611a065760405162461bcd60e51b81526004016107589061313f565b60008181526009602090815260408083206007548251630d48571f60e31b81529251919493611a9d9342936001600160a01b0390931692636a42b8f892600480840193919291829003018186803b158015611a6057600080fd5b505afa158015611a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9891906127fb565b6121d2565b9050600080805b6003850154811015611b6657846003018181548110611abf57fe5b6000918252602090912001546007546006870180546001600160a01b03938416803f975095509190921691637a0c53b2918591879186908110611afe57fe5b90600052602060002001886040518563ffffffff1660e01b8152600401611b289493929190612b5e565b600060405180830381600087803b158015611b4257600080fd5b505af1158015611b56573d6000803e3d6000fd5b505060019092019150611aa49050565b50600284018390556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290611ba0908790869061369d565b60405180910390a15050505050565b60405161093190612a67565b611bc36123d8565b5060008281526009602090815260408083206001600160a01b0385168452600d018252918290208251606081018452905460ff8082161515835261010082041692820192909252620100009091046001600160601b0316918101919091525b92915050565b600181565b6001546001600160a01b031633148015611c4657503315155b611c625760405162461bcd60e51b815260040161075890613220565b60008054600180546001600160a01b038082166001600160a01b03198086168217968790559092169092556040519282169390927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92611cc6928692911690612b44565b60405180910390a16001546040517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9916110da9184916001600160a01b031690612b44565b69021e19e0c9bab240000081565b6000546001600160a01b031681565b6008546001600160a01b031681565b6005611d4282610dca565b6007811115611d4d57fe5b14611d6a5760405162461bcd60e51b815260040161075890612fbd565b6000818152600960205260408120600c8101805461ff001916610100179055908080805b6003850154811015611f7f57846003018181548110611da957fe5b6000918252602090912001546007546006870180546001600160a01b03938416803f98509650919092169163a48659cc918691889186908110611de857fe5b9060005260206000200189600201546040518563ffffffff1660e01b8152600401611e169493929190612b5e565b60206040518083038186803b158015611e2e57600080fd5b505afa158015611e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6691906127fb565b6007546040516335a27e0560e01b81529193506001600160a01b0316906335a27e0590611e97908590600401612c64565b60206040518083038186803b158015611eaf57600080fd5b505afa158015611ec3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee791906127db565b15611f77576007546006860180546001600160a01b0390921691638176292f91869188919086908110611f1657fe5b9060005260206000200189600201546040518563ffffffff1660e01b8152600401611f449493929190612b5e565b600060405180830381600087803b158015611f5e57600080fd5b505af1158015611f72573d6000803e3d6000fd5b505050505b600101611d8e565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f85604051611ba09190612c64565b465b90565b60006001611fc184610dca565b6007811115611fcc57fe5b14611fe95760405162461bcd60e51b815260040161075890612ec4565b60028260ff16111561200d5760405162461bcd60e51b815260040161075890612cef565b60008381526009602090815260408083206001600160a01b0388168452600d8101909252909120805460ff16156120565760405162461bcd60e51b815260040161075890612f15565b600854600783015460405163782d6fe160e01b81526000926001600160a01b03169163782d6fe19161208c918b91600401612b2b565b60206040518083038186803b1580156120a457600080fd5b505afa1580156120b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120dc91906127fb565b905060ff8516612107576120fd83600a0154826001600160601b03166121d2565b600a84015561215d565b8460ff16600114156121345761212a8360090154826001600160601b03166121d2565b600984015561215d565b8460ff166002141561215d5761215783600b0154826001600160601b03166121d2565b600b8401555b8154600160ff199091161761ff00191661010060ff9690961695909502949094176dffffffffffffffffffffffff00001916620100006001600160601b0386160217905550909392505050565b6000828211156121cc5760405162461bcd60e51b815260040161075890613557565b50900390565b6000828201838110156121f75760405162461bcd60e51b8152600401610758906131a9565b9392505050565b604051806101c001604052806000815260200160006001600160a01b03168152602001600081526020016060815260200160608152602001606081526020016060815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b8280548282559060005260206000209081019282156122cf579160200282015b828111156122cf57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061229a565b506122db9291506123f8565b5090565b82805482825590600052602060002090810192821561231a579160200282015b8281111561231a5782518255916020019190600101906122ff565b506122db92915061241c565b828054828255906000526020600020908101928215612373579160200282015b828111156123735782518051612363918491602090910190612436565b5091602001919060010190612346565b506122db9291506124a3565b8280548282559060005260206000209081019282156123cc579160200282015b828111156123cc57825180516123bc918491602090910190612436565b509160200191906001019061239f565b506122db9291506124c6565b604080516060810182526000808252602082018190529181019190915290565b611fb191905b808211156122db5780546001600160a01b03191681556001016123fe565b611fb191905b808211156122db5760008155600101612422565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061247757805160ff191683800117855561231a565b8280016001018555821561231a579182018281111561231a5782518255916020019190600101906122ff565b611fb191905b808211156122db5760006124bd82826124e9565b506001016124a9565b611fb191905b808211156122db5760006124e082826124e9565b506001016124cc565b50805460018160011615610100020316600290046000825580601f1061250f575061252d565b601f01602090049060005260206000209081019061252d919061241c565b50565b600082601f830112612540578081fd5b813561255361254e82613753565b61372c565b81815291506020808301908481018184028601820187101561257457600080fd5b60005b8481101561259c57813561258a8161377f565b84529282019290820190600101612577565b505050505092915050565b600082601f8301126125b7578081fd5b81356125c561254e82613753565b818152915060208083019084810160005b8481101561259c576125ed888484358a010161265d565b845292820192908201906001016125d6565b600082601f83011261260f578081fd5b813561261d61254e82613753565b81815291506020808301908481018184028601820187101561263e57600080fd5b60005b8481101561259c57813584529282019290820190600101612641565b600082601f83011261266d578081fd5b813567ffffffffffffffff811115612683578182fd5b612696601f8201601f191660200161372c565b91508082528360208285010111156126ad57600080fd5b8060208401602084013760009082016020015292915050565b803560ff81168114611c2257600080fd5b6000602082840312156126e8578081fd5b81356121f78161377f565b600060208284031215612704578081fd5b81516121f78161377f565b600080600080600060a08688031215612726578081fd5b853567ffffffffffffffff8082111561273d578283fd5b61274989838a01612530565b9650602088013591508082111561275e578283fd5b61276a89838a016125ff565b9550604088013591508082111561277f578283fd5b61278b89838a016125a7565b945060608801359150808211156127a0578283fd5b6127ac89838a016125a7565b935060808801359150808211156127c1578283fd5b506127ce8882890161265d565b9150509295509295909350565b6000602082840312156127ec578081fd5b815180151581146121f7578182fd5b60006020828403121561280c578081fd5b5051919050565b600060208284031215612824578081fd5b5035919050565b6000806040838503121561283d578182fd5b82359150602083013561284f8161377f565b809150509250929050565b6000806040838503121561286c578182fd5b82359150602083013560ff8116811461284f578182fd5b60008060008060608587031215612898578182fd5b843593506128a986602087016126c6565b9250604085013567ffffffffffffffff808211156128c5578384fd5b81870188601f8201126128d6578485fd5b80359250818311156128e6578485fd5b8860208483010111156128f7578485fd5b959894975050602090940194505050565b600080600080600060a0868803121561291f578283fd5b8535945061293087602088016126c6565b935061293f87604088016126c6565b94979396509394606081013594506080013592915050565b6000815180845260208085019450808401835b8381101561298f5781516001600160a01b03168752958201959082019060010161296a565b509495945050505050565b6000815180845260208085018081965082840281019150828601855b858110156129e05782840389526129ce848351612a1c565b988501989350908401906001016129b6565b5091979650505050505050565b6000815180845260208085019450808401835b8381101561298f57815187529582019590820190600101612a00565b60008151808452815b81811015612a4157602081850181015186830182015201612a25565b81811115612a525782602083870101525b50601f01601f19169290920160200192915050565b7f42616c6c6f742875696e743235362070726f706f73616c49642c75696e743820815267737570706f72742960c01b602082015260280190565b61190160f01b81526002810192909252602282015260420190565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0392831681529116602082015260400190565b60006080820160018060a01b03871683526020868185015260806040850152828654600180821660008114612b9a5760018114612bba57612bf5565b612baa607f600285041687612c64565b60ff198416815285019350612bf5565b60028304612bc88188612c64565b612bd18c613773565b895b83811015612bec57815483820152908501908801612bd3565b91909101955050505b50505080935050505082606083015295945050505050565b600060808252612c206080830187612957565b8281036020840152612c3281876129ed565b8381036040850152612c44818761299a565b9150508281036060840152612c59818561299a565b979650505050505050565b90815260200190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b928352602083019190915260ff16604082015260600190565b93845260ff9290921660208401526040830152606082015260800190565b6020810160088310612cd657fe5b91905290565b6000602082526121f76020830184612a1c565b60208082526032908201527f476f7665726e6f72427261766f3a3a63617374566f7465496e7465726e616c3a60408201527120696e76616c696420766f7465207479706560701b606082015260800190565b6020808252602a908201527f476f7665726e6f72427261766f3a5f73657450656e64696e6741646d696e3a2060408201526961646d696e206f6e6c7960b01b606082015260800190565b6020808252602b908201527f476f7665726e6f72427261766f3a3a5f736574566f74696e67506572696f643a60408201526a2061646d696e206f6e6c7960a81b606082015260800190565b6020808252602a908201527f476f7665726e6f72427261766f3a3a5f736574566f74696e6744656c61793a2060408201526961646d696e206f6e6c7960b01b606082015260800190565b6020808252602e908201527f476f7665726e6f72427261766f3a3a696e697469616c697a653a20696e76616c60408201526d696420766f74652071756f72756d60901b606082015260800190565b60208082526036908201527f476f7665726e6f72427261766f3a3a5f736574566f74696e67506572696f643a604082015275081a5b9d985b1a59081d9bdd1a5b99c81c195c9a5bd960521b606082015260800190565b60208082526031908201527f476f7665726e6f72427261766f3a3a63617374566f7465496e7465726e616c3a604082015270081d9bdd1a5b99c81a5cc818db1bdcd959607a1b606082015260800190565b60208082526034908201527f476f7665726e6f72427261766f3a3a63617374566f7465496e7465726e616c3a604082015273081d9bdd195c88185b1c9958591e481d9bdd195960621b606082015260800190565b60208082526034908201527f476f7665726e6f72427261766f3a3a5f736574566f74696e6744656c61793a20604082015273696e76616c696420766f74696e672064656c617960601b606082015260800190565b60208082526045908201527f476f7665726e6f72427261766f3a3a657865637574653a2070726f706f73616c60408201527f2063616e206f6e6c7920626520657865637574656420696620697420697320716060820152641d595d595960da1b608082015260a00190565b6020808252602f908201527f476f7665726e6f72427261766f3a3a63617374566f746542795369673a20696e60408201526e76616c6964207369676e617475726560881b606082015260800190565b60208082526044908201527f476f7665726e6f72427261766f3a3a70726f706f73653a2070726f706f73616c60408201527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d6060820152630c2e8c6d60e31b608082015260a00190565b602080825260409082018190527f476f7665726e6f72427261766f3a3a5f73657450726f706f73616c5468726573908201527f686f6c643a20696e76616c69642070726f706f73616c207468726573686f6c64606082015260800190565b60208082526044908201527f476f7665726e6f72427261766f3a3a71756575653a2070726f706f73616c206360408201527f616e206f6e6c79206265207175657565642069662069742069732073756363656060820152631959195960e21b608082015260a00190565b6020808252601190820152706164646974696f6e206f766572666c6f7760781b604082015260600190565b6020808252602c908201527f476f7665726e6f72427261766f3a3a70726f706f73653a206d7573742070726f60408201526b7669646520616374696f6e7360a01b606082015260800190565b6020808252602e908201527f476f7665726e6f72427261766f3a5f61636365707441646d696e3a2070656e6460408201526d696e672061646d696e206f6e6c7960901b606082015260800190565b6020808252602f908201527f476f7665726e6f72427261766f3a3a63616e63656c3a2070726f706f7365722060408201526e18589bdd99481d1a1c995cda1bdb19608a1b606082015260800190565b60208082526028908201527f476f7665726e6f72427261766f3a3a70726f706f73653a20746f6f206d616e7960408201526720616374696f6e7360c01b606082015260800190565b60208082526059908201527f476f7665726e6f72427261766f3a3a70726f706f73653a206f6e65206c69766560408201527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60608201527f20616c72656164792070656e64696e672070726f706f73616c00000000000000608082015260a00190565b60208082526058908201527f476f7665726e6f72427261766f3a3a70726f706f73653a206f6e65206c69766560408201527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60608201527f20616c7265616479206163746976652070726f706f73616c0000000000000000608082015260a00190565b6020808252603f908201527f476f7665726e6f72427261766f3a3a70726f706f73653a2070726f706f73657260408201527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c6400606082015260800190565b60208082526036908201527f476f7665726e6f72427261766f3a3a63616e63656c3a2063616e6e6f742063616040820152751b98d95b08195e1958dd5d1959081c1c9bdc1bdcd85b60521b606082015260800190565b60208082526030908201527f476f7665726e6f72427261766f3a3a5f73657450726f706f73616c546872657360408201526f686f6c643a2061646d696e206f6e6c7960801b606082015260800190565b60208082526029908201527f476f7665726e6f72427261766f3a3a73746174653a20696e76616c69642070726040820152681bdc1bdcd85b081a5960ba1b606082015260800190565b6020808252601590820152747375627472616374696f6e20756e646572666c6f7760581b604082015260600190565b81511515815260208083015160ff16908201526040918201516001600160601b03169181019190915260600190565b8981526001600160a01b0389166020820152610120604082018190526000906135e08382018b612957565b83810360608501526135f2818b6129ed565b9150508281036080840152613607818961299a565b83810360a0850152613619818961299a565b9150508560c08401528460e084015282810361010084015261363b8185612a1c565b9c9b505050505050505050505050565b998a526001600160a01b039890981660208a015260408901969096526060880194909452608087019290925260a086015260c085015260e0840152151561010083015215156101208201526101400190565b918252602082015260400190565b600086825260ff861660208301526001600160601b038516604083015260806060830152826080830152828460a084013781830160a090810191909152601f909201601f19160101949350505050565b92835260ff9190911660208301526001600160601b0316604082015260806060820181905260009082015260a00190565b60405181810167ffffffffffffffff8111828210171561374b57600080fd5b604052919050565b600067ffffffffffffffff821115613769578081fd5b5060209081020190565b60009081526020902090565b6001600160a01b038116811461252d57600080fdfea2646970667358221220f00733d43a7eb771a6ce590a47ecaeef3d41481129019f4cd1ba66f0b272c92264736f6c63430006070033

Verified Source Code Partial Match

Compiler: v0.6.7+commit.b8d736ae EVM: istanbul Optimization: Yes (200 runs)
GovernorBravo.sol 586 lines
pragma solidity 0.6.7;
pragma experimental ABIEncoderV2;

interface DSDelegateTokenLike {
    function totalSupply() external view returns (uint);
    function getPriorVotes(address account, uint blockNumber) external view returns (uint256);
}

interface DSPauseLike {
    function proxy() external view returns (address);
    function delay() external view returns (uint);
    function scheduleTransaction(address, bytes32, bytes calldata, uint) external;
    function executeTransaction(address, bytes32, bytes calldata, uint) external;
    function abandonTransaction(address, bytes32, bytes calldata, uint) external;
    function authority() external view returns (address);
    function getTransactionDataHash(address, bytes32, bytes calldata, uint) external pure returns (bytes32);
    function scheduledTransactions(bytes32) external view returns (bool);
}

contract GovernorBravoEvents {
    /// @notice An event emitted when a new proposal is created
    event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);

    /// @notice An event emitted when a vote has been cast on a proposal
    /// @param voter The address which casted a vote
    /// @param proposalId The proposal id which was voted on
    /// @param support Support value for the vote. 0=against, 1=for, 2=abstain
    /// @param votes Number of votes which were cast by the voter
    /// @param reason The reason given for the vote by the voter
    event VoteCast(address indexed voter, uint proposalId, uint8 support, uint votes, string reason);

    /// @notice An event emitted when a proposal has been canceled
    event ProposalCanceled(uint id);

    /// @notice An event emitted when a proposal has been queued in the Timelock
    event ProposalQueued(uint id, uint eta);

    /// @notice An event emitted when a proposal has been executed in the Timelock
    event ProposalExecuted(uint id);

    /// @notice An event emitted when the voting delay is set
    event VotingDelaySet(uint oldVotingDelay, uint newVotingDelay);

    /// @notice An event emitted when the voting period is set
    event VotingPeriodSet(uint oldVotingPeriod, uint newVotingPeriod);

    /// @notice Emitted when implementation is changed
    event NewImplementation(address oldImplementation, address newImplementation);

    /// @notice Emitted when proposal threshold is set
    event QuorumVotesSet(uint oldProposalThreshold, uint newProposalThreshold);

    /// @notice Emitted when voting quorum is set
    event ProposalThresholdSet(uint oldQuorumVotes, uint newQuorumVotes);

    /// @notice Emitted when pendingAdmin is changed
    event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);

    /// @notice Emitted when pendingAdmin is accepted, which means admin is updated
    event NewAdmin(address oldAdmin, address newAdmin);

    /// @notice Emitted when timelock is changed
    event NewTimelock(address oldTimelock, address newTimelock);
}

contract GovernorBravoDelegatorStorage {
    /// @notice Administrator for this contract
    address public admin;

    /// @notice Pending administrator for this contract
    address public pendingAdmin;
}

/**
 * @title Storage for Governor Bravo Delegate
 * @notice For future upgrades, do not change GovernorBravoDelegateStorageV1. Create a new
 * contract which implements GovernorBravoDelegateStorageV1 and following the naming convention
 * GovernorBravoDelegateStorageVX.
 */
contract GovernorBravoDelegateStorageV1 is GovernorBravoDelegatorStorage {

    /// @notice The delay before voting on a proposal may take place, once proposed, in blocks
    uint public votingDelay;

    /// @notice The duration of voting on a proposal, in blocks
    uint public votingPeriod;

    /// @notice The number of votes for a proposal required in order for a quorum to be reached and for a vote to succeed
    uint public quorumVotes;

    /// @notice The number of votes required in order for a voter to become a proposer
    uint public proposalThreshold;

    /// @notice The total number of proposals
    uint public proposalCount;

    /// @notice The address of the Protocol Timelock
    DSPauseLike public timelock;

    /// @notice The address of the governance token
    DSDelegateTokenLike public governanceToken;

    /// @notice The official record of all proposals ever proposed
    mapping (uint => Proposal) public proposals;

    /// @notice The latest proposal for each proposer
    mapping (address => uint) public latestProposalIds;


    struct Proposal {
        /// @notice Unique id for looking up a proposal
        uint id;

        /// @notice Creator of the proposal
        address proposer;

        /// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds
        uint eta;

        /// @notice the ordered list of target addresses for calls to be made (USR in dsPause)
        address[] targets;

        /// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made (unused, kept to maintain the interface)
        uint[] values;

        /// @notice The ordered list of function signatures to be called (unused, kept to maintain the interface)
        string[] signatures;

        /// @notice The ordered list of calldata to be passed to each call (parameters in dsPause)
        bytes[] calldatas;

        /// @notice The block at which voting begins: holders must delegate their votes prior to this block
        uint startBlock;

        /// @notice The block at which voting ends: votes must be cast prior to this block
        uint endBlock;

        /// @notice Current number of votes in favor of this proposal
        uint forVotes;

        /// @notice Current number of votes in opposition to this proposal
        uint againstVotes;

        /// @notice Current number of votes for abstaining for this proposal
        uint abstainVotes;

        /// @notice Flag marking whether the proposal has been canceled
        bool canceled;

        /// @notice Flag marking whether the proposal has been executed
        bool executed;

        /// @notice Receipts of ballots for the entire set of voters
        mapping (address => Receipt) receipts;
    }

    /// @notice Ballot receipt record for a voter
    struct Receipt {
        /// @notice Whether or not a vote has been cast
        bool hasVoted;

        /// @notice Whether or not the voter supports the proposal or abstains
        uint8 support;

        /// @notice The number of votes the voter had, which were cast
        uint96 votes;
    }

    /// @notice Possible states that a proposal may be in
    enum ProposalState {
        Pending,
        Active,
        Canceled,
        Defeated,
        Succeeded,
        Queued,
        Expired,
        Executed
    }
}

contract GovernorBravo is GovernorBravoDelegateStorageV1, GovernorBravoEvents {

    /// @notice The name of this contract
    string public constant name = "RAI Governor";

    /// @notice The minimum setable proposal threshold
    uint public constant MIN_PROPOSAL_THRESHOLD = 1000 ether; // 15,000 protocol tokens

    /// @notice The maximum setable proposal threshold
    uint public constant MAX_PROPOSAL_THRESHOLD = 15000 ether; // 50,000 protocol tokens

    /// @notice The minimum setable voting period
    uint public constant MIN_VOTING_PERIOD = 6600; // About 24 hours

    /// @notice The max setable voting period
    uint public constant MAX_VOTING_PERIOD = 46500; // About 7 days

    /// @notice The min setable voting delay
    uint public constant MIN_VOTING_DELAY = 1;

    /// @notice The max setable voting delay
    uint public constant MAX_VOTING_DELAY = 6600; // About 24 hours

    /// @notice The minimum setable proposal threshold
    uint public constant MIN_QUORUM_VOTES = 10000 ether; // 10,000 protocol tokens

    /// @notice The maximum setable proposal threshold
    uint public constant MAX_QUORUM_VOTES = 100000 ether; // 100,000 protocol tokens

    /// @notice The maximum number of actions that can be included in a proposal
    uint public constant proposalMaxOperations = 10; // 10 actions

    /// @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 ballot struct used by the contract
    bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,uint8 support)");

    /**
      * @notice Constructor
      * @param timelock_ The address of the tmelock
      * @param governanceToken_ The address of the (un)governance token
      * @param votingPeriod_ The initial voting period
      * @param votingDelay_ The initial voting delay
      * @param proposalThreshold_ The initial proposal threshold
      */
    constructor(address timelock_, address governanceToken_, uint votingPeriod_, uint votingDelay_, uint quorumVotes_, uint proposalThreshold_) public {
        require(timelock_ != address(0), "GovernorBravo::initialize: invalid timelock address");
        require(governanceToken_ != address(0), "GovernorBravo::initialize: invalid gov token address");
        require(votingPeriod_ >= MIN_VOTING_PERIOD && votingPeriod_ <= MAX_VOTING_PERIOD, "GovernorBravo::initialize: invalid voting period");
        require(votingDelay_ >= MIN_VOTING_DELAY && votingDelay_ <= MAX_VOTING_DELAY, "GovernorBravo::initialize: invalid voting delay");
        require(quorumVotes_ >= MIN_QUORUM_VOTES && quorumVotes_ <= MAX_QUORUM_VOTES, "GovernorBravo::initialize: invalid vote quorum");
        require(proposalThreshold_ >= MIN_PROPOSAL_THRESHOLD && proposalThreshold_ <= MAX_PROPOSAL_THRESHOLD, "GovernorBravo::initialize: invalid proposal threshold");

        timelock = DSPauseLike(timelock_);
        governanceToken = DSDelegateTokenLike(governanceToken_);
        votingPeriod = votingPeriod_;
        votingDelay = votingDelay_;
        quorumVotes = quorumVotes_;
        proposalThreshold = proposalThreshold_;
        admin = timelock.proxy();
    }

    /**
      * @notice Function used to propose a new proposal. Sender must have delegates above the proposal threshold
      * @param targets Target addresses for proposal calls
      * @param calldatas Calldatas for proposal calls
      * @param description String description of the proposal
      * @return Proposal id of new proposal
      */
    function propose(address[] memory targets, uint[] memory /* values */, string[] memory /* signatures */, bytes[] memory calldatas, string memory description) public returns (uint) {
        require(governanceToken.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold, "GovernorBravo::propose: proposer votes below proposal threshold");
        require(targets.length == calldatas.length, "GovernorBravo::propose: proposal function information arity mismatch");
        require(targets.length != 0, "GovernorBravo::propose: must provide actions");
        require(targets.length <= proposalMaxOperations, "GovernorBravo::propose: too many actions");

        uint latestProposalId = latestProposalIds[msg.sender];
        if (latestProposalId != 0) {
          ProposalState proposersLatestProposalState = state(latestProposalId);
          require(proposersLatestProposalState != ProposalState.Active, "GovernorBravo::propose: one live proposal per proposer, found an already active proposal");
          require(proposersLatestProposalState != ProposalState.Pending, "GovernorBravo::propose: one live proposal per proposer, found an already pending proposal");
        }

        uint startBlock = add256(block.number, votingDelay);
        uint endBlock = add256(startBlock, votingPeriod);

        proposalCount++;
        Proposal memory newProposal = Proposal({
            id: proposalCount,
            proposer: msg.sender,
            eta: 0,
            targets: targets,
            values: new uint[](0),
            signatures: new string[](0),
            calldatas: calldatas,
            startBlock: startBlock,
            endBlock: endBlock,
            forVotes: 0,
            againstVotes: 0,
            abstainVotes: 0,
            canceled: false,
            executed: false
        });

        proposals[newProposal.id] = newProposal;
        latestProposalIds[newProposal.proposer] = newProposal.id;

        emit ProposalCreated(newProposal.id, msg.sender, targets, new uint[](0), new string[](0), calldatas, startBlock, endBlock, description);
        return newProposal.id;
    }

    /**
      * @notice Queues a proposal of state succeeded
      * @param proposalId The id of the proposal to queue
      */
    function queue(uint proposalId) external {
        require(state(proposalId) == ProposalState.Succeeded, "GovernorBravo::queue: proposal can only be queued if it is succeeded");
        Proposal storage proposal = proposals[proposalId];
        uint eta = add256(block.timestamp, timelock.delay());
        bytes32 codeHash;
        address usr;
        for (uint i = 0; i < proposal.targets.length; i++) {
            usr = proposal.targets[i];
            assembly { codeHash := extcodehash(usr) }
            timelock.scheduleTransaction(usr, codeHash, proposal.calldatas[i], eta);
        }
        proposal.eta = eta;
        emit ProposalQueued(proposalId, eta);
    }

    /**
      * @notice Executes a queued proposal if eta has passed
      * @param proposalId The id of the proposal to execute
      */
    function execute(uint proposalId) external payable {
        require(state(proposalId) == ProposalState.Queued, "GovernorBravo::execute: proposal can only be executed if it is queued");
        Proposal storage proposal = proposals[proposalId];
        proposal.executed = true;

        bytes32 codeHash;
        address usr;
        bytes32 scheduledTransactionHash;
        for (uint i = 0; i < proposal.targets.length; i++) {
            usr = proposal.targets[i];
            assembly { codeHash := extcodehash(usr) }
            scheduledTransactionHash = timelock.getTransactionDataHash(usr, codeHash, proposal.calldatas[i], proposal.eta);
            if (timelock.scheduledTransactions(scheduledTransactionHash)) // will skip proposals already executed straight into pause
                timelock.executeTransaction(usr, codeHash, proposal.calldatas[i], proposal.eta);
        }
        emit ProposalExecuted(proposalId);
    }

    /**
      * @notice Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold
      * @param proposalId The id of the proposal to cancel
      */
    function cancel(uint proposalId) external {
        require(state(proposalId) != ProposalState.Executed, "GovernorBravo::cancel: cannot cancel executed proposal");

        Proposal storage proposal = proposals[proposalId];
        require(msg.sender == proposal.proposer || governanceToken.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold, "GovernorBravo::cancel: proposer above threshold");
        proposal.canceled = true;

        if (state(proposalId) == ProposalState.Queued) {
            bytes32 codeHash;
            address usr;
            for (uint i = 0; i < proposal.targets.length; i++) {
                usr = proposal.targets[i];
                assembly { codeHash := extcodehash(usr) }
                timelock.abandonTransaction(usr, codeHash, proposal.calldatas[i], proposal.eta);
            }
        }

        emit ProposalCanceled(proposalId);
    }

    /**
      * @notice Gets actions of a proposal
      * @param proposalId the id of the proposal
      * @return Targets, values, signatures, and calldatas of the proposal actions
      */
    function getActions(uint proposalId) external view returns (address[] memory, uint[] memory, string[] memory, bytes[] memory) {
        Proposal storage p = proposals[proposalId];
        return (p.targets, p.values, p.signatures, p.calldatas);
    }

    /**
      * @notice Gets the receipt for a voter on a given proposal
      * @param proposalId the id of proposal
      * @param voter The address of the voter
      * @return The voting receipt
      */
    function getReceipt(uint proposalId, address voter) external view returns (Receipt memory) {
        return proposals[proposalId].receipts[voter];
    }

    /**
      * @notice Gets the state of a proposal
      * @param proposalId The id of the proposal
      * @return Proposal state
      */
    function state(uint proposalId) public view returns (ProposalState) {
        require(proposalCount >= proposalId, "GovernorBravo::state: invalid proposal id");
        Proposal storage proposal = proposals[proposalId];
        if (proposal.canceled) {
            return ProposalState.Canceled;
        } else if (block.number <= proposal.startBlock) {
            return ProposalState.Pending;
        } else if (block.number <= proposal.endBlock) {
            return ProposalState.Active;
        } else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes) {
            return ProposalState.Defeated;
        } else if (proposal.eta == 0) {
            return ProposalState.Succeeded;
        } else if (proposal.executed) {
            return ProposalState.Executed;
        } else {
            return ProposalState.Queued;
        }
    }

    /**
      * @notice Cast a vote for a proposal
      * @param proposalId The id of the proposal to vote on
      * @param support The support value for the vote. 0=against, 1=for, 2=abstain
      */
    function castVote(uint proposalId, uint8 support) external {
        emit VoteCast(msg.sender, proposalId, support, castVoteInternal(msg.sender, proposalId, support), "");
    }

    /**
      * @notice Cast a vote for a proposal with a reason
      * @param proposalId The id of the proposal to vote on
      * @param support The support value for the vote. 0=against, 1=for, 2=abstain
      * @param reason The reason given for the vote by the voter
      */
    function castVoteWithReason(uint proposalId, uint8 support, string calldata reason) external {
        emit VoteCast(msg.sender, proposalId, support, castVoteInternal(msg.sender, proposalId, support), reason);
    }

    /**
      * @notice Cast a vote for a proposal by signature
      * @dev External function that accepts EIP-712 signatures for voting on proposals.
      */
    function castVoteBySig(uint proposalId, uint8 support, uint8 v, bytes32 r, bytes32 s) external {
        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainIdInternal(), address(this)));
        bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "GovernorBravo::castVoteBySig: invalid signature");
        emit VoteCast(signatory, proposalId, support, castVoteInternal(signatory, proposalId, support), "");
    }

    /**
      * @notice Internal function that caries out voting logic
      * @param voter The voter that is casting their vote
      * @param proposalId The id of the proposal to vote on
      * @param support The support value for the vote. 0=against, 1=for, 2=abstain
      * @return The number of votes cast
      */
    function castVoteInternal(address voter, uint proposalId, uint8 support) internal returns (uint96) {
        require(state(proposalId) == ProposalState.Active, "GovernorBravo::castVoteInternal: voting is closed");
        require(support <= 2, "GovernorBravo::castVoteInternal: invalid vote type");
        Proposal storage proposal = proposals[proposalId];
        Receipt storage receipt = proposal.receipts[voter];
        require(receipt.hasVoted == false, "GovernorBravo::castVoteInternal: voter already voted");
        uint96 votes = uint96(governanceToken.getPriorVotes(voter, proposal.startBlock));

        if (support == 0) {
            proposal.againstVotes = add256(proposal.againstVotes, votes);
        } else if (support == 1) {
            proposal.forVotes = add256(proposal.forVotes, votes);
        } else if (support == 2) {
            proposal.abstainVotes = add256(proposal.abstainVotes, votes);
        }

        receipt.hasVoted = true;
        receipt.support = support;
        receipt.votes = votes;

        return votes;
    }

    /**
      * @notice Admin function for setting the voting delay
      * @param newVotingDelay new voting delay, in blocks
      */
    function _setVotingDelay(uint newVotingDelay) external {
        require(msg.sender == admin, "GovernorBravo::_setVotingDelay: admin only");
        require(newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY, "GovernorBravo::_setVotingDelay: invalid voting delay");
        emit VotingDelaySet(votingDelay, newVotingDelay);
        votingDelay = newVotingDelay;
    }

    /**
      * @notice Admin function for setting the voting period
      * @param newVotingPeriod new voting period, in blocks
      */
    function _setVotingPeriod(uint newVotingPeriod) external {
        require(msg.sender == admin, "GovernorBravo::_setVotingPeriod: admin only");
        require(newVotingPeriod >= MIN_VOTING_PERIOD && newVotingPeriod <= MAX_VOTING_PERIOD, "GovernorBravo::_setVotingPeriod: invalid voting period");
        emit VotingPeriodSet(votingPeriod, newVotingPeriod);
        votingPeriod = newVotingPeriod;
    }

    /**
      * @notice Admin function for setting the vote quorum to validate a proposal
      * @dev newQuorumVotes must be greater than the hardcoded min
      * @param newQuorumVotes new proposal quorum
      */
    function _setQuorumVotes(uint newQuorumVotes) external {
        require(msg.sender == admin, "GovernorBravo::_setProposalThreshold: admin only");
        require(newQuorumVotes >= MIN_QUORUM_VOTES && newQuorumVotes <= MAX_QUORUM_VOTES, "GovernorBravo::initialize: invalid vote quorum");
        emit QuorumVotesSet(quorumVotes, newQuorumVotes);
        quorumVotes = newQuorumVotes;
    }

    /**
      * @notice Admin function for setting the proposal threshold
      * @dev newProposalThreshold must be greater than the hardcoded min
      * @param newProposalThreshold new proposal threshold
      */
    function _setProposalThreshold(uint newProposalThreshold) external {
        require(msg.sender == admin, "GovernorBravo::_setProposalThreshold: admin only");
        require(newProposalThreshold >= MIN_PROPOSAL_THRESHOLD && newProposalThreshold <= MAX_PROPOSAL_THRESHOLD, "GovernorBravo::_setProposalThreshold: invalid proposal threshold");
        emit ProposalThresholdSet(proposalThreshold, newProposalThreshold);
        proposalThreshold = newProposalThreshold;
    }

    /**
      * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
      * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
      * @param newPendingAdmin New pending admin.
      */
    function _setPendingAdmin(address newPendingAdmin) external {
        // Check caller = admin
        require(msg.sender == admin, "GovernorBravo:_setPendingAdmin: admin only");

        // Save current value, if any, for inclusion in log
        address oldPendingAdmin = pendingAdmin;

        // Store pendingAdmin with value newPendingAdmin
        pendingAdmin = newPendingAdmin;

        // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
        emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
    }

    /**
      * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
      * @dev Admin function for pending admin to accept role and update admin
      */
    function _acceptAdmin() external {
        // Check caller is pendingAdmin and pendingAdmin ≠ address(0)
        require(msg.sender == pendingAdmin && msg.sender != address(0), "GovernorBravo:_acceptAdmin: pending admin only");

        // Save current values for inclusion in log
        address oldAdmin = admin;
        address oldPendingAdmin = pendingAdmin;

        // Store admin with value pendingAdmin
        admin = pendingAdmin;

        // Clear the pending value
        pendingAdmin = address(0);

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

    /**
      * @notice Admin function for changing the timelock address
      * @dev If timelock.proxy() is the admin, it is also swapped for newTimelock.proxy()
      * @param newTimelock new timelock address
      */
    function _setTimelock(address newTimelock) external {
        require(msg.sender == admin, "GovernorBravo::_setProposalThreshold: admin only");

        // if admin is timelock.proxy also swap it
        if (admin == timelock.proxy()) {
            admin = DSPauseLike(newTimelock).proxy();
            emit NewAdmin(timelock.proxy(), admin);
        }

        emit NewTimelock(address(timelock), newTimelock);
        timelock = DSPauseLike(newTimelock);
    }

    function add256(uint256 a, uint256 b) internal pure returns (uint) {
        uint c = a + b;
        require(c >= a, "addition overflow");
        return c;
    }

    function sub256(uint256 a, uint256 b) internal pure returns (uint) {
        require(b <= a, "subtraction underflow");
        return a - b;
    }

    function getChainIdInternal() internal pure returns (uint) {
        uint chainId;
        assembly { chainId := chainid() }
        return chainId;
    }
}

Read Contract

BALLOT_TYPEHASH 0xdeaaa7cc → bytes32
DOMAIN_TYPEHASH 0x20606b70 → bytes32
MAX_PROPOSAL_THRESHOLD 0x25fd935a → uint256
MAX_QUORUM_VOTES 0x6979c951 → uint256
MAX_VOTING_DELAY 0xb1126263 → uint256
MAX_VOTING_PERIOD 0xa64e024a → uint256
MIN_PROPOSAL_THRESHOLD 0x791f5d23 → uint256
MIN_QUORUM_VOTES 0xf4e10268 → uint256
MIN_VOTING_DELAY 0xe48083fe → uint256
MIN_VOTING_PERIOD 0x215809ca → uint256
admin 0xf851a440 → address
getActions 0x328dd982 → address[], uint256[], string[], bytes[]
getReceipt 0xe23a9a52 → tuple
governanceToken 0xf96dae0a → address
latestProposalIds 0x17977c61 → uint256
name 0x06fdde03 → string
pendingAdmin 0x26782247 → address
proposalCount 0xda35c664 → uint256
proposalMaxOperations 0x7bdbe4d0 → uint256
proposalThreshold 0xb58131b0 → uint256
proposals 0x013cf08b → uint256, address, uint256, uint256, uint256, uint256, uint256, uint256, bool, bool
quorumVotes 0x24bc1a64 → uint256
state 0x3e4f49e6 → uint8
timelock 0xd33219b4 → address
votingDelay 0x3932abb1 → uint256
votingPeriod 0x02a251a3 → uint256

Write Contract 14 functions

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

_acceptAdmin 0xe9c714f2
No parameters
_setPendingAdmin 0xb71d1a0c
address newPendingAdmin
_setProposalThreshold 0x17ba1b8b
uint256 newProposalThreshold
_setQuorumVotes 0x86d37e8b
uint256 newQuorumVotes
_setTimelock 0x87bae18f
address newTimelock
_setVotingDelay 0x1dfb1b5a
uint256 newVotingDelay
_setVotingPeriod 0x0ea2d98c
uint256 newVotingPeriod
cancel 0x40e58ee5
uint256 proposalId
castVote 0x56781388
uint256 proposalId
uint8 support
castVoteBySig 0x3bccf4fd
uint256 proposalId
uint8 support
uint8 v
bytes32 r
bytes32 s
castVoteWithReason 0x7b3c71d3
uint256 proposalId
uint8 support
string reason
execute 0xfe0d94c1
uint256 proposalId
propose 0xda95691a
address[] targets
uint256[]
string[]
bytes[] calldatas
string description
returns: uint256
queue 0xddf0b009
uint256 proposalId

Recent Transactions

No transactions found for this address