From 35013571d5932a9fc192239581a2461da8d11624 Mon Sep 17 00:00:00 2001 From: Nguyen Sy Thanh Son Date: Tue, 14 Aug 2018 04:17:27 +0000 Subject: [PATCH 1/3] remove nodeId in smart contract --- .../validator/contract/TomoValidator.sol | 15 +- contracts/validator/contract/validator.go | 199 ++---------------- 2 files changed, 15 insertions(+), 199 deletions(-) diff --git a/contracts/validator/contract/TomoValidator.sol b/contracts/validator/contract/TomoValidator.sol index 2c544eda4b56..180c8129dcec 100644 --- a/contracts/validator/contract/TomoValidator.sol +++ b/contracts/validator/contract/TomoValidator.sol @@ -9,12 +9,10 @@ contract TomoValidator { event Unvote(address _voter, address _candidate, uint256 _cap); event Propose(address _owner, address _candidate, uint256 _cap); event Resign(address _owner, address _candidate); - event SetNodeId(address _owner, address _candidate, string _nodeId); event Withdraw(address _owner, uint256 _blockNumber, uint256 _cap); struct ValidatorState { address owner; - string nodeId; bool isCandidate; uint256 cap; mapping(address => uint256) voters; @@ -97,7 +95,6 @@ contract TomoValidator { candidates.push(_candidates[i]); validatorsState[_candidates[i]] = ValidatorState({ owner: _firstOwner, - nodeId: '', isCandidate: true, cap: _caps[i] }); @@ -106,11 +103,10 @@ contract TomoValidator { } } - function propose(address _candidate, string _nodeId) external payable onlyValidCandidateCap onlyNotCandidate(_candidate) { + function propose(address _candidate) external payable onlyValidCandidateCap onlyNotCandidate(_candidate) { candidates.push(_candidate); validatorsState[_candidate] = ValidatorState({ owner: msg.sender, - nodeId: _nodeId, isCandidate: true, cap: msg.value }); @@ -137,10 +133,6 @@ contract TomoValidator { return validatorsState[_candidate].cap; } - function getCandidateNodeId(address _candidate) public view returns(string) { - return validatorsState[_candidate].nodeId; - } - function getCandidateOwner(address _candidate) public view returns(address) { return validatorsState[_candidate].owner; } @@ -177,11 +169,6 @@ contract TomoValidator { emit Unvote(msg.sender, _candidate, _cap); } - function setNodeId(address _candidate, string _nodeId) public onlyOwner(_candidate) { - validatorsState[_candidate].nodeId = _nodeId; - emit SetNodeId(msg.sender, _candidate, _nodeId); - } - function resign(address _candidate) public onlyOwner(_candidate) onlyCandidate(_candidate) { validatorsState[_candidate].isCandidate = false; candidateCount = candidateCount - 1; diff --git a/contracts/validator/contract/validator.go b/contracts/validator/contract/validator.go index 9fdb42506870..a2f5231b59cc 100644 --- a/contracts/validator/contract/validator.go +++ b/contracts/validator/contract/validator.go @@ -177,10 +177,10 @@ func (_SafeMath *SafeMathTransactorRaw) Transact(opts *bind.TransactOpts, method } // TomoValidatorABI is the input ABI used to generate the binding from. -const TomoValidatorABI = "[{\"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\":true,\"inputs\":[{\"name\":\"_blockNumber\",\"type\":\"uint256\"}],\"name\":\"getWithdrawCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"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\":\"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\":\"\",\"type\":\"uint256\"}],\"name\":\"candidates\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"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\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"},{\"name\":\"_nodeId\",\"type\":\"string\"}],\"name\":\"setNodeId\",\"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\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateNodeId\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"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\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"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\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"},{\"name\":\"_nodeId\",\"type\":\"string\"}],\"name\":\"propose\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_candidates\",\"type\":\"address[]\"},{\"name\":\"_caps\",\"type\":\"uint256[]\"},{\"name\":\"_firstOwner\",\"type\":\"address\"},{\"name\":\"_minCandidateCap\",\"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\":\"_candidate\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_nodeId\",\"type\":\"string\"}],\"name\":\"SetNodeId\",\"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\"}]" +const TomoValidatorABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"propose\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"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\":true,\"inputs\":[{\"name\":\"_blockNumber\",\"type\":\"uint256\"}],\"name\":\"getWithdrawCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"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\":\"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\":\"\",\"type\":\"uint256\"}],\"name\":\"candidates\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"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\":false,\"inputs\":[{\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"vote\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"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\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"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\"},{\"inputs\":[{\"name\":\"_candidates\",\"type\":\"address[]\"},{\"name\":\"_caps\",\"type\":\"uint256[]\"},{\"name\":\"_firstOwner\",\"type\":\"address\"},{\"name\":\"_minCandidateCap\",\"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\"}]" // TomoValidatorBin is the compiled bytecode used for deploying new contracts. -const TomoValidatorBin = `0x6060604052600360045534156200001557600080fd5b6040516200176738038062001767833981016040528080518201919060200180518201919060200180519190602001805191906020018051919060200180519190602001805160058690556006859055600784905560088190559150600090505b87518110156200028757600380546001810162000094838262000295565b916000526020600020900160008a8481518110620000ae57fe5b90602001906020020151909190916101000a815481600160a060020a030219169083600160a060020a031602179055505060806040519081016040528087600160a060020a03168152602001602060405190810160409081526000825290825260016020830152018883815181106200012357fe5b906020019060200201519052600160008a84815181106200014057fe5b90602001906020020151600160a060020a03168152602081019190915260400160002081518154600160a060020a031916600160a060020a03919091161781556020820151816001019080516200019c929160200190620002c1565b50604082015160028201805460ff191691151591909117905560608201516003909101555060026000898381518110620001d257fe5b90602001906020020151600160a060020a03168152602081019190915260400160002080546001810162000207838262000295565b50600091825260208220018054600160a060020a031916600160a060020a038916179055600554600380549192600192909190859081106200024557fe5b6000918252602080832090910154600160a060020a0390811684528382019490945260409283018220938b168252600490930190925290205560010162000076565b505050505050505062000366565b815481835581811511620002bc57600083815260209020620002bc91810190830162000346565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200030457805160ff191683800117855562000334565b8280016001018555821562000334579182015b828111156200033457825182559160200191906001019062000317565b506200034292915062000346565b5090565b6200036391905b808211156200034257600081556001016200034d565b90565b6113f180620003766000396000f30060606040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166302aa9be2811461012157806306a49fce1461014557806315febd68146101ab5780632d15cc04146101d35780632f9c4bba146101f2578063302b6872146102055780633477ee2e1461022a578063441a3e701461025c57806358e7525f146102755780636a000d74146102945780636dd7d8ea146102f35780637d40257f14610307578063a9a981a31461039d578063a9ff959e146103b0578063ae6e43f5146103c3578063b642facd146103e2578063d09f1ab414610401578063d161c76714610414578063d51b9e9314610427578063d55b7dff1461045a578063d6f0948c1461046d575b600080fd5b341561012c57600080fd5b610143600160a060020a036004351660243561048d565b005b341561015057600080fd5b6101586106c3565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561019757808201518382015260200161017f565b505050509050019250505060405180910390f35b34156101b657600080fd5b6101c160043561072c565b60405190815260200160405180910390f35b34156101de57600080fd5b610158600160a060020a0360043516610750565b34156101fd57600080fd5b6101586107dd565b341561021057600080fd5b6101c1600160a060020a036004358116906024351661085f565b341561023557600080fd5b61024060043561088e565b604051600160a060020a03909116815260200160405180910390f35b341561026757600080fd5b6101436004356024356108b6565b341561028057600080fd5b6101c1600160a060020a0360043516610a1d565b341561029f57600080fd5b61014360048035600160a060020a03169060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610a3b95505050505050565b610143600160a060020a0360043516610b4c565b341561031257600080fd5b610326600160a060020a0360043516610cf9565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561036257808201518382015260200161034a565b50505050905090810190601f16801561038f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103a857600080fd5b6101c1610dbf565b34156103bb57600080fd5b6101c1610dc5565b34156103ce57600080fd5b610143600160a060020a0360043516610dcb565b34156103ed57600080fd5b610240600160a060020a036004351661103e565b341561040c57600080fd5b6101c161105c565b341561041f57600080fd5b6101c1611062565b341561043257600080fd5b610446600160a060020a0360043516611068565b604051901515815260200160405180910390f35b341561046557600080fd5b6101c1611089565b61014360048035600160a060020a0316906024803590810191013561108f565b600160a060020a038083166000908152600160209081526040808320339094168352600490930190529081205483908390819010156104cb57600080fd5b600160a060020a038281166000908152600160205260409020543382169116141561053957600554600160a060020a03808416600090815260016020908152604080832033909416835260049093019052205461052e908363ffffffff6112ca16565b101561053957600080fd5b600160a060020a038516600090815260016020526040902060030154610565908563ffffffff6112ca16565b600160a060020a038087166000908152600160209081526040808320600381019590955533909316825260049093019092529020546105aa908563ffffffff6112ca16565b600160a060020a0380871660009081526001602090815260408083203390941683526004909301905220556008546105e8904363ffffffff6112dc16565b600160a060020a03331660009081526020818152604080832084845290915290205490935061061d908563ffffffff6112dc16565b600160a060020a033316600081815260208181526040808320888452808352908320949094559181529052600190810180549091810161065d83826112f2565b5060009182526020909120018390557faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2338686604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050505050565b6106cb61131b565b600380548060200260200160405190810160405280929190818152602001828054801561072157602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610703575b505050505090505b90565b33600160a060020a0316600090815260208181526040808320938352929052205490565b61075861131b565b6002600083600160a060020a0316600160a060020a031681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156107d157602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116107b3575b50505050509050919050565b6107e561131b565b60008033600160a060020a0316600160a060020a0316815260200190815260200160002060010180548060200260200160405190810160405280929190818152602001828054801561072157602002820191906000526020600020905b815481526020019060010190808311610842575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526004909201909152205490565b600380548290811061089c57fe5b600091825260209091200154600160a060020a0316905081565b600082828282116108c657600080fd5b43829010156108d457600080fd5b600160a060020a0333166000908152602081815260408083208584529091528120541161090057600080fd5b600160a060020a033316600090815260208190526040902060010180548391908390811061092a57fe5b6000918252602090912001541461094057600080fd5b600160a060020a0333166000818152602081815260408083208984528083529083208054908490559383529190526001018054919450908590811061098157fe5b6000918252602082200155600160a060020a03331683156108fc0284604051600060405180830381858888f1935050505015156109bd57600080fd5b7ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5683386856040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a15050505050565b600160a060020a031660009081526001602052604090206003015490565b600160a060020a038281166000908152600160205260409020548391338116911614610a6657600080fd5b600160a060020a038316600090815260016020819052604090912001828051610a9392916020019061132d565b507f0e421c04ccd34fafbe77c6b2f9384de8c5c4795114325fedb698a6ce62b2d744338484604051600160a060020a0380851682528316602082015260606040820181815290820183818151815260200191508051906020019080838360005b83811015610b0b578082015183820152602001610af3565b50505050905090810190601f168015610b385780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505050565b600160a060020a038116600090815260016020526040902060020154819060ff161515610b7857600080fd5b600160a060020a038216600090815260016020526040902060030154610ba4903463ffffffff6112dc16565b600160a060020a038084166000908152600160209081526040808320600381019590955533909316825260049093019092529020541515610c3a57600160a060020a0382166000908152600260205260409020805460018101610c0783826112f2565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a03161790555b600160a060020a038083166000908152600160209081526040808320339094168352600490930190522054610c75903463ffffffff6112dc16565b600160a060020a03808416600090815260016020908152604080832033948516845260040190915290819020929092557f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc918490349051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050565b610d0161131b565b6001600083600160a060020a0316600160a060020a031681526020019081526020016000206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107d15780601f10610d92576101008083540402835291602001916107d1565b820191906000526020600020905b815481529060010190602001808311610da05750939695505050505050565b60045481565b60085481565b600160a060020a038181166000908152600160205260408120549091829182918591338216911614610dfc57600080fd5b600160a060020a038516600090815260016020526040902060020154859060ff161515610e2857600080fd5b600160a060020a0386166000908152600160205260408120600201805460ff191690556004805460001901905594505b600354851015610eda5785600160a060020a0316600386815481101515610e7b57fe5b600091825260209091200154600160a060020a03161415610ecf576003805486908110610ea457fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff19169055610eda565b600190940193610e58565b600160a060020a038087166000818152600160208181526040808420339096168452600486018252832054939092529052600390910154909450610f24908563ffffffff6112ca16565b600160a060020a03808816600090815260016020908152604080832060038101959095553390931682526004909301909252812055600754610f6c904363ffffffff6112dc16565b600160a060020a033316600090815260208181526040808320848452909152902054909350610fa1908563ffffffff6112dc16565b600160a060020a0333166000818152602081815260408083208884528083529083209490945591815290526001908101805490918101610fe183826112f2565b5060009182526020909120018390557f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d33387604051600160a060020a039283168152911660208201526040908101905180910390a1505050505050565b600160a060020a039081166000908152600160205260409020541690565b60065481565b60075481565b600160a060020a031660009081526001602052604090206002015460ff1690565b60055481565b60055434101561109e57600080fd5b600160a060020a038316600090815260016020526040902060020154839060ff16156110c957600080fd5b60038054600181016110db83826112f2565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03861617905560806040519081016040528033600160a060020a0316815260200184848080601f016020809104026020016040519081016040528181529291906020840183838082843750505092845250506001602080840182905234604094850152600160a060020a03891660009081529190529190912090508151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151816001019080516111c692916020019061132d565b50604082015160028201805460ff1916911515919091179055606082015160039091015550600160a060020a038085166000818152600160208181526040808420339096168452600495860182528084203490558554830190955592825260029092529190912080549091810161123d83826112f2565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a038116919091179091557f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1908534604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a150505050565b6000828211156112d657fe5b50900390565b6000828201838110156112eb57fe5b9392505050565b815481835581811511611316576000838152602090206113169181019083016113ab565b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061136e57805160ff191683800117855561139b565b8280016001018555821561139b579182015b8281111561139b578251825591602001919060010190611380565b506113a79291506113ab565b5090565b61072991905b808211156113a757600081556001016113b15600a165627a7a72305820533461a49b570aed456dd656820c26187266c282cce831a86380e92277028eb30029` +const TomoValidatorBin = `0x6060604052600360045534156200001557600080fd5b6040516200133338038062001333833981016040528080518201919060200180518201919060200180519190602001805191906020018051919060200180519190602001805160058690556006859055600784905560088190559150600090505b87518110156200026d5760038054600181016200009483826200027b565b916000526020600020900160008a8481518110620000ae57fe5b90602001906020020151909190916101000a815481600160a060020a030219169083600160a060020a031602179055505060606040519081016040908152600160a060020a03881682526001602083015281018883815181106200010e57fe5b906020019060200201519052600160008a84815181106200012b57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002081518154600160a060020a031916600160a060020a039190911617815560208201518154901515740100000000000000000000000000000000000000000260a060020a60ff021990911617815560408201516001909101555060026000898381518110620001b857fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460018101620001ed83826200027b565b50600091825260208220018054600160a060020a031916600160a060020a038916179055600554600380549192600192909190859081106200022b57fe5b6000918252602080832090910154600160a060020a0390811684528382019490945260409283018220938b168252600290930190925290205560010162000076565b5050505050505050620002cb565b815481835581811511620002a257600083815260209020620002a2918101908301620002a7565b505050565b620002c891905b80821115620002c45760008155600101620002ae565b5090565b90565b61105880620002db6000396000f3006060604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301267951811461010b57806302aa9be21461012157806306a49fce1461014357806315febd68146101a95780632d15cc04146101d15780632f9c4bba146101f0578063302b6872146102035780633477ee2e14610228578063441a3e701461025a57806358e7525f146102735780636dd7d8ea14610292578063a9a981a3146102a6578063a9ff959e146102b9578063ae6e43f5146102cc578063b642facd146102eb578063d09f1ab41461030a578063d161c7671461031d578063d51b9e9314610330578063d55b7dff14610363575b600080fd5b61011f600160a060020a0360043516610376565b005b341561012c57600080fd5b61011f600160a060020a0360043516602435610569565b341561014e57600080fd5b61015661079c565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561019557808201518382015260200161017d565b505050509050019250505060405180910390f35b34156101b457600080fd5b6101bf600435610805565b60405190815260200160405180910390f35b34156101dc57600080fd5b610156600160a060020a0360043516610829565b34156101fb57600080fd5b6101566108b6565b341561020e57600080fd5b6101bf600160a060020a0360043581169060243516610938565b341561023357600080fd5b61023e600435610967565b604051600160a060020a03909116815260200160405180910390f35b341561026557600080fd5b61011f60043560243561098f565b341561027e57600080fd5b6101bf600160a060020a0360043516610af6565b61011f600160a060020a0360043516610b15565b34156102b157600080fd5b6101bf610cc3565b34156102c457600080fd5b6101bf610cc9565b34156102d757600080fd5b61011f600160a060020a0360043516610ccf565b34156102f657600080fd5b61023e600160a060020a0360043516610f56565b341561031557600080fd5b6101bf610f74565b341561032857600080fd5b6101bf610f7a565b341561033b57600080fd5b61034f600160a060020a0360043516610f80565b604051901515815260200160405180910390f35b341561036e57600080fd5b6101bf610fa5565b60055434101561038557600080fd5b600160a060020a038116600090815260016020526040902054819060a060020a900460ff16156103b457600080fd5b60038054600181016103c68382610fd3565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03841617905560606040519081016040908152600160a060020a03338116835260016020808501829052348486015291861660009081529152208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151815490151560a060020a0274ff0000000000000000000000000000000000000000199091161781556040820151600191820155600160a060020a0380851660008181526020848152604080832033909516835260029485018252808320349055600480548701905592825292909252902080549092509081016104de8382610fd3565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a038116919091179091557f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1908334604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050565b600160a060020a038083166000908152600160209081526040808320339094168352600290930190529081205483908390819010156105a757600080fd5b600160a060020a038281166000908152600160205260409020543382169116141561061557600554600160a060020a03808416600090815260016020908152604080832033909416835260029093019052205461060a908363ffffffff610fab16565b101561061557600080fd5b600160a060020a03851660009081526001602081905260409091200154610642908563ffffffff610fab16565b600160a060020a038087166000908152600160208181526040808420928301959095553390931682526002019091522054610683908563ffffffff610fab16565b600160a060020a0380871660009081526001602090815260408083203390941683526002909301905220556008546106c1904363ffffffff610fbd16565b600160a060020a0333166000908152602081815260408083208484529091529020549093506106f6908563ffffffff610fbd16565b600160a060020a03331660008181526020818152604080832088845280835290832094909455918152905260019081018054909181016107368382610fd3565b5060009182526020909120018390557faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2338686604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050505050565b6107a4610ffc565b60038054806020026020016040519081016040528092919081815260200182805480156107fa57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116107dc575b505050505090505b90565b33600160a060020a0316600090815260208181526040808320938352929052205490565b610831610ffc565b6002600083600160a060020a0316600160a060020a031681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156108aa57602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161088c575b50505050509050919050565b6108be610ffc565b60008033600160a060020a0316600160a060020a031681526020019081526020016000206001018054806020026020016040519081016040528092919081815260200182805480156107fa57602002820191906000526020600020905b81548152602001906001019080831161091b575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b600380548290811061097557fe5b600091825260209091200154600160a060020a0316905081565b6000828282821161099f57600080fd5b43829010156109ad57600080fd5b600160a060020a033316600090815260208181526040808320858452909152812054116109d957600080fd5b600160a060020a0333166000908152602081905260409020600101805483919083908110610a0357fe5b60009182526020909120015414610a1957600080fd5b600160a060020a03331660008181526020818152604080832089845280835290832080549084905593835291905260010180549194509085908110610a5a57fe5b6000918252602082200155600160a060020a03331683156108fc0284604051600060405180830381858888f193505050501515610a9657600080fd5b7ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5683386856040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600160a060020a038116600090815260016020526040902054819060a060020a900460ff161515610b4557600080fd5b600160a060020a03821660009081526001602081905260409091200154610b72903463ffffffff610fbd16565b600160a060020a0380841660009081526001602081815260408084209283019590955533909316825260020190915220541515610c0457600160a060020a0382166000908152600260205260409020805460018101610bd18382610fd3565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a03161790555b600160a060020a038083166000908152600160209081526040808320339094168352600290930190522054610c3f903463ffffffff610fbd16565b600160a060020a03808416600090815260016020908152604080832033948516845260020190915290819020929092557f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc918490349051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050565b60045481565b60085481565b600160a060020a038181166000908152600160205260408120549091829182918591338216911614610d0057600080fd5b600160a060020a038516600090815260016020526040902054859060a060020a900460ff161515610d3057600080fd5b600160a060020a0386166000908152600160205260408120805474ff0000000000000000000000000000000000000000191690556004805460001901905594505b600354851015610df35785600160a060020a0316600386815481101515610d9457fe5b600091825260209091200154600160a060020a03161415610de8576003805486908110610dbd57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff19169055610df3565b600190940193610d71565b600160a060020a03808716600081815260016020818152604080842033909616845260028601825283205493909252908190529190910154909450610e3e908563ffffffff610fab16565b600160a060020a0380881660009081526001602081815260408084209283019590955533909316825260020190915290812055600754610e84904363ffffffff610fbd16565b600160a060020a033316600090815260208181526040808320848452909152902054909350610eb9908563ffffffff610fbd16565b600160a060020a0333166000818152602081815260408083208884528083529083209490945591815290526001908101805490918101610ef98382610fd3565b5060009182526020909120018390557f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d33387604051600160a060020a039283168152911660208201526040908101905180910390a1505050505050565b600160a060020a039081166000908152600160205260409020541690565b60065481565b60075481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b60055481565b600082821115610fb757fe5b50900390565b600082820183811015610fcc57fe5b9392505050565b815481835581811511610ff757600083815260209020610ff791810190830161100e565b505050565b60206040519081016040526000815290565b61080291905b808211156110285760008155600101611014565b50905600a165627a7a723058203be85a5a9cef3cebc4526b6065edb9e75339d161e6b3cbd3bd82c29e6bab9efc0029` // DeployTomoValidator deploys a new Ethereum contract, binding an instance of TomoValidator to it. func DeployTomoValidator(auth *bind.TransactOpts, backend bind.ContractBackend, _candidates []common.Address, _caps []*big.Int, _firstOwner common.Address, _minCandidateCap *big.Int, _maxValidatorNumber *big.Int, _candidateWithdrawDelay *big.Int, _voterWithdrawDelay *big.Int) (common.Address, *types.Transaction, *TomoValidator, error) { @@ -441,32 +441,6 @@ func (_TomoValidator *TomoValidatorCallerSession) GetCandidateCap(_candidate com return _TomoValidator.Contract.GetCandidateCap(&_TomoValidator.CallOpts, _candidate) } -// GetCandidateNodeId is a free data retrieval call binding the contract method 0x7d40257f. -// -// Solidity: function getCandidateNodeId(_candidate address) constant returns(string) -func (_TomoValidator *TomoValidatorCaller) GetCandidateNodeId(opts *bind.CallOpts, _candidate common.Address) (string, error) { - var ( - ret0 = new(string) - ) - out := ret0 - err := _TomoValidator.contract.Call(opts, out, "getCandidateNodeId", _candidate) - return *ret0, err -} - -// GetCandidateNodeId is a free data retrieval call binding the contract method 0x7d40257f. -// -// Solidity: function getCandidateNodeId(_candidate address) constant returns(string) -func (_TomoValidator *TomoValidatorSession) GetCandidateNodeId(_candidate common.Address) (string, error) { - return _TomoValidator.Contract.GetCandidateNodeId(&_TomoValidator.CallOpts, _candidate) -} - -// GetCandidateNodeId is a free data retrieval call binding the contract method 0x7d40257f. -// -// Solidity: function getCandidateNodeId(_candidate address) constant returns(string) -func (_TomoValidator *TomoValidatorCallerSession) GetCandidateNodeId(_candidate common.Address) (string, error) { - return _TomoValidator.Contract.GetCandidateNodeId(&_TomoValidator.CallOpts, _candidate) -} - // GetCandidateOwner is a free data retrieval call binding the contract method 0xb642facd. // // Solidity: function getCandidateOwner(_candidate address) constant returns(address) @@ -727,25 +701,25 @@ func (_TomoValidator *TomoValidatorCallerSession) VoterWithdrawDelay() (*big.Int return _TomoValidator.Contract.VoterWithdrawDelay(&_TomoValidator.CallOpts) } -// Propose is a paid mutator transaction binding the contract method 0xd6f0948c. +// Propose is a paid mutator transaction binding the contract method 0x01267951. // -// Solidity: function propose(_candidate address, _nodeId string) returns() -func (_TomoValidator *TomoValidatorTransactor) Propose(opts *bind.TransactOpts, _candidate common.Address, _nodeId string) (*types.Transaction, error) { - return _TomoValidator.contract.Transact(opts, "propose", _candidate, _nodeId) +// Solidity: function propose(_candidate address) returns() +func (_TomoValidator *TomoValidatorTransactor) Propose(opts *bind.TransactOpts, _candidate common.Address) (*types.Transaction, error) { + return _TomoValidator.contract.Transact(opts, "propose", _candidate) } -// Propose is a paid mutator transaction binding the contract method 0xd6f0948c. +// Propose is a paid mutator transaction binding the contract method 0x01267951. // -// Solidity: function propose(_candidate address, _nodeId string) returns() -func (_TomoValidator *TomoValidatorSession) Propose(_candidate common.Address, _nodeId string) (*types.Transaction, error) { - return _TomoValidator.Contract.Propose(&_TomoValidator.TransactOpts, _candidate, _nodeId) +// Solidity: function propose(_candidate address) returns() +func (_TomoValidator *TomoValidatorSession) Propose(_candidate common.Address) (*types.Transaction, error) { + return _TomoValidator.Contract.Propose(&_TomoValidator.TransactOpts, _candidate) } -// Propose is a paid mutator transaction binding the contract method 0xd6f0948c. +// Propose is a paid mutator transaction binding the contract method 0x01267951. // -// Solidity: function propose(_candidate address, _nodeId string) returns() -func (_TomoValidator *TomoValidatorTransactorSession) Propose(_candidate common.Address, _nodeId string) (*types.Transaction, error) { - return _TomoValidator.Contract.Propose(&_TomoValidator.TransactOpts, _candidate, _nodeId) +// Solidity: function propose(_candidate address) returns() +func (_TomoValidator *TomoValidatorTransactorSession) Propose(_candidate common.Address) (*types.Transaction, error) { + return _TomoValidator.Contract.Propose(&_TomoValidator.TransactOpts, _candidate) } // Resign is a paid mutator transaction binding the contract method 0xae6e43f5. @@ -769,27 +743,6 @@ func (_TomoValidator *TomoValidatorTransactorSession) Resign(_candidate common.A return _TomoValidator.Contract.Resign(&_TomoValidator.TransactOpts, _candidate) } -// SetNodeId is a paid mutator transaction binding the contract method 0x6a000d74. -// -// Solidity: function setNodeId(_candidate address, _nodeId string) returns() -func (_TomoValidator *TomoValidatorTransactor) SetNodeId(opts *bind.TransactOpts, _candidate common.Address, _nodeId string) (*types.Transaction, error) { - return _TomoValidator.contract.Transact(opts, "setNodeId", _candidate, _nodeId) -} - -// SetNodeId is a paid mutator transaction binding the contract method 0x6a000d74. -// -// Solidity: function setNodeId(_candidate address, _nodeId string) returns() -func (_TomoValidator *TomoValidatorSession) SetNodeId(_candidate common.Address, _nodeId string) (*types.Transaction, error) { - return _TomoValidator.Contract.SetNodeId(&_TomoValidator.TransactOpts, _candidate, _nodeId) -} - -// SetNodeId is a paid mutator transaction binding the contract method 0x6a000d74. -// -// Solidity: function setNodeId(_candidate address, _nodeId string) returns() -func (_TomoValidator *TomoValidatorTransactorSession) SetNodeId(_candidate common.Address, _nodeId string) (*types.Transaction, error) { - return _TomoValidator.Contract.SetNodeId(&_TomoValidator.TransactOpts, _candidate, _nodeId) -} - // Unvote is a paid mutator transaction binding the contract method 0x02aa9be2. // // Solidity: function unvote(_candidate address, _cap uint256) returns() @@ -1100,130 +1053,6 @@ func (_TomoValidator *TomoValidatorFilterer) WatchResign(opts *bind.WatchOpts, s }), nil } -// TomoValidatorSetNodeIdIterator is returned from FilterSetNodeId and is used to iterate over the raw logs and unpacked data for SetNodeId events raised by the TomoValidator contract. -type TomoValidatorSetNodeIdIterator struct { - Event *TomoValidatorSetNodeId // 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 *TomoValidatorSetNodeIdIterator) 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(TomoValidatorSetNodeId) - 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(TomoValidatorSetNodeId) - 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 *TomoValidatorSetNodeIdIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *TomoValidatorSetNodeIdIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// TomoValidatorSetNodeId represents a SetNodeId event raised by the TomoValidator contract. -type TomoValidatorSetNodeId struct { - Owner common.Address - Candidate common.Address - NodeId string - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSetNodeId is a free log retrieval operation binding the contract event 0x0e421c04ccd34fafbe77c6b2f9384de8c5c4795114325fedb698a6ce62b2d744. -// -// Solidity: event SetNodeId(_owner address, _candidate address, _nodeId string) -func (_TomoValidator *TomoValidatorFilterer) FilterSetNodeId(opts *bind.FilterOpts) (*TomoValidatorSetNodeIdIterator, error) { - - logs, sub, err := _TomoValidator.contract.FilterLogs(opts, "SetNodeId") - if err != nil { - return nil, err - } - return &TomoValidatorSetNodeIdIterator{contract: _TomoValidator.contract, event: "SetNodeId", logs: logs, sub: sub}, nil -} - -// WatchSetNodeId is a free log subscription operation binding the contract event 0x0e421c04ccd34fafbe77c6b2f9384de8c5c4795114325fedb698a6ce62b2d744. -// -// Solidity: event SetNodeId(_owner address, _candidate address, _nodeId string) -func (_TomoValidator *TomoValidatorFilterer) WatchSetNodeId(opts *bind.WatchOpts, sink chan<- *TomoValidatorSetNodeId) (event.Subscription, error) { - - logs, sub, err := _TomoValidator.contract.WatchLogs(opts, "SetNodeId") - 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(TomoValidatorSetNodeId) - if err := _TomoValidator.contract.UnpackLog(event, "SetNodeId", 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 -} - // TomoValidatorUnvoteIterator is returned from FilterUnvote and is used to iterate over the raw logs and unpacked data for Unvote events raised by the TomoValidator contract. type TomoValidatorUnvoteIterator struct { Event *TomoValidatorUnvote // Event containing the contract specifics and raw log From 2312678cffa90f7ce57f1e6d6ee1b8fb3986dd9c Mon Sep 17 00:00:00 2001 From: Nguyen Sy Thanh Son Date: Tue, 14 Aug 2018 04:34:41 +0000 Subject: [PATCH 2/3] remove interfaces validator --- contracts/validator/contract/interfaces/IValidator.sol | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 contracts/validator/contract/interfaces/IValidator.sol diff --git a/contracts/validator/contract/interfaces/IValidator.sol b/contracts/validator/contract/interfaces/IValidator.sol deleted file mode 100644 index 5f2c00061a0b..000000000000 --- a/contracts/validator/contract/interfaces/IValidator.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma solidity ^0.4.21; - -interface IValidator { - function propose(address, string) external payable; - function vote(address) external payable; -} From 96c9a8f1f2043cb5fed9666f3300d06ebbab02d2 Mon Sep 17 00:00:00 2001 From: Nguyen Sy Thanh Son Date: Tue, 14 Aug 2018 08:04:42 +0000 Subject: [PATCH 3/3] fix unitest --- contracts/validator/validator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/validator/validator_test.go b/contracts/validator/validator_test.go index c00df0514b36..5f6141306ba7 100644 --- a/contracts/validator/validator_test.go +++ b/contracts/validator/validator_test.go @@ -114,7 +114,7 @@ func TestRewardBalance(t *testing.T) { opts := bind.NewKeyedTransactor(acc4Key) opts.Value = new(big.Int).SetUint64(50000) acc4Validator, _ := NewValidator(opts, validatorAddr, contractBackend) - acc4Validator.Propose(acc3Addr, "http://") + acc4Validator.Propose(acc3Addr) contractBackend.Commit() totalVote := 0