diff --git a/contracts/multisigwallet/contract/multisigwallet.go b/contracts/multisigwallet/contract/multisigwallet.go index fd5401f632..8cd1109197 100644 --- a/contracts/multisigwallet/contract/multisigwallet.go +++ b/contracts/multisigwallet/contract/multisigwallet.go @@ -436,7 +436,7 @@ func (_MultiSigWallet *MultiSigWalletCallerSession) Owners(arg0 *big.Int) (commo return _MultiSigWallet.Contract.Owners(&_MultiSigWallet.CallOpts, arg0) } -// Required is a free data retrieval call binding the contract method 0XDC8452cd. +// Required is a free data retrieval call binding the contract method 0xdc8452cd. // // Solidity: function required() constant returns(uint256) func (_MultiSigWallet *MultiSigWalletCaller) Required(opts *bind.CallOpts) (*big.Int, error) { @@ -448,14 +448,14 @@ func (_MultiSigWallet *MultiSigWalletCaller) Required(opts *bind.CallOpts) (*big return *ret0, err } -// Required is a free data retrieval call binding the contract method 0XDC8452cd. +// Required is a free data retrieval call binding the contract method 0xdc8452cd. // // Solidity: function required() constant returns(uint256) func (_MultiSigWallet *MultiSigWalletSession) Required() (*big.Int, error) { return _MultiSigWallet.Contract.Required(&_MultiSigWallet.CallOpts) } -// Required is a free data retrieval call binding the contract method 0XDC8452cd. +// Required is a free data retrieval call binding the contract method 0xdc8452cd. // // Solidity: function required() constant returns(uint256) func (_MultiSigWallet *MultiSigWalletCallerSession) Required() (*big.Int, error) { diff --git a/contracts/utils.go b/contracts/utils.go index 21dd0f799c..7b9b9638dd 100644 --- a/contracts/utils.go +++ b/contracts/utils.go @@ -38,7 +38,6 @@ import ( "github.com/ethereum/go-ethereum/consensus/XDPoS" "github.com/ethereum/go-ethereum/contracts/blocksigner/contract" randomizeContract "github.com/ethereum/go-ethereum/contracts/randomize/contract" - contractValidator "github.com/ethereum/go-ethereum/contracts/validator/contract" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" @@ -85,7 +84,8 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, m // Add tx signed to local tx pool. err = pool.AddLocal(txSigned) if err != nil { - log.Warn("Fail to add tx sign to local pool.", "error", err, "number", block.NumberU64(), "hash", block.Hash().Hex(), "from", account.Address, "nonce", nonce) + log.Error("Fail to add tx sign to local pool.", "error", err, "number", block.NumberU64(), "hash", block.Hash().Hex(), "from", account.Address, "nonce", nonce) + return err } // Create secret tx. @@ -114,6 +114,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, m err = pool.AddLocal(txSigned) if err != nil { log.Error("Fail to add tx secret to local pool.", "error", err, "number", block.NumberU64(), "hash", block.Hash().Hex(), "from", account.Address, "nonce", nonce) + return err } // Put randomize key into chainDb. @@ -125,6 +126,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, m randomizeKeyValue, err := chainDb.Get(randomizeKeyName) if err != nil { log.Error("Fail to get randomize key from state db.", "error", err) + return err } tx, err := BuildTxOpeningRandomize(nonce+1, common.HexToAddress(common.RandomizeSMC), randomizeKeyValue) @@ -141,6 +143,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, m err = pool.AddLocal(txSigned) if err != nil { log.Error("Fail to add tx opening to local pool.", "error", err, "number", block.NumberU64(), "hash", block.Hash().Hex(), "from", account.Address, "nonce", nonce) + return err } // Clear randomize key in state db. @@ -195,7 +198,12 @@ func BuildTxOpeningRandomize(nonce uint64, randomizeAddr common.Address, randomi } // Get signers signed for blockNumber from blockSigner contract. -func GetSignersFromContract(addrBlockSigner common.Address, client bind.ContractBackend, blockHash common.Hash) ([]common.Address, error) { +func GetSignersFromContract(state *state.StateDB, block *types.Block) ([]common.Address, error) { + return GetSigners(state, block), nil +} + +// Get signers signed for blockNumber from blockSigner contract. +func GetSignersByExecutingEVM(addrBlockSigner common.Address, client bind.ContractBackend, blockHash common.Hash) ([]common.Address, error) { blockSigner, err := contract.NewBlockSigner(addrBlockSigner, client) if err != nil { log.Error("Fail get instance of blockSigner", "error", err) @@ -207,7 +215,6 @@ func GetSignersFromContract(addrBlockSigner common.Address, client bind.Contract log.Error("Fail get block signers", "error", err) return nil, err } - return addrs, nil } @@ -289,6 +296,7 @@ func DecryptRandomizeFromSecretsAndOpening(secrets [][32]byte, opening [32]byte) intNumber, err := strconv.Atoi(decryptSecret) if err != nil { log.Error("Can not convert string to integer", "error", err) + return -1, err } random = int64(intNumber) } @@ -299,23 +307,44 @@ func DecryptRandomizeFromSecretsAndOpening(secrets [][32]byte, opening [32]byte) } // Calculate reward for reward checkpoint. -func GetRewardForCheckpoint(chain consensus.ChainReader, blockSignerAddr common.Address, number uint64, rCheckpoint uint64, client bind.ContractBackend, totalSigner *uint64) (map[common.Address]*rewardLog, error) { +func GetRewardForCheckpoint(c *XDPoS.XDPoS, chain consensus.ChainReader, header *types.Header, rCheckpoint uint64, totalSigner *uint64) (map[common.Address]*rewardLog, error) { // Not reward for singer of genesis block and only calculate reward at checkpoint block. + number := header.Number.Uint64() prevCheckpoint := number - (rCheckpoint * 2) startBlockNumber := prevCheckpoint + 1 endBlockNumber := startBlockNumber + rCheckpoint - 1 signers := make(map[common.Address]*rewardLog) - prevHeaderCheckpoint := chain.GetHeaderByNumber(prevCheckpoint) - masternodes := XDPoS.GetMasternodesFromCheckpointHeader(prevHeaderCheckpoint) + mapBlkHash := map[uint64]common.Hash{} - if len(masternodes) > 0 { - for i := startBlockNumber; i <= endBlockNumber; i++ { - block := chain.GetHeaderByNumber(i) - addrs, err := GetSignersFromContract(blockSignerAddr, client, block.Hash()) - if err != nil { - log.Error("Fail to get signers from smartcontract.", "error", err, "blockNumber", i) - return nil, err + data := make(map[common.Hash][]common.Address) + for i := prevCheckpoint + (rCheckpoint * 2) - 1; i >= startBlockNumber; i-- { + header = chain.GetHeader(header.ParentHash, i) + mapBlkHash[i] = header.Hash() + signData, ok := c.BlockSigners.Get(header.Hash()) + if !ok { + log.Debug("Failed get from cached", "hash", header.Hash().String(), "number", i) + block := chain.GetBlock(header.Hash(), i) + txs := block.Transactions() + if !chain.Config().IsTIPSigning(header.Number) { + receipts := core.GetBlockReceipts(c.GetDb(), header.Hash(), i) + signData = c.CacheData(header, txs, receipts) + } else { + signData = c.CacheSigner(header.Hash(), txs) } + } + txs := signData.([]*types.Transaction) + for _, tx := range txs { + blkHash := common.BytesToHash(tx.Data()[len(tx.Data())-32:]) + from := *tx.From() + data[blkHash] = append(data[blkHash], from) + } + } + header = chain.GetHeader(header.ParentHash, prevCheckpoint) + masternodes := XDPoS.GetMasternodesFromCheckpointHeader(header) + + for i := startBlockNumber; i <= endBlockNumber; i++ { + if i%common.MergeSignRange == 0 || !chain.Config().IsTIP2019(big.NewInt(int64(i))) { + addrs := data[mapBlkHash[i]] // Filter duplicate address. if len(addrs) > 0 { addrSigners := make(map[common.Address]bool) @@ -374,46 +403,27 @@ func CalculateRewardForSigner(chainReward *big.Int, signers map[common.Address]* } // Get candidate owner by address. -func GetCandidatesOwnerBySigner(validator *contractValidator.XDCValidator, signerAddr common.Address) common.Address { - owner := signerAddr - opts := new(bind.CallOpts) - owner, err := validator.GetCandidateOwner(opts, signerAddr) - if err != nil { - log.Error("Fail get candidate owner", "error", err) - return owner - } - +func GetCandidatesOwnerBySigner(state *state.StateDB, signerAddr common.Address) common.Address { + owner := GetCandidateOwner(state, signerAddr) return owner } -// Calculate reward for holders. -func CalculateRewardForHolders(foudationWalletAddr common.Address, validator *contractValidator.XDCValidator, state *state.StateDB, signer common.Address, calcReward *big.Int) (error, map[common.Address]*big.Int) { - rewards, err := GetRewardBalancesRate(foudationWalletAddr, signer, calcReward, validator) +func CalculateRewardForHolders(foundationWalletAddr common.Address, state *state.StateDB, signer common.Address, calcReward *big.Int, blockNumber uint64) (error, map[common.Address]*big.Int) { + rewards, err := GetRewardBalancesRate(foundationWalletAddr, state, signer, calcReward, blockNumber) if err != nil { return err, nil } - if len(rewards) > 0 { - for holder, reward := range rewards { - state.AddBalance(holder, reward) - } - } return nil, rewards } -// Get reward balance rates for master node, founder and holders. -func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.XDCValidator) (map[common.Address]*big.Int, error) { - owner := GetCandidatesOwnerBySigner(validator, masterAddr) +func GetRewardBalancesRate(foundationWalletAddr common.Address, state *state.StateDB, masterAddr common.Address, totalReward *big.Int, blockNumber uint64) (map[common.Address]*big.Int, error) { + owner := GetCandidatesOwnerBySigner(state, masterAddr) balances := make(map[common.Address]*big.Int) rewardMaster := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardMasterPercent)) rewardMaster = new(big.Int).Div(rewardMaster, new(big.Int).SetInt64(100)) balances[owner] = rewardMaster // Get voters for masternode. - opts := new(bind.CallOpts) - voters, err := validator.GetVoters(opts, masterAddr) - if err != nil { - log.Error("Fail to get voters", "error", err) - return nil, err - } + voters := GetVoters(state, masterAddr) if len(voters) > 0 { totalVoterReward := new(big.Int).Mul(totalReward, new(big.Int).SetUint64(common.RewardVoterPercent)) @@ -422,12 +432,10 @@ func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common // Get voters capacities. voterCaps := make(map[common.Address]*big.Int) for _, voteAddr := range voters { - voterCap, err := validator.GetVoterCap(opts, masterAddr, voteAddr) - if err != nil { - log.Error("Fail to get vote capacity", "error", err) - return nil, err + if _, ok := voterCaps[voteAddr]; ok && common.TIP2019Block.Uint64() <= blockNumber { + continue } - + voterCap := GetVoterCap(state, masterAddr, voteAddr) totalCap.Add(totalCap, voterCap) voterCaps[voteAddr] = voterCap } @@ -447,9 +455,9 @@ func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common } } - foudationReward := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardFoundationPercent)) - foudationReward = new(big.Int).Div(foudationReward, new(big.Int).SetInt64(100)) - balances[foudationWalletAddr] = foudationReward + foundationReward := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardFoundationPercent)) + foundationReward = new(big.Int).Div(foundationReward, new(big.Int).SetInt64(100)) + balances[foundationWalletAddr] = foundationReward jsonHolders, err := json.Marshal(balances) if err != nil { diff --git a/contracts/validator/contract/XDCValidator.sol b/contracts/validator/contract/XDCValidator.sol index 34d8b4e51b..73a8dea5d9 100644 --- a/contracts/validator/contract/XDCValidator.sol +++ b/contracts/validator/contract/XDCValidator.sol @@ -2,7 +2,7 @@ pragma solidity ^0.4.21; import "./libs/SafeMath.sol"; -contract XDCValidator { +contract XDCalidator { using SafeMath for uint256; event Vote(address _voter, address _candidate, uint256 _cap); @@ -37,7 +37,7 @@ contract XDCValidator { uint256 public voterWithdrawDelay; modifier onlyValidCandidateCap { - // anyone can deposit X XDC to become a candidate + // anyone can deposit X XDCto become a candidate require(msg.value >= minCandidateCap); _; } @@ -83,7 +83,7 @@ contract XDCValidator { _; } - function XDCValidator ( + function XDCalidator ( address[] _candidates, uint256[] _caps, address _firstOwner, diff --git a/contracts/validator/contract/validator.go b/contracts/validator/contract/validator.go index 503154caef..b450ff11de 100644 --- a/contracts/validator/contract/validator.go +++ b/contracts/validator/contract/validator.go @@ -15,119 +15,123 @@ import ( "github.com/ethereum/go-ethereum/event" ) -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = abi.U256 - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription -) +// SafeMathABI is the input ABI used to generate the binding from. +const SafeMathABI = "[]" -// KycABI is the input ABI used to generate the binding from. -const KycABI = "[{\"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\":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\":\"\",\"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\":\"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\":\"\",\"type\":\"address\"}],\"name\":\"invalidKYCCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_invalidMasternode\",\"type\":\"address\"}],\"name\":\"InvalidPercent\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_invalidMasternode\",\"type\":\"address\"}],\"name\":\"VoteInvalidKYC\",\"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\":\"_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\":\"_kycdata\",\"type\":\"bytes32\"}],\"name\":\"uploadKYC\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getOwnerCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"minVoterCap\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_masternode\",\"type\":\"address\"}],\"name\":\"getOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"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\"}]" +// SafeMathBin is the compiled bytecode used for deploying new contracts. +const SafeMathBin = `0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146060604052600080fd00a165627a7a72305820b9407d48ebc7efee5c9f08b3b3a957df2939281f5913225e8c1291f069b900490029` -// Kyc is an auto generated Go binding around an Ethereum contract. -type Kyc struct { - KycCaller // Read-only binding to the contract - KycTransactor // Write-only binding to the contract - KycFilterer // Log filterer for contract events +// DeploySafeMath deploys a new Ethereum contract, binding an instance of SafeMath to it. +func DeploySafeMath(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SafeMath, error) { + parsed, err := abi.JSON(strings.NewReader(SafeMathABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(SafeMathBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &SafeMath{SafeMathCaller: SafeMathCaller{contract: contract}, SafeMathTransactor: SafeMathTransactor{contract: contract}, SafeMathFilterer: SafeMathFilterer{contract: contract}}, nil } -// KycCaller is an auto generated read-only Go binding around an Ethereum contract. -type KycCaller struct { +// SafeMath is an auto generated Go binding around an Ethereum contract. +type SafeMath struct { + SafeMathCaller // Read-only binding to the contract + SafeMathTransactor // Write-only binding to the contract + SafeMathFilterer // Log filterer for contract events +} + +// SafeMathCaller is an auto generated read-only Go binding around an Ethereum contract. +type SafeMathCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// KycTransactor is an auto generated write-only Go binding around an Ethereum contract. -type KycTransactor struct { +// SafeMathTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SafeMathTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// KycFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type KycFilterer struct { +// SafeMathFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SafeMathFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// KycSession is an auto generated Go binding around an Ethereum contract, +// SafeMathSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type KycSession struct { - Contract *Kyc // Generic contract binding to set the session for +type SafeMathSession struct { + Contract *SafeMath // 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 } -// KycCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// SafeMathCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type KycCallerSession struct { - Contract *KycCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session +type SafeMathCallerSession struct { + Contract *SafeMathCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session } -// KycTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// SafeMathTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type KycTransactorSession struct { - Contract *KycTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +type SafeMathTransactorSession struct { + Contract *SafeMathTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// KycRaw is an auto generated low-level Go binding around an Ethereum contract. -type KycRaw struct { - Contract *Kyc // Generic contract binding to access the raw methods on +// SafeMathRaw is an auto generated low-level Go binding around an Ethereum contract. +type SafeMathRaw struct { + Contract *SafeMath // Generic contract binding to access the raw methods on } -// KycCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type KycCallerRaw struct { - Contract *KycCaller // Generic read-only contract binding to access the raw methods on +// SafeMathCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SafeMathCallerRaw struct { + Contract *SafeMathCaller // Generic read-only contract binding to access the raw methods on } -// KycTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type KycTransactorRaw struct { - Contract *KycTransactor // Generic write-only contract binding to access the raw methods on +// SafeMathTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SafeMathTransactorRaw struct { + Contract *SafeMathTransactor // Generic write-only contract binding to access the raw methods on } -// NewKyc creates a new instance of Kyc, bound to a specific deployed contract. -func NewKyc(address common.Address, backend bind.ContractBackend) (*Kyc, error) { - contract, err := bindKyc(address, backend, backend, backend) +// NewSafeMath creates a new instance of SafeMath, bound to a specific deployed contract. +func NewSafeMath(address common.Address, backend bind.ContractBackend) (*SafeMath, error) { + contract, err := bindSafeMath(address, backend, backend, backend) if err != nil { return nil, err } - return &Kyc{KycCaller: KycCaller{contract: contract}, KycTransactor: KycTransactor{contract: contract}, KycFilterer: KycFilterer{contract: contract}}, nil + return &SafeMath{SafeMathCaller: SafeMathCaller{contract: contract}, SafeMathTransactor: SafeMathTransactor{contract: contract}, SafeMathFilterer: SafeMathFilterer{contract: contract}}, nil } -// NewKycCaller creates a new read-only instance of Kyc, bound to a specific deployed contract. -func NewKycCaller(address common.Address, caller bind.ContractCaller) (*KycCaller, error) { - contract, err := bindKyc(address, caller, nil, nil) +// NewSafeMathCaller creates a new read-only instance of SafeMath, bound to a specific deployed contract. +func NewSafeMathCaller(address common.Address, caller bind.ContractCaller) (*SafeMathCaller, error) { + contract, err := bindSafeMath(address, caller, nil, nil) if err != nil { return nil, err } - return &KycCaller{contract: contract}, nil + return &SafeMathCaller{contract: contract}, nil } -// NewKycTransactor creates a new write-only instance of Kyc, bound to a specific deployed contract. -func NewKycTransactor(address common.Address, transactor bind.ContractTransactor) (*KycTransactor, error) { - contract, err := bindKyc(address, nil, transactor, nil) +// NewSafeMathTransactor creates a new write-only instance of SafeMath, bound to a specific deployed contract. +func NewSafeMathTransactor(address common.Address, transactor bind.ContractTransactor) (*SafeMathTransactor, error) { + contract, err := bindSafeMath(address, nil, transactor, nil) if err != nil { return nil, err } - return &KycTransactor{contract: contract}, nil + return &SafeMathTransactor{contract: contract}, nil } -// NewKycFilterer creates a new log filterer instance of Kyc, bound to a specific deployed contract. -func NewKycFilterer(address common.Address, filterer bind.ContractFilterer) (*KycFilterer, error) { - contract, err := bindKyc(address, nil, nil, filterer) +// NewSafeMathFilterer creates a new log filterer instance of SafeMath, bound to a specific deployed contract. +func NewSafeMathFilterer(address common.Address, filterer bind.ContractFilterer) (*SafeMathFilterer, error) { + contract, err := bindSafeMath(address, nil, nil, filterer) if err != nil { return nil, err } - return &KycFilterer{contract: contract}, nil + return &SafeMathFilterer{contract: contract}, nil } -// bindKyc binds a generic wrapper to an already deployed contract. -func bindKyc(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(KycABI)) +// bindSafeMath binds a generic wrapper to an already deployed contract. +func bindSafeMath(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(SafeMathABI)) if err != nil { return nil, err } @@ -138,762 +142,699 @@ func bindKyc(address common.Address, caller bind.ContractCaller, transactor bind // 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 (_Kyc *KycRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Kyc.Contract.KycCaller.contract.Call(opts, result, method, params...) +func (_SafeMath *SafeMathRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _SafeMath.Contract.SafeMathCaller.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 (_Kyc *KycRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Kyc.Contract.KycTransactor.contract.Transfer(opts) +func (_SafeMath *SafeMathRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SafeMath.Contract.SafeMathTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_Kyc *KycRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Kyc.Contract.KycTransactor.contract.Transact(opts, method, params...) +func (_SafeMath *SafeMathRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SafeMath.Contract.SafeMathTransactor.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 (_Kyc *KycCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Kyc.Contract.contract.Call(opts, result, method, params...) +func (_SafeMath *SafeMathCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _SafeMath.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 (_Kyc *KycTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Kyc.Contract.contract.Transfer(opts) +func (_SafeMath *SafeMathTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SafeMath.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_Kyc *KycTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Kyc.Contract.contract.Transact(opts, method, params...) +func (_SafeMath *SafeMathTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SafeMath.Contract.contract.Transact(opts, method, params...) } -// InvalidPercent is a free data retrieval call binding the contract method 0x7ea80829. -// -// Solidity: function InvalidPercent(address _invalidMasternode) constant returns(uint256) -func (_Kyc *KycCaller) InvalidPercent(opts *bind.CallOpts, _invalidMasternode common.Address) (*big.Int, error) { - var ( - ret0 = new(*big.Int) - ) - out := ret0 - err := _Kyc.contract.Call(opts, out, "InvalidPercent", _invalidMasternode) - return *ret0, err +// 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\":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\"},{\"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\"}]" + +// XDCValidatorBin is the compiled bytecode used for deploying new contracts. +const XDCValidatorBin = `0x6060604052600060045534156200001557600080fd5b60405162001415380380620014158339810160405280805182019190602001805182019190602001805191906020018051919060200180519190602001805191906020018051919060200180516005879055600686905560078590556008849055600981905591506000905088516004555060005b88518110156200027c576003805460018101620000a883826200028b565b916000526020600020900160008b8481518110620000c257fe5b90602001906020020151909190916101000a815481600160a060020a030219169083600160a060020a031602179055505060606040519081016040908152600160a060020a03891682526001602083015281018983815181106200012257fe5b906020019060200201519052600160008b84815181106200013f57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002081518154600160a060020a031916600160a060020a039190911617815560208201518154901515740100000000000000000000000000000000000000000260a060020a60ff0219909116178155604082015160019091015550600260008a8381518110620001cc57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000208054600181016200020183826200028b565b50600091825260208220018054600160a060020a031916600160a060020a038a16179055600554906001908b84815181106200023957fe5b90602001906020020151600160a060020a03908116825260208083019390935260409182016000908120918c16815260029091019092529020556001016200008a565b505050505050505050620002db565b815481835581811511620002b257600083815260209020620002b2918101908301620002b7565b505050565b620002d891905b80821115620002d45760008155600101620002be565b5090565b90565b61112a80620002eb6000396000f3006060604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301267951811461011657806302aa9be21461012c57806306a49fce1461014e57806315febd68146101b45780632d15cc04146101dc5780632f9c4bba146101fb578063302b68721461020e5780633477ee2e14610233578063441a3e701461026557806358e7525f1461027e5780636dd7d8ea1461029d578063a9a981a3146102b1578063a9ff959e146102c4578063ae6e43f5146102d7578063b642facd146102f6578063d09f1ab414610315578063d161c76714610328578063d51b9e931461033b578063d55b7dff1461036e578063f8ac9dd514610381575b600080fd5b61012a600160a060020a0360043516610394565b005b341561013757600080fd5b61012a600160a060020a0360043516602435610616565b341561015957600080fd5b610161610849565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156101a0578082015183820152602001610188565b505050509050019250505060405180910390f35b34156101bf57600080fd5b6101ca6004356108b2565b60405190815260200160405180910390f35b34156101e757600080fd5b610161600160a060020a03600435166108d6565b341561020657600080fd5b610161610963565b341561021957600080fd5b6101ca600160a060020a03600435811690602435166109e5565b341561023e57600080fd5b610249600435610a14565b604051600160a060020a03909116815260200160405180910390f35b341561027057600080fd5b61012a600435602435610a3c565b341561028957600080fd5b6101ca600160a060020a0360043516610ba3565b61012a600160a060020a0360043516610bc2565b34156102bc57600080fd5b6101ca610d7f565b34156102cf57600080fd5b6101ca610d85565b34156102e257600080fd5b61012a600160a060020a0360043516610d8b565b341561030157600080fd5b610249600160a060020a0360043516611022565b341561032057600080fd5b6101ca611040565b341561033357600080fd5b6101ca611046565b341561034657600080fd5b61035a600160a060020a036004351661104c565b604051901515815260200160405180910390f35b341561037957600080fd5b6101ca611071565b341561038c57600080fd5b6101ca611077565b6005546000903410156103a657600080fd5b600160a060020a038216600090815260016020526040902054829060a060020a900460ff16156103d557600080fd5b600160a060020a03831660009081526001602081905260409091200154610402903463ffffffff61107d16565b91506003805480600101828161041891906110a5565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03851617905560606040519081016040908152600160a060020a0333811683526001602080850182905283850187905291871660009081529152208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151815490151560a060020a0274ff0000000000000000000000000000000000000000199091161781556040820151600191820155600160a060020a03808616600090815260209283526040808220339093168252600290920190925290205461051d91503463ffffffff61107d16565b600160a060020a038085166000908152600160208181526040808420339095168452600290940190529190209190915560045461055f9163ffffffff61107d16565b600455600160a060020a038316600090815260026020526040902080546001810161058a83826110a5565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a038116919091179091557f7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1908434604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505050565b600160a060020a0380831660009081526001602090815260408083203390941683526002909301905290812054839083908190101561065457600080fd5b600160a060020a03828116600090815260016020526040902054338216911614156106c257600554600160a060020a0380841660009081526001602090815260408083203390941683526002909301905220546106b7908363ffffffff61109316565b10156106c257600080fd5b600160a060020a038516600090815260016020819052604090912001546106ef908563ffffffff61109316565b600160a060020a038087166000908152600160208181526040808420928301959095553390931682526002019091522054610730908563ffffffff61109316565b600160a060020a03808716600090815260016020908152604080832033909416835260029093019052205560095461076e904363ffffffff61107d16565b600160a060020a0333166000908152602081815260408083208484529091529020549093506107a3908563ffffffff61107d16565b600160a060020a03331660008181526020818152604080832088845280835290832094909455918152905260019081018054909181016107e383826110a5565b5060009182526020909120018390557faa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2338686604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050505050565b6108516110ce565b60038054806020026020016040519081016040528092919081815260200182805480156108a757602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610889575b505050505090505b90565b33600160a060020a0316600090815260208181526040808320938352929052205490565b6108de6110ce565b6002600083600160a060020a0316600160a060020a0316815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561095757602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610939575b50505050509050919050565b61096b6110ce565b60008033600160a060020a0316600160a060020a031681526020019081526020016000206001018054806020026020016040519081016040528092919081815260200182805480156108a757602002820191906000526020600020905b8154815260200190600101908083116109c8575050505050905090565b600160a060020a0391821660009081526001602090815260408083209390941682526002909201909152205490565b6003805482908110610a2257fe5b600091825260209091200154600160a060020a0316905081565b60008282828211610a4c57600080fd5b4382901015610a5a57600080fd5b600160a060020a03331660009081526020818152604080832085845290915281205411610a8657600080fd5b600160a060020a0333166000908152602081905260409020600101805483919083908110610ab057fe5b60009182526020909120015414610ac657600080fd5b600160a060020a03331660008181526020818152604080832089845280835290832080549084905593835291905260010180549194509085908110610b0757fe5b6000918252602082200155600160a060020a03331683156108fc0284604051600060405180830381858888f193505050501515610b4357600080fd5b7ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5683386856040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a15050505050565b600160a060020a03166000908152600160208190526040909120015490565b600654341015610bd157600080fd5b600160a060020a038116600090815260016020526040902054819060a060020a900460ff161515610c0157600080fd5b600160a060020a03821660009081526001602081905260409091200154610c2e903463ffffffff61107d16565b600160a060020a0380841660009081526001602081815260408084209283019590955533909316825260020190915220541515610cc057600160a060020a0382166000908152600260205260409020805460018101610c8d83826110a5565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a03161790555b600160a060020a038083166000908152600160209081526040808320339094168352600290930190522054610cfb903463ffffffff61107d16565b600160a060020a03808416600090815260016020908152604080832033948516845260020190915290819020929092557f66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc918490349051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050565b60045481565b60095481565b600160a060020a038181166000908152600160205260408120549091829182918591338216911614610dbc57600080fd5b600160a060020a038516600090815260016020526040902054859060a060020a900460ff161515610dec57600080fd5b600160a060020a0386166000908152600160208190526040909120805474ff000000000000000000000000000000000000000019169055600454610e359163ffffffff61109316565b600455600094505b600354851015610ebf5785600160a060020a0316600386815481101515610e6057fe5b600091825260209091200154600160a060020a03161415610eb4576003805486908110610e8957fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff19169055610ebf565b600190940193610e3d565b600160a060020a03808716600081815260016020818152604080842033909616845260028601825283205493909252908190529190910154909450610f0a908563ffffffff61109316565b600160a060020a0380881660009081526001602081815260408084209283019590955533909316825260020190915290812055600854610f50904363ffffffff61107d16565b600160a060020a033316600090815260208181526040808320848452909152902054909350610f85908563ffffffff61107d16565b600160a060020a0333166000818152602081815260408083208884528083529083209490945591815290526001908101805490918101610fc583826110a5565b5060009182526020909120018390557f4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d33387604051600160a060020a039283168152911660208201526040908101905180910390a1505050505050565b600160a060020a039081166000908152600160205260409020541690565b60075481565b60085481565b600160a060020a031660009081526001602052604090205460a060020a900460ff1690565b60055481565b60065481565b60008282018381101561108c57fe5b9392505050565b60008282111561109f57fe5b50900390565b8154818355818115116110c9576000838152602090206110c99181019083016110e0565b505050565b60206040519081016040526000815290565b6108af91905b808211156110fa57600081556001016110e6565b50905600a165627a7a72305820555de7c5131842a4fccb258fccd95ae1539019bb744b4253893b37fed1b3d8e90029` + +// 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 } -// InvalidPercent is a free data retrieval call binding the contract method 0x7ea80829. -// -// Solidity: function InvalidPercent(address _invalidMasternode) constant returns(uint256) -func (_Kyc *KycSession) InvalidPercent(_invalidMasternode common.Address) (*big.Int, error) { - return _Kyc.Contract.InvalidPercent(&_Kyc.CallOpts, _invalidMasternode) +// 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 } -// InvalidPercent is a free data retrieval call binding the contract method 0x7ea80829. -// -// Solidity: function InvalidPercent(address _invalidMasternode) constant returns(uint256) -func (_Kyc *KycCallerSession) InvalidPercent(_invalidMasternode common.Address) (*big.Int, error) { - return _Kyc.Contract.InvalidPercent(&_Kyc.CallOpts, _invalidMasternode) +// 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...) } // CandidateCount is a free data retrieval call binding the contract method 0xa9a981a3. // // Solidity: function candidateCount() constant returns(uint256) -func (_Kyc *KycCaller) CandidateCount(opts *bind.CallOpts) (*big.Int, error) { +func (_XDCValidator *XDCValidatorCaller) CandidateCount(opts *bind.CallOpts) (*big.Int, error) { var ( ret0 = new(*big.Int) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "candidateCount") + 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 (_Kyc *KycSession) CandidateCount() (*big.Int, error) { - return _Kyc.Contract.CandidateCount(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) CandidateCount() (*big.Int, error) { - return _Kyc.Contract.CandidateCount(&_Kyc.CallOpts) +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 (_Kyc *KycCaller) CandidateWithdrawDelay(opts *bind.CallOpts) (*big.Int, error) { +func (_XDCValidator *XDCValidatorCaller) CandidateWithdrawDelay(opts *bind.CallOpts) (*big.Int, error) { var ( ret0 = new(*big.Int) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "candidateWithdrawDelay") + 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 (_Kyc *KycSession) CandidateWithdrawDelay() (*big.Int, error) { - return _Kyc.Contract.CandidateWithdrawDelay(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) CandidateWithdrawDelay() (*big.Int, error) { - return _Kyc.Contract.CandidateWithdrawDelay(&_Kyc.CallOpts) +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 (_Kyc *KycCaller) Candidates(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { +// 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 := _Kyc.contract.Call(opts, out, "candidates", arg0) + 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 (_Kyc *KycSession) Candidates(arg0 *big.Int) (common.Address, error) { - return _Kyc.Contract.Candidates(&_Kyc.CallOpts, arg0) +// 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 (_Kyc *KycCallerSession) Candidates(arg0 *big.Int) (common.Address, error) { - return _Kyc.Contract.Candidates(&_Kyc.CallOpts, arg0) +// 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(address _candidate) constant returns(uint256) -func (_Kyc *KycCaller) GetCandidateCap(opts *bind.CallOpts, _candidate common.Address) (*big.Int, error) { +// 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 := _Kyc.contract.Call(opts, out, "getCandidateCap", _candidate) + 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(address _candidate) constant returns(uint256) -func (_Kyc *KycSession) GetCandidateCap(_candidate common.Address) (*big.Int, error) { - return _Kyc.Contract.GetCandidateCap(&_Kyc.CallOpts, _candidate) +// 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(address _candidate) constant returns(uint256) -func (_Kyc *KycCallerSession) GetCandidateCap(_candidate common.Address) (*big.Int, error) { - return _Kyc.Contract.GetCandidateCap(&_Kyc.CallOpts, _candidate) +// 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(address _candidate) constant returns(address) -func (_Kyc *KycCaller) GetCandidateOwner(opts *bind.CallOpts, _candidate common.Address) (common.Address, error) { +// 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 := _Kyc.contract.Call(opts, out, "getCandidateOwner", _candidate) + 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(address _candidate) constant returns(address) -func (_Kyc *KycSession) GetCandidateOwner(_candidate common.Address) (common.Address, error) { - return _Kyc.Contract.GetCandidateOwner(&_Kyc.CallOpts, _candidate) +// 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(address _candidate) constant returns(address) -func (_Kyc *KycCallerSession) GetCandidateOwner(_candidate common.Address) (common.Address, error) { - return _Kyc.Contract.GetCandidateOwner(&_Kyc.CallOpts, _candidate) +// 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 (_Kyc *KycCaller) GetCandidates(opts *bind.CallOpts) ([]common.Address, error) { +func (_XDCValidator *XDCValidatorCaller) GetCandidates(opts *bind.CallOpts) ([]common.Address, error) { var ( ret0 = new([]common.Address) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "getCandidates") + 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 (_Kyc *KycSession) GetCandidates() ([]common.Address, error) { - return _Kyc.Contract.GetCandidates(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) GetCandidates() ([]common.Address, error) { - return _Kyc.Contract.GetCandidates(&_Kyc.CallOpts) +func (_XDCValidator *XDCValidatorCallerSession) GetCandidates() ([]common.Address, error) { + return _XDCValidator.Contract.GetCandidates(&_XDCValidator.CallOpts) } -// GetOwner is a free data retrieval call binding the contract method 0xfa544161. +// GetVoterCap is a free data retrieval call binding the contract method 0x302b6872. // -// Solidity: function getOwner(address _masternode) constant returns(address) -func (_Kyc *KycCaller) GetOwner(opts *bind.CallOpts, _masternode common.Address) (common.Address, error) { - var ( - ret0 = new(common.Address) - ) - out := ret0 - err := _Kyc.contract.Call(opts, out, "getOwner", _masternode) - return *ret0, err -} - -// GetOwner is a free data retrieval call binding the contract method 0xfa544161. -// -// Solidity: function getOwner(address _masternode) constant returns(address) -func (_Kyc *KycSession) GetOwner(_masternode common.Address) (common.Address, error) { - return _Kyc.Contract.GetOwner(&_Kyc.CallOpts, _masternode) -} - -// GetOwner is a free data retrieval call binding the contract method 0xfa544161. -// -// Solidity: function getOwner(address _masternode) constant returns(address) -func (_Kyc *KycCallerSession) GetOwner(_masternode common.Address) (common.Address, error) { - return _Kyc.Contract.GetOwner(&_Kyc.CallOpts, _masternode) -} - -// GetOwnerCount is a free data retrieval call binding the contract method 0xef18374a. -// -// Solidity: function getOwnerCount() constant returns(uint256) -func (_Kyc *KycCaller) GetOwnerCount(opts *bind.CallOpts) (*big.Int, error) { +// 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 := _Kyc.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 (_Kyc *KycSession) GetOwnerCount() (*big.Int, error) { - return _Kyc.Contract.GetOwnerCount(&_Kyc.CallOpts) -} - -// GetOwnerCount is a free data retrieval call binding the contract method 0xef18374a. -// -// Solidity: function getOwnerCount() constant returns(uint256) -func (_Kyc *KycCallerSession) GetOwnerCount() (*big.Int, error) { - return _Kyc.Contract.GetOwnerCount(&_Kyc.CallOpts) -} - -// GetVoterCap is a free data retrieval call binding the contract method 0x302b6872. -// -// Solidity: function getVoterCap(address _candidate, address _voter) constant returns(uint256) -func (_Kyc *KycCaller) GetVoterCap(opts *bind.CallOpts, _candidate common.Address, _voter common.Address) (*big.Int, error) { - var ( - ret0 = new(*big.Int) - ) - out := ret0 - err := _Kyc.contract.Call(opts, out, "getVoterCap", _candidate, _voter) + 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(address _candidate, address _voter) constant returns(uint256) -func (_Kyc *KycSession) GetVoterCap(_candidate common.Address, _voter common.Address) (*big.Int, error) { - return _Kyc.Contract.GetVoterCap(&_Kyc.CallOpts, _candidate, _voter) +// 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(address _candidate, address _voter) constant returns(uint256) -func (_Kyc *KycCallerSession) GetVoterCap(_candidate common.Address, _voter common.Address) (*big.Int, error) { - return _Kyc.Contract.GetVoterCap(&_Kyc.CallOpts, _candidate, _voter) +// 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(address _candidate) constant returns(address[]) -func (_Kyc *KycCaller) GetVoters(opts *bind.CallOpts, _candidate common.Address) ([]common.Address, error) { +// 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 := _Kyc.contract.Call(opts, out, "getVoters", _candidate) + 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(address _candidate) constant returns(address[]) -func (_Kyc *KycSession) GetVoters(_candidate common.Address) ([]common.Address, error) { - return _Kyc.Contract.GetVoters(&_Kyc.CallOpts, _candidate) +// 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(address _candidate) constant returns(address[]) -func (_Kyc *KycCallerSession) GetVoters(_candidate common.Address) ([]common.Address, error) { - return _Kyc.Contract.GetVoters(&_Kyc.CallOpts, _candidate) +// 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 (_Kyc *KycCaller) GetWithdrawBlockNumbers(opts *bind.CallOpts) ([]*big.Int, error) { +func (_XDCValidator *XDCValidatorCaller) GetWithdrawBlockNumbers(opts *bind.CallOpts) ([]*big.Int, error) { var ( ret0 = new([]*big.Int) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "getWithdrawBlockNumbers") + 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 (_Kyc *KycSession) GetWithdrawBlockNumbers() ([]*big.Int, error) { - return _Kyc.Contract.GetWithdrawBlockNumbers(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) GetWithdrawBlockNumbers() ([]*big.Int, error) { - return _Kyc.Contract.GetWithdrawBlockNumbers(&_Kyc.CallOpts) +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(uint256 _blockNumber) constant returns(uint256) -func (_Kyc *KycCaller) GetWithdrawCap(opts *bind.CallOpts, _blockNumber *big.Int) (*big.Int, error) { +// 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 := _Kyc.contract.Call(opts, out, "getWithdrawCap", _blockNumber) + 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(uint256 _blockNumber) constant returns(uint256) -func (_Kyc *KycSession) GetWithdrawCap(_blockNumber *big.Int) (*big.Int, error) { - return _Kyc.Contract.GetWithdrawCap(&_Kyc.CallOpts, _blockNumber) +// 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(uint256 _blockNumber) constant returns(uint256) -func (_Kyc *KycCallerSession) GetWithdrawCap(_blockNumber *big.Int) (*big.Int, error) { - return _Kyc.Contract.GetWithdrawCap(&_Kyc.CallOpts, _blockNumber) +// 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. +// IsCandidate is a free data retrieval call binding the contract method 0xd51b9e93. // -// Solidity: function hasVotedInvalid(address , address ) constant returns(bool) -func (_Kyc *KycCaller) HasVotedInvalid(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (bool, error) { +// 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 := _Kyc.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 (_Kyc *KycSession) HasVotedInvalid(arg0 common.Address, arg1 common.Address) (bool, error) { - return _Kyc.Contract.HasVotedInvalid(&_Kyc.CallOpts, arg0, arg1) -} - -// HasVotedInvalid is a free data retrieval call binding the contract method 0x0e3e4fb8. -// -// Solidity: function hasVotedInvalid(address , address ) constant returns(bool) -func (_Kyc *KycCallerSession) HasVotedInvalid(arg0 common.Address, arg1 common.Address) (bool, error) { - return _Kyc.Contract.HasVotedInvalid(&_Kyc.CallOpts, arg0, arg1) -} - -// InvalidKYCCount is a free data retrieval call binding the contract method 0x72e44a38. -// -// Solidity: function invalidKYCCount(address ) constant returns(uint256) -func (_Kyc *KycCaller) InvalidKYCCount(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { - var ( - ret0 = new(*big.Int) - ) - out := ret0 - err := _Kyc.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 (_Kyc *KycSession) InvalidKYCCount(arg0 common.Address) (*big.Int, error) { - return _Kyc.Contract.InvalidKYCCount(&_Kyc.CallOpts, arg0) -} - -// InvalidKYCCount is a free data retrieval call binding the contract method 0x72e44a38. -// -// Solidity: function invalidKYCCount(address ) constant returns(uint256) -func (_Kyc *KycCallerSession) InvalidKYCCount(arg0 common.Address) (*big.Int, error) { - return _Kyc.Contract.InvalidKYCCount(&_Kyc.CallOpts, arg0) -} - -// IsCandidate is a free data retrieval call binding the contract method 0xd51b9e93. -// -// Solidity: function isCandidate(address _candidate) constant returns(bool) -func (_Kyc *KycCaller) IsCandidate(opts *bind.CallOpts, _candidate common.Address) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _Kyc.contract.Call(opts, out, "isCandidate", _candidate) + 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(address _candidate) constant returns(bool) -func (_Kyc *KycSession) IsCandidate(_candidate common.Address) (bool, error) { - return _Kyc.Contract.IsCandidate(&_Kyc.CallOpts, _candidate) +// 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(address _candidate) constant returns(bool) -func (_Kyc *KycCallerSession) IsCandidate(_candidate common.Address) (bool, error) { - return _Kyc.Contract.IsCandidate(&_Kyc.CallOpts, _candidate) +// Solidity: function isCandidate(_candidate address) constant returns(bool) +func (_XDCValidator *XDCValidatorCallerSession) IsCandidate(_candidate common.Address) (bool, error) { + return _XDCValidator.Contract.IsCandidate(&_XDCValidator.CallOpts, _candidate) } // MaxValidatorNumber is a free data retrieval call binding the contract method 0xd09f1ab4. // // Solidity: function maxValidatorNumber() constant returns(uint256) -func (_Kyc *KycCaller) MaxValidatorNumber(opts *bind.CallOpts) (*big.Int, error) { +func (_XDCValidator *XDCValidatorCaller) MaxValidatorNumber(opts *bind.CallOpts) (*big.Int, error) { var ( ret0 = new(*big.Int) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "maxValidatorNumber") + 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 (_Kyc *KycSession) MaxValidatorNumber() (*big.Int, error) { - return _Kyc.Contract.MaxValidatorNumber(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) MaxValidatorNumber() (*big.Int, error) { - return _Kyc.Contract.MaxValidatorNumber(&_Kyc.CallOpts) +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 (_Kyc *KycCaller) MinCandidateCap(opts *bind.CallOpts) (*big.Int, error) { +func (_XDCValidator *XDCValidatorCaller) MinCandidateCap(opts *bind.CallOpts) (*big.Int, error) { var ( ret0 = new(*big.Int) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "minCandidateCap") + 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 (_Kyc *KycSession) MinCandidateCap() (*big.Int, error) { - return _Kyc.Contract.MinCandidateCap(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) MinCandidateCap() (*big.Int, error) { - return _Kyc.Contract.MinCandidateCap(&_Kyc.CallOpts) +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 (_Kyc *KycCaller) MinVoterCap(opts *bind.CallOpts) (*big.Int, error) { +func (_XDCValidator *XDCValidatorCaller) MinVoterCap(opts *bind.CallOpts) (*big.Int, error) { var ( ret0 = new(*big.Int) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "minVoterCap") + 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 (_Kyc *KycSession) MinVoterCap() (*big.Int, error) { - return _Kyc.Contract.MinVoterCap(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) MinVoterCap() (*big.Int, error) { - return _Kyc.Contract.MinVoterCap(&_Kyc.CallOpts) -} - -// OwnerToCandidate is a free data retrieval call binding the contract method 0x2a3640b1. -// -// Solidity: function ownerToCandidate(address , uint256 ) constant returns(address) -func (_Kyc *KycCaller) OwnerToCandidate(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (common.Address, error) { - var ( - ret0 = new(common.Address) - ) - out := ret0 - err := _Kyc.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 (_Kyc *KycSession) OwnerToCandidate(arg0 common.Address, arg1 *big.Int) (common.Address, error) { - return _Kyc.Contract.OwnerToCandidate(&_Kyc.CallOpts, arg0, arg1) -} - -// OwnerToCandidate is a free data retrieval call binding the contract method 0x2a3640b1. -// -// Solidity: function ownerToCandidate(address , uint256 ) constant returns(address) -func (_Kyc *KycCallerSession) OwnerToCandidate(arg0 common.Address, arg1 *big.Int) (common.Address, error) { - return _Kyc.Contract.OwnerToCandidate(&_Kyc.CallOpts, arg0, arg1) -} - -// Owners is a free data retrieval call binding the contract method 0x025e7c27. -// -// Solidity: function owners(uint256 ) constant returns(address) -func (_Kyc *KycCaller) Owners(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { - var ( - ret0 = new(common.Address) - ) - out := ret0 - err := _Kyc.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 (_Kyc *KycSession) Owners(arg0 *big.Int) (common.Address, error) { - return _Kyc.Contract.Owners(&_Kyc.CallOpts, arg0) -} - -// Owners is a free data retrieval call binding the contract method 0x025e7c27. -// -// Solidity: function owners(uint256 ) constant returns(address) -func (_Kyc *KycCallerSession) Owners(arg0 *big.Int) (common.Address, error) { - return _Kyc.Contract.Owners(&_Kyc.CallOpts, arg0) +func (_XDCValidator *XDCValidatorCallerSession) MinVoterCap() (*big.Int, error) { + return _XDCValidator.Contract.MinVoterCap(&_XDCValidator.CallOpts) } // VoterWithdrawDelay is a free data retrieval call binding the contract method 0xa9ff959e. // // Solidity: function voterWithdrawDelay() constant returns(uint256) -func (_Kyc *KycCaller) VoterWithdrawDelay(opts *bind.CallOpts) (*big.Int, error) { +func (_XDCValidator *XDCValidatorCaller) VoterWithdrawDelay(opts *bind.CallOpts) (*big.Int, error) { var ( ret0 = new(*big.Int) ) out := ret0 - err := _Kyc.contract.Call(opts, out, "voterWithdrawDelay") + 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 (_Kyc *KycSession) VoterWithdrawDelay() (*big.Int, error) { - return _Kyc.Contract.VoterWithdrawDelay(&_Kyc.CallOpts) +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 (_Kyc *KycCallerSession) VoterWithdrawDelay() (*big.Int, error) { - return _Kyc.Contract.VoterWithdrawDelay(&_Kyc.CallOpts) -} - -// VoteInvalidKYC is a paid mutator transaction binding the contract method 0xa0f56aa1. -// -// Solidity: function VoteInvalidKYC(address _invalidMasternode) returns() -func (_Kyc *KycTransactor) VoteInvalidKYC(opts *bind.TransactOpts, _invalidMasternode common.Address) (*types.Transaction, error) { - return _Kyc.contract.Transact(opts, "VoteInvalidKYC", _invalidMasternode) -} - -// VoteInvalidKYC is a paid mutator transaction binding the contract method 0xa0f56aa1. -// -// Solidity: function VoteInvalidKYC(address _invalidMasternode) returns() -func (_Kyc *KycSession) VoteInvalidKYC(_invalidMasternode common.Address) (*types.Transaction, error) { - return _Kyc.Contract.VoteInvalidKYC(&_Kyc.TransactOpts, _invalidMasternode) -} - -// VoteInvalidKYC is a paid mutator transaction binding the contract method 0xa0f56aa1. -// -// Solidity: function VoteInvalidKYC(address _invalidMasternode) returns() -func (_Kyc *KycTransactorSession) VoteInvalidKYC(_invalidMasternode common.Address) (*types.Transaction, error) { - return _Kyc.Contract.VoteInvalidKYC(&_Kyc.TransactOpts, _invalidMasternode) +func (_XDCValidator *XDCValidatorCallerSession) VoterWithdrawDelay() (*big.Int, error) { + return _XDCValidator.Contract.VoterWithdrawDelay(&_XDCValidator.CallOpts) } // Propose is a paid mutator transaction binding the contract method 0x01267951. // -// Solidity: function propose(address _candidate) returns() -func (_Kyc *KycTransactor) Propose(opts *bind.TransactOpts, _candidate common.Address) (*types.Transaction, error) { - return _Kyc.contract.Transact(opts, "propose", _candidate) +// 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(address _candidate) returns() -func (_Kyc *KycSession) Propose(_candidate common.Address) (*types.Transaction, error) { - return _Kyc.Contract.Propose(&_Kyc.TransactOpts, _candidate) +// 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(address _candidate) returns() -func (_Kyc *KycTransactorSession) Propose(_candidate common.Address) (*types.Transaction, error) { - return _Kyc.Contract.Propose(&_Kyc.TransactOpts, _candidate) +// Solidity: function propose(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactorSession) Propose(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Propose(&_XDCValidator.TransactOpts, _candidate) } // Resign is a paid mutator transaction binding the contract method 0xae6e43f5. // -// Solidity: function resign(address _candidate) returns() -func (_Kyc *KycTransactor) Resign(opts *bind.TransactOpts, _candidate common.Address) (*types.Transaction, error) { - return _Kyc.contract.Transact(opts, "resign", _candidate) +// 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(address _candidate) returns() -func (_Kyc *KycSession) Resign(_candidate common.Address) (*types.Transaction, error) { - return _Kyc.Contract.Resign(&_Kyc.TransactOpts, _candidate) +// 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(address _candidate) returns() -func (_Kyc *KycTransactorSession) Resign(_candidate common.Address) (*types.Transaction, error) { - return _Kyc.Contract.Resign(&_Kyc.TransactOpts, _candidate) +// 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(address _candidate, uint256 _cap) returns() -func (_Kyc *KycTransactor) Unvote(opts *bind.TransactOpts, _candidate common.Address, _cap *big.Int) (*types.Transaction, error) { - return _Kyc.contract.Transact(opts, "unvote", _candidate, _cap) +// 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(address _candidate, uint256 _cap) returns() -func (_Kyc *KycSession) Unvote(_candidate common.Address, _cap *big.Int) (*types.Transaction, error) { - return _Kyc.Contract.Unvote(&_Kyc.TransactOpts, _candidate, _cap) +// 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(address _candidate, uint256 _cap) returns() -func (_Kyc *KycTransactorSession) Unvote(_candidate common.Address, _cap *big.Int) (*types.Transaction, error) { - return _Kyc.Contract.Unvote(&_Kyc.TransactOpts, _candidate, _cap) -} - -// UploadKYC is a paid mutator transaction binding the contract method 0xe8fd6927. -// -// Solidity: function uploadKYC(bytes32 _kycdata) returns() -func (_Kyc *KycTransactor) UploadKYC(opts *bind.TransactOpts, _kycdata [32]byte) (*types.Transaction, error) { - return _Kyc.contract.Transact(opts, "uploadKYC", _kycdata) -} - -// UploadKYC is a paid mutator transaction binding the contract method 0xe8fd6927. -// -// Solidity: function uploadKYC(bytes32 _kycdata) returns() -func (_Kyc *KycSession) UploadKYC(_kycdata [32]byte) (*types.Transaction, error) { - return _Kyc.Contract.UploadKYC(&_Kyc.TransactOpts, _kycdata) -} - -// UploadKYC is a paid mutator transaction binding the contract method 0xe8fd6927. -// -// Solidity: function uploadKYC(bytes32 _kycdata) returns() -func (_Kyc *KycTransactorSession) UploadKYC(_kycdata [32]byte) (*types.Transaction, error) { - return _Kyc.Contract.UploadKYC(&_Kyc.TransactOpts, _kycdata) +// 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) } // Vote is a paid mutator transaction binding the contract method 0x6dd7d8ea. // -// Solidity: function vote(address _candidate) returns() -func (_Kyc *KycTransactor) Vote(opts *bind.TransactOpts, _candidate common.Address) (*types.Transaction, error) { - return _Kyc.contract.Transact(opts, "vote", _candidate) +// 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(address _candidate) returns() -func (_Kyc *KycSession) Vote(_candidate common.Address) (*types.Transaction, error) { - return _Kyc.Contract.Vote(&_Kyc.TransactOpts, _candidate) +// 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(address _candidate) returns() -func (_Kyc *KycTransactorSession) Vote(_candidate common.Address) (*types.Transaction, error) { - return _Kyc.Contract.Vote(&_Kyc.TransactOpts, _candidate) +// Solidity: function vote(_candidate address) returns() +func (_XDCValidator *XDCValidatorTransactorSession) Vote(_candidate common.Address) (*types.Transaction, error) { + return _XDCValidator.Contract.Vote(&_XDCValidator.TransactOpts, _candidate) } // Withdraw is a paid mutator transaction binding the contract method 0x441a3e70. // -// Solidity: function withdraw(uint256 _blockNumber, uint256 _index) returns() -func (_Kyc *KycTransactor) Withdraw(opts *bind.TransactOpts, _blockNumber *big.Int, _index *big.Int) (*types.Transaction, error) { - return _Kyc.contract.Transact(opts, "withdraw", _blockNumber, _index) +// 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(uint256 _blockNumber, uint256 _index) returns() -func (_Kyc *KycSession) Withdraw(_blockNumber *big.Int, _index *big.Int) (*types.Transaction, error) { - return _Kyc.Contract.Withdraw(&_Kyc.TransactOpts, _blockNumber, _index) +// 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(uint256 _blockNumber, uint256 _index) returns() -func (_Kyc *KycTransactorSession) Withdraw(_blockNumber *big.Int, _index *big.Int) (*types.Transaction, error) { - return _Kyc.Contract.Withdraw(&_Kyc.TransactOpts, _blockNumber, _index) +// 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) } -// KycProposeIterator is returned from FilterPropose and is used to iterate over the raw logs and unpacked data for Propose events raised by the Kyc contract. -type KycProposeIterator struct { - Event *KycPropose // Event containing the contract specifics and raw log +// 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 @@ -907,7 +848,7 @@ type KycProposeIterator struct { // 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 *KycProposeIterator) Next() bool { +func (it *XDCValidatorProposeIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -916,7 +857,7 @@ func (it *KycProposeIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(KycPropose) + it.Event = new(XDCValidatorPropose) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -931,7 +872,7 @@ func (it *KycProposeIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(KycPropose) + it.Event = new(XDCValidatorPropose) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -947,19 +888,19 @@ func (it *KycProposeIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *KycProposeIterator) Error() error { +func (it *XDCValidatorProposeIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *KycProposeIterator) Close() error { +func (it *XDCValidatorProposeIterator) Close() error { it.sub.Unsubscribe() return nil } -// KycPropose represents a Propose event raised by the Kyc contract. -type KycPropose struct { +// XDCValidatorPropose represents a Propose event raised by the XDCValidator contract. +type XDCValidatorPropose struct { Owner common.Address Candidate common.Address Cap *big.Int @@ -968,22 +909,22 @@ type KycPropose struct { // FilterPropose is a free log retrieval operation binding the contract event 0x7635f1d87b47fba9f2b09e56eb4be75cca030e0cb179c1602ac9261d39a8f5c1. // -// Solidity: event Propose(address _owner, address _candidate, uint256 _cap) -func (_Kyc *KycFilterer) FilterPropose(opts *bind.FilterOpts) (*KycProposeIterator, error) { +// Solidity: event Propose(_owner address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterPropose(opts *bind.FilterOpts) (*XDCValidatorProposeIterator, error) { - logs, sub, err := _Kyc.contract.FilterLogs(opts, "Propose") + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Propose") if err != nil { return nil, err } - return &KycProposeIterator{contract: _Kyc.contract, event: "Propose", logs: logs, sub: sub}, nil + 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(address _owner, address _candidate, uint256 _cap) -func (_Kyc *KycFilterer) WatchPropose(opts *bind.WatchOpts, sink chan<- *KycPropose) (event.Subscription, error) { +// 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 := _Kyc.contract.WatchLogs(opts, "Propose") + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Propose") if err != nil { return nil, err } @@ -993,8 +934,8 @@ func (_Kyc *KycFilterer) WatchPropose(opts *bind.WatchOpts, sink chan<- *KycProp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(KycPropose) - if err := _Kyc.contract.UnpackLog(event, "Propose", log); err != nil { + event := new(XDCValidatorPropose) + if err := _XDCValidator.contract.UnpackLog(event, "Propose", log); err != nil { return err } event.Raw = log @@ -1015,9 +956,9 @@ func (_Kyc *KycFilterer) WatchPropose(opts *bind.WatchOpts, sink chan<- *KycProp }), nil } -// KycResignIterator is returned from FilterResign and is used to iterate over the raw logs and unpacked data for Resign events raised by the Kyc contract. -type KycResignIterator struct { - Event *KycResign // Event containing the contract specifics and raw log +// 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 @@ -1031,7 +972,7 @@ type KycResignIterator struct { // 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 *KycResignIterator) Next() bool { +func (it *XDCValidatorResignIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1040,7 +981,7 @@ func (it *KycResignIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(KycResign) + it.Event = new(XDCValidatorResign) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1055,7 +996,7 @@ func (it *KycResignIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(KycResign) + it.Event = new(XDCValidatorResign) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1071,19 +1012,19 @@ func (it *KycResignIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *KycResignIterator) Error() error { +func (it *XDCValidatorResignIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *KycResignIterator) Close() error { +func (it *XDCValidatorResignIterator) Close() error { it.sub.Unsubscribe() return nil } -// KycResign represents a Resign event raised by the Kyc contract. -type KycResign struct { +// 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 @@ -1091,22 +1032,22 @@ type KycResign struct { // FilterResign is a free log retrieval operation binding the contract event 0x4edf3e325d0063213a39f9085522994a1c44bea5f39e7d63ef61260a1e58c6d3. // -// Solidity: event Resign(address _owner, address _candidate) -func (_Kyc *KycFilterer) FilterResign(opts *bind.FilterOpts) (*KycResignIterator, error) { +// Solidity: event Resign(_owner address, _candidate address) +func (_XDCValidator *XDCValidatorFilterer) FilterResign(opts *bind.FilterOpts) (*XDCValidatorResignIterator, error) { - logs, sub, err := _Kyc.contract.FilterLogs(opts, "Resign") + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Resign") if err != nil { return nil, err } - return &KycResignIterator{contract: _Kyc.contract, event: "Resign", logs: logs, sub: sub}, nil + 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(address _owner, address _candidate) -func (_Kyc *KycFilterer) WatchResign(opts *bind.WatchOpts, sink chan<- *KycResign) (event.Subscription, error) { +// Solidity: event Resign(_owner address, _candidate address) +func (_XDCValidator *XDCValidatorFilterer) WatchResign(opts *bind.WatchOpts, sink chan<- *XDCValidatorResign) (event.Subscription, error) { - logs, sub, err := _Kyc.contract.WatchLogs(opts, "Resign") + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Resign") if err != nil { return nil, err } @@ -1116,8 +1057,8 @@ func (_Kyc *KycFilterer) WatchResign(opts *bind.WatchOpts, sink chan<- *KycResig select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(KycResign) - if err := _Kyc.contract.UnpackLog(event, "Resign", log); err != nil { + event := new(XDCValidatorResign) + if err := _XDCValidator.contract.UnpackLog(event, "Resign", log); err != nil { return err } event.Raw = log @@ -1138,9 +1079,9 @@ func (_Kyc *KycFilterer) WatchResign(opts *bind.WatchOpts, sink chan<- *KycResig }), nil } -// KycUnvoteIterator is returned from FilterUnvote and is used to iterate over the raw logs and unpacked data for Unvote events raised by the Kyc contract. -type KycUnvoteIterator struct { - Event *KycUnvote // Event containing the contract specifics and raw log +// 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 @@ -1154,7 +1095,7 @@ type KycUnvoteIterator struct { // 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 *KycUnvoteIterator) Next() bool { +func (it *XDCValidatorUnvoteIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1163,7 +1104,7 @@ func (it *KycUnvoteIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(KycUnvote) + it.Event = new(XDCValidatorUnvote) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1178,7 +1119,7 @@ func (it *KycUnvoteIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(KycUnvote) + it.Event = new(XDCValidatorUnvote) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1194,19 +1135,19 @@ func (it *KycUnvoteIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *KycUnvoteIterator) Error() error { +func (it *XDCValidatorUnvoteIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *KycUnvoteIterator) Close() error { +func (it *XDCValidatorUnvoteIterator) Close() error { it.sub.Unsubscribe() return nil } -// KycUnvote represents a Unvote event raised by the Kyc contract. -type KycUnvote struct { +// XDCValidatorUnvote represents a Unvote event raised by the XDCValidator contract. +type XDCValidatorUnvote struct { Voter common.Address Candidate common.Address Cap *big.Int @@ -1215,22 +1156,22 @@ type KycUnvote struct { // FilterUnvote is a free log retrieval operation binding the contract event 0xaa0e554f781c3c3b2be110a0557f260f11af9a8aa2c64bc1e7a31dbb21e32fa2. // -// Solidity: event Unvote(address _voter, address _candidate, uint256 _cap) -func (_Kyc *KycFilterer) FilterUnvote(opts *bind.FilterOpts) (*KycUnvoteIterator, error) { +// Solidity: event Unvote(_voter address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterUnvote(opts *bind.FilterOpts) (*XDCValidatorUnvoteIterator, error) { - logs, sub, err := _Kyc.contract.FilterLogs(opts, "Unvote") + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Unvote") if err != nil { return nil, err } - return &KycUnvoteIterator{contract: _Kyc.contract, event: "Unvote", logs: logs, sub: sub}, nil + 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(address _voter, address _candidate, uint256 _cap) -func (_Kyc *KycFilterer) WatchUnvote(opts *bind.WatchOpts, sink chan<- *KycUnvote) (event.Subscription, error) { +// 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 := _Kyc.contract.WatchLogs(opts, "Unvote") + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Unvote") if err != nil { return nil, err } @@ -1240,8 +1181,8 @@ func (_Kyc *KycFilterer) WatchUnvote(opts *bind.WatchOpts, sink chan<- *KycUnvot select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(KycUnvote) - if err := _Kyc.contract.UnpackLog(event, "Unvote", log); err != nil { + event := new(XDCValidatorUnvote) + if err := _XDCValidator.contract.UnpackLog(event, "Unvote", log); err != nil { return err } event.Raw = log @@ -1262,9 +1203,9 @@ func (_Kyc *KycFilterer) WatchUnvote(opts *bind.WatchOpts, sink chan<- *KycUnvot }), nil } -// KycVoteIterator is returned from FilterVote and is used to iterate over the raw logs and unpacked data for Vote events raised by the Kyc contract. -type KycVoteIterator struct { - Event *KycVote // Event containing the contract specifics and raw log +// 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 @@ -1278,7 +1219,7 @@ type KycVoteIterator struct { // 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 *KycVoteIterator) Next() bool { +func (it *XDCValidatorVoteIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1287,7 +1228,7 @@ func (it *KycVoteIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(KycVote) + it.Event = new(XDCValidatorVote) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1302,7 +1243,7 @@ func (it *KycVoteIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(KycVote) + it.Event = new(XDCValidatorVote) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1318,19 +1259,19 @@ func (it *KycVoteIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *KycVoteIterator) Error() error { +func (it *XDCValidatorVoteIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *KycVoteIterator) Close() error { +func (it *XDCValidatorVoteIterator) Close() error { it.sub.Unsubscribe() return nil } -// KycVote represents a Vote event raised by the Kyc contract. -type KycVote struct { +// XDCValidatorVote represents a Vote event raised by the XDCValidator contract. +type XDCValidatorVote struct { Voter common.Address Candidate common.Address Cap *big.Int @@ -1339,22 +1280,22 @@ type KycVote struct { // FilterVote is a free log retrieval operation binding the contract event 0x66a9138482c99e9baf08860110ef332cc0c23b4a199a53593d8db0fc8f96fbfc. // -// Solidity: event Vote(address _voter, address _candidate, uint256 _cap) -func (_Kyc *KycFilterer) FilterVote(opts *bind.FilterOpts) (*KycVoteIterator, error) { +// Solidity: event Vote(_voter address, _candidate address, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterVote(opts *bind.FilterOpts) (*XDCValidatorVoteIterator, error) { - logs, sub, err := _Kyc.contract.FilterLogs(opts, "Vote") + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Vote") if err != nil { return nil, err } - return &KycVoteIterator{contract: _Kyc.contract, event: "Vote", logs: logs, sub: sub}, nil + 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(address _voter, address _candidate, uint256 _cap) -func (_Kyc *KycFilterer) WatchVote(opts *bind.WatchOpts, sink chan<- *KycVote) (event.Subscription, error) { +// 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 := _Kyc.contract.WatchLogs(opts, "Vote") + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Vote") if err != nil { return nil, err } @@ -1364,8 +1305,8 @@ func (_Kyc *KycFilterer) WatchVote(opts *bind.WatchOpts, sink chan<- *KycVote) ( select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(KycVote) - if err := _Kyc.contract.UnpackLog(event, "Vote", log); err != nil { + event := new(XDCValidatorVote) + if err := _XDCValidator.contract.UnpackLog(event, "Vote", log); err != nil { return err } event.Raw = log @@ -1386,9 +1327,9 @@ func (_Kyc *KycFilterer) WatchVote(opts *bind.WatchOpts, sink chan<- *KycVote) ( }), nil } -// KycWithdrawIterator is returned from FilterWithdraw and is used to iterate over the raw logs and unpacked data for Withdraw events raised by the Kyc contract. -type KycWithdrawIterator struct { - Event *KycWithdraw // Event containing the contract specifics and raw log +// 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 @@ -1402,7 +1343,7 @@ type KycWithdrawIterator struct { // 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 *KycWithdrawIterator) Next() bool { +func (it *XDCValidatorWithdrawIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1411,7 +1352,7 @@ func (it *KycWithdrawIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(KycWithdraw) + it.Event = new(XDCValidatorWithdraw) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1426,7 +1367,7 @@ func (it *KycWithdrawIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(KycWithdraw) + it.Event = new(XDCValidatorWithdraw) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1442,19 +1383,19 @@ func (it *KycWithdrawIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *KycWithdrawIterator) Error() error { +func (it *XDCValidatorWithdrawIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *KycWithdrawIterator) Close() error { +func (it *XDCValidatorWithdrawIterator) Close() error { it.sub.Unsubscribe() return nil } -// KycWithdraw represents a Withdraw event raised by the Kyc contract. -type KycWithdraw struct { +// XDCValidatorWithdraw represents a Withdraw event raised by the XDCValidator contract. +type XDCValidatorWithdraw struct { Owner common.Address BlockNumber *big.Int Cap *big.Int @@ -1463,22 +1404,22 @@ type KycWithdraw struct { // FilterWithdraw is a free log retrieval operation binding the contract event 0xf279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568. // -// Solidity: event Withdraw(address _owner, uint256 _blockNumber, uint256 _cap) -func (_Kyc *KycFilterer) FilterWithdraw(opts *bind.FilterOpts) (*KycWithdrawIterator, error) { +// Solidity: event Withdraw(_owner address, _blockNumber uint256, _cap uint256) +func (_XDCValidator *XDCValidatorFilterer) FilterWithdraw(opts *bind.FilterOpts) (*XDCValidatorWithdrawIterator, error) { - logs, sub, err := _Kyc.contract.FilterLogs(opts, "Withdraw") + logs, sub, err := _XDCValidator.contract.FilterLogs(opts, "Withdraw") if err != nil { return nil, err } - return &KycWithdrawIterator{contract: _Kyc.contract, event: "Withdraw", logs: logs, sub: sub}, nil + 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(address _owner, uint256 _blockNumber, uint256 _cap) -func (_Kyc *KycFilterer) WatchWithdraw(opts *bind.WatchOpts, sink chan<- *KycWithdraw) (event.Subscription, error) { +// 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 := _Kyc.contract.WatchLogs(opts, "Withdraw") + logs, sub, err := _XDCValidator.contract.WatchLogs(opts, "Withdraw") if err != nil { return nil, err } @@ -1488,8 +1429,8 @@ func (_Kyc *KycFilterer) WatchWithdraw(opts *bind.WatchOpts, sink chan<- *KycWit select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(KycWithdraw) - if err := _Kyc.contract.UnpackLog(event, "Withdraw", log); err != nil { + event := new(XDCValidatorWithdraw) + if err := _XDCValidator.contract.UnpackLog(event, "Withdraw", log); err != nil { return err } event.Raw = log diff --git a/contracts/validator/validator.go b/contracts/validator/validator.go index 9e4f5283d2..cfaac10c72 100644 --- a/contracts/validator/validator.go +++ b/contracts/validator/validator.go @@ -1,3 +1,18 @@ +// Copyright (c) 2018 XDCchain +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + package validator import ( @@ -48,4 +63,4 @@ func DeployValidator(transactOpts *bind.TransactOpts, contractBackend bind.Contr } return validatorAddr, validator, nil -} \ No newline at end of file +} diff --git a/contracts/validator/validator_test.go b/contracts/validator/validator_test.go index 0f74d9b029..d29a1c5f29 100644 --- a/contracts/validator/validator_test.go +++ b/contracts/validator/validator_test.go @@ -17,18 +17,19 @@ package validator import ( "context" + "encoding/json" "math/big" + "math/rand" "testing" "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/contracts" - "github.com/ethereum/go-ethereum/contracts/validator/contract" + contractValidator "github.com/ethereum/go-ethereum/contracts/validator/contract" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" - "math/rand" + "github.com/ethereum/go-ethereum/log" ) var ( @@ -94,7 +95,7 @@ func TestRewardBalance(t *testing.T) { // validatorAddr, _, baseValidator, err := contract.DeployXDCValidator(transactOpts, contractBackend, big.NewInt(50000), big.NewInt(99), big.NewInt(100), big.NewInt(100)) validatorCap := new(big.Int) validatorCap.SetString("50000000000000000000000", 10) - validatorAddr, _, baseValidator, err := contract.DeployXDCValidator( + validatorAddr, _, baseValidator, err := contractValidator.DeployXDCValidator( transactOpts, contractBackend, []common.Address{addr}, @@ -144,7 +145,7 @@ func TestRewardBalance(t *testing.T) { foundationAddr := common.HexToAddress(common.FoudationAddr) totalReward := new(big.Int).SetInt64(15 * 1000) - rewards, err := contracts.GetRewardBalancesRate(foundationAddr, acc3Addr, totalReward, baseValidator) + rewards, err := GetRewardBalancesRate(foundationAddr, acc3Addr, totalReward, baseValidator) if err != nil { t.Error("Fail to get reward balances rate.", err) } @@ -175,3 +176,76 @@ func TestRewardBalance(t *testing.T) { } } + +func GetRewardBalancesRate(foudationWalletAddr common.Address, masterAddr common.Address, totalReward *big.Int, validator *contractValidator.XDCValidator) (map[common.Address]*big.Int, error) { + owner := GetCandidatesOwnerBySigner(validator, masterAddr) + balances := make(map[common.Address]*big.Int) + rewardMaster := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardMasterPercent)) + rewardMaster = new(big.Int).Div(rewardMaster, new(big.Int).SetInt64(100)) + balances[owner] = rewardMaster + // Get voters for masternode. + opts := new(bind.CallOpts) + voters, err := validator.GetVoters(opts, masterAddr) + if err != nil { + log.Crit("Fail to get voters", "error", err) + return nil, err + } + + if len(voters) > 0 { + totalVoterReward := new(big.Int).Mul(totalReward, new(big.Int).SetUint64(common.RewardVoterPercent)) + totalVoterReward = new(big.Int).Div(totalVoterReward, new(big.Int).SetUint64(100)) + totalCap := new(big.Int) + // Get voters capacities. + voterCaps := make(map[common.Address]*big.Int) + for _, voteAddr := range voters { + var voterCap *big.Int + + voterCap, err = validator.GetVoterCap(opts, masterAddr, voteAddr) + if err != nil { + log.Crit("Fail to get vote capacity", "error", err) + } + + totalCap.Add(totalCap, voterCap) + voterCaps[voteAddr] = voterCap + } + if totalCap.Cmp(new(big.Int).SetInt64(0)) > 0 { + for addr, voteCap := range voterCaps { + // Only valid voter has cap > 0. + if voteCap.Cmp(new(big.Int).SetInt64(0)) > 0 { + rcap := new(big.Int).Mul(totalVoterReward, voteCap) + rcap = new(big.Int).Div(rcap, totalCap) + if balances[addr] != nil { + balances[addr].Add(balances[addr], rcap) + } else { + balances[addr] = rcap + } + } + } + } + } + + foudationReward := new(big.Int).Mul(totalReward, new(big.Int).SetInt64(common.RewardFoundationPercent)) + foudationReward = new(big.Int).Div(foudationReward, new(big.Int).SetInt64(100)) + balances[foudationWalletAddr] = foudationReward + + jsonHolders, err := json.Marshal(balances) + if err != nil { + log.Error("Fail to parse json holders", "error", err) + return nil, err + } + log.Info("Holders reward", "holders", string(jsonHolders), "master node", masterAddr.String()) + + return balances, nil +} + +func GetCandidatesOwnerBySigner(validator *contractValidator.XDCValidator, signerAddr common.Address) common.Address { + owner := signerAddr + opts := new(bind.CallOpts) + owner, err := validator.GetCandidateOwner(opts, signerAddr) + if err != nil { + log.Error("Fail get candidate owner", "error", err) + return owner + } + + return owner +}