diff --git a/common/constants.go b/common/constants.go index e3e2d8c04de5..642f8f6431dc 100644 --- a/common/constants.go +++ b/common/constants.go @@ -52,6 +52,7 @@ var BerlinBlock = big.NewInt(76321000) // Target 19th June 2024 var LondonBlock = big.NewInt(76321000) // Target 19th June 2024 var MergeBlock = big.NewInt(76321000) // Target 19th June 2024 var ShanghaiBlock = big.NewInt(76321000) // Target 19th June 2024 +var ValidtorV2SMCBlock = big.NewInt(9999999999) var TIPXDCXTestnet = big.NewInt(38383838) var IsTestnet bool = false diff --git a/common/constants/constants.go.devnet b/common/constants/constants.go.devnet index d0a585cc9a76..b863edae0909 100644 --- a/common/constants/constants.go.devnet +++ b/common/constants/constants.go.devnet @@ -52,6 +52,7 @@ var LondonBlock = big.NewInt(16832700) var MergeBlock = big.NewInt(16832700) var ShanghaiBlock = big.NewInt(16832700) var Eip1559Block = big.NewInt(9999999999) +var ValidtorV2SMCBlock = big.NewInt(22320000) var TIPXDCXTestnet = big.NewInt(0) var IsTestnet bool = false @@ -77,6 +78,7 @@ var TRC21IssuerSMCTestNet = HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44 var TRC21IssuerSMC = HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee") var XDCXListingSMC = HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53") var XDCXListingSMCTestNet = HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0") + var TRC21GasPriceBefore = big.NewInt(2500) var TRC21GasPrice = big.NewInt(250000000) var RateTopUp = big.NewInt(90) // 90% diff --git a/common/constants/constants.go.testnet b/common/constants/constants.go.testnet index a7e9fb64ba46..ecf7e91e6cfd 100644 --- a/common/constants/constants.go.testnet +++ b/common/constants/constants.go.testnet @@ -52,6 +52,7 @@ var LondonBlock = big.NewInt(61290000) var MergeBlock = big.NewInt(61290000) var ShanghaiBlock = big.NewInt(61290000) // Target 31st March 2024 var Eip1559Block = big.NewInt(9999999999) +var ValidtorV2SMCBlock = big.NewInt(9999999999) var TIPXDCXTestnet = big.NewInt(23779191) var IsTestnet bool = true diff --git a/common/types.go b/common/types.go index c7abab289b9a..fd2e15852dbe 100644 --- a/common/types.go +++ b/common/types.go @@ -48,6 +48,8 @@ const ( SignMethod = "0xe341eaa4" XDCXApplyMethod = "0xc6b32f34" XDCZApplyMethod = "0xc6b32f34" + XDCValidatorV2Code = "0x6080604052600436106102035763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663012679518114610208578063025e7c271461021e57806302aa9be21461025257806306a49fce146102765780630999ec79146102db5780630db02622146102f05780630e3e4fb81461031757806315febd68146103525780631c68951c1461036a5780632a3640b11461040a5780632d15cc041461042e5780632f54bf6e1461044f5780632f9c4bba1461048b578063302b6872146104a057806332658652146104c75780633477ee2e1461055d5780634110a48914610575578063441a3e70146105be57806358e7525f146105d95780635b860d27146105fa5780635b9cd8cc1461061b5780635c134d661461063f57806367134e7014610663578063681d8bf2146106845780636dd7d8ea1461069957806372e44a38146106ad578063935ad0d1146106ce578063a9a981a3146106e3578063a9ff959e146106f8578063ae6e43f51461070d578063b622f1411461072e578063b642facd1461074f578063c45607df14610770578063d09f1ab414610791578063d161c767146107a6578063d51b9e93146107bb578063d55b7dff146107dc578063db11daef146107f1578063ef18374a14610812578063f2ee3c7d14610827578063f5c9512514610848578063f8ac9dd514610868575b600080fd5b61021c600160a060020a036004351661087d565b005b34801561022a57600080fd5b50610236600435610c7e565b60408051600160a060020a039092168252519081900360200190f35b34801561025e57600080fd5b5061021c600160a060020a0360043516602435610ca6565b34801561028257600080fd5b5061028b610f32565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102c75781810151838201526020016102af565b505050509050019250505060405180910390f35b3480156102e757600080fd5b5061021c610f95565b3480156102fc57600080fd5b5061030561107d565b60408051918252519081900360200190f35b34801561032357600080fd5b5061033e600160a060020a0360043581169060243516611083565b604080519115158252519081900360200190f35b34801561035e57600080fd5b506103056004356110a3565b34801561037657600080fd5b5061038b600160a060020a03600435166110c2565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103ce5781810151838201526020016103b6565b50505050905090810190601f1680156103fb5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561041657600080fd5b50610236600160a060020a0360043516602435611169565b34801561043a57600080fd5b5061028b600160a060020a03600435166111a0565b34801561045b57600080fd5b50610470600160a060020a0360043516611216565b60408051921515835260208301919091528051918290030190f35b34801561049757600080fd5b5061028b61127b565b3480156104ac57600080fd5b50610305600160a060020a03600435811690602435166112dc565b3480156104d357600080fd5b506104e8600160a060020a036004351661130b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561052257818101518382015260200161050a565b50505050905090810190601f16801561054f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056957600080fd5b50610236600435611441565b34801561058157600080fd5b50610596600160a060020a036004351661144f565b60408051600160a060020a039094168452911515602084015282820152519081900360600190f35b3480156105ca57600080fd5b5061021c60043560243561147e565b3480156105e557600080fd5b50610305600160a060020a0360043516611769565b34801561060657600080fd5b50610305600160a060020a0360043516611788565b34801561062757600080fd5b506104e8600160a060020a0360043516602435611885565b34801561064b57600080fd5b50610236600160a060020a036004351660243561193b565b34801561066f57600080fd5b50610305600160a060020a0360043516611956565b34801561069057600080fd5b5061021c611971565b61021c600160a060020a0360043516611a53565b3480156106b957600080fd5b50610305600160a060020a0360043516611cb4565b3480156106da57600080fd5b5061021c611cc6565b3480156106ef57600080fd5b50610305611fc5565b34801561070457600080fd5b50610305611fcb565b34801561071957600080fd5b5061021c600160a060020a0360043516611fd1565b34801561073a57600080fd5b5061033e600160a060020a03600435166123b7565b34801561075b57600080fd5b50610236600160a060020a03600435166123cc565b34801561077c57600080fd5b50610305600160a060020a03600435166123ea565b34801561079d57600080fd5b50610305612405565b3480156107b257600080fd5b5061030561240b565b3480156107c757600080fd5b5061033e600160a060020a0360043516612411565b3480156107e857600080fd5b50610305612436565b3480156107fd57600080fd5b5061033e600160a060020a036004351661243c565b34801561081e57600080fd5b50610305612451565b34801561083357600080fd5b5061021c600160a060020a0360043516612457565b34801561085457600080fd5b5061021c600480356024810191013561294f565b34801561087457600080fd5b50610305612a32565b600b546000903410156108da576040805160e560020a62461bcd02815260206004820152601560248201527f496e76616c69642043616e646964617465204361700000000000000000000000604482015290519081900360640190fd5b33600090815260036020526040902054151580610904575033600090815260066020526040812054115b151561095a576040805160e560020a62461bcd02815260206004820152601060248201527f4b5943206e6f742075706c6f6164656400000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038216600090815260116020526040902054829060ff16156109bb576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612ee2833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff1615610a33576040805160e560020a62461bcd02815260206004820152601360248201527f416c726561647920612063616e64696461746500000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831660009081526001602081905260409091200154610a60903463ffffffff612a3816565b6008805460018181019092557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3018054600160a060020a03808816600160a060020a03199283168117909355604080516060810182523380825260208281018881528385018a81526000988952898352858920945185549251151560a060020a0274ff0000000000000000000000000000000000000000199190981692909816919091179690961694909417825593519581019590955591835260029093019092522054909250610b37903463ffffffff612a3816565b600160a060020a038416600090815260016020818152604080842033855260020190915290912091909155600954610b749163ffffffff612a3816565b600955336000908152600660205260409020541515610bda5760078054600181810183556000929092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688018054600160a060020a03191633179055600a805490910190555b336000818152600660209081526040808320805460018181018355918552838520018054600160a060020a038a16600160a060020a031991821681179092558186526002855283862080549384018155865294849020909101805490941685179093558051938452908301919091523482820152517f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c19181900360600190a1505050565b6007805482908110610c8c57fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a038216600090815260016020908152604080832033845260020190915281205483908390811115610d28576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c696420566f74650000000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a0382811660009081526001602052604090205416331415610dda57600b54600160a060020a0383166000908152600160209081526040808320338452600201909152902054610d84908363ffffffff612a4e16565b1015610dda576040805160e560020a62461bcd02815260206004820181905260248201527f4d696e696d756d206361702073686f756c64206265206d61696e7461696e6564604482015290519081900360640190fd5b600160a060020a03851660009081526001602081905260409091200154610e07908563ffffffff612a4e16565b600160a060020a038616600090815260016020818152604080842092830194909455338352600290910190522054610e45908563ffffffff612a4e16565b600160a060020a0386166000908152600160209081526040808320338452600201909152902055600f54610e7f904363ffffffff612a3816565b33600090815260208181526040808320848452909152902054909350610eab908563ffffffff612a3816565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a0388169282019290925280820186905290517faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa29181900360600190a15050505050565b60606008805480602002602001604051908101604052809291908181526020018280548015610f8a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610f6c575b505050505090505b90565b6060600080600880549050604051908082528060200260200182016040528015610fc9578160200160208202803883390190505b50925060009150600090505b60085481101561106557600880546000919083908110610ff157fe5b600091825260209091200154600160a060020a03161461105d57600880548290811061101957fe5b6000918252602090912001548351600160a060020a039091169084908490811061103f57fe5b600160a060020a039092166020928302909101909101526001909101905b600101610fd5565b81835261107760086020850184612cfa565b50505050565b600a5481565b600560209081526000928352604080842090915290825290205460ff1681565b336000908152602081815260408083208484529091529020545b919050565b6012602090815260009182526040918290208054600180830180548651600293821615610100026000190190911692909204601f81018690048602830186019096528582529194929390929083018282801561115f5780601f106111345761010080835404028352916020019161115f565b820191906000526020600020905b81548152906001019060200180831161114257829003601f168201915b5050505050905082565b60066020528160005260406000208181548110151561118457fe5b600091825260209091200154600160a060020a03169150829050565b600160a060020a03811660009081526002602090815260409182902080548351818402810184019094528084526060939283018282801561120a57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116111ec575b50505050509050919050565b600080805b60075481101561126d5783600160a060020a031660078281548110151561123e57fe5b600091825260209091200154600160a060020a031614156112655760018192509250611275565b60010161121b565b600092508291505b50915091565b3360009081526020818152604091829020600101805483518184028101840190945280845260609392830182828015610f8a57602002820191906000526020600020905b8154815260200190600101908083116112bf575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b606061131682612411565b156114195760036000611328846123cc565b600160a060020a0316600160a060020a03168152602001908152602001600020600160036000611357866123cc565b600160a060020a03168152602081019190915260400160002054825491900390811061137f57fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561140d5780601f106113e25761010080835404028352916020019161140d565b820191906000526020600020905b8154815290600101906020018083116113f057829003601f168201915b505050505090506110bd565b600160a060020a03821660009081526003602052604090208054600019810190811061137f57fe5b6008805482908110610c8c57fe5b60016020819052600091825260409091208054910154600160a060020a0382169160a060020a900460ff169083565b336000908152601060205260408120548390839060ff16156114ea576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b60008211611542576040805160e560020a62461bcd02815260206004820152601460248201527f496e76616c696420626c6f636b206e756d626572000000000000000000000000604482015290519081900360640190fd5b438211156115c0576040805160e560020a62461bcd02815260206004820152603560248201527f426c6f636b206e756d6265722073686f756c64206265206c657373207468616e60448201527f2063757272656e7420626c6f636b206e756d6265720000000000000000000000606482015290519081900360840190fd5b336000908152602081815260408083208584529091528120541161162e576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f2063617020746f2077697468647261770000000000000000000000000000604482015290519081900360640190fd5b33600090815260208190526040902060010180548391908390811061164f57fe5b90600052602060002001541415156116b1576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c696420696e64657800000000000000000000000000000000000000604482015290519081900360640190fd5b33600081815260208181526040808320898452808352908320805490849055938352919052600101805491945090859081106116e957fe5b60009182526020822001819055604051339185156108fc02918691818181858888f19350505050158015611721573d6000803e3d6000fd5b50604080513381526020810187905280820185905290517ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360600190a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600160a060020a038116600090815260116020526040812054829060ff16156117e9576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612ee2833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611850576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612ee2833981519152604482015290519081900360640190fd5b611858612451565b600160a060020a03841660009081526004602052604090205460640281151561187d57fe5b049392505050565b6003602052816000526040600020818154811015156118a057fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529450909250908301828280156119335780601f1061190857610100808354040283529160200191611933565b820191906000526020600020905b81548152906001019060200180831161191657829003601f168201915b505050505081565b60026020528160005260406000208181548110151561118457fe5b600160a060020a031660009081526006602052604090205490565b60606000806007805490506040519080825280602002602001820160405280156119a5578160200160208202803883390190505b50925060009150600090505b600754811015611a41576007805460009190839081106119cd57fe5b600091825260209091200154600160a060020a031614611a395760078054829081106119f557fe5b6000918252602090912001548351600160a060020a0390911690849084908110611a1b57fe5b600160a060020a039092166020928302909101909101526001909101905b6001016119b1565b81835261107760076020850184612cfa565b600c54341015611aad576040805160e560020a62461bcd02815260206004820152601160248201527f496e76616c696420566f74657220436170000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038116600090815260116020526040902054819060ff1615611b0e576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612ee2833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611b75576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612ee2833981519152604482015290519081900360640190fd5b600160a060020a03821660009081526001602081905260409091200154611ba2903463ffffffff612a3816565b600160a060020a0383166000908152600160208181526040808420928301949094553383526002909101905220541515611c0f57600160a060020a0382166000908152600260209081526040822080546001810182559083529120018054600160a060020a031916331790555b600160a060020a0382166000908152600160209081526040808320338452600201909152902054611c46903463ffffffff612a3816565b600160a060020a0383166000818152600160209081526040808320338085526002909101835292819020949094558351918252810191909152348183015290517f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc9181900360600190a15050565b60046020526000908152604090205481565b336000908152601060205260408120546060919060ff1615611d32576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b33600090815260126020908152604091829020600190810180548451600293821615610100026000190190911692909204601f810184900484028301840190945283825290929091830182828015611dcb5780601f10611da057610100808354040283529160200191611dcb565b820191906000526020600020905b815481529060010190602001808311611dae57829003601f168201915b505033600090815260126020526040812054855195975095509093119250611e40915050576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f204b59432075706c6f616465640000000000000000000000000000000000604482015290519081900360640190fd5b6206978081014311611e9c576040805160e560020a62461bcd02815260206004820152601460248201527f4b5943206e6f7420766572696669656420796574000000000000000000000000604482015290519081900360640190fd5b336000818152601260208181526040808420848155815180840192839052858152959094529190529151611ed69260019092019190612d5f565b5033600090815260036020908152604082208054600181018083559184529282902085519193611f0c9391019190860190612d5f565b50507f949360d814b28a3b393a68909efe1fee120ee09cac30f360a0f80ab5415a611a33836040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611f86578181015183820152602001611f6e565b50505050905090810190601f168015611fb35780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b60095481565b600f5481565b600160a060020a03808216600090815260016020526040812054909182918291829182918791163314612074576040805160e560020a62461bcd02815260206004820152602160248201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60448201527f6e00000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038716600090815260016020526040902054879060a060020a900460ff161515612115576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0388166000908152600160208190526040909120805474ff00000000000000000000000000000000000000001916905560095461215e9163ffffffff612a4e16565b60095561216a88612a60565b3360009081526006602052604081208054909850965094505b8585101561226e5787600160a060020a031687868154811015156121a357fe5b600091825260209091200154600160a060020a031614156122635786600187038154811015156121cf57fe5b6000918252602090912001548754600160a060020a03909116908890879081106121f557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550866001870381548110151561223457fe5b60009182526020909120018054600160a060020a0319169055865461225d886000198301612dd9565b5061226e565b600190940193612183565b8654151561227f5761227f33612b54565b600160a060020a0388166000818152600160208181526040808420338552600281018352908420549490935281905201549094506122c3908563ffffffff612a4e16565b600160a060020a0389166000908152600160208181526040808420928301949094553383526002909101905290812055600e54612306904363ffffffff612a3816565b33600090815260208181526040808320848452909152902054909350612332908563ffffffff612a3816565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a038b169282019290925281517f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3929181900390910190a15050505050505050565b60116020526000908152604090205460ff1681565b600160a060020a039081166000908152600160205260409020541690565b600160a060020a031660009081526003602052604090205490565b600d5481565b600e5481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b600b5481565b60106020526000908152604090205460ff1681565b600a5490565b33600081815260116020526040812054909182918291829182916060918291849182919060ff16156124c1576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612ee2833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515612528576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612ee2833981519152604482015290519081900360640190fd5b612531336123cc565b9950600560008b600160a060020a0316600160a060020a0316815260200190815260200160002060008c600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460ff161515156125e0576040805160e560020a62461bcd02815260206004820152600d60248201527f416c726561647920766f74656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03808b166000908152600560209081526040808320938f168352928152828220805460ff19166001908117909155600490915291902080549091019055604b61262e612451565b600160a060020a038d1660009081526004602052604090205460640281151561265357fe5b041061294257600160a060020a038b166000818152601060209081526040808320805460ff1916600190811790915560128084528285208581558351808601948590528681529690955290925292516126b193929091019190612d5f565b506126bb8b611216565b98509850881561294257600854604080518281526020808402820101909152600098508897509080156126f8578160200160208202803883390190505b506008546040805182815260208084028201019091529196508015612727578160200160208202803883390190505b509350600092505b60085483101561288f57600880548490811061274757fe5b600091825260209091200154600160a060020a0390811692508b1661276b836123cc565b600160a060020a031614156128585760095461278e90600163ffffffff612a4e16565b60095584516001870196839187919081106127a557fe5b600160a060020a0392831660209182029092018101919091528382166000908152601182526040808220805460ff19166001908117909155808452818320805474ffffffffffffffffffffffffffffffffffffffffff1916815501829055928e168152600390915290812061281991612dfd565b600160a060020a038b16600090815260066020526040812061283a91612e1e565b600160a060020a038b16600090815260046020526040812055612884565b835160018801978391869190811061286c57fe5b600160a060020a039092166020928302909101909101525b60019092019161272f565b86845285855283516128a8906008906020870190612cfa565b506128b288612c4d565b7fe18d61a5bf4aa2ab40afc88aa9039d27ae17ff4ec1c65f5f414df6f02ce8b35e8b866040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561292d578181015183820152602001612915565b50505050905001935050505060405180910390a15b5050505050505050505050565b3360009081526010602052604090205460ff16156129b7576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b604080519081016040528043815260200183838080601f01602080910402602001604051908101604052809392919081815260200183838082843750505092909352505033600090815260126020908152604090912083518155838201518051919350612a2b926001850192910190612d5f565b5050505050565b600c5481565b600082820183811015612a4757fe5b9392505050565b600082821115612a5a57fe5b50900390565b60085460005b81811015612b4f5782600160a060020a0316600882815481101515612a8757fe5b600091825260209091200154600160a060020a03161415612b4757600880546000198401908110612ab457fe5b60009182526020909120015460088054600160a060020a039092169183908110612ada57fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600880546000198401908110612b1557fe5b60009182526020909120018054600160a060020a03191690556008805490612b41906000198301612dd9565b50612b4f565b600101612a66565b505050565b60075460005b81811015612b4f5782600160a060020a0316600782815481101515612b7b57fe5b600091825260209091200154600160a060020a03161415612c4557600780546000198401908110612ba857fe5b60009182526020909120015460078054600160a060020a039092169183908110612bce57fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600780546000198401908110612c0957fe5b60009182526020909120018054600160a060020a03191690556007805490612c35906000198301612dd9565b50600a8054600019019055612b4f565b600101612b5a565b600780546000198101919082908110612c6257fe5b60009182526020909120015460078054600160a060020a039092169184908110612c8857fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556007805482908110612cbf57fe5b60009182526020909120018054600160a060020a03191690556007805490612ceb906000198301612dd9565b5050600a805460001901905550565b828054828255906000526020600020908101928215612d4f579160200282015b82811115612d4f5782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190612d1a565b50612d5b929150612e3c565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612da057805160ff1916838001178555612dcd565b82800160010185558215612dcd579182015b82811115612dcd578251825591602001919060010190612db2565b50612d5b929150612e60565b815481835581811115612b4f57600083815260209020612b4f918101908301612e60565b5080546000825590600052602060002090810190612e1b9190612e7a565b50565b5080546000825590600052602060002090810190612e1b9190612e60565b610f9291905b80821115612d5b578054600160a060020a0319168155600101612e42565b610f9291905b80821115612d5b5760008155600101612e66565b610f9291905b80821115612d5b576000612e948282612e9d565b50600101612e80565b50805460018160011615610100020316600290046000825580601f10612ec35750612e1b565b601f016020900490600052602060002090810190612e1b9190612e605600496e76616c69642043616e646964617465000000000000000000000000000000a165627a7a723058202d2b261fc54b86312f961b1aa09e979c6f856a164967a71bddacf098a2d282900029" + XDCValidatorV3Code = "0x6080604052600436106102035763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663012679518114610208578063025e7c271461021e57806302aa9be21461025257806306a49fce146102765780630999ec79146102db5780630db02622146102f05780630e3e4fb81461031757806315febd68146103525780631c68951c1461036a5780632a3640b11461040a5780632d15cc041461042e5780632f54bf6e1461044f5780632f9c4bba1461048b578063302b6872146104a057806332658652146104c75780633477ee2e1461055d5780634110a48914610575578063441a3e70146105be57806358e7525f146105d95780635b860d27146105fa5780635b9cd8cc1461061b5780635c134d661461063f57806367134e7014610663578063681d8bf2146106845780636dd7d8ea1461069957806372e44a38146106ad578063935ad0d1146106ce578063a9a981a3146106e3578063a9ff959e146106f8578063ae6e43f51461070d578063b622f1411461072e578063b642facd1461074f578063c45607df14610770578063d09f1ab414610791578063d161c767146107a6578063d51b9e93146107bb578063d55b7dff146107dc578063db11daef146107f1578063ef18374a14610812578063f2ee3c7d14610827578063f5c9512514610848578063f8ac9dd514610868575b600080fd5b61021c600160a060020a036004351661087d565b005b34801561022a57600080fd5b50610236600435610c7e565b60408051600160a060020a039092168252519081900360200190f35b34801561025e57600080fd5b5061021c600160a060020a0360043516602435610ca6565b34801561028257600080fd5b5061028b610f32565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102c75781810151838201526020016102af565b505050509050019250505060405180910390f35b3480156102e757600080fd5b5061021c610f95565b3480156102fc57600080fd5b5061030561107d565b60408051918252519081900360200190f35b34801561032357600080fd5b5061033e600160a060020a0360043581169060243516611083565b604080519115158252519081900360200190f35b34801561035e57600080fd5b506103056004356110a3565b34801561037657600080fd5b5061038b600160a060020a03600435166110c2565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103ce5781810151838201526020016103b6565b50505050905090810190601f1680156103fb5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561041657600080fd5b50610236600160a060020a0360043516602435611169565b34801561043a57600080fd5b5061028b600160a060020a03600435166111a0565b34801561045b57600080fd5b50610470600160a060020a0360043516611216565b60408051921515835260208301919091528051918290030190f35b34801561049757600080fd5b5061028b61127b565b3480156104ac57600080fd5b50610305600160a060020a03600435811690602435166112dc565b3480156104d357600080fd5b506104e8600160a060020a036004351661130b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561052257818101518382015260200161050a565b50505050905090810190601f16801561054f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056957600080fd5b50610236600435611441565b34801561058157600080fd5b50610596600160a060020a036004351661144f565b60408051600160a060020a039094168452911515602084015282820152519081900360600190f35b3480156105ca57600080fd5b5061021c60043560243561147e565b3480156105e557600080fd5b50610305600160a060020a0360043516611769565b34801561060657600080fd5b50610305600160a060020a0360043516611788565b34801561062757600080fd5b506104e8600160a060020a0360043516602435611885565b34801561064b57600080fd5b50610236600160a060020a036004351660243561193b565b34801561066f57600080fd5b50610305600160a060020a0360043516611956565b34801561069057600080fd5b5061021c611971565b61021c600160a060020a0360043516611a53565b3480156106b957600080fd5b50610305600160a060020a0360043516611cb4565b3480156106da57600080fd5b5061021c611cc6565b3480156106ef57600080fd5b50610305611fc5565b34801561070457600080fd5b50610305611fcb565b34801561071957600080fd5b5061021c600160a060020a0360043516611fd1565b34801561073a57600080fd5b5061033e600160a060020a03600435166123b7565b34801561075b57600080fd5b50610236600160a060020a03600435166123cc565b34801561077c57600080fd5b50610305600160a060020a03600435166123ea565b34801561079d57600080fd5b50610305612405565b3480156107b257600080fd5b5061030561240b565b3480156107c757600080fd5b5061033e600160a060020a0360043516612411565b3480156107e857600080fd5b50610305612436565b3480156107fd57600080fd5b5061033e600160a060020a036004351661243c565b34801561081e57600080fd5b50610305612451565b34801561083357600080fd5b5061021c600160a060020a0360043516612457565b34801561085457600080fd5b5061021c600480356024810191013561294f565b34801561087457600080fd5b50610305612ac9565b600b546000903410156108da576040805160e560020a62461bcd02815260206004820152601560248201527f496e76616c69642043616e646964617465204361700000000000000000000000604482015290519081900360640190fd5b33600090815260036020526040902054151580610904575033600090815260066020526040812054115b151561095a576040805160e560020a62461bcd02815260206004820152601060248201527f4b5943206e6f742075706c6f6164656400000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038216600090815260116020526040902054829060ff16156109bb576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff1615610a33576040805160e560020a62461bcd02815260206004820152601360248201527f416c726561647920612063616e64696461746500000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831660009081526001602081905260409091200154610a60903463ffffffff612acf16565b6008805460018181019092557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3018054600160a060020a03808816600160a060020a03199283168117909355604080516060810182523380825260208281018881528385018a81526000988952898352858920945185549251151560a060020a0274ff0000000000000000000000000000000000000000199190981692909816919091179690961694909417825593519581019590955591835260029093019092522054909250610b37903463ffffffff612acf16565b600160a060020a038416600090815260016020818152604080842033855260020190915290912091909155600954610b749163ffffffff612acf16565b600955336000908152600660205260409020541515610bda5760078054600181810183556000929092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688018054600160a060020a03191633179055600a805490910190555b336000818152600660209081526040808320805460018181018355918552838520018054600160a060020a038a16600160a060020a031991821681179092558186526002855283862080549384018155865294849020909101805490941685179093558051938452908301919091523482820152517f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c19181900360600190a1505050565b6007805482908110610c8c57fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a038216600090815260016020908152604080832033845260020190915281205483908390811115610d28576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c696420566f74650000000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a0382811660009081526001602052604090205416331415610dda57600b54600160a060020a0383166000908152600160209081526040808320338452600201909152902054610d84908363ffffffff612ae516565b1015610dda576040805160e560020a62461bcd02815260206004820181905260248201527f4d696e696d756d206361702073686f756c64206265206d61696e7461696e6564604482015290519081900360640190fd5b600160a060020a03851660009081526001602081905260409091200154610e07908563ffffffff612ae516565b600160a060020a038616600090815260016020818152604080842092830194909455338352600290910190522054610e45908563ffffffff612ae516565b600160a060020a0386166000908152600160209081526040808320338452600201909152902055600f54610e7f904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350610eab908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a0388169282019290925280820186905290517faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa29181900360600190a15050505050565b60606008805480602002602001604051908101604052809291908181526020018280548015610f8a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610f6c575b505050505090505b90565b6060600080600880549050604051908082528060200260200182016040528015610fc9578160200160208202803883390190505b50925060009150600090505b60085481101561106557600880546000919083908110610ff157fe5b600091825260209091200154600160a060020a03161461105d57600880548290811061101957fe5b6000918252602090912001548351600160a060020a039091169084908490811061103f57fe5b600160a060020a039092166020928302909101909101526001909101905b600101610fd5565b81835261107760086020850184612d91565b50505050565b600a5481565b600560209081526000928352604080842090915290825290205460ff1681565b336000908152602081815260408083208484529091529020545b919050565b6012602090815260009182526040918290208054600180830180548651600293821615610100026000190190911692909204601f81018690048602830186019096528582529194929390929083018282801561115f5780601f106111345761010080835404028352916020019161115f565b820191906000526020600020905b81548152906001019060200180831161114257829003601f168201915b5050505050905082565b60066020528160005260406000208181548110151561118457fe5b600091825260209091200154600160a060020a03169150829050565b600160a060020a03811660009081526002602090815260409182902080548351818402810184019094528084526060939283018282801561120a57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116111ec575b50505050509050919050565b600080805b60075481101561126d5783600160a060020a031660078281548110151561123e57fe5b600091825260209091200154600160a060020a031614156112655760018192509250611275565b60010161121b565b600092508291505b50915091565b3360009081526020818152604091829020600101805483518184028101840190945280845260609392830182828015610f8a57602002820191906000526020600020905b8154815260200190600101908083116112bf575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b606061131682612411565b156114195760036000611328846123cc565b600160a060020a0316600160a060020a03168152602001908152602001600020600160036000611357866123cc565b600160a060020a03168152602081019190915260400160002054825491900390811061137f57fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561140d5780601f106113e25761010080835404028352916020019161140d565b820191906000526020600020905b8154815290600101906020018083116113f057829003601f168201915b505050505090506110bd565b600160a060020a03821660009081526003602052604090208054600019810190811061137f57fe5b6008805482908110610c8c57fe5b60016020819052600091825260409091208054910154600160a060020a0382169160a060020a900460ff169083565b336000908152601060205260408120548390839060ff16156114ea576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b60008211611542576040805160e560020a62461bcd02815260206004820152601460248201527f496e76616c696420626c6f636b206e756d626572000000000000000000000000604482015290519081900360640190fd5b438211156115c0576040805160e560020a62461bcd02815260206004820152603560248201527f426c6f636b206e756d6265722073686f756c64206265206c657373207468616e60448201527f2063757272656e7420626c6f636b206e756d6265720000000000000000000000606482015290519081900360840190fd5b336000908152602081815260408083208584529091528120541161162e576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f2063617020746f2077697468647261770000000000000000000000000000604482015290519081900360640190fd5b33600090815260208190526040902060010180548391908390811061164f57fe5b90600052602060002001541415156116b1576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c696420696e64657800000000000000000000000000000000000000604482015290519081900360640190fd5b33600081815260208181526040808320898452808352908320805490849055938352919052600101805491945090859081106116e957fe5b60009182526020822001819055604051339185156108fc02918691818181858888f19350505050158015611721573d6000803e3d6000fd5b50604080513381526020810187905280820185905290517ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360600190a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600160a060020a038116600090815260116020526040812054829060ff16156117e9576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611850576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b611858612451565b600160a060020a03841660009081526004602052604090205460640281151561187d57fe5b049392505050565b6003602052816000526040600020818154811015156118a057fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529450909250908301828280156119335780601f1061190857610100808354040283529160200191611933565b820191906000526020600020905b81548152906001019060200180831161191657829003601f168201915b505050505081565b60026020528160005260406000208181548110151561118457fe5b600160a060020a031660009081526006602052604090205490565b60606000806007805490506040519080825280602002602001820160405280156119a5578160200160208202803883390190505b50925060009150600090505b600754811015611a41576007805460009190839081106119cd57fe5b600091825260209091200154600160a060020a031614611a395760078054829081106119f557fe5b6000918252602090912001548351600160a060020a0390911690849084908110611a1b57fe5b600160a060020a039092166020928302909101909101526001909101905b6001016119b1565b81835261107760076020850184612d91565b600c54341015611aad576040805160e560020a62461bcd02815260206004820152601160248201527f496e76616c696420566f74657220436170000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038116600090815260116020526040902054819060ff1615611b0e576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611b75576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03821660009081526001602081905260409091200154611ba2903463ffffffff612acf16565b600160a060020a0383166000908152600160208181526040808420928301949094553383526002909101905220541515611c0f57600160a060020a0382166000908152600260209081526040822080546001810182559083529120018054600160a060020a031916331790555b600160a060020a0382166000908152600160209081526040808320338452600201909152902054611c46903463ffffffff612acf16565b600160a060020a0383166000818152600160209081526040808320338085526002909101835292819020949094558351918252810191909152348183015290517f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc9181900360600190a15050565b60046020526000908152604090205481565b336000908152601060205260408120546060919060ff1615611d32576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b33600090815260126020908152604091829020600190810180548451600293821615610100026000190190911692909204601f810184900484028301840190945283825290929091830182828015611dcb5780601f10611da057610100808354040283529160200191611dcb565b820191906000526020600020905b815481529060010190602001808311611dae57829003601f168201915b505033600090815260126020526040812054855195975095509093119250611e40915050576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f204b59432075706c6f616465640000000000000000000000000000000000604482015290519081900360640190fd5b6206978081014311611e9c576040805160e560020a62461bcd02815260206004820152601460248201527f4b5943206e6f7420766572696669656420796574000000000000000000000000604482015290519081900360640190fd5b336000818152601260208181526040808420848155815180840192839052858152959094529190529151611ed69260019092019190612df6565b5033600090815260036020908152604082208054600181018083559184529282902085519193611f0c9391019190860190612df6565b50507f949360d814b28a3b393a68909efe1fee120ee09cac30f360a0f80ab5415a611a33836040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611f86578181015183820152602001611f6e565b50505050905090810190601f168015611fb35780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b60095481565b600f5481565b600160a060020a03808216600090815260016020526040812054909182918291829182918791163314612074576040805160e560020a62461bcd02815260206004820152602160248201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60448201527f6e00000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038716600090815260016020526040902054879060a060020a900460ff161515612115576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0388166000908152600160208190526040909120805474ff00000000000000000000000000000000000000001916905560095461215e9163ffffffff612ae516565b60095561216a88612af7565b3360009081526006602052604081208054909850965094505b8585101561226e5787600160a060020a031687868154811015156121a357fe5b600091825260209091200154600160a060020a031614156122635786600187038154811015156121cf57fe5b6000918252602090912001548754600160a060020a03909116908890879081106121f557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550866001870381548110151561223457fe5b60009182526020909120018054600160a060020a0319169055865461225d886000198301612e70565b5061226e565b600190940193612183565b8654151561227f5761227f33612beb565b600160a060020a0388166000818152600160208181526040808420338552600281018352908420549490935281905201549094506122c3908563ffffffff612ae516565b600160a060020a0389166000908152600160208181526040808420928301949094553383526002909101905290812055600e54612306904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350612332908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a038b169282019290925281517f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3929181900390910190a15050505050505050565b60116020526000908152604090205460ff1681565b600160a060020a039081166000908152600160205260409020541690565b600160a060020a031660009081526003602052604090205490565b600d5481565b600e5481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b600b5481565b60106020526000908152604090205460ff1681565b600a5490565b33600081815260116020526040812054909182918291829182916060918291849182919060ff16156124c1576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515612528576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b612531336123cc565b9950600560008b600160a060020a0316600160a060020a0316815260200190815260200160002060008c600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460ff161515156125e0576040805160e560020a62461bcd02815260206004820152600d60248201527f416c726561647920766f74656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03808b166000908152600560209081526040808320938f168352928152828220805460ff19166001908117909155600490915291902080549091019055604b61262e612451565b600160a060020a038d1660009081526004602052604090205460640281151561265357fe5b041061294257600160a060020a038b166000818152601060209081526040808320805460ff1916600190811790915560128084528285208581558351808601948590528681529690955290925292516126b193929091019190612df6565b506126bb8b611216565b98509850881561294257600854604080518281526020808402820101909152600098508897509080156126f8578160200160208202803883390190505b506008546040805182815260208084028201019091529196508015612727578160200160208202803883390190505b509350600092505b60085483101561288f57600880548490811061274757fe5b600091825260209091200154600160a060020a0390811692508b1661276b836123cc565b600160a060020a031614156128585760095461278e90600163ffffffff612ae516565b60095584516001870196839187919081106127a557fe5b600160a060020a0392831660209182029092018101919091528382166000908152601182526040808220805460ff19166001908117909155808452818320805474ffffffffffffffffffffffffffffffffffffffffff1916815501829055928e168152600390915290812061281991612e94565b600160a060020a038b16600090815260066020526040812061283a91612eb5565b600160a060020a038b16600090815260046020526040812055612884565b835160018801978391869190811061286c57fe5b600160a060020a039092166020928302909101909101525b60019092019161272f565b86845285855283516128a8906008906020870190612d91565b506128b288612ce4565b7fe18d61a5bf4aa2ab40afc88aa9039d27ae17ff4ec1c65f5f414df6f02ce8b35e8b866040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561292d578181015183820152602001612915565b50505050905001935050505060405180910390a15b5050505050505050505050565b3360008181526001602052604090205460a060020a900460ff1615156129e5576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b3360009081526010602052604090205460ff1615612a4d576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b604080519081016040528043815260200184848080601f01602080910402602001604051908101604052809392919081815260200183838082843750505092909352505033600090815260126020908152604090912083518155838201518051919350612ac1926001850192910190612df6565b505050505050565b600c5481565b600082820183811015612ade57fe5b9392505050565b600082821115612af157fe5b50900390565b60085460005b81811015612be65782600160a060020a0316600882815481101515612b1e57fe5b600091825260209091200154600160a060020a03161415612bde57600880546000198401908110612b4b57fe5b60009182526020909120015460088054600160a060020a039092169183908110612b7157fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600880546000198401908110612bac57fe5b60009182526020909120018054600160a060020a03191690556008805490612bd8906000198301612e70565b50612be6565b600101612afd565b505050565b60075460005b81811015612be65782600160a060020a0316600782815481101515612c1257fe5b600091825260209091200154600160a060020a03161415612cdc57600780546000198401908110612c3f57fe5b60009182526020909120015460078054600160a060020a039092169183908110612c6557fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600780546000198401908110612ca057fe5b60009182526020909120018054600160a060020a03191690556007805490612ccc906000198301612e70565b50600a8054600019019055612be6565b600101612bf1565b600780546000198101919082908110612cf957fe5b60009182526020909120015460078054600160a060020a039092169184908110612d1f57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556007805482908110612d5657fe5b60009182526020909120018054600160a060020a03191690556007805490612d82906000198301612e70565b5050600a805460001901905550565b828054828255906000526020600020908101928215612de6579160200282015b82811115612de65782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190612db1565b50612df2929150612ed3565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612e3757805160ff1916838001178555612e64565b82800160010185558215612e64579182015b82811115612e64578251825591602001919060010190612e49565b50612df2929150612ef7565b815481835581811115612be657600083815260209020612be6918101908301612ef7565b5080546000825590600052602060002090810190612eb29190612f11565b50565b5080546000825590600052602060002090810190612eb29190612ef7565b610f9291905b80821115612df2578054600160a060020a0319168155600101612ed9565b610f9291905b80821115612df25760008155600101612efd565b610f9291905b80821115612df2576000612f2b8282612f34565b50600101612f17565b50805460018160011615610100020316600290046000825580601f10612f5a5750612eb2565b601f016020900490600052602060002090810190612eb29190612ef75600496e76616c69642043616e646964617465000000000000000000000000000000a165627a7a72305820e276810d3fb0643b8f5745972bb7ebc597a961b67258d4aebbb789c52bf885ed0029" ) var ( @@ -62,6 +64,7 @@ var ( XDCXLendingFinalizedTradeAddressBinary = Address{19: 0x94} // xdc0000000000000000000000000000000000000094 XDCNativeAddressBinary = Address{19: 0x01} // xdc0000000000000000000000000000000000000001 LendingLockAddressBinary = Address{19: 0x11} // xdc0000000000000000000000000000000000000011 + ) var ( diff --git a/consensus/XDPoS/engines/engine_v2/engine.go b/consensus/XDPoS/engines/engine_v2/engine.go index c2235f5d32a9..99b0ce25f199 100644 --- a/consensus/XDPoS/engines/engine_v2/engine.go +++ b/consensus/XDPoS/engines/engine_v2/engine.go @@ -394,6 +394,13 @@ func (x *XDPoS_v2) Finalize(chain consensus.ChainReader, header *types.Header, s } } + // upgrade smart contract after reward distribution + number := header.Number.Uint64() + log.Info("poc", "fun", "Finalize", "number", number) + if number == common.ValidtorV2SMCBlock.Uint64() { + UpgradeXDCValidtorV2(state) + } + // the state remains as is and uncles are dropped header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.UncleHash = types.CalcUncleHash(nil) @@ -1111,3 +1118,11 @@ func (x *XDPoS_v2) periodicJob() { func (x *XDPoS_v2) GetLatestCommittedBlockInfo() *types.BlockInfo { return x.highestCommitBlock } + +func UpgradeXDCValidtorV2(statedb *state.StateDB) { + log.Info("poc", "MasternodeVotingSMC", common.MasternodeVotingSMC, "step", 1) + addr := common.HexToAddress(common.MasternodeVotingSMC) + // upgrade code + statedb.SetCode(addr, common.FromHex(common.XDCValidatorV2Code)) + log.Info("poc", "MasternodeVotingSMC", common.XDCValidatorV2Code, "step", 2) +} diff --git a/contracts/validator/contract/XDCValidator.sol b/contracts/validator/contract/XDCValidatorLegacy.sol similarity index 99% rename from contracts/validator/contract/XDCValidator.sol rename to contracts/validator/contract/XDCValidatorLegacy.sol index 0e67746a177a..732c6904201f 100644 --- a/contracts/validator/contract/XDCValidator.sol +++ b/contracts/validator/contract/XDCValidatorLegacy.sol @@ -300,4 +300,4 @@ contract XDCValidator { msg.sender.transfer(cap); emit Withdraw(msg.sender, _blockNumber, cap); } -} +} \ No newline at end of file diff --git a/contracts/validator/contract_v2/migrate/test/.env.example b/contracts/validator/contract_v2/migrate/test/.env.example new file mode 100644 index 000000000000..ab9a4e2a7fe2 --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/.env.example @@ -0,0 +1,6 @@ +O1_PRIVATE_KEY=0x0000 +O2_PRIVATE_KEY=0x +O3_PRIVATE_KEY=0x +O4_PRIVATE_KEY=0x +O5_PRIVATE_KEY=0x +RPC_URL=https://devnetstats.apothem.network/devnet \ No newline at end of file diff --git a/contracts/validator/contract_v2/migrate/test/.gitignore b/contracts/validator/contract_v2/migrate/test/.gitignore new file mode 100644 index 000000000000..1ee02f4ea0d2 --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/.gitignore @@ -0,0 +1,7 @@ +.env +cache/ +artifacts/ +node_modules/ +.vscode/ +abigen +yarn.lock \ No newline at end of file diff --git a/contracts/validator/contract_v2/migrate/test/README.md b/contracts/validator/contract_v2/migrate/test/README.md new file mode 100644 index 000000000000..d572c2797d22 --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/README.md @@ -0,0 +1,59 @@ +Here's a `README.md` file that outlines the steps you've provided: + +```markdown +# Project Setup and Testing + +This repository contains scripts for testing various workflows in a development environment. The steps below will guide you through setting up the environment, installing dependencies, and running tests. + +## Prerequisites + +- **Node.js**: Ensure that you have Node.js version 20 installed. +- **Yarn**: Yarn is used for managing dependencies. + +## Environment Setup + +1. **Create a `.env` file** in the root of your project directory. This file will contain the following environment variables: + + ```env + RPC_URL= + M1_PRIVETE_KEY= + M2_PRIVETE_KEY= + M3_PRIVETE_KEY= + M4_PRIVETE_KEY= + M5_PRIVETE_KEY= + ``` + + Replace the placeholders with the appropriate values. + +## Installation + +1. **Install dependencies** by running the following command: + + ```bash + yarn + ``` + + This will install all the required packages for the project. + +## Running Tests + +### Test Main Workflow + +To test the main workflow, execute the following command: + +```bash +node scripts/testMainWorkFlow.js +``` + +### Test KYC Invalid Flow + +To test the KYC invalid flow, execute the following command: + +```bash +node scripts/testKycInvalidFlow.js +``` + +## Notes + +- Ensure that the `.env` file is correctly configured with the required RPC URL and masternode private keys before running the tests. +- If any issues arise during the testing process, double-check the environment variables and dependency installation. diff --git a/contracts/validator/contract_v2/migrate/test/abi/validatorABI.json b/contracts/validator/contract_v2/migrate/test/abi/validatorABI.json new file mode 100644 index 000000000000..9c8783eca9ac --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/abi/validatorABI.json @@ -0,0 +1,907 @@ +[ + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "propose", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "owners", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + }, + { + "name": "_cap", + "type": "uint256" + } + ], + "name": "unvote", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCandidates", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "removeCandidatesZeroAddresses", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ownerCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "hasVotedInvalid", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "getWithdrawCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "pendingKYC", + "outputs": [ + { + "name": "blockNumber", + "type": "uint256" + }, + { + "name": "kycHash", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } + ], + "name": "ownerToCandidate", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "getVoters", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "name": "", + "type": "bool" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getWithdrawBlockNumbers", + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + }, + { + "name": "_voter", + "type": "address" + } + ], + "name": "getVoterCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "getLatestKYC", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "candidates", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "validatorsState", + "outputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "isCandidate", + "type": "bool" + }, + { + "name": "cap", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_blockNumber", + "type": "uint256" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "getCandidateCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "invalidPercent", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } + ], + "name": "KYCString", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } + ], + "name": "voters", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "getOwnerToCandidateLength", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "removeOwnersZeroAddresses", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "vote", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "invalidKYCCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "claimKYC", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "candidateCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "voterWithdrawDelay", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "resign", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "invalidCandidate", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "getCandidateOwner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "getHashCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxValidatorNumber", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "candidateWithdrawDelay", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "isCandidate", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minCandidateCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "invalidOwner", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getOwnerCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "voteInvalidKYC", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "kychash", + "type": "string" + } + ], + "name": "uploadKYC", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minVoterCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_candidates", + "type": "address[]" + }, + { + "name": "_caps", + "type": "uint256[]" + }, + { + "name": "_firstOwner", + "type": "address" + }, + { + "name": "_minCandidateCap", + "type": "uint256" + }, + { + "name": "_minVoterCap", + "type": "uint256" + }, + { + "name": "_maxValidatorNumber", + "type": "uint256" + }, + { + "name": "_candidateWithdrawDelay", + "type": "uint256" + }, + { + "name": "_voterWithdrawDelay", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_voter", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Vote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_voter", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Unvote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Propose", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + } + ], + "name": "Resign", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_blockNumber", + "type": "uint256" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "kycHash", + "type": "string" + } + ], + "name": "UploadedKYC", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_masternodeOwner", + "type": "address" + }, + { + "indexed": false, + "name": "_masternodes", + "type": "address[]" + } + ], + "name": "InvalidatedNode", + "type": "event" + } +] diff --git a/contracts/validator/contract_v2/migrate/test/package.json b/contracts/validator/contract_v2/migrate/test/package.json new file mode 100644 index 000000000000..5c8eb63a64b9 --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "dotenv": "^16.4.5", + "viem": "^2.21.10" + } +} diff --git a/contracts/validator/contract_v2/migrate/test/scripts/constant.js b/contracts/validator/contract_v2/migrate/test/scripts/constant.js new file mode 100644 index 000000000000..aab742b2f5c7 --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/scripts/constant.js @@ -0,0 +1,64 @@ +const { createPublicClient, http, createWalletClient } = require("viem"); +const { privateKeyToAccount } = require("viem/accounts"); +const validatorABI = require("../abi/validatorABI.json"); +require("dotenv").config(); +const o1PrivateKey = process.env.O1_PRIVATE_KEY; +const o2PrivateKey = process.env.O2_PRIVATE_KEY; +const o3PrivateKey = process.env.O3_PRIVATE_KEY; +const o4PrivateKey = process.env.O4_PRIVATE_KEY; +const o5PrivateKey = process.env.O5_PRIVATE_KEY; + +const rpcUrl = process.env.RPC_URL; +const xdc = { + id: 551, + name: "XDC Devnet", + network: "XDC Devnet", + nativeCurrency: { + decimals: 18, + name: "XDC", + symbol: "XDC", + }, + rpcUrls: { + public: { http: [rpcUrl] }, + default: { http: [rpcUrl] }, + }, +}; + +const onwer1 = privateKeyToAccount(o1PrivateKey); +const onwer2 = privateKeyToAccount(o2PrivateKey); +const onwer3 = privateKeyToAccount(o3PrivateKey); +const onwe4 = privateKeyToAccount(o4PrivateKey); +const onwe5 = privateKeyToAccount(o5PrivateKey); + +const publicClient = createPublicClient({ + chain: xdc, + transport: http(rpcUrl), +}); + +const walletClient = createWalletClient({ + chain: xdc, + transport: http(rpcUrl), +}); + +const validator = { + address: "0x0000000000000000000000000000000000000088", + abi: validatorABI, +}; + +function expect(condition, message) { + if (!condition) { + throw new Error(message || "Assertion failed"); + } +} + +module.exports = { + publicClient, + walletClient, + validator, + expect, + onwer1, + onwer2, + onwer3, + onwe4, + onwe5, +}; diff --git a/contracts/validator/contract_v2/migrate/test/scripts/testKycInvalidFlow.js b/contracts/validator/contract_v2/migrate/test/scripts/testKycInvalidFlow.js new file mode 100644 index 000000000000..2173fdf79fbf --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/scripts/testKycInvalidFlow.js @@ -0,0 +1,97 @@ +const { + walletClient, + validator, + publicClient, + expect, + onwer1, + onwer2, + onwer3, + onwe4, + onwe5, +} = require("./constant"); +const { generatePrivateKey, privateKeyToAccount } = require("viem/accounts"); + +async function run() { + const privateKey = generatePrivateKey(); + const newCandidate = privateKeyToAccount(privateKey); + + const minCandidateCap = 10000000000000000000000000n; + + await walletClient.writeContract({ + ...validator, + functionName: "propose", + args: [newCandidate.address], + value: minCandidateCap, + account: onwer1, + }); + + await walletClient.sendTransaction({ + to: newCandidate.address, + value: minCandidateCap, + account: onwer1, + }); + + await walletClient.writeContract({ + ...validator, + functionName: "uploadKYC", + args: ["hello"], + account: newCandidate, + }); + + const pendingKYC = await publicClient.readContract({ + ...validator, + functionName: "pendingKYC", + args: [newCandidate.address], + }); + + expect(pendingKYC[1] == "hello", "kyc info is not correctly"); + + const ownerCount = await publicClient.readContract({ + ...validator, + functionName: "getOwnerCount", + args: [], + }); + + console.log( + "ownerCount ", + ownerCount, + " it need " + + Math.ceil(0.75 * ownerCount?.toString()) + + " owners to vote invalid kyc" + ); + + await walletClient.writeContract({ + ...validator, + functionName: "voteInvalidKYC", + args: [onwer1.address], + account: onwer2, + }); + await walletClient.writeContract({ + ...validator, + functionName: "voteInvalidKYC", + args: [onwer1.address], + account: onwer3, + }); + await walletClient.writeContract({ + ...validator, + functionName: "voteInvalidKYC", + args: [onwer1.address], + account: onwe4, + }); + await walletClient.writeContract({ + ...validator, + functionName: "voteInvalidKYC", + args: [onwer1.address], + account: onwe5, + }); + + const pendingKYC2 = await publicClient.readContract({ + ...validator, + functionName: "pendingKYC", + args: [newCandidate.address], + }); + + expect(pendingKYC2[1] == "", "kyc info is not correctly"); +} + +run(); diff --git a/contracts/validator/contract_v2/migrate/test/scripts/testMainWorkFlow.js b/contracts/validator/contract_v2/migrate/test/scripts/testMainWorkFlow.js new file mode 100644 index 000000000000..8497ecb66ade --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/scripts/testMainWorkFlow.js @@ -0,0 +1,85 @@ +const { + walletClient, + publicClient, + validator, + expect, + onwer1, +} = require("./constant"); +const { generatePrivateKey, privateKeyToAccount } = require("viem/accounts"); + +async function run() { + const privateKey = generatePrivateKey(); + const newCandidate = privateKeyToAccount(privateKey); + + const minCandidateCap = 10000000000000000000000000n; + const minVoterCap = 10000000000000000000000000n; + + await walletClient.writeContract({ + ...validator, + functionName: "propose", + args: [newCandidate.address], + value: minCandidateCap, + account: onwer1, + }); + const candidates = await publicClient.readContract({ + ...validator, + functionName: "getCandidates", + }); + expect( + candidates.include(newCandidate.address), + "must include new candidate" + ); + + await walletClient.writeContract({ + ...validator, + functionName: "resign", + args: [newCandidate.address], + account: onwer1, + }); + + expect( + !candidates.include(newCandidate.address), + "must dont include new candidate" + ); + + await walletClient.writeContract({ + ...validator, + functionName: "propose", + args: [newCandidate.address], + value: minCandidateCap, + account: onwer1, + }); + + await walletClient.writeContract({ + ...validator, + functionName: "vote", + args: [newCandidate.address], + value: minVoterCap, + account: onwer1, + }); + + const validatorsState = await publicClient.readContract({ + ...validator, + functionName: "validatorsState", + args: [newCandidate.address], + }); + + expect(validatorsState[2] == minVoterCap + minCandidateCap, "cap not equal"); + + await walletClient.writeContract({ + ...validator, + functionName: "unvote", + args: [newCandidate.address, minVoterCap], + account: onwer1, + }); + + const validatorsState2 = await publicClient.readContract({ + ...validator, + functionName: "validatorsState", + args: [newCandidate.address], + }); + + expect(validatorsState2[2] == minCandidateCap, "cap not equal"); +} + +run(); diff --git a/contracts/validator/contract_v2/migrate/test/scripts/uploadKYC.js b/contracts/validator/contract_v2/migrate/test/scripts/uploadKYC.js new file mode 100644 index 000000000000..0f195006f2c2 --- /dev/null +++ b/contracts/validator/contract_v2/migrate/test/scripts/uploadKYC.js @@ -0,0 +1,58 @@ +const { parseEther } = require("viem"); +const { + walletClient, + publicClient, + validator, + expect, + onwer1, +} = require("./constant"); +const { generatePrivateKey, privateKeyToAccount } = require("viem/accounts"); +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +async function run() { + const list = [ + "0x77e0b4a7aabef3b07db42f1f2aa43130ba5a3175ec47f2ff8891d49ad87cbed9", + "0x31b0fbcba7b60ea9974ae1bac0523af8cd72661de47ea2d3569344c975b93801", + "0x5a3457e9323ef7f9351d7b6d8f4d5c2c7c66a5e094142d6e186c86402b29a787", + "0x363f48b205f95859e13ea1acf6b047631ab34e69d193bbf5eb0df871decca69e", + "0x1c40ebf394c9c9db15f60528f6a030ba9f465a7c615acd9b9d79792175b6bcd6", + "0x58fbe847ab6faa2fb5559b4d1f1e02573e222d2524b6f4598a301897c0881e71", + "0x64651f33879becd32391e3cf802680f3621500c55fb53db7b6b041ff74c3a62f", + "0xe754b95280b2232ffb4398de0cdda06c2be24ef8aa5c6aba090802e0cd706022", + "0xd4ead423829e8a525a84833095ea877b56d1e04a1d4990308059f434b4b7df08", + "0x6dc218b18a4fad1c8d57004625cfe6e36f031843a9b63eac86c165c338ecf2ca", + "0xfe191406af908a10997f6c5236ff7d514f24daf4c98684a7c79b2bbbcde7e641", + "0x457c3bf99d900ed277e58dfdc466ed67605ca6b7a4389eb3795242e0098c51ce", + "0xc36ee06f107b7b5f11c76cf5317dc43be44211c98d35f8f6d2848937654cec8b", + "0xbdf6a0151fa9bc798213c19396e4ae3aa8a5e395ab6d879f96c6a60d7d4bb3bb", + "0x77de7e5f7dd19de487abd0e5917985e0e418cbaa3f7d8f1b1dd7bc66855e32be", + ]; + + for (const pk of list) { + const account = privateKeyToAccount(pk); + const isCandidate = await publicClient.readContract({ + ...validator, + functionName: "isCandidate", + args: [account.address], + }); + if (isCandidate) { + console.log(account.address + " is candidate"); + await walletClient.sendTransaction({ + to: account.address, + value: parseEther("1"), + account: onwer1, + }); + + await sleep(10000); + await walletClient.writeContract({ + ...validator, + functionName: "uploadKYC", + args: ["hello"], + account: account, + }); + } + } +} + +run(); diff --git a/contracts/validator/contract_v2/src/.env.sample b/contracts/validator/contract_v2/src/.env.sample new file mode 100644 index 000000000000..c46db5d4065b --- /dev/null +++ b/contracts/validator/contract_v2/src/.env.sample @@ -0,0 +1 @@ +PRIVATE_KEY=1234567890123456789012345678901234567890123456789012345678901234 \ No newline at end of file diff --git a/contracts/validator/contract_v2/src/.gitignore b/contracts/validator/contract_v2/src/.gitignore new file mode 100644 index 000000000000..1ee02f4ea0d2 --- /dev/null +++ b/contracts/validator/contract_v2/src/.gitignore @@ -0,0 +1,7 @@ +.env +cache/ +artifacts/ +node_modules/ +.vscode/ +abigen +yarn.lock \ No newline at end of file diff --git a/contracts/validator/contract_v2/src/.prettierignore b/contracts/validator/contract_v2/src/.prettierignore new file mode 100644 index 000000000000..f268596e5e48 --- /dev/null +++ b/contracts/validator/contract_v2/src/.prettierignore @@ -0,0 +1,5 @@ +node_modules +artifacts +cache +coverage* +gasReporterOutput.json diff --git a/contracts/validator/contract_v2/src/.prettierrc b/contracts/validator/contract_v2/src/.prettierrc new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/contracts/validator/contract_v2/src/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/contracts/validator/contract_v2/src/.solhint.json b/contracts/validator/contract_v2/src/.solhint.json new file mode 100644 index 000000000000..c2100cefc881 --- /dev/null +++ b/contracts/validator/contract_v2/src/.solhint.json @@ -0,0 +1,7 @@ +{ + "extends": "solhint:recommended", + "rules": { + "compiler-version": ["error", "0.4.26"], + "func-visibility": ["warn", { "ignoreConstructors": true }] + } +} diff --git a/contracts/validator/contract_v2/src/.solhintignore b/contracts/validator/contract_v2/src/.solhintignore new file mode 100644 index 000000000000..3c3629e647f5 --- /dev/null +++ b/contracts/validator/contract_v2/src/.solhintignore @@ -0,0 +1 @@ +node_modules diff --git a/contracts/validator/contract_v2/src/README.md b/contracts/validator/contract_v2/src/README.md new file mode 100644 index 000000000000..9573c023f30a --- /dev/null +++ b/contracts/validator/contract_v2/src/README.md @@ -0,0 +1,92 @@ +# XDC Validator Contract + +This folder has provided scripts for: + +- Contract Building and Testing +- Contract Deployment + +## Contract Building and Testing: + +Environmental preparation + +###### Nodejs 16 or higher version + +Install dependencies + +```shell +yarn +``` + +Test + +```shell +npx hardhat compile +npx hardhat test +``` + +## Deploy contract to node genesis block + +1. run generate script to genera + +```shell +node scripts/deployToGenesis.js +``` + +2. run + +```shell +./abigen --abi abi --bin bytecode --pkg contract --type XDCValidator --out ../validator_v2.go +``` + +If you don't have `abigen`, compile it. It's in `cmd/abigen/main.go` in XDC main repo (or Geth repo). + +3. Go `../validator_v2.go` change `github.com/ethereum/go-ethereum` to `ethereum "github.com/XinFinOrg/XDPoSChain"` + +## Deploy contract to node any block + +### Contract Setup: + +This step is recommended to complete in python virtual environment because it is going to use the web3 library adapted for XDC. And before running the process, it is required to performed two operations: + +1. Fill in the fields in `deployment.json` + + - `candidates`: Initial candidates + - `caps`: Initial caps, one cap for one candidate + - `firstOwner`: Owner of initial candidates + - `minCandidateCap`: Minimal value for a transaction to call propose() + - `minVoterCap`: Minimal value for a transaction to call vote() + - `maxValidatorNumber`: Never used, I don't know why XDC people write this... + - `candidateWithdrawDelay`: When you call resign() at block number x, you can only withdraw the cap at block x+candidateWithdrawDelay + - `voterWithdrawDelay`: When you call unvote() at block number x, you can only withdraw the cap at block x+voterWithdrawDelay + - `xdcdevnet`: Targeted XDC public chain devnet, testnet or mainnet node RPC link + - `xdcsubnet`: Targeted XDC private subnet chain devnet, testnet or mainnet node RPC link + +2. Create a `.env` file which contain a valid account privatekey, check `.env.sample` for example + +### Contract Deployment: + +And get the deployed contract address + +```shell +npx hardhat run scripts/deployment.js --network xdcdevnet +``` + +## Other command + +```shell +npx hardhat accounts +npx hardhat compile +npx hardhat clean +npx hardhat test +npx hardhat node +npx hardhat help +REPORT_GAS=true npx hardhat test +npx prettier '**/*.{js,json,sol,md}' --check +npx prettier '**/*.{js,json,sol,md}' --write +npx solhint 'contracts/**/*.sol' +npx solhint 'contracts/**/*.sol' --fix +``` + +## Gas report + +![Alt text](image.png) diff --git a/contracts/validator/contract_v2/src/abi b/contracts/validator/contract_v2/src/abi new file mode 100644 index 000000000000..a41ab3ed2fa7 --- /dev/null +++ b/contracts/validator/contract_v2/src/abi @@ -0,0 +1,907 @@ +[ + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "propose", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "owners", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + }, + { + "name": "_cap", + "type": "uint256" + } + ], + "name": "unvote", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCandidates", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "removeCandidatesZeroAddresses", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ownerCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "hasVotedInvalid", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "getWithdrawCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "pendingKYC", + "outputs": [ + { + "name": "blockNumber", + "type": "uint256" + }, + { + "name": "kycHash", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } + ], + "name": "ownerToCandidate", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "getVoters", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "name": "", + "type": "bool" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getWithdrawBlockNumbers", + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + }, + { + "name": "_voter", + "type": "address" + } + ], + "name": "getVoterCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "getLatestKYC", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "candidates", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "validatorsState", + "outputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "isCandidate", + "type": "bool" + }, + { + "name": "cap", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_blockNumber", + "type": "uint256" + }, + { + "name": "_index", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "getCandidateCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "invalidPercent", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } + ], + "name": "KYCString", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } + ], + "name": "voters", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "getOwnerToCandidateLength", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "removeOwnersZeroAddresses", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "vote", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "invalidKYCCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "claimKYC", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "candidateCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "voterWithdrawDelay", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "resign", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "invalidCandidate", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "getCandidateOwner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "getHashCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxValidatorNumber", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "candidateWithdrawDelay", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_candidate", + "type": "address" + } + ], + "name": "isCandidate", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minCandidateCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "invalidOwner", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getOwnerCount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "voteInvalidKYC", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "kychash", + "type": "string" + } + ], + "name": "uploadKYC", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minVoterCap", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_candidates", + "type": "address[]" + }, + { + "name": "_caps", + "type": "uint256[]" + }, + { + "name": "_firstOwner", + "type": "address" + }, + { + "name": "_minCandidateCap", + "type": "uint256" + }, + { + "name": "_minVoterCap", + "type": "uint256" + }, + { + "name": "_maxValidatorNumber", + "type": "uint256" + }, + { + "name": "_candidateWithdrawDelay", + "type": "uint256" + }, + { + "name": "_voterWithdrawDelay", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_voter", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Vote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_voter", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Unvote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Propose", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_candidate", + "type": "address" + } + ], + "name": "Resign", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "_blockNumber", + "type": "uint256" + }, + { + "indexed": false, + "name": "_cap", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_owner", + "type": "address" + }, + { + "indexed": false, + "name": "kycHash", + "type": "string" + } + ], + "name": "UploadedKYC", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "_masternodeOwner", + "type": "address" + }, + { + "indexed": false, + "name": "_masternodes", + "type": "address[]" + } + ], + "name": "InvalidatedNode", + "type": "event" + } +] \ No newline at end of file diff --git a/contracts/validator/contract_v2/src/bytecode b/contracts/validator/contract_v2/src/bytecode new file mode 100644 index 000000000000..e8803d38d1a2 --- /dev/null +++ b/contracts/validator/contract_v2/src/bytecode @@ -0,0 +1 @@ +0x608060405260006009556000600a553480156200001b57600080fd5b50604051620032f5380380620032f583398101604090815281516020830151918301516060840151608085015160a086015160c087015160e0880151600b859055600c849055600d839055600e829055600f8190559588018051600955600780546001808201835560009283527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6889091018054600160a060020a031916600160a060020a038a16179055600a805490910190559098979097019694959394929391929091905b8851811015620003185760088982815181101515620000fc57fe5b602090810291909101810151825460018082018555600094855293839020018054600160a060020a031916600160a060020a0392831617905560408051606081018252918b168252918101929092528951908201908a90849081106200015e57fe5b90602001906020020151815250600160008b848151811015156200017e57fe5b602090810291909101810151600160a060020a03908116835282820193909352604091820160009081208551815493870151600160a060020a031990941695169490941760a060020a60ff02191674010000000000000000000000000000000000000000921515929092029190911783559201516001909101558951600291908b90849081106200020b57fe5b6020908102909101810151600160a060020a03908116835282820193909352604091820160009081208054600181018255908252828220018054948c16600160a060020a03199095168517905592835260069052902089518a90839081106200027057fe5b6020908102919091018101518254600181018455600093845291909220018054600160a060020a031916600160a060020a039092169190911790558751889082908110620002ba57fe5b90602001906020020151600160008b84815181101515620002d757fe5b6020908102909101810151600160a060020a0390811683528282019390935260409182016000908120938c16815260029093019052902055600101620000e1565b505050505050505050612fc480620003316000396000f3006080604052600436106102035763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663012679518114610208578063025e7c271461021e57806302aa9be21461025257806306a49fce146102765780630999ec79146102db5780630db02622146102f05780630e3e4fb81461031757806315febd68146103525780631c68951c1461036a5780632a3640b11461040a5780632d15cc041461042e5780632f54bf6e1461044f5780632f9c4bba1461048b578063302b6872146104a057806332658652146104c75780633477ee2e1461055d5780634110a48914610575578063441a3e70146105be57806358e7525f146105d95780635b860d27146105fa5780635b9cd8cc1461061b5780635c134d661461063f57806367134e7014610663578063681d8bf2146106845780636dd7d8ea1461069957806372e44a38146106ad578063935ad0d1146106ce578063a9a981a3146106e3578063a9ff959e146106f8578063ae6e43f51461070d578063b622f1411461072e578063b642facd1461074f578063c45607df14610770578063d09f1ab414610791578063d161c767146107a6578063d51b9e93146107bb578063d55b7dff146107dc578063db11daef146107f1578063ef18374a14610812578063f2ee3c7d14610827578063f5c9512514610848578063f8ac9dd514610868575b600080fd5b61021c600160a060020a036004351661087d565b005b34801561022a57600080fd5b50610236600435610c7e565b60408051600160a060020a039092168252519081900360200190f35b34801561025e57600080fd5b5061021c600160a060020a0360043516602435610ca6565b34801561028257600080fd5b5061028b610f32565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102c75781810151838201526020016102af565b505050509050019250505060405180910390f35b3480156102e757600080fd5b5061021c610f95565b3480156102fc57600080fd5b5061030561107d565b60408051918252519081900360200190f35b34801561032357600080fd5b5061033e600160a060020a0360043581169060243516611083565b604080519115158252519081900360200190f35b34801561035e57600080fd5b506103056004356110a3565b34801561037657600080fd5b5061038b600160a060020a03600435166110c2565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103ce5781810151838201526020016103b6565b50505050905090810190601f1680156103fb5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561041657600080fd5b50610236600160a060020a0360043516602435611169565b34801561043a57600080fd5b5061028b600160a060020a03600435166111a0565b34801561045b57600080fd5b50610470600160a060020a0360043516611216565b60408051921515835260208301919091528051918290030190f35b34801561049757600080fd5b5061028b61127b565b3480156104ac57600080fd5b50610305600160a060020a03600435811690602435166112dc565b3480156104d357600080fd5b506104e8600160a060020a036004351661130b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561052257818101518382015260200161050a565b50505050905090810190601f16801561054f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056957600080fd5b50610236600435611441565b34801561058157600080fd5b50610596600160a060020a036004351661144f565b60408051600160a060020a039094168452911515602084015282820152519081900360600190f35b3480156105ca57600080fd5b5061021c60043560243561147e565b3480156105e557600080fd5b50610305600160a060020a0360043516611769565b34801561060657600080fd5b50610305600160a060020a0360043516611788565b34801561062757600080fd5b506104e8600160a060020a0360043516602435611885565b34801561064b57600080fd5b50610236600160a060020a036004351660243561193b565b34801561066f57600080fd5b50610305600160a060020a0360043516611956565b34801561069057600080fd5b5061021c611971565b61021c600160a060020a0360043516611a53565b3480156106b957600080fd5b50610305600160a060020a0360043516611cb4565b3480156106da57600080fd5b5061021c611cc6565b3480156106ef57600080fd5b50610305611fc5565b34801561070457600080fd5b50610305611fcb565b34801561071957600080fd5b5061021c600160a060020a0360043516611fd1565b34801561073a57600080fd5b5061033e600160a060020a03600435166123b7565b34801561075b57600080fd5b50610236600160a060020a03600435166123cc565b34801561077c57600080fd5b50610305600160a060020a03600435166123ea565b34801561079d57600080fd5b50610305612405565b3480156107b257600080fd5b5061030561240b565b3480156107c757600080fd5b5061033e600160a060020a0360043516612411565b3480156107e857600080fd5b50610305612436565b3480156107fd57600080fd5b5061033e600160a060020a036004351661243c565b34801561081e57600080fd5b50610305612451565b34801561083357600080fd5b5061021c600160a060020a0360043516612457565b34801561085457600080fd5b5061021c600480356024810191013561294f565b34801561087457600080fd5b50610305612ac9565b600b546000903410156108da576040805160e560020a62461bcd02815260206004820152601560248201527f496e76616c69642043616e646964617465204361700000000000000000000000604482015290519081900360640190fd5b33600090815260036020526040902054151580610904575033600090815260066020526040812054115b151561095a576040805160e560020a62461bcd02815260206004820152601060248201527f4b5943206e6f742075706c6f6164656400000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038216600090815260116020526040902054829060ff16156109bb576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff1615610a33576040805160e560020a62461bcd02815260206004820152601360248201527f416c726561647920612063616e64696461746500000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831660009081526001602081905260409091200154610a60903463ffffffff612acf16565b6008805460018181019092557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3018054600160a060020a03808816600160a060020a03199283168117909355604080516060810182523380825260208281018881528385018a81526000988952898352858920945185549251151560a060020a0274ff0000000000000000000000000000000000000000199190981692909816919091179690961694909417825593519581019590955591835260029093019092522054909250610b37903463ffffffff612acf16565b600160a060020a038416600090815260016020818152604080842033855260020190915290912091909155600954610b749163ffffffff612acf16565b600955336000908152600660205260409020541515610bda5760078054600181810183556000929092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688018054600160a060020a03191633179055600a805490910190555b336000818152600660209081526040808320805460018181018355918552838520018054600160a060020a038a16600160a060020a031991821681179092558186526002855283862080549384018155865294849020909101805490941685179093558051938452908301919091523482820152517f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c19181900360600190a1505050565b6007805482908110610c8c57fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a038216600090815260016020908152604080832033845260020190915281205483908390811115610d28576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c696420566f74650000000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a0382811660009081526001602052604090205416331415610dda57600b54600160a060020a0383166000908152600160209081526040808320338452600201909152902054610d84908363ffffffff612ae516565b1015610dda576040805160e560020a62461bcd02815260206004820181905260248201527f4d696e696d756d206361702073686f756c64206265206d61696e7461696e6564604482015290519081900360640190fd5b600160a060020a03851660009081526001602081905260409091200154610e07908563ffffffff612ae516565b600160a060020a038616600090815260016020818152604080842092830194909455338352600290910190522054610e45908563ffffffff612ae516565b600160a060020a0386166000908152600160209081526040808320338452600201909152902055600f54610e7f904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350610eab908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a0388169282019290925280820186905290517faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa29181900360600190a15050505050565b60606008805480602002602001604051908101604052809291908181526020018280548015610f8a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610f6c575b505050505090505b90565b6060600080600880549050604051908082528060200260200182016040528015610fc9578160200160208202803883390190505b50925060009150600090505b60085481101561106557600880546000919083908110610ff157fe5b600091825260209091200154600160a060020a03161461105d57600880548290811061101957fe5b6000918252602090912001548351600160a060020a039091169084908490811061103f57fe5b600160a060020a039092166020928302909101909101526001909101905b600101610fd5565b81835261107760086020850184612d91565b50505050565b600a5481565b600560209081526000928352604080842090915290825290205460ff1681565b336000908152602081815260408083208484529091529020545b919050565b6012602090815260009182526040918290208054600180830180548651600293821615610100026000190190911692909204601f81018690048602830186019096528582529194929390929083018282801561115f5780601f106111345761010080835404028352916020019161115f565b820191906000526020600020905b81548152906001019060200180831161114257829003601f168201915b5050505050905082565b60066020528160005260406000208181548110151561118457fe5b600091825260209091200154600160a060020a03169150829050565b600160a060020a03811660009081526002602090815260409182902080548351818402810184019094528084526060939283018282801561120a57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116111ec575b50505050509050919050565b600080805b60075481101561126d5783600160a060020a031660078281548110151561123e57fe5b600091825260209091200154600160a060020a031614156112655760018192509250611275565b60010161121b565b600092508291505b50915091565b3360009081526020818152604091829020600101805483518184028101840190945280845260609392830182828015610f8a57602002820191906000526020600020905b8154815260200190600101908083116112bf575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b606061131682612411565b156114195760036000611328846123cc565b600160a060020a0316600160a060020a03168152602001908152602001600020600160036000611357866123cc565b600160a060020a03168152602081019190915260400160002054825491900390811061137f57fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561140d5780601f106113e25761010080835404028352916020019161140d565b820191906000526020600020905b8154815290600101906020018083116113f057829003601f168201915b505050505090506110bd565b600160a060020a03821660009081526003602052604090208054600019810190811061137f57fe5b6008805482908110610c8c57fe5b60016020819052600091825260409091208054910154600160a060020a0382169160a060020a900460ff169083565b336000908152601060205260408120548390839060ff16156114ea576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b60008211611542576040805160e560020a62461bcd02815260206004820152601460248201527f496e76616c696420626c6f636b206e756d626572000000000000000000000000604482015290519081900360640190fd5b438211156115c0576040805160e560020a62461bcd02815260206004820152603560248201527f426c6f636b206e756d6265722073686f756c64206265206c657373207468616e60448201527f2063757272656e7420626c6f636b206e756d6265720000000000000000000000606482015290519081900360840190fd5b336000908152602081815260408083208584529091528120541161162e576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f2063617020746f2077697468647261770000000000000000000000000000604482015290519081900360640190fd5b33600090815260208190526040902060010180548391908390811061164f57fe5b90600052602060002001541415156116b1576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c696420696e64657800000000000000000000000000000000000000604482015290519081900360640190fd5b33600081815260208181526040808320898452808352908320805490849055938352919052600101805491945090859081106116e957fe5b60009182526020822001819055604051339185156108fc02918691818181858888f19350505050158015611721573d6000803e3d6000fd5b50604080513381526020810187905280820185905290517ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360600190a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600160a060020a038116600090815260116020526040812054829060ff16156117e9576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611850576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b611858612451565b600160a060020a03841660009081526004602052604090205460640281151561187d57fe5b049392505050565b6003602052816000526040600020818154811015156118a057fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529450909250908301828280156119335780601f1061190857610100808354040283529160200191611933565b820191906000526020600020905b81548152906001019060200180831161191657829003601f168201915b505050505081565b60026020528160005260406000208181548110151561118457fe5b600160a060020a031660009081526006602052604090205490565b60606000806007805490506040519080825280602002602001820160405280156119a5578160200160208202803883390190505b50925060009150600090505b600754811015611a41576007805460009190839081106119cd57fe5b600091825260209091200154600160a060020a031614611a395760078054829081106119f557fe5b6000918252602090912001548351600160a060020a0390911690849084908110611a1b57fe5b600160a060020a039092166020928302909101909101526001909101905b6001016119b1565b81835261107760076020850184612d91565b600c54341015611aad576040805160e560020a62461bcd02815260206004820152601160248201527f496e76616c696420566f74657220436170000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038116600090815260116020526040902054819060ff1615611b0e576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611b75576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03821660009081526001602081905260409091200154611ba2903463ffffffff612acf16565b600160a060020a0383166000908152600160208181526040808420928301949094553383526002909101905220541515611c0f57600160a060020a0382166000908152600260209081526040822080546001810182559083529120018054600160a060020a031916331790555b600160a060020a0382166000908152600160209081526040808320338452600201909152902054611c46903463ffffffff612acf16565b600160a060020a0383166000818152600160209081526040808320338085526002909101835292819020949094558351918252810191909152348183015290517f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc9181900360600190a15050565b60046020526000908152604090205481565b336000908152601060205260408120546060919060ff1615611d32576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b33600090815260126020908152604091829020600190810180548451600293821615610100026000190190911692909204601f810184900484028301840190945283825290929091830182828015611dcb5780601f10611da057610100808354040283529160200191611dcb565b820191906000526020600020905b815481529060010190602001808311611dae57829003601f168201915b505033600090815260126020526040812054855195975095509093119250611e40915050576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f204b59432075706c6f616465640000000000000000000000000000000000604482015290519081900360640190fd5b6206978081014311611e9c576040805160e560020a62461bcd02815260206004820152601460248201527f4b5943206e6f7420766572696669656420796574000000000000000000000000604482015290519081900360640190fd5b336000818152601260208181526040808420848155815180840192839052858152959094529190529151611ed69260019092019190612df6565b5033600090815260036020908152604082208054600181018083559184529282902085519193611f0c9391019190860190612df6565b50507f949360d814b28a3b393a68909efe1fee120ee09cac30f360a0f80ab5415a611a33836040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611f86578181015183820152602001611f6e565b50505050905090810190601f168015611fb35780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b60095481565b600f5481565b600160a060020a03808216600090815260016020526040812054909182918291829182918791163314612074576040805160e560020a62461bcd02815260206004820152602160248201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60448201527f6e00000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038716600090815260016020526040902054879060a060020a900460ff161515612115576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0388166000908152600160208190526040909120805474ff00000000000000000000000000000000000000001916905560095461215e9163ffffffff612ae516565b60095561216a88612af7565b3360009081526006602052604081208054909850965094505b8585101561226e5787600160a060020a031687868154811015156121a357fe5b600091825260209091200154600160a060020a031614156122635786600187038154811015156121cf57fe5b6000918252602090912001548754600160a060020a03909116908890879081106121f557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550866001870381548110151561223457fe5b60009182526020909120018054600160a060020a0319169055865461225d886000198301612e70565b5061226e565b600190940193612183565b8654151561227f5761227f33612beb565b600160a060020a0388166000818152600160208181526040808420338552600281018352908420549490935281905201549094506122c3908563ffffffff612ae516565b600160a060020a0389166000908152600160208181526040808420928301949094553383526002909101905290812055600e54612306904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350612332908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a038b169282019290925281517f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3929181900390910190a15050505050505050565b60116020526000908152604090205460ff1681565b600160a060020a039081166000908152600160205260409020541690565b600160a060020a031660009081526003602052604090205490565b600d5481565b600e5481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b600b5481565b60106020526000908152604090205460ff1681565b600a5490565b33600081815260116020526040812054909182918291829182916060918291849182919060ff16156124c1576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515612528576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b612531336123cc565b9950600560008b600160a060020a0316600160a060020a0316815260200190815260200160002060008c600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460ff161515156125e0576040805160e560020a62461bcd02815260206004820152600d60248201527f416c726561647920766f74656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03808b166000908152600560209081526040808320938f168352928152828220805460ff19166001908117909155600490915291902080549091019055604b61262e612451565b600160a060020a038d1660009081526004602052604090205460640281151561265357fe5b041061294257600160a060020a038b166000818152601060209081526040808320805460ff1916600190811790915560128084528285208581558351808601948590528681529690955290925292516126b193929091019190612df6565b506126bb8b611216565b98509850881561294257600854604080518281526020808402820101909152600098508897509080156126f8578160200160208202803883390190505b506008546040805182815260208084028201019091529196508015612727578160200160208202803883390190505b509350600092505b60085483101561288f57600880548490811061274757fe5b600091825260209091200154600160a060020a0390811692508b1661276b836123cc565b600160a060020a031614156128585760095461278e90600163ffffffff612ae516565b60095584516001870196839187919081106127a557fe5b600160a060020a0392831660209182029092018101919091528382166000908152601182526040808220805460ff19166001908117909155808452818320805474ffffffffffffffffffffffffffffffffffffffffff1916815501829055928e168152600390915290812061281991612e94565b600160a060020a038b16600090815260066020526040812061283a91612eb5565b600160a060020a038b16600090815260046020526040812055612884565b835160018801978391869190811061286c57fe5b600160a060020a039092166020928302909101909101525b60019092019161272f565b86845285855283516128a8906008906020870190612d91565b506128b288612ce4565b7fe18d61a5bf4aa2ab40afc88aa9039d27ae17ff4ec1c65f5f414df6f02ce8b35e8b866040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561292d578181015183820152602001612915565b50505050905001935050505060405180910390a15b5050505050505050505050565b3360008181526001602052604090205460a060020a900460ff1615156129e5576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b3360009081526010602052604090205460ff1615612a4d576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b604080519081016040528043815260200184848080601f01602080910402602001604051908101604052809392919081815260200183838082843750505092909352505033600090815260126020908152604090912083518155838201518051919350612ac1926001850192910190612df6565b505050505050565b600c5481565b600082820183811015612ade57fe5b9392505050565b600082821115612af157fe5b50900390565b60085460005b81811015612be65782600160a060020a0316600882815481101515612b1e57fe5b600091825260209091200154600160a060020a03161415612bde57600880546000198401908110612b4b57fe5b60009182526020909120015460088054600160a060020a039092169183908110612b7157fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600880546000198401908110612bac57fe5b60009182526020909120018054600160a060020a03191690556008805490612bd8906000198301612e70565b50612be6565b600101612afd565b505050565b60075460005b81811015612be65782600160a060020a0316600782815481101515612c1257fe5b600091825260209091200154600160a060020a03161415612cdc57600780546000198401908110612c3f57fe5b60009182526020909120015460078054600160a060020a039092169183908110612c6557fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600780546000198401908110612ca057fe5b60009182526020909120018054600160a060020a03191690556007805490612ccc906000198301612e70565b50600a8054600019019055612be6565b600101612bf1565b600780546000198101919082908110612cf957fe5b60009182526020909120015460078054600160a060020a039092169184908110612d1f57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556007805482908110612d5657fe5b60009182526020909120018054600160a060020a03191690556007805490612d82906000198301612e70565b5050600a805460001901905550565b828054828255906000526020600020908101928215612de6579160200282015b82811115612de65782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190612db1565b50612df2929150612ed3565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612e3757805160ff1916838001178555612e64565b82800160010185558215612e64579182015b82811115612e64578251825591602001919060010190612e49565b50612df2929150612ef7565b815481835581811115612be657600083815260209020612be6918101908301612ef7565b5080546000825590600052602060002090810190612eb29190612f11565b50565b5080546000825590600052602060002090810190612eb29190612ef7565b610f9291905b80821115612df2578054600160a060020a0319168155600101612ed9565b610f9291905b80821115612df25760008155600101612efd565b610f9291905b80821115612df2576000612f2b8282612f34565b50600101612f17565b50805460018160011615610100020316600290046000825580601f10612f5a5750612eb2565b601f016020900490600052602060002090810190612eb29190612ef75600496e76616c69642043616e646964617465000000000000000000000000000000a165627a7a72305820e276810d3fb0643b8f5745972bb7ebc597a961b67258d4aebbb789c52bf885ed0029 \ No newline at end of file diff --git a/contracts/validator/contract_v2/src/contracts/XDCValidator.sol b/contracts/validator/contract_v2/src/contracts/XDCValidator.sol new file mode 100644 index 000000000000..8736a7032a04 --- /dev/null +++ b/contracts/validator/contract_v2/src/contracts/XDCValidator.sol @@ -0,0 +1,543 @@ +// SPDX-License-Identifier: MIT +pragma solidity =0.4.26; + +import {SafeMath} from "./libraries/SafeMath.sol"; + +contract XDCValidator { + using SafeMath for uint256; + + event Vote(address _voter, address _candidate, uint256 _cap); + event Unvote(address _voter, address _candidate, uint256 _cap); + event Propose(address _owner, address _candidate, uint256 _cap); + event Resign(address _owner, address _candidate); + event Withdraw(address _owner, uint256 _blockNumber, uint256 _cap); + event UploadedKYC(address _owner, string kycHash); + event InvalidatedNode(address _masternodeOwner, address[] _masternodes); + + struct ValidatorState { + address owner; + bool isCandidate; + uint256 cap; + mapping(address => uint256) voters; + } + + struct WithdrawState { + mapping(uint256 => uint256) caps; + uint256[] blockNumbers; + } + + mapping(address => WithdrawState) withdrawsState; + + mapping(address => ValidatorState) public validatorsState; + mapping(address => address[]) public voters; + + // Mapping structures added for KYC feature. + mapping(address => string[]) public KYCString; + mapping(address => uint) public invalidKYCCount; + mapping(address => mapping(address => bool)) public hasVotedInvalid; + mapping(address => address[]) public ownerToCandidate; + address[] public owners; + + address[] public candidates; + + uint256 public candidateCount = 0; + uint256 public ownerCount = 0; + uint256 public minCandidateCap; + uint256 public minVoterCap; + uint256 public maxValidatorNumber; + uint256 public candidateWithdrawDelay; + uint256 public voterWithdrawDelay; + // owner => invalid + mapping(address => bool) public invalidOwner; + // candaite => invalid + mapping(address => bool) public invalidCandidate; + + struct PendingKYCState { + uint256 blockNumber; + string kycHash; + } + + mapping(address => PendingKYCState) public pendingKYC; + + modifier onlyValidCandidateCap() { + // anyone can deposit X XDC to become a candidate + require(msg.value >= minCandidateCap, "Invalid Candidate Cap"); + _; + } + + modifier onlyValidVoterCap() { + require(msg.value >= minVoterCap, "Invalid Voter Cap"); + _; + } + + modifier onlyKYCWhitelisted() { + require( + KYCString[msg.sender].length != 0 || + ownerToCandidate[msg.sender].length > 0, + "KYC not uploaded" + ); + _; + } + + modifier onlyOwner(address _candidate) { + require( + validatorsState[_candidate].owner == msg.sender, + "Only owner can call this function" + ); + _; + } + + modifier onlyCandidate(address _candidate) { + require( + validatorsState[_candidate].isCandidate, + "Only candidate can call this function" + ); + _; + } + + modifier onlyValidCandidate(address _candidate) { + require(!invalidCandidate[_candidate], "Invalid Candidate"); + require(validatorsState[_candidate].isCandidate, "Invalid Candidate"); + _; + } + + modifier onlyNotCandidate(address _candidate) { + require(!invalidCandidate[_candidate], "Invalid Candidate"); + require( + !validatorsState[_candidate].isCandidate, + "Already a candidate" + ); + _; + } + + modifier onlyValidVote(address _candidate, uint256 _cap) { + require( + validatorsState[_candidate].voters[msg.sender] >= _cap, + "Invalid Vote" + ); + if (validatorsState[_candidate].owner == msg.sender) { + require( + validatorsState[_candidate].voters[msg.sender].sub(_cap) >= + minCandidateCap, + "Minimum cap should be maintained" + ); + } + _; + } + + modifier onlyValidWithdraw(uint256 _blockNumber, uint _index) { + require(!invalidOwner[msg.sender], "Invalid Owner"); + require(_blockNumber > 0, "Invalid block number"); + require( + block.number >= _blockNumber, + "Block number should be less than current block number" + ); + require( + withdrawsState[msg.sender].caps[_blockNumber] > 0, + "No cap to withdraw" + ); + require( + withdrawsState[msg.sender].blockNumbers[_index] == _blockNumber, + "Invalid index" + ); + _; + } + + constructor( + address[] _candidates, + uint256[] _caps, + address _firstOwner, + uint256 _minCandidateCap, + uint256 _minVoterCap, + uint256 _maxValidatorNumber, + uint256 _candidateWithdrawDelay, + uint256 _voterWithdrawDelay + ) public { + minCandidateCap = _minCandidateCap; + minVoterCap = _minVoterCap; + maxValidatorNumber = _maxValidatorNumber; + candidateWithdrawDelay = _candidateWithdrawDelay; + voterWithdrawDelay = _voterWithdrawDelay; + candidateCount = _candidates.length; + owners.push(_firstOwner); + ownerCount++; + for (uint256 i = 0; i < _candidates.length; i++) { + candidates.push(_candidates[i]); + validatorsState[_candidates[i]] = ValidatorState({ + owner: _firstOwner, + isCandidate: true, + cap: _caps[i] + }); + voters[_candidates[i]].push(_firstOwner); + ownerToCandidate[_firstOwner].push(_candidates[i]); + validatorsState[_candidates[i]].voters[_firstOwner] = _caps[i]; + } + } + + function uploadKYC(string kychash) external onlyCandidate(msg.sender) { + require(!invalidOwner[msg.sender], "Invalid Owner"); + pendingKYC[msg.sender] = PendingKYCState({ + blockNumber: block.number, + kycHash: kychash + }); + } + + function claimKYC() external { + require(!invalidOwner[msg.sender], "Invalid Owner"); + string memory kychash = pendingKYC[msg.sender].kycHash; + uint256 blockNumber = pendingKYC[msg.sender].blockNumber; + require(bytes(kychash).length > 0, "No KYC uploaded"); + require( + block.number > blockNumber + 10 * 43200, + "KYC not verified yet" + ); + + pendingKYC[msg.sender].blockNumber = 0; + pendingKYC[msg.sender].kycHash = ""; + KYCString[msg.sender].push(kychash); + + emit UploadedKYC(msg.sender, kychash); + } + + // propose : any non-candidate who has uploaded its KYC can become an owner by proposing a candidate. + function propose( + address _candidate + ) + external + payable + onlyValidCandidateCap + onlyKYCWhitelisted + onlyNotCandidate(_candidate) + { + uint256 cap = validatorsState[_candidate].cap.add(msg.value); + candidates.push(_candidate); + validatorsState[_candidate] = ValidatorState({ + owner: msg.sender, + isCandidate: true, + cap: cap + }); + validatorsState[_candidate].voters[msg.sender] = validatorsState[ + _candidate + ].voters[msg.sender].add(msg.value); + candidateCount = candidateCount.add(1); + if (ownerToCandidate[msg.sender].length == 0) { + owners.push(msg.sender); + ownerCount++; + } + ownerToCandidate[msg.sender].push(_candidate); + voters[_candidate].push(msg.sender); + emit Propose(msg.sender, _candidate, msg.value); + } + + function vote( + address _candidate + ) external payable onlyValidVoterCap onlyValidCandidate(_candidate) { + validatorsState[_candidate].cap = validatorsState[_candidate].cap.add( + msg.value + ); + if (validatorsState[_candidate].voters[msg.sender] == 0) { + voters[_candidate].push(msg.sender); + } + validatorsState[_candidate].voters[msg.sender] = validatorsState[ + _candidate + ].voters[msg.sender].add(msg.value); + emit Vote(msg.sender, _candidate, msg.value); + } + + function getCandidates() public view returns (address[]) { + return candidates; + } + + function getCandidateCap(address _candidate) public view returns (uint256) { + return validatorsState[_candidate].cap; + } + + function getCandidateOwner( + address _candidate + ) public view returns (address) { + return validatorsState[_candidate].owner; + } + + function getVoterCap( + address _candidate, + address _voter + ) public view returns (uint256) { + return validatorsState[_candidate].voters[_voter]; + } + + function getVoters(address _candidate) public view returns (address[]) { + return voters[_candidate]; + } + + function isCandidate(address _candidate) public view returns (bool) { + return validatorsState[_candidate].isCandidate; + } + + function getWithdrawBlockNumbers() public view returns (uint256[]) { + return withdrawsState[msg.sender].blockNumbers; + } + + function getWithdrawCap( + uint256 _blockNumber + ) public view returns (uint256) { + return withdrawsState[msg.sender].caps[_blockNumber]; + } + + function unvote( + address _candidate, + uint256 _cap + ) public onlyValidVote(_candidate, _cap) { + validatorsState[_candidate].cap = validatorsState[_candidate].cap.sub( + _cap + ); + validatorsState[_candidate].voters[msg.sender] = validatorsState[ + _candidate + ].voters[msg.sender].sub(_cap); + + // refund after delay X blocks + uint256 withdrawBlockNumber = voterWithdrawDelay.add(block.number); + withdrawsState[msg.sender].caps[withdrawBlockNumber] = withdrawsState[ + msg.sender + ].caps[withdrawBlockNumber].add(_cap); + withdrawsState[msg.sender].blockNumbers.push(withdrawBlockNumber); + + emit Unvote(msg.sender, _candidate, _cap); + } + + function resign( + address _candidate + ) public onlyOwner(_candidate) onlyCandidate(_candidate) { + validatorsState[_candidate].isCandidate = false; + candidateCount = candidateCount.sub(1); + + deleteCandidate(_candidate); + + // Cleanup the ownerToCandidate mapping for the resigning candidate's owner + address[] storage ownedCandidates = ownerToCandidate[msg.sender]; + uint256 ownedCandidatesLength = ownedCandidates.length; + for (uint256 j = 0; j < ownedCandidatesLength; j++) { + if (ownedCandidates[j] == _candidate) { + ownedCandidates[j] = ownedCandidates[ownedCandidatesLength - 1]; + delete ownedCandidates[ownedCandidatesLength - 1]; + ownedCandidates.length--; // Manually decrease the array length + break; + } + } + + // Optionally, consider adjusting ownerCount if needed + if (ownedCandidates.length == 0) { + // If specific logic is needed to manage the owners array, implement here + deleteOwner(msg.sender); + } + + uint256 cap = validatorsState[_candidate].voters[msg.sender]; + validatorsState[_candidate].cap = validatorsState[_candidate].cap.sub( + cap + ); + validatorsState[_candidate].voters[msg.sender] = 0; + // refunding after resigning X blocks + uint256 withdrawBlockNumber = candidateWithdrawDelay.add(block.number); + withdrawsState[msg.sender].caps[withdrawBlockNumber] = withdrawsState[ + msg.sender + ].caps[withdrawBlockNumber].add(cap); + withdrawsState[msg.sender].blockNumbers.push(withdrawBlockNumber); + emit Resign(msg.sender, _candidate); + } + + // voteInvalidKYC : any candidate can vote for invalid KYC i.e. a particular candidate's owner has uploaded a bad KYC. + // On securing 75% votes against an owner ( not candidate ), owner & all its candidates will lose their funds. + function voteInvalidKYC( + address _owner + ) public onlyValidCandidate(msg.sender) { + address candidateOwner = getCandidateOwner(msg.sender); + + require(!hasVotedInvalid[candidateOwner][_owner], "Already voted"); + hasVotedInvalid[candidateOwner][_owner] = true; + invalidKYCCount[_owner] += 1; + if ((invalidKYCCount[_owner] * 100) / getOwnerCount() >= 75) { + // 75% owners say that the KYC is invalid + invalidOwner[_owner] = true; + pendingKYC[_owner].blockNumber = 0; + pendingKYC[_owner].kycHash = ""; + + (bool isOwnerNow, uint ownerIndex) = isOwner(_owner); + if (isOwnerNow) { + uint j = 0; + uint count = 0; + address[] memory allInvalidMasternodes = new address[]( + candidates.length + ); + address[] memory newCandidates = new address[]( + candidates.length + ); + + for (uint i = 0; i < candidates.length; i++) { + address candidate = candidates[i]; + if (getCandidateOwner(candidate) == _owner) { + // logic to remove cap. + candidateCount = candidateCount.sub(1); + allInvalidMasternodes[count++] = candidate; + invalidCandidate[candidate] = true; + delete validatorsState[candidate]; + delete KYCString[_owner]; + delete ownerToCandidate[_owner]; + delete invalidKYCCount[_owner]; + } else { + newCandidates[j++] = candidate; + } + } + + // Resize the array. + assembly { + mstore(newCandidates, j) + mstore(allInvalidMasternodes, count) + } + candidates = newCandidates; + + removeOwnerByIndex(ownerIndex); + emit InvalidatedNode(_owner, allInvalidMasternodes); + } + } + } + + // invalidPercent : get votes against an owner in percentage. + function invalidPercent( + address _owner + ) public view onlyValidCandidate(_owner) returns (uint) { + return ((invalidKYCCount[_owner] * 100) / getOwnerCount()); + } + + // getOwnerCount : get count of total owners; accounts who own atleast one masternode. + function getOwnerCount() public view returns (uint) { + return ownerCount; + } + + // getKYC : get KYC uploaded of the owner of the given masternode or the owner themselves + function getLatestKYC(address _address) public view returns (string) { + if (isCandidate(_address)) { + return + KYCString[getCandidateOwner(_address)][ + KYCString[getCandidateOwner(_address)].length - 1 + ]; + } else { + return KYCString[_address][KYCString[_address].length - 1]; + } + } + + function getHashCount(address _address) public view returns (uint) { + return KYCString[_address].length; + } + + function withdraw( + uint256 _blockNumber, + uint _index + ) public onlyValidWithdraw(_blockNumber, _index) { + uint256 cap = withdrawsState[msg.sender].caps[_blockNumber]; + delete withdrawsState[msg.sender].caps[_blockNumber]; + delete withdrawsState[msg.sender].blockNumbers[_index]; + msg.sender.transfer(cap); + emit Withdraw(msg.sender, _blockNumber, cap); + } + + function removeZeroAddresses( + address[] memory addresses + ) private pure returns (address[] memory) { + address[] memory newAddresses = new address[](addresses.length); + uint256 j = 0; + for (uint256 i = 0; i < addresses.length; i++) { + if (addresses[i] != address(0)) { + newAddresses[j] = addresses[i]; + j++; + } + } + // Resize the array. + assembly { + mstore(newAddresses, j) + } + return newAddresses; + } + + function removeCandidatesZeroAddresses() external { + address[] memory newAddresses = new address[](candidates.length); + uint256 j = 0; + for (uint256 i = 0; i < candidates.length; i++) { + if (candidates[i] != address(0)) { + newAddresses[j] = candidates[i]; + j++; + } + } + // Resize the array. + assembly { + mstore(newAddresses, j) + } + candidates = newAddresses; + } + + function removeOwnersZeroAddresses() external { + address[] memory newAddresses = new address[](owners.length); + uint256 j = 0; + for (uint256 i = 0; i < owners.length; i++) { + if (owners[i] != address(0)) { + newAddresses[j] = owners[i]; + j++; + } + } + // Resize the array. + assembly { + mstore(newAddresses, j) + } + owners = newAddresses; + } + + // Efficiently remove _candidate from the candidates array + function deleteCandidate(address candidate) private { + uint256 candidatesLength = candidates.length; + for (uint256 i = 0; i < candidatesLength; i++) { + if (candidates[i] == candidate) { + candidates[i] = candidates[candidatesLength - 1]; + delete candidates[candidatesLength - 1]; + candidates.length--; // Manually decrease the array length + break; + } + } + } + + // Efficiently remove the invalid owner from the owners array + function deleteOwner(address owner) private { + uint256 ownersLength = owners.length; + for (uint k = 0; k < ownersLength; k++) { + if (owners[k] == owner) { + owners[k] = owners[ownersLength - 1]; // Swap with the last element + delete owners[ownersLength - 1]; // Delete the last element + owners.length--; // Decrease the array size + ownerCount--; // Decrease the owner count + break; + } + } + } + + // isOwner : check if the given address is an owner or not. + function isOwner(address owner) public view returns (bool, uint256) { + for (uint i = 0; i < owners.length; i++) { + if (owners[i] == owner) { + return (true, i); + } + } + return (false, 0); + } + + function removeOwnerByIndex(uint256 index) private { + // no need to check: index <= lastIndex + uint256 lastIndex = owners.length - 1; + owners[index] = owners[lastIndex]; + delete owners[lastIndex]; + owners.length--; + ownerCount--; + } + + function getOwnerToCandidateLength( + address _address + ) external view returns (uint256) { + return ownerToCandidate[_address].length; + } +} diff --git a/contracts/validator/contract_v2/src/contracts/libraries/SafeMath.sol b/contracts/validator/contract_v2/src/contracts/libraries/SafeMath.sol new file mode 100644 index 000000000000..8c205f939a49 --- /dev/null +++ b/contracts/validator/contract_v2/src/contracts/libraries/SafeMath.sol @@ -0,0 +1,46 @@ +pragma solidity =0.4.26; + +/** + * @title SafeMath + * @dev Math operations with safety checks that throw on error + */ +library SafeMath { + /** + * @dev Multiplies two numbers, throws on overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + if (a == 0) { + return 0; + } + uint256 c = a * b; + assert(c / a == b); + return c; + } + + /** + * @dev Integer division of two numbers, truncating the quotient. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + // assert(b > 0); // Solidity automatically throws when dividing by 0 + // uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + return a / b; + } + + /** + * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + assert(b <= a); + return a - b; + } + + /** + * @dev Adds two numbers, throws on overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + assert(c >= a); + return c; + } +} diff --git a/contracts/validator/contract_v2/src/deployedBytecode b/contracts/validator/contract_v2/src/deployedBytecode new file mode 100644 index 000000000000..143e8a14f7f8 --- /dev/null +++ b/contracts/validator/contract_v2/src/deployedBytecode @@ -0,0 +1 @@ +0x6080604052600436106102035763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663012679518114610208578063025e7c271461021e57806302aa9be21461025257806306a49fce146102765780630999ec79146102db5780630db02622146102f05780630e3e4fb81461031757806315febd68146103525780631c68951c1461036a5780632a3640b11461040a5780632d15cc041461042e5780632f54bf6e1461044f5780632f9c4bba1461048b578063302b6872146104a057806332658652146104c75780633477ee2e1461055d5780634110a48914610575578063441a3e70146105be57806358e7525f146105d95780635b860d27146105fa5780635b9cd8cc1461061b5780635c134d661461063f57806367134e7014610663578063681d8bf2146106845780636dd7d8ea1461069957806372e44a38146106ad578063935ad0d1146106ce578063a9a981a3146106e3578063a9ff959e146106f8578063ae6e43f51461070d578063b622f1411461072e578063b642facd1461074f578063c45607df14610770578063d09f1ab414610791578063d161c767146107a6578063d51b9e93146107bb578063d55b7dff146107dc578063db11daef146107f1578063ef18374a14610812578063f2ee3c7d14610827578063f5c9512514610848578063f8ac9dd514610868575b600080fd5b61021c600160a060020a036004351661087d565b005b34801561022a57600080fd5b50610236600435610c7e565b60408051600160a060020a039092168252519081900360200190f35b34801561025e57600080fd5b5061021c600160a060020a0360043516602435610ca6565b34801561028257600080fd5b5061028b610f32565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102c75781810151838201526020016102af565b505050509050019250505060405180910390f35b3480156102e757600080fd5b5061021c610f95565b3480156102fc57600080fd5b5061030561107d565b60408051918252519081900360200190f35b34801561032357600080fd5b5061033e600160a060020a0360043581169060243516611083565b604080519115158252519081900360200190f35b34801561035e57600080fd5b506103056004356110a3565b34801561037657600080fd5b5061038b600160a060020a03600435166110c2565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103ce5781810151838201526020016103b6565b50505050905090810190601f1680156103fb5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561041657600080fd5b50610236600160a060020a0360043516602435611169565b34801561043a57600080fd5b5061028b600160a060020a03600435166111a0565b34801561045b57600080fd5b50610470600160a060020a0360043516611216565b60408051921515835260208301919091528051918290030190f35b34801561049757600080fd5b5061028b61127b565b3480156104ac57600080fd5b50610305600160a060020a03600435811690602435166112dc565b3480156104d357600080fd5b506104e8600160a060020a036004351661130b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561052257818101518382015260200161050a565b50505050905090810190601f16801561054f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056957600080fd5b50610236600435611441565b34801561058157600080fd5b50610596600160a060020a036004351661144f565b60408051600160a060020a039094168452911515602084015282820152519081900360600190f35b3480156105ca57600080fd5b5061021c60043560243561147e565b3480156105e557600080fd5b50610305600160a060020a0360043516611769565b34801561060657600080fd5b50610305600160a060020a0360043516611788565b34801561062757600080fd5b506104e8600160a060020a0360043516602435611885565b34801561064b57600080fd5b50610236600160a060020a036004351660243561193b565b34801561066f57600080fd5b50610305600160a060020a0360043516611956565b34801561069057600080fd5b5061021c611971565b61021c600160a060020a0360043516611a53565b3480156106b957600080fd5b50610305600160a060020a0360043516611cb4565b3480156106da57600080fd5b5061021c611cc6565b3480156106ef57600080fd5b50610305611fc5565b34801561070457600080fd5b50610305611fcb565b34801561071957600080fd5b5061021c600160a060020a0360043516611fd1565b34801561073a57600080fd5b5061033e600160a060020a03600435166123b7565b34801561075b57600080fd5b50610236600160a060020a03600435166123cc565b34801561077c57600080fd5b50610305600160a060020a03600435166123ea565b34801561079d57600080fd5b50610305612405565b3480156107b257600080fd5b5061030561240b565b3480156107c757600080fd5b5061033e600160a060020a0360043516612411565b3480156107e857600080fd5b50610305612436565b3480156107fd57600080fd5b5061033e600160a060020a036004351661243c565b34801561081e57600080fd5b50610305612451565b34801561083357600080fd5b5061021c600160a060020a0360043516612457565b34801561085457600080fd5b5061021c600480356024810191013561294f565b34801561087457600080fd5b50610305612ac9565b600b546000903410156108da576040805160e560020a62461bcd02815260206004820152601560248201527f496e76616c69642043616e646964617465204361700000000000000000000000604482015290519081900360640190fd5b33600090815260036020526040902054151580610904575033600090815260066020526040812054115b151561095a576040805160e560020a62461bcd02815260206004820152601060248201527f4b5943206e6f742075706c6f6164656400000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038216600090815260116020526040902054829060ff16156109bb576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff1615610a33576040805160e560020a62461bcd02815260206004820152601360248201527f416c726561647920612063616e64696461746500000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831660009081526001602081905260409091200154610a60903463ffffffff612acf16565b6008805460018181019092557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3018054600160a060020a03808816600160a060020a03199283168117909355604080516060810182523380825260208281018881528385018a81526000988952898352858920945185549251151560a060020a0274ff0000000000000000000000000000000000000000199190981692909816919091179690961694909417825593519581019590955591835260029093019092522054909250610b37903463ffffffff612acf16565b600160a060020a038416600090815260016020818152604080842033855260020190915290912091909155600954610b749163ffffffff612acf16565b600955336000908152600660205260409020541515610bda5760078054600181810183556000929092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688018054600160a060020a03191633179055600a805490910190555b336000818152600660209081526040808320805460018181018355918552838520018054600160a060020a038a16600160a060020a031991821681179092558186526002855283862080549384018155865294849020909101805490941685179093558051938452908301919091523482820152517f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c19181900360600190a1505050565b6007805482908110610c8c57fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a038216600090815260016020908152604080832033845260020190915281205483908390811115610d28576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c696420566f74650000000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a0382811660009081526001602052604090205416331415610dda57600b54600160a060020a0383166000908152600160209081526040808320338452600201909152902054610d84908363ffffffff612ae516565b1015610dda576040805160e560020a62461bcd02815260206004820181905260248201527f4d696e696d756d206361702073686f756c64206265206d61696e7461696e6564604482015290519081900360640190fd5b600160a060020a03851660009081526001602081905260409091200154610e07908563ffffffff612ae516565b600160a060020a038616600090815260016020818152604080842092830194909455338352600290910190522054610e45908563ffffffff612ae516565b600160a060020a0386166000908152600160209081526040808320338452600201909152902055600f54610e7f904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350610eab908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a0388169282019290925280820186905290517faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa29181900360600190a15050505050565b60606008805480602002602001604051908101604052809291908181526020018280548015610f8a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610f6c575b505050505090505b90565b6060600080600880549050604051908082528060200260200182016040528015610fc9578160200160208202803883390190505b50925060009150600090505b60085481101561106557600880546000919083908110610ff157fe5b600091825260209091200154600160a060020a03161461105d57600880548290811061101957fe5b6000918252602090912001548351600160a060020a039091169084908490811061103f57fe5b600160a060020a039092166020928302909101909101526001909101905b600101610fd5565b81835261107760086020850184612d91565b50505050565b600a5481565b600560209081526000928352604080842090915290825290205460ff1681565b336000908152602081815260408083208484529091529020545b919050565b6012602090815260009182526040918290208054600180830180548651600293821615610100026000190190911692909204601f81018690048602830186019096528582529194929390929083018282801561115f5780601f106111345761010080835404028352916020019161115f565b820191906000526020600020905b81548152906001019060200180831161114257829003601f168201915b5050505050905082565b60066020528160005260406000208181548110151561118457fe5b600091825260209091200154600160a060020a03169150829050565b600160a060020a03811660009081526002602090815260409182902080548351818402810184019094528084526060939283018282801561120a57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116111ec575b50505050509050919050565b600080805b60075481101561126d5783600160a060020a031660078281548110151561123e57fe5b600091825260209091200154600160a060020a031614156112655760018192509250611275565b60010161121b565b600092508291505b50915091565b3360009081526020818152604091829020600101805483518184028101840190945280845260609392830182828015610f8a57602002820191906000526020600020905b8154815260200190600101908083116112bf575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b606061131682612411565b156114195760036000611328846123cc565b600160a060020a0316600160a060020a03168152602001908152602001600020600160036000611357866123cc565b600160a060020a03168152602081019190915260400160002054825491900390811061137f57fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561140d5780601f106113e25761010080835404028352916020019161140d565b820191906000526020600020905b8154815290600101906020018083116113f057829003601f168201915b505050505090506110bd565b600160a060020a03821660009081526003602052604090208054600019810190811061137f57fe5b6008805482908110610c8c57fe5b60016020819052600091825260409091208054910154600160a060020a0382169160a060020a900460ff169083565b336000908152601060205260408120548390839060ff16156114ea576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b60008211611542576040805160e560020a62461bcd02815260206004820152601460248201527f496e76616c696420626c6f636b206e756d626572000000000000000000000000604482015290519081900360640190fd5b438211156115c0576040805160e560020a62461bcd02815260206004820152603560248201527f426c6f636b206e756d6265722073686f756c64206265206c657373207468616e60448201527f2063757272656e7420626c6f636b206e756d6265720000000000000000000000606482015290519081900360840190fd5b336000908152602081815260408083208584529091528120541161162e576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f2063617020746f2077697468647261770000000000000000000000000000604482015290519081900360640190fd5b33600090815260208190526040902060010180548391908390811061164f57fe5b90600052602060002001541415156116b1576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c696420696e64657800000000000000000000000000000000000000604482015290519081900360640190fd5b33600081815260208181526040808320898452808352908320805490849055938352919052600101805491945090859081106116e957fe5b60009182526020822001819055604051339185156108fc02918691818181858888f19350505050158015611721573d6000803e3d6000fd5b50604080513381526020810187905280820185905290517ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360600190a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600160a060020a038116600090815260116020526040812054829060ff16156117e9576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611850576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b611858612451565b600160a060020a03841660009081526004602052604090205460640281151561187d57fe5b049392505050565b6003602052816000526040600020818154811015156118a057fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529450909250908301828280156119335780601f1061190857610100808354040283529160200191611933565b820191906000526020600020905b81548152906001019060200180831161191657829003601f168201915b505050505081565b60026020528160005260406000208181548110151561118457fe5b600160a060020a031660009081526006602052604090205490565b60606000806007805490506040519080825280602002602001820160405280156119a5578160200160208202803883390190505b50925060009150600090505b600754811015611a41576007805460009190839081106119cd57fe5b600091825260209091200154600160a060020a031614611a395760078054829081106119f557fe5b6000918252602090912001548351600160a060020a0390911690849084908110611a1b57fe5b600160a060020a039092166020928302909101909101526001909101905b6001016119b1565b81835261107760076020850184612d91565b600c54341015611aad576040805160e560020a62461bcd02815260206004820152601160248201527f496e76616c696420566f74657220436170000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038116600090815260116020526040902054819060ff1615611b0e576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611b75576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03821660009081526001602081905260409091200154611ba2903463ffffffff612acf16565b600160a060020a0383166000908152600160208181526040808420928301949094553383526002909101905220541515611c0f57600160a060020a0382166000908152600260209081526040822080546001810182559083529120018054600160a060020a031916331790555b600160a060020a0382166000908152600160209081526040808320338452600201909152902054611c46903463ffffffff612acf16565b600160a060020a0383166000818152600160209081526040808320338085526002909101835292819020949094558351918252810191909152348183015290517f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc9181900360600190a15050565b60046020526000908152604090205481565b336000908152601060205260408120546060919060ff1615611d32576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b33600090815260126020908152604091829020600190810180548451600293821615610100026000190190911692909204601f810184900484028301840190945283825290929091830182828015611dcb5780601f10611da057610100808354040283529160200191611dcb565b820191906000526020600020905b815481529060010190602001808311611dae57829003601f168201915b505033600090815260126020526040812054855195975095509093119250611e40915050576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f204b59432075706c6f616465640000000000000000000000000000000000604482015290519081900360640190fd5b6206978081014311611e9c576040805160e560020a62461bcd02815260206004820152601460248201527f4b5943206e6f7420766572696669656420796574000000000000000000000000604482015290519081900360640190fd5b336000818152601260208181526040808420848155815180840192839052858152959094529190529151611ed69260019092019190612df6565b5033600090815260036020908152604082208054600181018083559184529282902085519193611f0c9391019190860190612df6565b50507f949360d814b28a3b393a68909efe1fee120ee09cac30f360a0f80ab5415a611a33836040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611f86578181015183820152602001611f6e565b50505050905090810190601f168015611fb35780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b60095481565b600f5481565b600160a060020a03808216600090815260016020526040812054909182918291829182918791163314612074576040805160e560020a62461bcd02815260206004820152602160248201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60448201527f6e00000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038716600090815260016020526040902054879060a060020a900460ff161515612115576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0388166000908152600160208190526040909120805474ff00000000000000000000000000000000000000001916905560095461215e9163ffffffff612ae516565b60095561216a88612af7565b3360009081526006602052604081208054909850965094505b8585101561226e5787600160a060020a031687868154811015156121a357fe5b600091825260209091200154600160a060020a031614156122635786600187038154811015156121cf57fe5b6000918252602090912001548754600160a060020a03909116908890879081106121f557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550866001870381548110151561223457fe5b60009182526020909120018054600160a060020a0319169055865461225d886000198301612e70565b5061226e565b600190940193612183565b8654151561227f5761227f33612beb565b600160a060020a0388166000818152600160208181526040808420338552600281018352908420549490935281905201549094506122c3908563ffffffff612ae516565b600160a060020a0389166000908152600160208181526040808420928301949094553383526002909101905290812055600e54612306904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350612332908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a038b169282019290925281517f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3929181900390910190a15050505050505050565b60116020526000908152604090205460ff1681565b600160a060020a039081166000908152600160205260409020541690565b600160a060020a031660009081526003602052604090205490565b600d5481565b600e5481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b600b5481565b60106020526000908152604090205460ff1681565b600a5490565b33600081815260116020526040812054909182918291829182916060918291849182919060ff16156124c1576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515612528576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b612531336123cc565b9950600560008b600160a060020a0316600160a060020a0316815260200190815260200160002060008c600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460ff161515156125e0576040805160e560020a62461bcd02815260206004820152600d60248201527f416c726561647920766f74656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03808b166000908152600560209081526040808320938f168352928152828220805460ff19166001908117909155600490915291902080549091019055604b61262e612451565b600160a060020a038d1660009081526004602052604090205460640281151561265357fe5b041061294257600160a060020a038b166000818152601060209081526040808320805460ff1916600190811790915560128084528285208581558351808601948590528681529690955290925292516126b193929091019190612df6565b506126bb8b611216565b98509850881561294257600854604080518281526020808402820101909152600098508897509080156126f8578160200160208202803883390190505b506008546040805182815260208084028201019091529196508015612727578160200160208202803883390190505b509350600092505b60085483101561288f57600880548490811061274757fe5b600091825260209091200154600160a060020a0390811692508b1661276b836123cc565b600160a060020a031614156128585760095461278e90600163ffffffff612ae516565b60095584516001870196839187919081106127a557fe5b600160a060020a0392831660209182029092018101919091528382166000908152601182526040808220805460ff19166001908117909155808452818320805474ffffffffffffffffffffffffffffffffffffffffff1916815501829055928e168152600390915290812061281991612e94565b600160a060020a038b16600090815260066020526040812061283a91612eb5565b600160a060020a038b16600090815260046020526040812055612884565b835160018801978391869190811061286c57fe5b600160a060020a039092166020928302909101909101525b60019092019161272f565b86845285855283516128a8906008906020870190612d91565b506128b288612ce4565b7fe18d61a5bf4aa2ab40afc88aa9039d27ae17ff4ec1c65f5f414df6f02ce8b35e8b866040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561292d578181015183820152602001612915565b50505050905001935050505060405180910390a15b5050505050505050505050565b3360008181526001602052604090205460a060020a900460ff1615156129e5576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b3360009081526010602052604090205460ff1615612a4d576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b604080519081016040528043815260200184848080601f01602080910402602001604051908101604052809392919081815260200183838082843750505092909352505033600090815260126020908152604090912083518155838201518051919350612ac1926001850192910190612df6565b505050505050565b600c5481565b600082820183811015612ade57fe5b9392505050565b600082821115612af157fe5b50900390565b60085460005b81811015612be65782600160a060020a0316600882815481101515612b1e57fe5b600091825260209091200154600160a060020a03161415612bde57600880546000198401908110612b4b57fe5b60009182526020909120015460088054600160a060020a039092169183908110612b7157fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600880546000198401908110612bac57fe5b60009182526020909120018054600160a060020a03191690556008805490612bd8906000198301612e70565b50612be6565b600101612afd565b505050565b60075460005b81811015612be65782600160a060020a0316600782815481101515612c1257fe5b600091825260209091200154600160a060020a03161415612cdc57600780546000198401908110612c3f57fe5b60009182526020909120015460078054600160a060020a039092169183908110612c6557fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600780546000198401908110612ca057fe5b60009182526020909120018054600160a060020a03191690556007805490612ccc906000198301612e70565b50600a8054600019019055612be6565b600101612bf1565b600780546000198101919082908110612cf957fe5b60009182526020909120015460078054600160a060020a039092169184908110612d1f57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556007805482908110612d5657fe5b60009182526020909120018054600160a060020a03191690556007805490612d82906000198301612e70565b5050600a805460001901905550565b828054828255906000526020600020908101928215612de6579160200282015b82811115612de65782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190612db1565b50612df2929150612ed3565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612e3757805160ff1916838001178555612e64565b82800160010185558215612e64579182015b82811115612e64578251825591602001919060010190612e49565b50612df2929150612ef7565b815481835581811115612be657600083815260209020612be6918101908301612ef7565b5080546000825590600052602060002090810190612eb29190612f11565b50565b5080546000825590600052602060002090810190612eb29190612ef7565b610f9291905b80821115612df2578054600160a060020a0319168155600101612ed9565b610f9291905b80821115612df25760008155600101612efd565b610f9291905b80821115612df2576000612f2b8282612f34565b50600101612f17565b50805460018160011615610100020316600290046000825580601f10612f5a5750612eb2565b601f016020900490600052602060002090810190612eb29190612ef75600496e76616c69642043616e646964617465000000000000000000000000000000a165627a7a72305820e276810d3fb0643b8f5745972bb7ebc597a961b67258d4aebbb789c52bf885ed0029 \ No newline at end of file diff --git a/contracts/validator/contract_v2/src/deployment.json b/contracts/validator/contract_v2/src/deployment.json new file mode 100644 index 000000000000..f06716fbcad7 --- /dev/null +++ b/contracts/validator/contract_v2/src/deployment.json @@ -0,0 +1,15 @@ +{ + "candidates": [ + "0xf0AbABbb043792D8cDAf1961c96758932189965D", + "0xf43988206b1F23cBECe8EA835F31FA97EB1a73fd" + ], + "caps": ["10000000000000000000000000", "10000000000000000000000000"], + "firstOwner": "0x662696e1f7925b68b4f6f440977d1da2b1b8d3f6", + "minCandidateCap": "10000000000000000000000000", + "minVoterCap": "25000000000000000000000", + "maxValidatorNumber": 18, + "candidateWithdrawDelay": 1296000, + "voterWithdrawDelay": 432000, + "xdcdevnet": "https://devnetstats.apothem.network/devnet", + "xdcsubnet": "https://devnetstats.apothem.network/subnet" +} diff --git a/contracts/validator/contract_v2/src/hardhat.config.js b/contracts/validator/contract_v2/src/hardhat.config.js new file mode 100644 index 000000000000..69f02229ffcf --- /dev/null +++ b/contracts/validator/contract_v2/src/hardhat.config.js @@ -0,0 +1,34 @@ +require("@nomiclabs/hardhat-waffle"); +require("hardhat-gas-reporter"); +require("dotenv").config(); +const deploy = require("./deployment.json"); +/** + * @type import('hardhat/config').HardhatUserConfig + */ +module.exports = { + solidity: { + version: "0.4.26", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + networks: { + xdcdevnet: { + url: deploy["xdcdevnet"], + accounts: [ + process.env.PRIVATE_KEY || + "1234567890123456789012345678901234567890123456789012345678901234", + ], + }, + xdcsubnet: { + url: deploy["xdcsubnet"], + accounts: [ + process.env.PRIVATE_KEY || + "1234567890123456789012345678901234567890123456789012345678901234", + ], + }, + }, +}; diff --git a/contracts/validator/contract_v2/src/image.png b/contracts/validator/contract_v2/src/image.png new file mode 100644 index 000000000000..f3ee5a907df8 Binary files /dev/null and b/contracts/validator/contract_v2/src/image.png differ diff --git a/contracts/validator/contract_v2/src/package.json b/contracts/validator/contract_v2/src/package.json new file mode 100644 index 000000000000..370c62cba594 --- /dev/null +++ b/contracts/validator/contract_v2/src/package.json @@ -0,0 +1,25 @@ +{ + "name": "hardhat-project", + "devDependencies": { + "@ethereumjs/util": "^8.0.6", + "@nomicfoundation/hardhat-network-helpers": "^1.0.8", + "@nomicfoundation/hardhat-toolbox": "^3.0.0", + "@nomiclabs/hardhat-ethers": "^2.2.3", + "@nomiclabs/hardhat-etherscan": "^3.1.7", + "@nomiclabs/hardhat-waffle": "^2.0.6", + "chai": "^4.3.7", + "dotenv": "^16.3.1", + "ethereum-waffle": "^3.4.4", + "ethers": "^5.7.2", + "hardhat": "^2.17.1", + "hardhat-gas-reporter": "^1.0.9", + "node-fetch": "2", + "patch-package": "^7.0.0", + "prettier": "^2.8.8", + "prettier-plugin-solidity": "^1.1.3", + "solhint": "^3.5.1" + }, + "scripts": { + "postinstall": "patch-package" + } +} diff --git a/contracts/validator/contract_v2/src/patches/@ethersproject+address+5.7.0.patch b/contracts/validator/contract_v2/src/patches/@ethersproject+address+5.7.0.patch new file mode 100644 index 000000000000..46180ef2c0ac --- /dev/null +++ b/contracts/validator/contract_v2/src/patches/@ethersproject+address+5.7.0.patch @@ -0,0 +1,33 @@ +diff --git a/node_modules/@ethersproject/address/lib/index.js b/node_modules/@ethersproject/address/lib/index.js +index 21dfad1..f46e887 100644 +--- a/node_modules/@ethersproject/address/lib/index.js ++++ b/node_modules/@ethersproject/address/lib/index.js +@@ -69,6 +69,8 @@ function getAddress(address) { + if (typeof (address) !== "string") { + logger.throwArgumentError("invalid address", "address", address); + } ++ //xdc ++ address= address.replace(/^xdc/, '0x'); + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (address.substring(0, 2) !== "0x") { +diff --git a/node_modules/@ethersproject/address/src.ts/index.ts b/node_modules/@ethersproject/address/src.ts/index.ts +index 661d70e..eb590aa 100644 +--- a/node_modules/@ethersproject/address/src.ts/index.ts ++++ b/node_modules/@ethersproject/address/src.ts/index.ts +@@ -81,6 +81,7 @@ export function getAddress(address: string): string { + logger.throwArgumentError("invalid address", "address", address); + } + ++ + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + + // Missing the 0x prefix +@@ -109,6 +110,7 @@ export function getAddress(address: string): string { + logger.throwArgumentError("invalid address", "address", address); + } + ++ + return result; + } + diff --git a/contracts/validator/contract_v2/src/patches/@ethersproject+providers+5.7.2.patch b/contracts/validator/contract_v2/src/patches/@ethersproject+providers+5.7.2.patch new file mode 100644 index 000000000000..1051b17ecf14 --- /dev/null +++ b/contracts/validator/contract_v2/src/patches/@ethersproject+providers+5.7.2.patch @@ -0,0 +1,25 @@ +diff --git a/node_modules/@ethersproject/providers/lib.esm/formatter.js b/node_modules/@ethersproject/providers/lib.esm/formatter.js +index f89fbce..02e4a36 100644 +--- a/node_modules/@ethersproject/providers/lib.esm/formatter.js ++++ b/node_modules/@ethersproject/providers/lib.esm/formatter.js +@@ -270,6 +270,7 @@ export class Formatter { + } + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address ++ + if (transaction.to && BigNumber.from(transaction.to).isZero()) { + transaction.to = "0x0000000000000000000000000000000000000000"; + } +diff --git a/node_modules/@ethersproject/providers/lib/formatter.js b/node_modules/@ethersproject/providers/lib/formatter.js +index 7f118ae..3764227 100644 +--- a/node_modules/@ethersproject/providers/lib/formatter.js ++++ b/node_modules/@ethersproject/providers/lib/formatter.js +@@ -273,7 +273,7 @@ var Formatter = /** @class */ (function () { + } + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address +- if (transaction.to && bignumber_1.BigNumber.from(transaction.to).isZero()) { ++ if (transaction.to && bignumber_1.BigNumber.from(transaction.to.replace(/^xdc/, '0x')).isZero()) { + transaction.to = "0x0000000000000000000000000000000000000000"; + } + // Rename input to data diff --git a/contracts/validator/contract_v2/src/scripts/deployToGenesis.js b/contracts/validator/contract_v2/src/scripts/deployToGenesis.js new file mode 100644 index 000000000000..cd559f785e66 --- /dev/null +++ b/contracts/validator/contract_v2/src/scripts/deployToGenesis.js @@ -0,0 +1,28 @@ +const XDCValidator = require("../artifacts/contracts/XDCValidator.sol/XDCValidator.json"); +const fs = require("fs"); + +const abi = XDCValidator["abi"]; +const bytecode = XDCValidator["bytecode"]; +const deployedBytecode = XDCValidator["deployedBytecode"]; + +fs.writeFile("./abi", JSON.stringify(abi, null, 3), "utf8", function (error) { + if (error) { + console.log(error); + return false; + } + console.log("Write success "); +}); +fs.writeFile("./bytecode", bytecode, "utf8", function (error) { + if (error) { + console.log(error); + return false; + } + console.log("Write success "); +}); +fs.writeFile("./deployedBytecode", deployedBytecode, "utf8", function (error) { + if (error) { + console.log(error); + return false; + } + console.log("Write success "); +}); \ No newline at end of file diff --git a/contracts/validator/contract_v2/src/scripts/deployment.js b/contracts/validator/contract_v2/src/scripts/deployment.js new file mode 100644 index 000000000000..b1061c421664 --- /dev/null +++ b/contracts/validator/contract_v2/src/scripts/deployment.js @@ -0,0 +1,34 @@ +const hre = require("hardhat"); +const deploy = require("../deployment.json"); + +async function main() { + const xdcValidatorFactory = await hre.ethers.getContractFactory( + "XDCValidator" + ); + + const xdcValidator = await xdcValidatorFactory.deploy( + deploy["candidates"], + deploy["caps"].map((item) => { + return hre.ethers.utils.parseUnits(item, 0); + }), + deploy["firstOwner"], + hre.ethers.utils.parseUnits(deploy["minCandidateCap"], 0), + hre.ethers.utils.parseUnits(deploy["minVoterCap"], 0), + deploy["maxValidatorNumber"], + deploy["candidateWithdrawDelay"], + deploy["voterWithdrawDelay"], + ); + + await xdcValidator.deployed(); + + console.log("xdcValidator deployed to:", xdcValidator.address); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/contracts/validator/contract_v2/src/test/xdcValidator.js b/contracts/validator/contract_v2/src/test/xdcValidator.js new file mode 100644 index 000000000000..7d4cd5581fa8 --- /dev/null +++ b/contracts/validator/contract_v2/src/test/xdcValidator.js @@ -0,0 +1,260 @@ +const { expect } = require("chai"); +const { ethers } = require("hardhat"); +const deploy = { + candidates: [ + "0xf0AbABbb043792D8cDAf1961c96758932189965D", + "0xf43988206b1F23cBECe8EA835F31FA97EB1a73fd", + ], + caps: ["10000000000000000000000000", "10000000000000000000000000", "100"], + minCandidateCap: "10000000000000000000000000", + minVoterCap: "25000000000000000000000", + maxValidatorNumber: 18, + candidateWithdrawDelay: 1296000, + voterWithdrawDelay: 432000, + minCandidateNum: 2, +}; +const { + loadFixture, + setBalance, + time, + mine, +} = require("@nomicfoundation/hardhat-toolbox/network-helpers"); + +describe("XDCValidator", () => { + let xdcValidator; + let master; + const fixture = async () => { + const factory = await ethers.getContractFactory("XDCValidator"); + const signer = await ethers.getSigner(); + const master = signer.address; + deploy["candidates"].push(master); + const xdcValidator = await factory.deploy( + deploy["candidates"], + deploy["caps"].map((item) => { + return hre.ethers.utils.parseUnits(item, 0); + }), + master, + hre.ethers.utils.parseUnits(deploy["minCandidateCap"], 0), + hre.ethers.utils.parseUnits(deploy["minVoterCap"], 0), + deploy["maxValidatorNumber"], + deploy["candidateWithdrawDelay"], + deploy["voterWithdrawDelay"] + ); + + return { xdcValidator, master }; + }; + + beforeEach("deploy fixture", async () => { + ({ xdcValidator, master } = await loadFixture(fixture)); + }); + + describe("test xdc validator contract", () => { + it("propose", async () => { + await setBalance(master, 1e30); + const candidate = await ethers.Wallet.createRandom().getAddress(); + const minCandidateCap = hre.ethers.utils.parseUnits( + deploy["minCandidateCap"], + 0 + ); + await xdcValidator.propose(candidate, { + value: minCandidateCap, + }); + + const candidates = await xdcValidator.getCandidates(); + const voters = await xdcValidator.getVoters(candidate); + const ownerLength = await xdcValidator.getOwnerToCandidateLength(master); + const ownerToCandidates = []; + for (let i = 0; i < ownerLength; i++) { + const ownerToCandidate = await xdcValidator.ownerToCandidate(master, i); + ownerToCandidates.push(ownerToCandidate); + } + const validatorsState = await xdcValidator.validatorsState(candidate); + const voterCap = await xdcValidator.getVoterCap(candidate, master); + + expect(candidates).to.include(candidate); + expect(voters).to.include(master); + expect(ownerToCandidates).to.include(candidate); + expect(validatorsState["owner"]).to.eq(master); + expect(validatorsState["isCandidate"]).to.eq(true); + expect(validatorsState["cap"]).to.eq(minCandidateCap); + expect(voterCap).to.eq(minCandidateCap); + }); + + it("resign", async () => { + await setBalance(master, 1e30); + const candidate = await ethers.Wallet.createRandom().getAddress(); + const minCandidateCap = hre.ethers.utils.parseUnits( + deploy["minCandidateCap"], + 0 + ); + await xdcValidator.propose(candidate, { + value: minCandidateCap, + }); + const candidatesBefore = await xdcValidator.getCandidates(); + + await xdcValidator.resign(candidate); + const candidates = await xdcValidator.getCandidates(); + const voters = await xdcValidator.getVoters(candidate); + const ownerLength = await xdcValidator.getOwnerToCandidateLength(master); + const ownerToCandidates = []; + for (let i = 0; i < ownerLength; i++) { + const ownerToCandidate = await xdcValidator.ownerToCandidate(master, i); + ownerToCandidates.push(ownerToCandidate); + } + const validatorsState = await xdcValidator.validatorsState(candidate); + const voterCap = await xdcValidator.getVoterCap(candidate, master); + + const before = [...deploy["candidates"]]; + before.push(candidate); + + expect(candidatesBefore).to.deep.eq(before); + expect(candidates).to.deep.eq(deploy["candidates"]); + expect(voters).to.include(master); + expect(ownerToCandidates).to.not.include(candidate); + expect(validatorsState["owner"]).to.eq(master); + expect(validatorsState["isCandidate"]).to.eq(false); + expect(validatorsState["cap"]).to.eq(0); + expect(voterCap).to.eq(0); + }); + + it("vote", async () => { + await setBalance(master, 1e30); + const candidate = await ethers.Wallet.createRandom().getAddress(); + const minCandidateCap = hre.ethers.utils.parseUnits( + deploy["minCandidateCap"], + 0 + ); + await xdcValidator.propose(candidate, { + value: minCandidateCap, + }); + const minVoterCap = hre.ethers.utils.parseUnits(deploy["minVoterCap"], 0); + await xdcValidator.vote(candidate, { + value: minVoterCap, + }); + const candidates = await xdcValidator.getCandidates(); + const voters = await xdcValidator.getVoters(candidate); + const ownerLength = await xdcValidator.getOwnerToCandidateLength(master); + const ownerToCandidates = []; + for (let i = 0; i < ownerLength; i++) { + const ownerToCandidate = await xdcValidator.ownerToCandidate(master, i); + ownerToCandidates.push(ownerToCandidate); + } + const validatorsState = await xdcValidator.validatorsState(candidate); + const voterCap = await xdcValidator.getVoterCap(candidate, master); + + expect(candidates).to.include(candidate); + expect(voters).to.include(master); + expect(ownerToCandidates).to.include(candidate); + expect(validatorsState["owner"]).to.eq(master); + expect(validatorsState["isCandidate"]).to.eq(true); + expect(validatorsState["cap"]).to.eq(minCandidateCap.add(minVoterCap)); + expect(voterCap).to.eq(minCandidateCap.add(minVoterCap)); + }); + + it("unvote", async () => { + await setBalance(master, 1e30); + const candidate = await ethers.Wallet.createRandom().getAddress(); + const minCandidateCap = hre.ethers.utils.parseUnits( + deploy["minCandidateCap"], + 0 + ); + await xdcValidator.propose(candidate, { + value: minCandidateCap, + }); + const minVoterCap = hre.ethers.utils.parseUnits(deploy["minVoterCap"], 0); + await xdcValidator.vote(candidate, { + value: minVoterCap, + }); + + const block = await time.latestBlock(); + await xdcValidator.unvote(candidate, minVoterCap); + + const candidates = await xdcValidator.getCandidates(); + const voters = await xdcValidator.getVoters(candidate); + const ownerLength = await xdcValidator.getOwnerToCandidateLength(master); + const ownerToCandidates = []; + for (let i = 0; i < ownerLength; i++) { + const ownerToCandidate = await xdcValidator.ownerToCandidate(master, i); + ownerToCandidates.push(ownerToCandidate); + } + const validatorsState = await xdcValidator.validatorsState(candidate); + const voterCap = await xdcValidator.getVoterCap(candidate, master); + const withdrawCap = await xdcValidator.getWithdrawCap( + block + deploy["voterWithdrawDelay"] + 1 + ); + expect(candidates).to.include(candidate); + expect(voters).to.include(master); + expect(ownerToCandidates).to.include(candidate); + expect(validatorsState["owner"]).to.eq(master); + expect(validatorsState["isCandidate"]).to.eq(true); + expect(validatorsState["cap"]).to.eq(minCandidateCap); + expect(voterCap).to.eq(minCandidateCap); + expect(withdrawCap).to.eq(minVoterCap); + }); + + it("withdraw", async () => { + await setBalance(master, 1e30); + const candidate = await ethers.Wallet.createRandom().getAddress(); + const minCandidateCap = hre.ethers.utils.parseUnits( + deploy["minCandidateCap"], + 0 + ); + await xdcValidator.propose(candidate, { + value: minCandidateCap, + }); + const minVoterCap = hre.ethers.utils.parseUnits(deploy["minVoterCap"], 0); + await xdcValidator.vote(candidate, { + value: minVoterCap, + }); + + const block = await time.latestBlock(); + await xdcValidator.unvote(candidate, minVoterCap); + mine(deploy["voterWithdrawDelay"] + 1); + const beforeBalance = await ethers.provider.getBalance( + xdcValidator.address + ); + const withdrawCap = await xdcValidator.getWithdrawCap( + block + deploy["voterWithdrawDelay"] + 1 + ); + + await xdcValidator.withdraw(block + deploy["voterWithdrawDelay"] + 1, 0); + const afterBalance = await ethers.provider.getBalance( + xdcValidator.address + ); + expect(afterBalance).to.eq(beforeBalance.sub(withdrawCap)); + }); + + it("directly resign one candidate", async () => { + const oldCandidates = await xdcValidator.getCandidates(); + + await xdcValidator.resign("0xf43988206b1F23cBECe8EA835F31FA97EB1a73fd"); + const newCandidates = await xdcValidator.getCandidates(); + expect(oldCandidates).to.deep.eq(deploy["candidates"]); + expect(newCandidates).to.deep.eq([ + "0xf0AbABbb043792D8cDAf1961c96758932189965D", + master, + ]); + }); + + it("kyc upload and claim", async () => { + const kyc = "0x01"; + await xdcValidator.uploadKYC(kyc); + const pendingKYC = await xdcValidator.pendingKYC(master); + expect(pendingKYC?.kycHash).to.eq(kyc); + await mine(10 * 43200); + await xdcValidator.claimKYC(); + const kycString = await xdcValidator.KYCString(master, 0); + expect(kycString).to.eq(kyc); + }); + + it("kyc invalid vote", async () => { + const kyc = "0x01"; + await xdcValidator.uploadKYC(kyc); + const pendingKYC = await xdcValidator.pendingKYC(master); + expect(pendingKYC?.kycHash).to.eq(kyc); + await xdcValidator.voteInvalidKYC(master); + const pendingKYCAfter = await xdcValidator.pendingKYC(master); + expect(pendingKYCAfter?.kycHash).to.eq(""); + }); + }); +}); diff --git a/contracts/validator/contract_v2/validator_v2.go b/contracts/validator/contract_v2/validator_v2.go new file mode 100644 index 000000000000..99882b396ad1 --- /dev/null +++ b/contracts/validator/contract_v2/validator_v2.go @@ -0,0 +1,2112 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract + +import ( + "math/big" + "strings" + + ethereum "github.com/XinFinOrg/XDPoSChain" + "github.com/XinFinOrg/XDPoSChain/accounts/abi" + "github.com/XinFinOrg/XDPoSChain/accounts/abi/bind" + "github.com/XinFinOrg/XDPoSChain/common" + "github.com/XinFinOrg/XDPoSChain/core/types" + "github.com/XinFinOrg/XDPoSChain/event" +) + +// XDCValidatorABI is the input ABI used to generate the binding from. +const XDCValidatorABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"propose\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"owners\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"},{\"name\":\"_cap\",\"type\":\"uint256\"}],\"name\":\"unvote\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getCandidates\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"removeCandidatesZeroAddresses\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ownerCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"address\"}],\"name\":\"hasVotedInvalid\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_blockNumber\",\"type\":\"uint256\"}],\"name\":\"getWithdrawCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingKYC\",\"outputs\":[{\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"name\":\"kycHash\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ownerToCandidate\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getVoters\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"isOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getWithdrawBlockNumbers\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"},{\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"getVoterCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"getLatestKYC\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"candidates\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"validatorsState\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"isCandidate\",\"type\":\"bool\"},{\"name\":\"cap\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_blockNumber\",\"type\":\"uint256\"},{\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"invalidPercent\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"KYCString\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"voters\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"getOwnerToCandidateLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"removeOwnersZeroAddresses\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"vote\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"invalidKYCCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"claimKYC\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"candidateCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"voterWithdrawDelay\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"resign\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"invalidCandidate\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"getHashCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"maxValidatorNumber\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"candidateWithdrawDelay\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"isCandidate\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"minCandidateCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"invalidOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getOwnerCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"voteInvalidKYC\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"kychash\",\"type\":\"string\"}],\"name\":\"uploadKYC\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"minVoterCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_candidates\",\"type\":\"address[]\"},{\"name\":\"_caps\",\"type\":\"uint256[]\"},{\"name\":\"_firstOwner\",\"type\":\"address\"},{\"name\":\"_minCandidateCap\",\"type\":\"uint256\"},{\"name\":\"_minVoterCap\",\"type\":\"uint256\"},{\"name\":\"_maxValidatorNumber\",\"type\":\"uint256\"},{\"name\":\"_candidateWithdrawDelay\",\"type\":\"uint256\"},{\"name\":\"_voterWithdrawDelay\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_voter\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_candidate\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_cap\",\"type\":\"uint256\"}],\"name\":\"Vote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_voter\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_candidate\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_cap\",\"type\":\"uint256\"}],\"name\":\"Unvote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_candidate\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_cap\",\"type\":\"uint256\"}],\"name\":\"Propose\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"Resign\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_blockNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"_cap\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"kycHash\",\"type\":\"string\"}],\"name\":\"UploadedKYC\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_masternodeOwner\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_masternodes\",\"type\":\"address[]\"}],\"name\":\"InvalidatedNode\",\"type\":\"event\"}]" + +// XDCValidatorBin is the compiled bytecode used for deploying new contracts. +const XDCValidatorBin = `0x608060405260006009556000600a553480156200001b57600080fd5b50604051620032f5380380620032f583398101604090815281516020830151918301516060840151608085015160a086015160c087015160e0880151600b859055600c849055600d839055600e829055600f8190559588018051600955600780546001808201835560009283527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6889091018054600160a060020a031916600160a060020a038a16179055600a805490910190559098979097019694959394929391929091905b8851811015620003185760088982815181101515620000fc57fe5b602090810291909101810151825460018082018555600094855293839020018054600160a060020a031916600160a060020a0392831617905560408051606081018252918b168252918101929092528951908201908a90849081106200015e57fe5b90602001906020020151815250600160008b848151811015156200017e57fe5b602090810291909101810151600160a060020a03908116835282820193909352604091820160009081208551815493870151600160a060020a031990941695169490941760a060020a60ff02191674010000000000000000000000000000000000000000921515929092029190911783559201516001909101558951600291908b90849081106200020b57fe5b6020908102909101810151600160a060020a03908116835282820193909352604091820160009081208054600181018255908252828220018054948c16600160a060020a03199095168517905592835260069052902089518a90839081106200027057fe5b6020908102919091018101518254600181018455600093845291909220018054600160a060020a031916600160a060020a039092169190911790558751889082908110620002ba57fe5b90602001906020020151600160008b84815181101515620002d757fe5b6020908102909101810151600160a060020a0390811683528282019390935260409182016000908120938c16815260029093019052902055600101620000e1565b505050505050505050612fc480620003316000396000f3006080604052600436106102035763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663012679518114610208578063025e7c271461021e57806302aa9be21461025257806306a49fce146102765780630999ec79146102db5780630db02622146102f05780630e3e4fb81461031757806315febd68146103525780631c68951c1461036a5780632a3640b11461040a5780632d15cc041461042e5780632f54bf6e1461044f5780632f9c4bba1461048b578063302b6872146104a057806332658652146104c75780633477ee2e1461055d5780634110a48914610575578063441a3e70146105be57806358e7525f146105d95780635b860d27146105fa5780635b9cd8cc1461061b5780635c134d661461063f57806367134e7014610663578063681d8bf2146106845780636dd7d8ea1461069957806372e44a38146106ad578063935ad0d1146106ce578063a9a981a3146106e3578063a9ff959e146106f8578063ae6e43f51461070d578063b622f1411461072e578063b642facd1461074f578063c45607df14610770578063d09f1ab414610791578063d161c767146107a6578063d51b9e93146107bb578063d55b7dff146107dc578063db11daef146107f1578063ef18374a14610812578063f2ee3c7d14610827578063f5c9512514610848578063f8ac9dd514610868575b600080fd5b61021c600160a060020a036004351661087d565b005b34801561022a57600080fd5b50610236600435610c7e565b60408051600160a060020a039092168252519081900360200190f35b34801561025e57600080fd5b5061021c600160a060020a0360043516602435610ca6565b34801561028257600080fd5b5061028b610f32565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102c75781810151838201526020016102af565b505050509050019250505060405180910390f35b3480156102e757600080fd5b5061021c610f95565b3480156102fc57600080fd5b5061030561107d565b60408051918252519081900360200190f35b34801561032357600080fd5b5061033e600160a060020a0360043581169060243516611083565b604080519115158252519081900360200190f35b34801561035e57600080fd5b506103056004356110a3565b34801561037657600080fd5b5061038b600160a060020a03600435166110c2565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103ce5781810151838201526020016103b6565b50505050905090810190601f1680156103fb5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561041657600080fd5b50610236600160a060020a0360043516602435611169565b34801561043a57600080fd5b5061028b600160a060020a03600435166111a0565b34801561045b57600080fd5b50610470600160a060020a0360043516611216565b60408051921515835260208301919091528051918290030190f35b34801561049757600080fd5b5061028b61127b565b3480156104ac57600080fd5b50610305600160a060020a03600435811690602435166112dc565b3480156104d357600080fd5b506104e8600160a060020a036004351661130b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561052257818101518382015260200161050a565b50505050905090810190601f16801561054f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056957600080fd5b50610236600435611441565b34801561058157600080fd5b50610596600160a060020a036004351661144f565b60408051600160a060020a039094168452911515602084015282820152519081900360600190f35b3480156105ca57600080fd5b5061021c60043560243561147e565b3480156105e557600080fd5b50610305600160a060020a0360043516611769565b34801561060657600080fd5b50610305600160a060020a0360043516611788565b34801561062757600080fd5b506104e8600160a060020a0360043516602435611885565b34801561064b57600080fd5b50610236600160a060020a036004351660243561193b565b34801561066f57600080fd5b50610305600160a060020a0360043516611956565b34801561069057600080fd5b5061021c611971565b61021c600160a060020a0360043516611a53565b3480156106b957600080fd5b50610305600160a060020a0360043516611cb4565b3480156106da57600080fd5b5061021c611cc6565b3480156106ef57600080fd5b50610305611fc5565b34801561070457600080fd5b50610305611fcb565b34801561071957600080fd5b5061021c600160a060020a0360043516611fd1565b34801561073a57600080fd5b5061033e600160a060020a03600435166123b7565b34801561075b57600080fd5b50610236600160a060020a03600435166123cc565b34801561077c57600080fd5b50610305600160a060020a03600435166123ea565b34801561079d57600080fd5b50610305612405565b3480156107b257600080fd5b5061030561240b565b3480156107c757600080fd5b5061033e600160a060020a0360043516612411565b3480156107e857600080fd5b50610305612436565b3480156107fd57600080fd5b5061033e600160a060020a036004351661243c565b34801561081e57600080fd5b50610305612451565b34801561083357600080fd5b5061021c600160a060020a0360043516612457565b34801561085457600080fd5b5061021c600480356024810191013561294f565b34801561087457600080fd5b50610305612ac9565b600b546000903410156108da576040805160e560020a62461bcd02815260206004820152601560248201527f496e76616c69642043616e646964617465204361700000000000000000000000604482015290519081900360640190fd5b33600090815260036020526040902054151580610904575033600090815260066020526040812054115b151561095a576040805160e560020a62461bcd02815260206004820152601060248201527f4b5943206e6f742075706c6f6164656400000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038216600090815260116020526040902054829060ff16156109bb576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff1615610a33576040805160e560020a62461bcd02815260206004820152601360248201527f416c726561647920612063616e64696461746500000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831660009081526001602081905260409091200154610a60903463ffffffff612acf16565b6008805460018181019092557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3018054600160a060020a03808816600160a060020a03199283168117909355604080516060810182523380825260208281018881528385018a81526000988952898352858920945185549251151560a060020a0274ff0000000000000000000000000000000000000000199190981692909816919091179690961694909417825593519581019590955591835260029093019092522054909250610b37903463ffffffff612acf16565b600160a060020a038416600090815260016020818152604080842033855260020190915290912091909155600954610b749163ffffffff612acf16565b600955336000908152600660205260409020541515610bda5760078054600181810183556000929092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688018054600160a060020a03191633179055600a805490910190555b336000818152600660209081526040808320805460018181018355918552838520018054600160a060020a038a16600160a060020a031991821681179092558186526002855283862080549384018155865294849020909101805490941685179093558051938452908301919091523482820152517f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c19181900360600190a1505050565b6007805482908110610c8c57fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a038216600090815260016020908152604080832033845260020190915281205483908390811115610d28576040805160e560020a62461bcd02815260206004820152600c60248201527f496e76616c696420566f74650000000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a0382811660009081526001602052604090205416331415610dda57600b54600160a060020a0383166000908152600160209081526040808320338452600201909152902054610d84908363ffffffff612ae516565b1015610dda576040805160e560020a62461bcd02815260206004820181905260248201527f4d696e696d756d206361702073686f756c64206265206d61696e7461696e6564604482015290519081900360640190fd5b600160a060020a03851660009081526001602081905260409091200154610e07908563ffffffff612ae516565b600160a060020a038616600090815260016020818152604080842092830194909455338352600290910190522054610e45908563ffffffff612ae516565b600160a060020a0386166000908152600160209081526040808320338452600201909152902055600f54610e7f904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350610eab908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a0388169282019290925280820186905290517faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa29181900360600190a15050505050565b60606008805480602002602001604051908101604052809291908181526020018280548015610f8a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610f6c575b505050505090505b90565b6060600080600880549050604051908082528060200260200182016040528015610fc9578160200160208202803883390190505b50925060009150600090505b60085481101561106557600880546000919083908110610ff157fe5b600091825260209091200154600160a060020a03161461105d57600880548290811061101957fe5b6000918252602090912001548351600160a060020a039091169084908490811061103f57fe5b600160a060020a039092166020928302909101909101526001909101905b600101610fd5565b81835261107760086020850184612d91565b50505050565b600a5481565b600560209081526000928352604080842090915290825290205460ff1681565b336000908152602081815260408083208484529091529020545b919050565b6012602090815260009182526040918290208054600180830180548651600293821615610100026000190190911692909204601f81018690048602830186019096528582529194929390929083018282801561115f5780601f106111345761010080835404028352916020019161115f565b820191906000526020600020905b81548152906001019060200180831161114257829003601f168201915b5050505050905082565b60066020528160005260406000208181548110151561118457fe5b600091825260209091200154600160a060020a03169150829050565b600160a060020a03811660009081526002602090815260409182902080548351818402810184019094528084526060939283018282801561120a57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116111ec575b50505050509050919050565b600080805b60075481101561126d5783600160a060020a031660078281548110151561123e57fe5b600091825260209091200154600160a060020a031614156112655760018192509250611275565b60010161121b565b600092508291505b50915091565b3360009081526020818152604091829020600101805483518184028101840190945280845260609392830182828015610f8a57602002820191906000526020600020905b8154815260200190600101908083116112bf575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b606061131682612411565b156114195760036000611328846123cc565b600160a060020a0316600160a060020a03168152602001908152602001600020600160036000611357866123cc565b600160a060020a03168152602081019190915260400160002054825491900390811061137f57fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561140d5780601f106113e25761010080835404028352916020019161140d565b820191906000526020600020905b8154815290600101906020018083116113f057829003601f168201915b505050505090506110bd565b600160a060020a03821660009081526003602052604090208054600019810190811061137f57fe5b6008805482908110610c8c57fe5b60016020819052600091825260409091208054910154600160a060020a0382169160a060020a900460ff169083565b336000908152601060205260408120548390839060ff16156114ea576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b60008211611542576040805160e560020a62461bcd02815260206004820152601460248201527f496e76616c696420626c6f636b206e756d626572000000000000000000000000604482015290519081900360640190fd5b438211156115c0576040805160e560020a62461bcd02815260206004820152603560248201527f426c6f636b206e756d6265722073686f756c64206265206c657373207468616e60448201527f2063757272656e7420626c6f636b206e756d6265720000000000000000000000606482015290519081900360840190fd5b336000908152602081815260408083208584529091528120541161162e576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f2063617020746f2077697468647261770000000000000000000000000000604482015290519081900360640190fd5b33600090815260208190526040902060010180548391908390811061164f57fe5b90600052602060002001541415156116b1576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c696420696e64657800000000000000000000000000000000000000604482015290519081900360640190fd5b33600081815260208181526040808320898452808352908320805490849055938352919052600101805491945090859081106116e957fe5b60009182526020822001819055604051339185156108fc02918691818181858888f19350505050158015611721573d6000803e3d6000fd5b50604080513381526020810187905280820185905290517ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360600190a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600160a060020a038116600090815260116020526040812054829060ff16156117e9576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611850576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b611858612451565b600160a060020a03841660009081526004602052604090205460640281151561187d57fe5b049392505050565b6003602052816000526040600020818154811015156118a057fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529450909250908301828280156119335780601f1061190857610100808354040283529160200191611933565b820191906000526020600020905b81548152906001019060200180831161191657829003601f168201915b505050505081565b60026020528160005260406000208181548110151561118457fe5b600160a060020a031660009081526006602052604090205490565b60606000806007805490506040519080825280602002602001820160405280156119a5578160200160208202803883390190505b50925060009150600090505b600754811015611a41576007805460009190839081106119cd57fe5b600091825260209091200154600160a060020a031614611a395760078054829081106119f557fe5b6000918252602090912001548351600160a060020a0390911690849084908110611a1b57fe5b600160a060020a039092166020928302909101909101526001909101905b6001016119b1565b81835261107760076020850184612d91565b600c54341015611aad576040805160e560020a62461bcd02815260206004820152601160248201527f496e76616c696420566f74657220436170000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038116600090815260116020526040902054819060ff1615611b0e576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515611b75576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03821660009081526001602081905260409091200154611ba2903463ffffffff612acf16565b600160a060020a0383166000908152600160208181526040808420928301949094553383526002909101905220541515611c0f57600160a060020a0382166000908152600260209081526040822080546001810182559083529120018054600160a060020a031916331790555b600160a060020a0382166000908152600160209081526040808320338452600201909152902054611c46903463ffffffff612acf16565b600160a060020a0383166000818152600160209081526040808320338085526002909101835292819020949094558351918252810191909152348183015290517f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc9181900360600190a15050565b60046020526000908152604090205481565b336000908152601060205260408120546060919060ff1615611d32576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b33600090815260126020908152604091829020600190810180548451600293821615610100026000190190911692909204601f810184900484028301840190945283825290929091830182828015611dcb5780601f10611da057610100808354040283529160200191611dcb565b820191906000526020600020905b815481529060010190602001808311611dae57829003601f168201915b505033600090815260126020526040812054855195975095509093119250611e40915050576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f204b59432075706c6f616465640000000000000000000000000000000000604482015290519081900360640190fd5b6206978081014311611e9c576040805160e560020a62461bcd02815260206004820152601460248201527f4b5943206e6f7420766572696669656420796574000000000000000000000000604482015290519081900360640190fd5b336000818152601260208181526040808420848155815180840192839052858152959094529190529151611ed69260019092019190612df6565b5033600090815260036020908152604082208054600181018083559184529282902085519193611f0c9391019190860190612df6565b50507f949360d814b28a3b393a68909efe1fee120ee09cac30f360a0f80ab5415a611a33836040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611f86578181015183820152602001611f6e565b50505050905090810190601f168015611fb35780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b60095481565b600f5481565b600160a060020a03808216600090815260016020526040812054909182918291829182918791163314612074576040805160e560020a62461bcd02815260206004820152602160248201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60448201527f6e00000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038716600090815260016020526040902054879060a060020a900460ff161515612115576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0388166000908152600160208190526040909120805474ff00000000000000000000000000000000000000001916905560095461215e9163ffffffff612ae516565b60095561216a88612af7565b3360009081526006602052604081208054909850965094505b8585101561226e5787600160a060020a031687868154811015156121a357fe5b600091825260209091200154600160a060020a031614156122635786600187038154811015156121cf57fe5b6000918252602090912001548754600160a060020a03909116908890879081106121f557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550866001870381548110151561223457fe5b60009182526020909120018054600160a060020a0319169055865461225d886000198301612e70565b5061226e565b600190940193612183565b8654151561227f5761227f33612beb565b600160a060020a0388166000818152600160208181526040808420338552600281018352908420549490935281905201549094506122c3908563ffffffff612ae516565b600160a060020a0389166000908152600160208181526040808420928301949094553383526002909101905290812055600e54612306904363ffffffff612acf16565b33600090815260208181526040808320848452909152902054909350612332908563ffffffff612acf16565b33600081815260208181526040808320888452808352818420959095558282526001948501805495860181558352918190209093018690558051918252600160a060020a038b169282019290925281517f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3929181900390910190a15050505050505050565b60116020526000908152604090205460ff1681565b600160a060020a039081166000908152600160205260409020541690565b600160a060020a031660009081526003602052604090205490565b600d5481565b600e5481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b600b5481565b60106020526000908152604090205460ff1681565b600a5490565b33600081815260116020526040812054909182918291829182916060918291849182919060ff16156124c1576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b600160a060020a03811660009081526001602052604090205460a060020a900460ff161515612528576040805160e560020a62461bcd0281526020600482015260116024820152600080516020612f79833981519152604482015290519081900360640190fd5b612531336123cc565b9950600560008b600160a060020a0316600160a060020a0316815260200190815260200160002060008c600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460ff161515156125e0576040805160e560020a62461bcd02815260206004820152600d60248201527f416c726561647920766f74656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03808b166000908152600560209081526040808320938f168352928152828220805460ff19166001908117909155600490915291902080549091019055604b61262e612451565b600160a060020a038d1660009081526004602052604090205460640281151561265357fe5b041061294257600160a060020a038b166000818152601060209081526040808320805460ff1916600190811790915560128084528285208581558351808601948590528681529690955290925292516126b193929091019190612df6565b506126bb8b611216565b98509850881561294257600854604080518281526020808402820101909152600098508897509080156126f8578160200160208202803883390190505b506008546040805182815260208084028201019091529196508015612727578160200160208202803883390190505b509350600092505b60085483101561288f57600880548490811061274757fe5b600091825260209091200154600160a060020a0390811692508b1661276b836123cc565b600160a060020a031614156128585760095461278e90600163ffffffff612ae516565b60095584516001870196839187919081106127a557fe5b600160a060020a0392831660209182029092018101919091528382166000908152601182526040808220805460ff19166001908117909155808452818320805474ffffffffffffffffffffffffffffffffffffffffff1916815501829055928e168152600390915290812061281991612e94565b600160a060020a038b16600090815260066020526040812061283a91612eb5565b600160a060020a038b16600090815260046020526040812055612884565b835160018801978391869190811061286c57fe5b600160a060020a039092166020928302909101909101525b60019092019161272f565b86845285855283516128a8906008906020870190612d91565b506128b288612ce4565b7fe18d61a5bf4aa2ab40afc88aa9039d27ae17ff4ec1c65f5f414df6f02ce8b35e8b866040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561292d578181015183820152602001612915565b50505050905001935050505060405180910390a15b5050505050505050505050565b3360008181526001602052604090205460a060020a900460ff1615156129e5576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c792063616e6469646174652063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b3360009081526010602052604090205460ff1615612a4d576040805160e560020a62461bcd02815260206004820152600d60248201527f496e76616c6964204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b604080519081016040528043815260200184848080601f01602080910402602001604051908101604052809392919081815260200183838082843750505092909352505033600090815260126020908152604090912083518155838201518051919350612ac1926001850192910190612df6565b505050505050565b600c5481565b600082820183811015612ade57fe5b9392505050565b600082821115612af157fe5b50900390565b60085460005b81811015612be65782600160a060020a0316600882815481101515612b1e57fe5b600091825260209091200154600160a060020a03161415612bde57600880546000198401908110612b4b57fe5b60009182526020909120015460088054600160a060020a039092169183908110612b7157fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600880546000198401908110612bac57fe5b60009182526020909120018054600160a060020a03191690556008805490612bd8906000198301612e70565b50612be6565b600101612afd565b505050565b60075460005b81811015612be65782600160a060020a0316600782815481101515612c1257fe5b600091825260209091200154600160a060020a03161415612cdc57600780546000198401908110612c3f57fe5b60009182526020909120015460078054600160a060020a039092169183908110612c6557fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600780546000198401908110612ca057fe5b60009182526020909120018054600160a060020a03191690556007805490612ccc906000198301612e70565b50600a8054600019019055612be6565b600101612bf1565b600780546000198101919082908110612cf957fe5b60009182526020909120015460078054600160a060020a039092169184908110612d1f57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556007805482908110612d5657fe5b60009182526020909120018054600160a060020a03191690556007805490612d82906000198301612e70565b5050600a805460001901905550565b828054828255906000526020600020908101928215612de6579160200282015b82811115612de65782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190612db1565b50612df2929150612ed3565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612e3757805160ff1916838001178555612e64565b82800160010185558215612e64579182015b82811115612e64578251825591602001919060010190612e49565b50612df2929150612ef7565b815481835581811115612be657600083815260209020612be6918101908301612ef7565b5080546000825590600052602060002090810190612eb29190612f11565b50565b5080546000825590600052602060002090810190612eb29190612ef7565b610f9291905b80821115612df2578054600160a060020a0319168155600101612ed9565b610f9291905b80821115612df25760008155600101612efd565b610f9291905b80821115612df2576000612f2b8282612f34565b50600101612f17565b50805460018160011615610100020316600290046000825580601f10612f5a5750612eb2565b601f016020900490600052602060002090810190612eb29190612ef75600496e76616c69642043616e646964617465000000000000000000000000000000a165627a7a72305820e276810d3fb0643b8f5745972bb7ebc597a961b67258d4aebbb789c52bf885ed0029` + +// DeployXDCValidator deploys a new Ethereum contract, binding an instance of XDCValidator to it. +func DeployXDCValidator(auth *bind.TransactOpts, backend bind.ContractBackend, _candidates []common.Address, _caps []*big.Int, _firstOwner common.Address, _minCandidateCap *big.Int, _minVoterCap *big.Int, _maxValidatorNumber *big.Int, _candidateWithdrawDelay *big.Int, _voterWithdrawDelay *big.Int) (common.Address, *types.Transaction, *XDCValidator, error) { + parsed, err := abi.JSON(strings.NewReader(XDCValidatorABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(XDCValidatorBin), backend, _candidates, _caps, _firstOwner, _minCandidateCap, _minVoterCap, _maxValidatorNumber, _candidateWithdrawDelay, _voterWithdrawDelay) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &XDCValidator{XDCValidatorCaller: XDCValidatorCaller{contract: contract}, XDCValidatorTransactor: XDCValidatorTransactor{contract: contract}, XDCValidatorFilterer: XDCValidatorFilterer{contract: contract}}, nil +} + +// XDCValidator is an auto generated Go binding around an Ethereum contract. +type XDCValidator struct { + XDCValidatorCaller // Read-only binding to the contract + XDCValidatorTransactor // Write-only binding to the contract + XDCValidatorFilterer // Log filterer for contract events +} + +// XDCValidatorCaller is an auto generated read-only Go binding around an Ethereum contract. +type XDCValidatorCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// XDCValidatorTransactor is an auto generated write-only Go binding around an Ethereum contract. +type XDCValidatorTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// XDCValidatorFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type XDCValidatorFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// XDCValidatorSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type XDCValidatorSession struct { + Contract *XDCValidator // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// XDCValidatorCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type XDCValidatorCallerSession struct { + Contract *XDCValidatorCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// XDCValidatorTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type XDCValidatorTransactorSession struct { + Contract *XDCValidatorTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// XDCValidatorRaw is an auto generated low-level Go binding around an Ethereum contract. +type XDCValidatorRaw struct { + Contract *XDCValidator // Generic contract binding to access the raw methods on +} + +// XDCValidatorCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type XDCValidatorCallerRaw struct { + Contract *XDCValidatorCaller // Generic read-only contract binding to access the raw methods on +} + +// XDCValidatorTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type XDCValidatorTransactorRaw struct { + Contract *XDCValidatorTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewXDCValidator creates a new instance of XDCValidator, bound to a specific deployed contract. +func NewXDCValidator(address common.Address, backend bind.ContractBackend) (*XDCValidator, error) { + contract, err := bindXDCValidator(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &XDCValidator{XDCValidatorCaller: XDCValidatorCaller{contract: contract}, XDCValidatorTransactor: XDCValidatorTransactor{contract: contract}, XDCValidatorFilterer: XDCValidatorFilterer{contract: contract}}, nil +} + +// NewXDCValidatorCaller creates a new read-only instance of XDCValidator, bound to a specific deployed contract. +func NewXDCValidatorCaller(address common.Address, caller bind.ContractCaller) (*XDCValidatorCaller, error) { + contract, err := bindXDCValidator(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &XDCValidatorCaller{contract: contract}, nil +} + +// NewXDCValidatorTransactor creates a new write-only instance of XDCValidator, bound to a specific deployed contract. +func NewXDCValidatorTransactor(address common.Address, transactor bind.ContractTransactor) (*XDCValidatorTransactor, error) { + contract, err := bindXDCValidator(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &XDCValidatorTransactor{contract: contract}, nil +} + +// NewXDCValidatorFilterer creates a new log filterer instance of XDCValidator, bound to a specific deployed contract. +func NewXDCValidatorFilterer(address common.Address, filterer bind.ContractFilterer) (*XDCValidatorFilterer, error) { + contract, err := bindXDCValidator(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &XDCValidatorFilterer{contract: contract}, nil +} + +// bindXDCValidator binds a generic wrapper to an already deployed contract. +func bindXDCValidator(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(XDCValidatorABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_XDCValidator *XDCValidatorRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _XDCValidator.Contract.XDCValidatorCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_XDCValidator *XDCValidatorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _XDCValidator.Contract.XDCValidatorTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_XDCValidator *XDCValidatorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _XDCValidator.Contract.XDCValidatorTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_XDCValidator *XDCValidatorCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _XDCValidator.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_XDCValidator *XDCValidatorTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _XDCValidator.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_XDCValidator *XDCValidatorTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _XDCValidator.Contract.contract.Transact(opts, method, params...) +} + +// KYCString is a free data retrieval call binding the contract method 0x5b9cd8cc. +// +// Solidity: function KYCString( address, uint256) constant returns(string) +func (_XDCValidator *XDCValidatorCaller) KYCString(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (string, error) { + var ( + ret0 = new(string) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "KYCString", arg0, arg1) + return *ret0, err +} + +// KYCString is a free data retrieval call binding the contract method 0x5b9cd8cc. +// +// Solidity: function KYCString( address, uint256) constant returns(string) +func (_XDCValidator *XDCValidatorSession) KYCString(arg0 common.Address, arg1 *big.Int) (string, error) { + return _XDCValidator.Contract.KYCString(&_XDCValidator.CallOpts, arg0, arg1) +} + +// KYCString is a free data retrieval call binding the contract method 0x5b9cd8cc. +// +// Solidity: function KYCString( address, uint256) constant returns(string) +func (_XDCValidator *XDCValidatorCallerSession) KYCString(arg0 common.Address, arg1 *big.Int) (string, error) { + return _XDCValidator.Contract.KYCString(&_XDCValidator.CallOpts, arg0, arg1) +} + +// CandidateCount is a free data retrieval call binding the contract method 0xa9a981a3. +// +// Solidity: function candidateCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) CandidateCount(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "candidateCount") + return *ret0, err +} + +// CandidateCount is a free data retrieval call binding the contract method 0xa9a981a3. +// +// Solidity: function candidateCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) CandidateCount() (*big.Int, error) { + return _XDCValidator.Contract.CandidateCount(&_XDCValidator.CallOpts) +} + +// CandidateCount is a free data retrieval call binding the contract method 0xa9a981a3. +// +// Solidity: function candidateCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) CandidateCount() (*big.Int, error) { + return _XDCValidator.Contract.CandidateCount(&_XDCValidator.CallOpts) +} + +// CandidateWithdrawDelay is a free data retrieval call binding the contract method 0xd161c767. +// +// Solidity: function candidateWithdrawDelay() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) CandidateWithdrawDelay(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "candidateWithdrawDelay") + return *ret0, err +} + +// CandidateWithdrawDelay is a free data retrieval call binding the contract method 0xd161c767. +// +// Solidity: function candidateWithdrawDelay() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) CandidateWithdrawDelay() (*big.Int, error) { + return _XDCValidator.Contract.CandidateWithdrawDelay(&_XDCValidator.CallOpts) +} + +// CandidateWithdrawDelay is a free data retrieval call binding the contract method 0xd161c767. +// +// Solidity: function candidateWithdrawDelay() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) CandidateWithdrawDelay() (*big.Int, error) { + return _XDCValidator.Contract.CandidateWithdrawDelay(&_XDCValidator.CallOpts) +} + +// Candidates is a free data retrieval call binding the contract method 0x3477ee2e. +// +// Solidity: function candidates( uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCaller) Candidates(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "candidates", arg0) + return *ret0, err +} + +// Candidates is a free data retrieval call binding the contract method 0x3477ee2e. +// +// Solidity: function candidates( uint256) constant returns(address) +func (_XDCValidator *XDCValidatorSession) Candidates(arg0 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.Candidates(&_XDCValidator.CallOpts, arg0) +} + +// Candidates is a free data retrieval call binding the contract method 0x3477ee2e. +// +// Solidity: function candidates( uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCallerSession) Candidates(arg0 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.Candidates(&_XDCValidator.CallOpts, arg0) +} + +// GetCandidateCap is a free data retrieval call binding the contract method 0x58e7525f. +// +// Solidity: function getCandidateCap(_candidate address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) GetCandidateCap(opts *bind.CallOpts, _candidate common.Address) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getCandidateCap", _candidate) + return *ret0, err +} + +// GetCandidateCap is a free data retrieval call binding the contract method 0x58e7525f. +// +// Solidity: function getCandidateCap(_candidate address) constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) GetCandidateCap(_candidate common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetCandidateCap(&_XDCValidator.CallOpts, _candidate) +} + +// GetCandidateCap is a free data retrieval call binding the contract method 0x58e7525f. +// +// Solidity: function getCandidateCap(_candidate address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) GetCandidateCap(_candidate common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetCandidateCap(&_XDCValidator.CallOpts, _candidate) +} + +// GetCandidateOwner is a free data retrieval call binding the contract method 0xb642facd. +// +// Solidity: function getCandidateOwner(_candidate address) constant returns(address) +func (_XDCValidator *XDCValidatorCaller) GetCandidateOwner(opts *bind.CallOpts, _candidate common.Address) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getCandidateOwner", _candidate) + return *ret0, err +} + +// GetCandidateOwner is a free data retrieval call binding the contract method 0xb642facd. +// +// Solidity: function getCandidateOwner(_candidate address) constant returns(address) +func (_XDCValidator *XDCValidatorSession) GetCandidateOwner(_candidate common.Address) (common.Address, error) { + return _XDCValidator.Contract.GetCandidateOwner(&_XDCValidator.CallOpts, _candidate) +} + +// GetCandidateOwner is a free data retrieval call binding the contract method 0xb642facd. +// +// Solidity: function getCandidateOwner(_candidate address) constant returns(address) +func (_XDCValidator *XDCValidatorCallerSession) GetCandidateOwner(_candidate common.Address) (common.Address, error) { + return _XDCValidator.Contract.GetCandidateOwner(&_XDCValidator.CallOpts, _candidate) +} + +// GetCandidates is a free data retrieval call binding the contract method 0x06a49fce. +// +// Solidity: function getCandidates() constant returns(address[]) +func (_XDCValidator *XDCValidatorCaller) GetCandidates(opts *bind.CallOpts) ([]common.Address, error) { + var ( + ret0 = new([]common.Address) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getCandidates") + return *ret0, err +} + +// GetCandidates is a free data retrieval call binding the contract method 0x06a49fce. +// +// Solidity: function getCandidates() constant returns(address[]) +func (_XDCValidator *XDCValidatorSession) GetCandidates() ([]common.Address, error) { + return _XDCValidator.Contract.GetCandidates(&_XDCValidator.CallOpts) +} + +// GetCandidates is a free data retrieval call binding the contract method 0x06a49fce. +// +// Solidity: function getCandidates() constant returns(address[]) +func (_XDCValidator *XDCValidatorCallerSession) GetCandidates() ([]common.Address, error) { + return _XDCValidator.Contract.GetCandidates(&_XDCValidator.CallOpts) +} + +// GetHashCount is a free data retrieval call binding the contract method 0xc45607df. +// +// Solidity: function getHashCount(_address address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) GetHashCount(opts *bind.CallOpts, _address common.Address) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getHashCount", _address) + return *ret0, err +} + +// GetHashCount is a free data retrieval call binding the contract method 0xc45607df. +// +// Solidity: function getHashCount(_address address) constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) GetHashCount(_address common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetHashCount(&_XDCValidator.CallOpts, _address) +} + +// GetHashCount is a free data retrieval call binding the contract method 0xc45607df. +// +// Solidity: function getHashCount(_address address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) GetHashCount(_address common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetHashCount(&_XDCValidator.CallOpts, _address) +} + +// GetLatestKYC is a free data retrieval call binding the contract method 0x32658652. +// +// Solidity: function getLatestKYC(_address address) constant returns(string) +func (_XDCValidator *XDCValidatorCaller) GetLatestKYC(opts *bind.CallOpts, _address common.Address) (string, error) { + var ( + ret0 = new(string) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getLatestKYC", _address) + return *ret0, err +} + +// GetLatestKYC is a free data retrieval call binding the contract method 0x32658652. +// +// Solidity: function getLatestKYC(_address address) constant returns(string) +func (_XDCValidator *XDCValidatorSession) GetLatestKYC(_address common.Address) (string, error) { + return _XDCValidator.Contract.GetLatestKYC(&_XDCValidator.CallOpts, _address) +} + +// GetLatestKYC is a free data retrieval call binding the contract method 0x32658652. +// +// Solidity: function getLatestKYC(_address address) constant returns(string) +func (_XDCValidator *XDCValidatorCallerSession) GetLatestKYC(_address common.Address) (string, error) { + return _XDCValidator.Contract.GetLatestKYC(&_XDCValidator.CallOpts, _address) +} + +// GetOwnerCount is a free data retrieval call binding the contract method 0xef18374a. +// +// Solidity: function getOwnerCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) GetOwnerCount(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getOwnerCount") + return *ret0, err +} + +// GetOwnerCount is a free data retrieval call binding the contract method 0xef18374a. +// +// Solidity: function getOwnerCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) GetOwnerCount() (*big.Int, error) { + return _XDCValidator.Contract.GetOwnerCount(&_XDCValidator.CallOpts) +} + +// GetOwnerCount is a free data retrieval call binding the contract method 0xef18374a. +// +// Solidity: function getOwnerCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) GetOwnerCount() (*big.Int, error) { + return _XDCValidator.Contract.GetOwnerCount(&_XDCValidator.CallOpts) +} + +// GetOwnerToCandidateLength is a free data retrieval call binding the contract method 0x67134e70. +// +// Solidity: function getOwnerToCandidateLength(_address address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) GetOwnerToCandidateLength(opts *bind.CallOpts, _address common.Address) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getOwnerToCandidateLength", _address) + return *ret0, err +} + +// GetOwnerToCandidateLength is a free data retrieval call binding the contract method 0x67134e70. +// +// Solidity: function getOwnerToCandidateLength(_address address) constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) GetOwnerToCandidateLength(_address common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetOwnerToCandidateLength(&_XDCValidator.CallOpts, _address) +} + +// GetOwnerToCandidateLength is a free data retrieval call binding the contract method 0x67134e70. +// +// Solidity: function getOwnerToCandidateLength(_address address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) GetOwnerToCandidateLength(_address common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetOwnerToCandidateLength(&_XDCValidator.CallOpts, _address) +} + +// GetVoterCap is a free data retrieval call binding the contract method 0x302b6872. +// +// Solidity: function getVoterCap(_candidate address, _voter address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) GetVoterCap(opts *bind.CallOpts, _candidate common.Address, _voter common.Address) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getVoterCap", _candidate, _voter) + return *ret0, err +} + +// GetVoterCap is a free data retrieval call binding the contract method 0x302b6872. +// +// Solidity: function getVoterCap(_candidate address, _voter address) constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) GetVoterCap(_candidate common.Address, _voter common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetVoterCap(&_XDCValidator.CallOpts, _candidate, _voter) +} + +// GetVoterCap is a free data retrieval call binding the contract method 0x302b6872. +// +// Solidity: function getVoterCap(_candidate address, _voter address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) GetVoterCap(_candidate common.Address, _voter common.Address) (*big.Int, error) { + return _XDCValidator.Contract.GetVoterCap(&_XDCValidator.CallOpts, _candidate, _voter) +} + +// GetVoters is a free data retrieval call binding the contract method 0x2d15cc04. +// +// Solidity: function getVoters(_candidate address) constant returns(address[]) +func (_XDCValidator *XDCValidatorCaller) GetVoters(opts *bind.CallOpts, _candidate common.Address) ([]common.Address, error) { + var ( + ret0 = new([]common.Address) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getVoters", _candidate) + return *ret0, err +} + +// GetVoters is a free data retrieval call binding the contract method 0x2d15cc04. +// +// Solidity: function getVoters(_candidate address) constant returns(address[]) +func (_XDCValidator *XDCValidatorSession) GetVoters(_candidate common.Address) ([]common.Address, error) { + return _XDCValidator.Contract.GetVoters(&_XDCValidator.CallOpts, _candidate) +} + +// GetVoters is a free data retrieval call binding the contract method 0x2d15cc04. +// +// Solidity: function getVoters(_candidate address) constant returns(address[]) +func (_XDCValidator *XDCValidatorCallerSession) GetVoters(_candidate common.Address) ([]common.Address, error) { + return _XDCValidator.Contract.GetVoters(&_XDCValidator.CallOpts, _candidate) +} + +// GetWithdrawBlockNumbers is a free data retrieval call binding the contract method 0x2f9c4bba. +// +// Solidity: function getWithdrawBlockNumbers() constant returns(uint256[]) +func (_XDCValidator *XDCValidatorCaller) GetWithdrawBlockNumbers(opts *bind.CallOpts) ([]*big.Int, error) { + var ( + ret0 = new([]*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getWithdrawBlockNumbers") + return *ret0, err +} + +// GetWithdrawBlockNumbers is a free data retrieval call binding the contract method 0x2f9c4bba. +// +// Solidity: function getWithdrawBlockNumbers() constant returns(uint256[]) +func (_XDCValidator *XDCValidatorSession) GetWithdrawBlockNumbers() ([]*big.Int, error) { + return _XDCValidator.Contract.GetWithdrawBlockNumbers(&_XDCValidator.CallOpts) +} + +// GetWithdrawBlockNumbers is a free data retrieval call binding the contract method 0x2f9c4bba. +// +// Solidity: function getWithdrawBlockNumbers() constant returns(uint256[]) +func (_XDCValidator *XDCValidatorCallerSession) GetWithdrawBlockNumbers() ([]*big.Int, error) { + return _XDCValidator.Contract.GetWithdrawBlockNumbers(&_XDCValidator.CallOpts) +} + +// GetWithdrawCap is a free data retrieval call binding the contract method 0x15febd68. +// +// Solidity: function getWithdrawCap(_blockNumber uint256) constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) GetWithdrawCap(opts *bind.CallOpts, _blockNumber *big.Int) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "getWithdrawCap", _blockNumber) + return *ret0, err +} + +// GetWithdrawCap is a free data retrieval call binding the contract method 0x15febd68. +// +// Solidity: function getWithdrawCap(_blockNumber uint256) constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) GetWithdrawCap(_blockNumber *big.Int) (*big.Int, error) { + return _XDCValidator.Contract.GetWithdrawCap(&_XDCValidator.CallOpts, _blockNumber) +} + +// GetWithdrawCap is a free data retrieval call binding the contract method 0x15febd68. +// +// Solidity: function getWithdrawCap(_blockNumber uint256) constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) GetWithdrawCap(_blockNumber *big.Int) (*big.Int, error) { + return _XDCValidator.Contract.GetWithdrawCap(&_XDCValidator.CallOpts, _blockNumber) +} + +// HasVotedInvalid is a free data retrieval call binding the contract method 0x0e3e4fb8. +// +// Solidity: function hasVotedInvalid( address, address) constant returns(bool) +func (_XDCValidator *XDCValidatorCaller) HasVotedInvalid(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "hasVotedInvalid", arg0, arg1) + return *ret0, err +} + +// HasVotedInvalid is a free data retrieval call binding the contract method 0x0e3e4fb8. +// +// Solidity: function hasVotedInvalid( address, address) constant returns(bool) +func (_XDCValidator *XDCValidatorSession) HasVotedInvalid(arg0 common.Address, arg1 common.Address) (bool, error) { + return _XDCValidator.Contract.HasVotedInvalid(&_XDCValidator.CallOpts, arg0, arg1) +} + +// HasVotedInvalid is a free data retrieval call binding the contract method 0x0e3e4fb8. +// +// Solidity: function hasVotedInvalid( address, address) constant returns(bool) +func (_XDCValidator *XDCValidatorCallerSession) HasVotedInvalid(arg0 common.Address, arg1 common.Address) (bool, error) { + return _XDCValidator.Contract.HasVotedInvalid(&_XDCValidator.CallOpts, arg0, arg1) +} + +// InvalidCandidate is a free data retrieval call binding the contract method 0xb622f141. +// +// Solidity: function invalidCandidate( address) constant returns(bool) +func (_XDCValidator *XDCValidatorCaller) InvalidCandidate(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "invalidCandidate", arg0) + return *ret0, err +} + +// InvalidCandidate is a free data retrieval call binding the contract method 0xb622f141. +// +// Solidity: function invalidCandidate( address) constant returns(bool) +func (_XDCValidator *XDCValidatorSession) InvalidCandidate(arg0 common.Address) (bool, error) { + return _XDCValidator.Contract.InvalidCandidate(&_XDCValidator.CallOpts, arg0) +} + +// InvalidCandidate is a free data retrieval call binding the contract method 0xb622f141. +// +// Solidity: function invalidCandidate( address) constant returns(bool) +func (_XDCValidator *XDCValidatorCallerSession) InvalidCandidate(arg0 common.Address) (bool, error) { + return _XDCValidator.Contract.InvalidCandidate(&_XDCValidator.CallOpts, arg0) +} + +// InvalidKYCCount is a free data retrieval call binding the contract method 0x72e44a38. +// +// Solidity: function invalidKYCCount( address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) InvalidKYCCount(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "invalidKYCCount", arg0) + return *ret0, err +} + +// InvalidKYCCount is a free data retrieval call binding the contract method 0x72e44a38. +// +// Solidity: function invalidKYCCount( address) constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) InvalidKYCCount(arg0 common.Address) (*big.Int, error) { + return _XDCValidator.Contract.InvalidKYCCount(&_XDCValidator.CallOpts, arg0) +} + +// InvalidKYCCount is a free data retrieval call binding the contract method 0x72e44a38. +// +// Solidity: function invalidKYCCount( address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) InvalidKYCCount(arg0 common.Address) (*big.Int, error) { + return _XDCValidator.Contract.InvalidKYCCount(&_XDCValidator.CallOpts, arg0) +} + +// InvalidOwner is a free data retrieval call binding the contract method 0xdb11daef. +// +// Solidity: function invalidOwner( address) constant returns(bool) +func (_XDCValidator *XDCValidatorCaller) InvalidOwner(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "invalidOwner", arg0) + return *ret0, err +} + +// InvalidOwner is a free data retrieval call binding the contract method 0xdb11daef. +// +// Solidity: function invalidOwner( address) constant returns(bool) +func (_XDCValidator *XDCValidatorSession) InvalidOwner(arg0 common.Address) (bool, error) { + return _XDCValidator.Contract.InvalidOwner(&_XDCValidator.CallOpts, arg0) +} + +// InvalidOwner is a free data retrieval call binding the contract method 0xdb11daef. +// +// Solidity: function invalidOwner( address) constant returns(bool) +func (_XDCValidator *XDCValidatorCallerSession) InvalidOwner(arg0 common.Address) (bool, error) { + return _XDCValidator.Contract.InvalidOwner(&_XDCValidator.CallOpts, arg0) +} + +// InvalidPercent is a free data retrieval call binding the contract method 0x5b860d27. +// +// Solidity: function invalidPercent(_owner address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) InvalidPercent(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "invalidPercent", _owner) + return *ret0, err +} + +// InvalidPercent is a free data retrieval call binding the contract method 0x5b860d27. +// +// Solidity: function invalidPercent(_owner address) constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) InvalidPercent(_owner common.Address) (*big.Int, error) { + return _XDCValidator.Contract.InvalidPercent(&_XDCValidator.CallOpts, _owner) +} + +// InvalidPercent is a free data retrieval call binding the contract method 0x5b860d27. +// +// Solidity: function invalidPercent(_owner address) constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) InvalidPercent(_owner common.Address) (*big.Int, error) { + return _XDCValidator.Contract.InvalidPercent(&_XDCValidator.CallOpts, _owner) +} + +// IsCandidate is a free data retrieval call binding the contract method 0xd51b9e93. +// +// Solidity: function isCandidate(_candidate address) constant returns(bool) +func (_XDCValidator *XDCValidatorCaller) IsCandidate(opts *bind.CallOpts, _candidate common.Address) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "isCandidate", _candidate) + return *ret0, err +} + +// IsCandidate is a free data retrieval call binding the contract method 0xd51b9e93. +// +// Solidity: function isCandidate(_candidate address) constant returns(bool) +func (_XDCValidator *XDCValidatorSession) IsCandidate(_candidate common.Address) (bool, error) { + return _XDCValidator.Contract.IsCandidate(&_XDCValidator.CallOpts, _candidate) +} + +// IsCandidate is a free data retrieval call binding the contract method 0xd51b9e93. +// +// Solidity: function isCandidate(_candidate address) constant returns(bool) +func (_XDCValidator *XDCValidatorCallerSession) IsCandidate(_candidate common.Address) (bool, error) { + return _XDCValidator.Contract.IsCandidate(&_XDCValidator.CallOpts, _candidate) +} + +// IsOwner is a free data retrieval call binding the contract method 0x2f54bf6e. +// +// Solidity: function isOwner(owner address) constant returns(bool, uint256) +func (_XDCValidator *XDCValidatorCaller) IsOwner(opts *bind.CallOpts, owner common.Address) (bool, *big.Int, error) { + var ( + ret0 = new(bool) + ret1 = new(*big.Int) + ) + out := &[]interface{}{ + ret0, + ret1, + } + err := _XDCValidator.contract.Call(opts, out, "isOwner", owner) + return *ret0, *ret1, err +} + +// IsOwner is a free data retrieval call binding the contract method 0x2f54bf6e. +// +// Solidity: function isOwner(owner address) constant returns(bool, uint256) +func (_XDCValidator *XDCValidatorSession) IsOwner(owner common.Address) (bool, *big.Int, error) { + return _XDCValidator.Contract.IsOwner(&_XDCValidator.CallOpts, owner) +} + +// IsOwner is a free data retrieval call binding the contract method 0x2f54bf6e. +// +// Solidity: function isOwner(owner address) constant returns(bool, uint256) +func (_XDCValidator *XDCValidatorCallerSession) IsOwner(owner common.Address) (bool, *big.Int, error) { + return _XDCValidator.Contract.IsOwner(&_XDCValidator.CallOpts, owner) +} + +// MaxValidatorNumber is a free data retrieval call binding the contract method 0xd09f1ab4. +// +// Solidity: function maxValidatorNumber() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) MaxValidatorNumber(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "maxValidatorNumber") + return *ret0, err +} + +// MaxValidatorNumber is a free data retrieval call binding the contract method 0xd09f1ab4. +// +// Solidity: function maxValidatorNumber() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) MaxValidatorNumber() (*big.Int, error) { + return _XDCValidator.Contract.MaxValidatorNumber(&_XDCValidator.CallOpts) +} + +// MaxValidatorNumber is a free data retrieval call binding the contract method 0xd09f1ab4. +// +// Solidity: function maxValidatorNumber() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) MaxValidatorNumber() (*big.Int, error) { + return _XDCValidator.Contract.MaxValidatorNumber(&_XDCValidator.CallOpts) +} + +// MinCandidateCap is a free data retrieval call binding the contract method 0xd55b7dff. +// +// Solidity: function minCandidateCap() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) MinCandidateCap(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "minCandidateCap") + return *ret0, err +} + +// MinCandidateCap is a free data retrieval call binding the contract method 0xd55b7dff. +// +// Solidity: function minCandidateCap() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) MinCandidateCap() (*big.Int, error) { + return _XDCValidator.Contract.MinCandidateCap(&_XDCValidator.CallOpts) +} + +// MinCandidateCap is a free data retrieval call binding the contract method 0xd55b7dff. +// +// Solidity: function minCandidateCap() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) MinCandidateCap() (*big.Int, error) { + return _XDCValidator.Contract.MinCandidateCap(&_XDCValidator.CallOpts) +} + +// MinVoterCap is a free data retrieval call binding the contract method 0xf8ac9dd5. +// +// Solidity: function minVoterCap() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) MinVoterCap(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "minVoterCap") + return *ret0, err +} + +// MinVoterCap is a free data retrieval call binding the contract method 0xf8ac9dd5. +// +// Solidity: function minVoterCap() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) MinVoterCap() (*big.Int, error) { + return _XDCValidator.Contract.MinVoterCap(&_XDCValidator.CallOpts) +} + +// MinVoterCap is a free data retrieval call binding the contract method 0xf8ac9dd5. +// +// Solidity: function minVoterCap() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) MinVoterCap() (*big.Int, error) { + return _XDCValidator.Contract.MinVoterCap(&_XDCValidator.CallOpts) +} + +// OwnerCount is a free data retrieval call binding the contract method 0x0db02622. +// +// Solidity: function ownerCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) OwnerCount(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "ownerCount") + return *ret0, err +} + +// OwnerCount is a free data retrieval call binding the contract method 0x0db02622. +// +// Solidity: function ownerCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) OwnerCount() (*big.Int, error) { + return _XDCValidator.Contract.OwnerCount(&_XDCValidator.CallOpts) +} + +// OwnerCount is a free data retrieval call binding the contract method 0x0db02622. +// +// Solidity: function ownerCount() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) OwnerCount() (*big.Int, error) { + return _XDCValidator.Contract.OwnerCount(&_XDCValidator.CallOpts) +} + +// OwnerToCandidate is a free data retrieval call binding the contract method 0x2a3640b1. +// +// Solidity: function ownerToCandidate( address, uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCaller) OwnerToCandidate(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "ownerToCandidate", arg0, arg1) + return *ret0, err +} + +// OwnerToCandidate is a free data retrieval call binding the contract method 0x2a3640b1. +// +// Solidity: function ownerToCandidate( address, uint256) constant returns(address) +func (_XDCValidator *XDCValidatorSession) OwnerToCandidate(arg0 common.Address, arg1 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.OwnerToCandidate(&_XDCValidator.CallOpts, arg0, arg1) +} + +// OwnerToCandidate is a free data retrieval call binding the contract method 0x2a3640b1. +// +// Solidity: function ownerToCandidate( address, uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCallerSession) OwnerToCandidate(arg0 common.Address, arg1 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.OwnerToCandidate(&_XDCValidator.CallOpts, arg0, arg1) +} + +// Owners is a free data retrieval call binding the contract method 0x025e7c27. +// +// Solidity: function owners( uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCaller) Owners(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "owners", arg0) + return *ret0, err +} + +// Owners is a free data retrieval call binding the contract method 0x025e7c27. +// +// Solidity: function owners( uint256) constant returns(address) +func (_XDCValidator *XDCValidatorSession) Owners(arg0 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.Owners(&_XDCValidator.CallOpts, arg0) +} + +// Owners is a free data retrieval call binding the contract method 0x025e7c27. +// +// Solidity: function owners( uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCallerSession) Owners(arg0 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.Owners(&_XDCValidator.CallOpts, arg0) +} + +// PendingKYC is a free data retrieval call binding the contract method 0x1c68951c. +// +// Solidity: function pendingKYC( address) constant returns(blockNumber uint256, kycHash string) +func (_XDCValidator *XDCValidatorCaller) PendingKYC(opts *bind.CallOpts, arg0 common.Address) (struct { + BlockNumber *big.Int + KycHash string +}, error) { + ret := new(struct { + BlockNumber *big.Int + KycHash string + }) + out := ret + err := _XDCValidator.contract.Call(opts, out, "pendingKYC", arg0) + return *ret, err +} + +// PendingKYC is a free data retrieval call binding the contract method 0x1c68951c. +// +// Solidity: function pendingKYC( address) constant returns(blockNumber uint256, kycHash string) +func (_XDCValidator *XDCValidatorSession) PendingKYC(arg0 common.Address) (struct { + BlockNumber *big.Int + KycHash string +}, error) { + return _XDCValidator.Contract.PendingKYC(&_XDCValidator.CallOpts, arg0) +} + +// PendingKYC is a free data retrieval call binding the contract method 0x1c68951c. +// +// Solidity: function pendingKYC( address) constant returns(blockNumber uint256, kycHash string) +func (_XDCValidator *XDCValidatorCallerSession) PendingKYC(arg0 common.Address) (struct { + BlockNumber *big.Int + KycHash string +}, error) { + return _XDCValidator.Contract.PendingKYC(&_XDCValidator.CallOpts, arg0) +} + +// ValidatorsState is a free data retrieval call binding the contract method 0x4110a489. +// +// Solidity: function validatorsState( address) constant returns(owner address, isCandidate bool, cap uint256) +func (_XDCValidator *XDCValidatorCaller) ValidatorsState(opts *bind.CallOpts, arg0 common.Address) (struct { + Owner common.Address + IsCandidate bool + Cap *big.Int +}, error) { + ret := new(struct { + Owner common.Address + IsCandidate bool + Cap *big.Int + }) + out := ret + err := _XDCValidator.contract.Call(opts, out, "validatorsState", arg0) + return *ret, err +} + +// ValidatorsState is a free data retrieval call binding the contract method 0x4110a489. +// +// Solidity: function validatorsState( address) constant returns(owner address, isCandidate bool, cap uint256) +func (_XDCValidator *XDCValidatorSession) ValidatorsState(arg0 common.Address) (struct { + Owner common.Address + IsCandidate bool + Cap *big.Int +}, error) { + return _XDCValidator.Contract.ValidatorsState(&_XDCValidator.CallOpts, arg0) +} + +// ValidatorsState is a free data retrieval call binding the contract method 0x4110a489. +// +// Solidity: function validatorsState( address) constant returns(owner address, isCandidate bool, cap uint256) +func (_XDCValidator *XDCValidatorCallerSession) ValidatorsState(arg0 common.Address) (struct { + Owner common.Address + IsCandidate bool + Cap *big.Int +}, error) { + return _XDCValidator.Contract.ValidatorsState(&_XDCValidator.CallOpts, arg0) +} + +// VoterWithdrawDelay is a free data retrieval call binding the contract method 0xa9ff959e. +// +// Solidity: function voterWithdrawDelay() constant returns(uint256) +func (_XDCValidator *XDCValidatorCaller) VoterWithdrawDelay(opts *bind.CallOpts) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "voterWithdrawDelay") + return *ret0, err +} + +// VoterWithdrawDelay is a free data retrieval call binding the contract method 0xa9ff959e. +// +// Solidity: function voterWithdrawDelay() constant returns(uint256) +func (_XDCValidator *XDCValidatorSession) VoterWithdrawDelay() (*big.Int, error) { + return _XDCValidator.Contract.VoterWithdrawDelay(&_XDCValidator.CallOpts) +} + +// VoterWithdrawDelay is a free data retrieval call binding the contract method 0xa9ff959e. +// +// Solidity: function voterWithdrawDelay() constant returns(uint256) +func (_XDCValidator *XDCValidatorCallerSession) VoterWithdrawDelay() (*big.Int, error) { + return _XDCValidator.Contract.VoterWithdrawDelay(&_XDCValidator.CallOpts) +} + +// Voters is a free data retrieval call binding the contract method 0x5c134d66. +// +// Solidity: function voters( address, uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCaller) Voters(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _XDCValidator.contract.Call(opts, out, "voters", arg0, arg1) + return *ret0, err +} + +// Voters is a free data retrieval call binding the contract method 0x5c134d66. +// +// Solidity: function voters( address, uint256) constant returns(address) +func (_XDCValidator *XDCValidatorSession) Voters(arg0 common.Address, arg1 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.Voters(&_XDCValidator.CallOpts, arg0, arg1) +} + +// Voters is a free data retrieval call binding the contract method 0x5c134d66. +// +// Solidity: function voters( address, uint256) constant returns(address) +func (_XDCValidator *XDCValidatorCallerSession) Voters(arg0 common.Address, arg1 *big.Int) (common.Address, error) { + return _XDCValidator.Contract.Voters(&_XDCValidator.CallOpts, arg0, arg1) +} + +// ClaimKYC is a paid mutator transaction binding the contract method 0x935ad0d1. +// +// Solidity: function claimKYC() returns() +func (_XDCValidator *XDCValidatorTransactor) ClaimKYC(opts *bind.TransactOpts) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "claimKYC") +} + +// ClaimKYC is a paid mutator transaction binding the contract method 0x935ad0d1. +// +// Solidity: function claimKYC() returns() +func (_XDCValidator *XDCValidatorSession) ClaimKYC() (*types.Transaction, error) { + return _XDCValidator.Contract.ClaimKYC(&_XDCValidator.TransactOpts) +} + +// ClaimKYC is a paid mutator transaction binding the contract method 0x935ad0d1. +// +// Solidity: function claimKYC() returns() +func (_XDCValidator *XDCValidatorTransactorSession) ClaimKYC() (*types.Transaction, error) { + return _XDCValidator.Contract.ClaimKYC(&_XDCValidator.TransactOpts) +} + +// Propose is a paid mutator transaction binding the contract method 0x01267951. +// +// Solidity: function propose(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactor) Propose(opts *bind.TransactOpts, _candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "propose", _candidate) +} + +// Propose is a paid mutator transaction binding the contract method 0x01267951. +// +// Solidity: function propose(_candidate address) returns() +func (_XDCValidator *XDCValidatorSession) Propose(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Propose(&_XDCValidator.TransactOpts, _candidate) +} + +// Propose is a paid mutator transaction binding the contract method 0x01267951. +// +// Solidity: function propose(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactorSession) Propose(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Propose(&_XDCValidator.TransactOpts, _candidate) +} + +// RemoveCandidatesZeroAddresses is a paid mutator transaction binding the contract method 0x0999ec79. +// +// Solidity: function removeCandidatesZeroAddresses() returns() +func (_XDCValidator *XDCValidatorTransactor) RemoveCandidatesZeroAddresses(opts *bind.TransactOpts) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "removeCandidatesZeroAddresses") +} + +// RemoveCandidatesZeroAddresses is a paid mutator transaction binding the contract method 0x0999ec79. +// +// Solidity: function removeCandidatesZeroAddresses() returns() +func (_XDCValidator *XDCValidatorSession) RemoveCandidatesZeroAddresses() (*types.Transaction, error) { + return _XDCValidator.Contract.RemoveCandidatesZeroAddresses(&_XDCValidator.TransactOpts) +} + +// RemoveCandidatesZeroAddresses is a paid mutator transaction binding the contract method 0x0999ec79. +// +// Solidity: function removeCandidatesZeroAddresses() returns() +func (_XDCValidator *XDCValidatorTransactorSession) RemoveCandidatesZeroAddresses() (*types.Transaction, error) { + return _XDCValidator.Contract.RemoveCandidatesZeroAddresses(&_XDCValidator.TransactOpts) +} + +// RemoveOwnersZeroAddresses is a paid mutator transaction binding the contract method 0x681d8bf2. +// +// Solidity: function removeOwnersZeroAddresses() returns() +func (_XDCValidator *XDCValidatorTransactor) RemoveOwnersZeroAddresses(opts *bind.TransactOpts) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "removeOwnersZeroAddresses") +} + +// RemoveOwnersZeroAddresses is a paid mutator transaction binding the contract method 0x681d8bf2. +// +// Solidity: function removeOwnersZeroAddresses() returns() +func (_XDCValidator *XDCValidatorSession) RemoveOwnersZeroAddresses() (*types.Transaction, error) { + return _XDCValidator.Contract.RemoveOwnersZeroAddresses(&_XDCValidator.TransactOpts) +} + +// RemoveOwnersZeroAddresses is a paid mutator transaction binding the contract method 0x681d8bf2. +// +// Solidity: function removeOwnersZeroAddresses() returns() +func (_XDCValidator *XDCValidatorTransactorSession) RemoveOwnersZeroAddresses() (*types.Transaction, error) { + return _XDCValidator.Contract.RemoveOwnersZeroAddresses(&_XDCValidator.TransactOpts) +} + +// Resign is a paid mutator transaction binding the contract method 0xae6e43f5. +// +// Solidity: function resign(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactor) Resign(opts *bind.TransactOpts, _candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "resign", _candidate) +} + +// Resign is a paid mutator transaction binding the contract method 0xae6e43f5. +// +// Solidity: function resign(_candidate address) returns() +func (_XDCValidator *XDCValidatorSession) Resign(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Resign(&_XDCValidator.TransactOpts, _candidate) +} + +// Resign is a paid mutator transaction binding the contract method 0xae6e43f5. +// +// Solidity: function resign(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactorSession) Resign(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Resign(&_XDCValidator.TransactOpts, _candidate) +} + +// Unvote is a paid mutator transaction binding the contract method 0x02aa9be2. +// +// Solidity: function unvote(_candidate address, _cap uint256) returns() +func (_XDCValidator *XDCValidatorTransactor) Unvote(opts *bind.TransactOpts, _candidate common.Address, _cap *big.Int) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "unvote", _candidate, _cap) +} + +// Unvote is a paid mutator transaction binding the contract method 0x02aa9be2. +// +// Solidity: function unvote(_candidate address, _cap uint256) returns() +func (_XDCValidator *XDCValidatorSession) Unvote(_candidate common.Address, _cap *big.Int) (*types.Transaction, error) { + return _XDCValidator.Contract.Unvote(&_XDCValidator.TransactOpts, _candidate, _cap) +} + +// Unvote is a paid mutator transaction binding the contract method 0x02aa9be2. +// +// Solidity: function unvote(_candidate address, _cap uint256) returns() +func (_XDCValidator *XDCValidatorTransactorSession) Unvote(_candidate common.Address, _cap *big.Int) (*types.Transaction, error) { + return _XDCValidator.Contract.Unvote(&_XDCValidator.TransactOpts, _candidate, _cap) +} + +// UploadKYC is a paid mutator transaction binding the contract method 0xf5c95125. +// +// Solidity: function uploadKYC(kychash string) returns() +func (_XDCValidator *XDCValidatorTransactor) UploadKYC(opts *bind.TransactOpts, kychash string) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "uploadKYC", kychash) +} + +// UploadKYC is a paid mutator transaction binding the contract method 0xf5c95125. +// +// Solidity: function uploadKYC(kychash string) returns() +func (_XDCValidator *XDCValidatorSession) UploadKYC(kychash string) (*types.Transaction, error) { + return _XDCValidator.Contract.UploadKYC(&_XDCValidator.TransactOpts, kychash) +} + +// UploadKYC is a paid mutator transaction binding the contract method 0xf5c95125. +// +// Solidity: function uploadKYC(kychash string) returns() +func (_XDCValidator *XDCValidatorTransactorSession) UploadKYC(kychash string) (*types.Transaction, error) { + return _XDCValidator.Contract.UploadKYC(&_XDCValidator.TransactOpts, kychash) +} + +// Vote is a paid mutator transaction binding the contract method 0x6dd7d8ea. +// +// Solidity: function vote(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactor) Vote(opts *bind.TransactOpts, _candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "vote", _candidate) +} + +// Vote is a paid mutator transaction binding the contract method 0x6dd7d8ea. +// +// Solidity: function vote(_candidate address) returns() +func (_XDCValidator *XDCValidatorSession) Vote(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Vote(&_XDCValidator.TransactOpts, _candidate) +} + +// Vote is a paid mutator transaction binding the contract method 0x6dd7d8ea. +// +// Solidity: function vote(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactorSession) Vote(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Vote(&_XDCValidator.TransactOpts, _candidate) +} + +// VoteInvalidKYC is a paid mutator transaction binding the contract method 0xf2ee3c7d. +// +// Solidity: function voteInvalidKYC(_owner address) returns() +func (_XDCValidator *XDCValidatorTransactor) VoteInvalidKYC(opts *bind.TransactOpts, _owner common.Address) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "voteInvalidKYC", _owner) +} + +// VoteInvalidKYC is a paid mutator transaction binding the contract method 0xf2ee3c7d. +// +// Solidity: function voteInvalidKYC(_owner address) returns() +func (_XDCValidator *XDCValidatorSession) VoteInvalidKYC(_owner common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.VoteInvalidKYC(&_XDCValidator.TransactOpts, _owner) +} + +// VoteInvalidKYC is a paid mutator transaction binding the contract method 0xf2ee3c7d. +// +// Solidity: function voteInvalidKYC(_owner address) returns() +func (_XDCValidator *XDCValidatorTransactorSession) VoteInvalidKYC(_owner common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.VoteInvalidKYC(&_XDCValidator.TransactOpts, _owner) +} + +// Withdraw is a paid mutator transaction binding the contract method 0x441a3e70. +// +// Solidity: function withdraw(_blockNumber uint256, _index uint256) returns() +func (_XDCValidator *XDCValidatorTransactor) Withdraw(opts *bind.TransactOpts, _blockNumber *big.Int, _index *big.Int) (*types.Transaction, error) { + return _XDCValidator.contract.Transact(opts, "withdraw", _blockNumber, _index) +} + +// Withdraw is a paid mutator transaction binding the contract method 0x441a3e70. +// +// Solidity: function withdraw(_blockNumber uint256, _index uint256) returns() +func (_XDCValidator *XDCValidatorSession) Withdraw(_blockNumber *big.Int, _index *big.Int) (*types.Transaction, error) { + return _XDCValidator.Contract.Withdraw(&_XDCValidator.TransactOpts, _blockNumber, _index) +} + +// Withdraw is a paid mutator transaction binding the contract method 0x441a3e70. +// +// Solidity: function withdraw(_blockNumber uint256, _index uint256) returns() +func (_XDCValidator *XDCValidatorTransactorSession) Withdraw(_blockNumber *big.Int, _index *big.Int) (*types.Transaction, error) { + return _XDCValidator.Contract.Withdraw(&_XDCValidator.TransactOpts, _blockNumber, _index) +} + +// XDCValidatorInvalidatedNodeIterator is returned from FilterInvalidatedNode and is used to iterate over the raw logs and unpacked data for InvalidatedNode events raised by the XDCValidator contract. +type XDCValidatorInvalidatedNodeIterator struct { + Event *XDCValidatorInvalidatedNode // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *XDCValidatorInvalidatedNodeIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(XDCValidatorInvalidatedNode) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(XDCValidatorInvalidatedNode) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *XDCValidatorInvalidatedNodeIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *XDCValidatorInvalidatedNodeIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// XDCValidatorInvalidatedNode represents a InvalidatedNode event raised by the XDCValidator contract. +type XDCValidatorInvalidatedNode struct { + MasternodeOwner common.Address + Masternodes []common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInvalidatedNode is a free log retrieval operation binding the contract event 0xe18d61a5bf4aa2ab40afc88aa9039d27ae17ff4ec1c65f5f414df6f02ce8b35e. +// +// Solidity: event InvalidatedNode(_masternodeOwner address, _masternodes address[]) +func (_XDCValidator *XDCValidatorFilterer) FilterInvalidatedNode(opts *bind.FilterOpts) (*XDCValidatorInvalidatedNodeIterator, error) { + + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "InvalidatedNode") + if err != nil { + return nil, err + } + return &XDCValidatorInvalidatedNodeIterator{contract: _XDCValidator.contract, event: "InvalidatedNode", logs: logs, sub: sub}, nil +} + +// WatchInvalidatedNode is a free log subscription operation binding the contract event 0xe18d61a5bf4aa2ab40afc88aa9039d27ae17ff4ec1c65f5f414df6f02ce8b35e. +// +// Solidity: event InvalidatedNode(_masternodeOwner address, _masternodes address[]) +func (_XDCValidator *XDCValidatorFilterer) WatchInvalidatedNode(opts *bind.WatchOpts, sink chan<- *XDCValidatorInvalidatedNode) (event.Subscription, error) { + + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "InvalidatedNode") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(XDCValidatorInvalidatedNode) + if err := _XDCValidator.contract.UnpackLog(event, "InvalidatedNode", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// XDCValidatorProposeIterator is returned from FilterPropose and is used to iterate over the raw logs and unpacked data for Propose events raised by the XDCValidator contract. +type XDCValidatorProposeIterator struct { + Event *XDCValidatorPropose // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *XDCValidatorProposeIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(XDCValidatorPropose) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(XDCValidatorPropose) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *XDCValidatorProposeIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *XDCValidatorProposeIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// XDCValidatorPropose represents a Propose event raised by the XDCValidator contract. +type XDCValidatorPropose struct { + Owner common.Address + Candidate common.Address + Cap *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPropose is a free log retrieval operation binding the contract event 0x7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1. +// +// Solidity: event Propose(_owner address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterPropose(opts *bind.FilterOpts) (*XDCValidatorProposeIterator, error) { + + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Propose") + if err != nil { + return nil, err + } + return &XDCValidatorProposeIterator{contract: _XDCValidator.contract, event: "Propose", logs: logs, sub: sub}, nil +} + +// WatchPropose is a free log subscription operation binding the contract event 0x7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1. +// +// Solidity: event Propose(_owner address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) WatchPropose(opts *bind.WatchOpts, sink chan<- *XDCValidatorPropose) (event.Subscription, error) { + + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Propose") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(XDCValidatorPropose) + if err := _XDCValidator.contract.UnpackLog(event, "Propose", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// XDCValidatorResignIterator is returned from FilterResign and is used to iterate over the raw logs and unpacked data for Resign events raised by the XDCValidator contract. +type XDCValidatorResignIterator struct { + Event *XDCValidatorResign // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *XDCValidatorResignIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(XDCValidatorResign) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(XDCValidatorResign) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *XDCValidatorResignIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *XDCValidatorResignIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// XDCValidatorResign represents a Resign event raised by the XDCValidator contract. +type XDCValidatorResign struct { + Owner common.Address + Candidate common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterResign is a free log retrieval operation binding the contract event 0x4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3. +// +// Solidity: event Resign(_owner address, _candidate address) +func (_XDCValidator *XDCValidatorFilterer) FilterResign(opts *bind.FilterOpts) (*XDCValidatorResignIterator, error) { + + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Resign") + if err != nil { + return nil, err + } + return &XDCValidatorResignIterator{contract: _XDCValidator.contract, event: "Resign", logs: logs, sub: sub}, nil +} + +// WatchResign is a free log subscription operation binding the contract event 0x4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3. +// +// Solidity: event Resign(_owner address, _candidate address) +func (_XDCValidator *XDCValidatorFilterer) WatchResign(opts *bind.WatchOpts, sink chan<- *XDCValidatorResign) (event.Subscription, error) { + + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Resign") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(XDCValidatorResign) + if err := _XDCValidator.contract.UnpackLog(event, "Resign", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// XDCValidatorUnvoteIterator is returned from FilterUnvote and is used to iterate over the raw logs and unpacked data for Unvote events raised by the XDCValidator contract. +type XDCValidatorUnvoteIterator struct { + Event *XDCValidatorUnvote // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *XDCValidatorUnvoteIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(XDCValidatorUnvote) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(XDCValidatorUnvote) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *XDCValidatorUnvoteIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *XDCValidatorUnvoteIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// XDCValidatorUnvote represents a Unvote event raised by the XDCValidator contract. +type XDCValidatorUnvote struct { + Voter common.Address + Candidate common.Address + Cap *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUnvote is a free log retrieval operation binding the contract event 0xaa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2. +// +// Solidity: event Unvote(_voter address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterUnvote(opts *bind.FilterOpts) (*XDCValidatorUnvoteIterator, error) { + + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Unvote") + if err != nil { + return nil, err + } + return &XDCValidatorUnvoteIterator{contract: _XDCValidator.contract, event: "Unvote", logs: logs, sub: sub}, nil +} + +// WatchUnvote is a free log subscription operation binding the contract event 0xaa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2. +// +// Solidity: event Unvote(_voter address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) WatchUnvote(opts *bind.WatchOpts, sink chan<- *XDCValidatorUnvote) (event.Subscription, error) { + + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Unvote") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(XDCValidatorUnvote) + if err := _XDCValidator.contract.UnpackLog(event, "Unvote", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// XDCValidatorUploadedKYCIterator is returned from FilterUploadedKYC and is used to iterate over the raw logs and unpacked data for UploadedKYC events raised by the XDCValidator contract. +type XDCValidatorUploadedKYCIterator struct { + Event *XDCValidatorUploadedKYC // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *XDCValidatorUploadedKYCIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(XDCValidatorUploadedKYC) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(XDCValidatorUploadedKYC) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *XDCValidatorUploadedKYCIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *XDCValidatorUploadedKYCIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// XDCValidatorUploadedKYC represents a UploadedKYC event raised by the XDCValidator contract. +type XDCValidatorUploadedKYC struct { + Owner common.Address + KycHash string + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUploadedKYC is a free log retrieval operation binding the contract event 0x949360d814b28a3b393a68909efe1fee120ee09cac30f360a0f80ab5415a611a. +// +// Solidity: event UploadedKYC(_owner address, kycHash string) +func (_XDCValidator *XDCValidatorFilterer) FilterUploadedKYC(opts *bind.FilterOpts) (*XDCValidatorUploadedKYCIterator, error) { + + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "UploadedKYC") + if err != nil { + return nil, err + } + return &XDCValidatorUploadedKYCIterator{contract: _XDCValidator.contract, event: "UploadedKYC", logs: logs, sub: sub}, nil +} + +// WatchUploadedKYC is a free log subscription operation binding the contract event 0x949360d814b28a3b393a68909efe1fee120ee09cac30f360a0f80ab5415a611a. +// +// Solidity: event UploadedKYC(_owner address, kycHash string) +func (_XDCValidator *XDCValidatorFilterer) WatchUploadedKYC(opts *bind.WatchOpts, sink chan<- *XDCValidatorUploadedKYC) (event.Subscription, error) { + + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "UploadedKYC") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(XDCValidatorUploadedKYC) + if err := _XDCValidator.contract.UnpackLog(event, "UploadedKYC", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// XDCValidatorVoteIterator is returned from FilterVote and is used to iterate over the raw logs and unpacked data for Vote events raised by the XDCValidator contract. +type XDCValidatorVoteIterator struct { + Event *XDCValidatorVote // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *XDCValidatorVoteIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(XDCValidatorVote) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(XDCValidatorVote) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *XDCValidatorVoteIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *XDCValidatorVoteIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// XDCValidatorVote represents a Vote event raised by the XDCValidator contract. +type XDCValidatorVote struct { + Voter common.Address + Candidate common.Address + Cap *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterVote is a free log retrieval operation binding the contract event 0x66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc. +// +// Solidity: event Vote(_voter address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterVote(opts *bind.FilterOpts) (*XDCValidatorVoteIterator, error) { + + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Vote") + if err != nil { + return nil, err + } + return &XDCValidatorVoteIterator{contract: _XDCValidator.contract, event: "Vote", logs: logs, sub: sub}, nil +} + +// WatchVote is a free log subscription operation binding the contract event 0x66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc. +// +// Solidity: event Vote(_voter address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) WatchVote(opts *bind.WatchOpts, sink chan<- *XDCValidatorVote) (event.Subscription, error) { + + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Vote") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(XDCValidatorVote) + if err := _XDCValidator.contract.UnpackLog(event, "Vote", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// XDCValidatorWithdrawIterator is returned from FilterWithdraw and is used to iterate over the raw logs and unpacked data for Withdraw events raised by the XDCValidator contract. +type XDCValidatorWithdrawIterator struct { + Event *XDCValidatorWithdraw // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *XDCValidatorWithdrawIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(XDCValidatorWithdraw) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(XDCValidatorWithdraw) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *XDCValidatorWithdrawIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *XDCValidatorWithdrawIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// XDCValidatorWithdraw represents a Withdraw event raised by the XDCValidator contract. +type XDCValidatorWithdraw struct { + Owner common.Address + BlockNumber *big.Int + Cap *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWithdraw is a free log retrieval operation binding the contract event 0xf279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568. +// +// Solidity: event Withdraw(_owner address, _blockNumber uint256, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterWithdraw(opts *bind.FilterOpts) (*XDCValidatorWithdrawIterator, error) { + + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Withdraw") + if err != nil { + return nil, err + } + return &XDCValidatorWithdrawIterator{contract: _XDCValidator.contract, event: "Withdraw", logs: logs, sub: sub}, nil +} + +// WatchWithdraw is a free log subscription operation binding the contract event 0xf279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568. +// +// Solidity: event Withdraw(_owner address, _blockNumber uint256, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) WatchWithdraw(opts *bind.WatchOpts, sink chan<- *XDCValidatorWithdraw) (event.Subscription, error) { + + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Withdraw") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(XDCValidatorWithdraw) + if err := _XDCValidator.contract.UnpackLog(event, "Withdraw", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +}