github.com/unicornultrafoundation/go-u2u@v1.0.0-rc1.0.20240205080301-e74a83d3fadc/gossip/contract/ballot/Ballot.go (about) 1 // Code generated - DO NOT EDIT. 2 // This file is a generated binding and any manual changes will be lost. 3 4 package ballot 5 6 import ( 7 "errors" 8 "math/big" 9 "strings" 10 11 u2u "github.com/unicornultrafoundation/go-u2u" 12 "github.com/unicornultrafoundation/go-u2u/accounts/abi" 13 "github.com/unicornultrafoundation/go-u2u/accounts/abi/bind" 14 "github.com/unicornultrafoundation/go-u2u/common" 15 "github.com/unicornultrafoundation/go-u2u/core/types" 16 "github.com/unicornultrafoundation/go-u2u/event" 17 ) 18 19 // Reference imports to suppress errors if they are not otherwise used. 20 var ( 21 _ = errors.New 22 _ = big.NewInt 23 _ = strings.NewReader 24 _ = u2u.NotFound 25 _ = bind.Bind 26 _ = common.Big1 27 _ = types.BloomLookup 28 _ = event.NewSubscription 29 ) 30 31 // BallotMetaData contains all meta data concerning the Ballot contract. 32 var BallotMetaData = &bind.MetaData{ 33 ABI: "[{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"proposalNames\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"voteCount\",\"type\":\"uint256\"}],\"name\":\"NewProposal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"chairperson\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"voter\",\"type\":\"address\"}],\"name\":\"giveRightToVote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposals\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"voteCount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposal\",\"type\":\"uint256\"}],\"name\":\"vote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"voters\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"voted\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vote\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"winnerName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"winnerName_\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"winningProposal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningProposal_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", 34 Bin: "0x60806040523480156200001157600080fd5b5060405162001586380380620015868339818101604052810190620000379190620003b2565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555060005b8151811015620001e657600260405180604001604052808484815181106200010f576200010e62000403565b5b6020026020010151815260200160008152509080600181540180825580915050600190039060005260206000209060020201600090919091909150600082015181600001556020820151816001015550503373ffffffffffffffffffffffffffffffffffffffff167f4913a1b403184a1c69ab16947e9f4c7a1e48c069dccde91f2bf550ea77becc5b838381518110620001ae57620001ad62000403565b5b60200260200101516000604051620001c89291906200049a565b60405180910390a28080620001dd90620004f6565b915050620000e2565b505062000544565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620002528262000207565b810181811067ffffffffffffffff8211171562000274576200027362000218565b5b80604052505050565b600062000289620001ee565b905062000297828262000247565b919050565b600067ffffffffffffffff821115620002ba57620002b962000218565b5b602082029050602081019050919050565b600080fd5b6000819050919050565b620002e581620002d0565b8114620002f157600080fd5b50565b6000815190506200030581620002da565b92915050565b6000620003226200031c846200029c565b6200027d565b90508083825260208201905060208402830185811115620003485762000347620002cb565b5b835b81811015620003755780620003608882620002f4565b8452602084019350506020810190506200034a565b5050509392505050565b600082601f83011262000397576200039662000202565b5b8151620003a98482602086016200030b565b91505092915050565b600060208284031215620003cb57620003ca620001f8565b5b600082015167ffffffffffffffff811115620003ec57620003eb620001fd565b5b620003fa848285016200037f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6200043d81620002d0565b82525050565b6000819050919050565b6000819050919050565b6000819050919050565b6000620004826200047c620004768462000443565b62000457565b6200044d565b9050919050565b620004948162000461565b82525050565b6000604082019050620004b1600083018562000432565b620004c0602083018462000489565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000503826200044d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620005395762000538620004c7565b5b600182019050919050565b61103280620005546000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063609ff1bd1161005b578063609ff1bd146101145780639e7b8d6114610132578063a3ec138d1461014e578063e2ba53f01461018157610088565b80630121b93f1461008d578063013cf08b146100a95780632e4176cf146100da5780635c19a95c146100f8575b600080fd5b6100a760048036038101906100a291906109e5565b61019f565b005b6100c360048036038101906100be91906109e5565b6102e6565b6040516100d1929190610a3a565b60405180910390f35b6100e261031a565b6040516100ef9190610aa4565b60405180910390f35b610112600480360381019061010d9190610aeb565b61033e565b005b61011c6106da565b6040516101299190610b18565b60405180910390f35b61014c60048036038101906101479190610aeb565b610762565b005b61016860048036038101906101639190610aeb565b610919565b6040516101789493929190610b4e565b60405180910390f35b610189610976565b6040516101969190610b93565b60405180910390f35b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000154141561022a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022190610c0b565b60405180910390fd5b8060010160009054906101000a900460ff161561027c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027390610c77565b60405180910390fd5b60018160010160006101000a81548160ff0219169083151502179055508181600201819055508060000154600283815481106102bb576102ba610c97565b5b906000526020600020906002020160010160008282546102db9190610cf5565b925050819055505050565b600281815481106102f657600080fd5b90600052602060002090600202016000915090508060000154908060010154905082565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff16156103d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ca90610d97565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043990610e03565b60405180910390fd5b5b600073ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105b257600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156105ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a490610e6f565b60405180910390fd5b610443565b60018160010160006101000a81548160ff021916908315150217905550818160010160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff16156106b5578160000154600282600201548154811061068957610688610c97565b5b906000526020600020906002020160010160008282546106a99190610cf5565b925050819055506106d5565b81600001548160000160008282546106cd9190610cf5565b925050819055505b505050565b6000806000905060005b60028054905081101561075d57816002828154811061070657610705610c97565b5b906000526020600020906002020160010154111561074a576002818154811061073257610731610c97565b5b90600052602060002090600202016001015491508092505b808061075590610e8f565b9150506106e4565b505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e790610f4a565b60405180910390fd5b600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff1615610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087790610fb6565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154146108cf57600080fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555050565b60016020528060005260406000206000915090508060000154908060010160009054906101000a900460ff16908060010160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154905084565b600060026109826106da565b8154811061099357610992610c97565b5b906000526020600020906002020160000154905090565b600080fd5b6000819050919050565b6109c2816109af565b81146109cd57600080fd5b50565b6000813590506109df816109b9565b92915050565b6000602082840312156109fb576109fa6109aa565b5b6000610a09848285016109d0565b91505092915050565b6000819050919050565b610a2581610a12565b82525050565b610a34816109af565b82525050565b6000604082019050610a4f6000830185610a1c565b610a5c6020830184610a2b565b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610a8e82610a63565b9050919050565b610a9e81610a83565b82525050565b6000602082019050610ab96000830184610a95565b92915050565b610ac881610a83565b8114610ad357600080fd5b50565b600081359050610ae581610abf565b92915050565b600060208284031215610b0157610b006109aa565b5b6000610b0f84828501610ad6565b91505092915050565b6000602082019050610b2d6000830184610a2b565b92915050565b60008115159050919050565b610b4881610b33565b82525050565b6000608082019050610b636000830187610a2b565b610b706020830186610b3f565b610b7d6040830185610a95565b610b8a6060830184610a2b565b95945050505050565b6000602082019050610ba86000830184610a1c565b92915050565b600082825260208201905092915050565b7f486173206e6f20726967687420746f20766f7465000000000000000000000000600082015250565b6000610bf5601483610bae565b9150610c0082610bbf565b602082019050919050565b60006020820190508181036000830152610c2481610be8565b9050919050565b7f416c726561647920766f7465642e000000000000000000000000000000000000600082015250565b6000610c61600e83610bae565b9150610c6c82610c2b565b602082019050919050565b60006020820190508181036000830152610c9081610c54565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610d00826109af565b9150610d0b836109af565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610d4057610d3f610cc6565b5b828201905092915050565b7f596f7520616c726561647920766f7465642e0000000000000000000000000000600082015250565b6000610d81601283610bae565b9150610d8c82610d4b565b602082019050919050565b60006020820190508181036000830152610db081610d74565b9050919050565b7f53656c662d64656c65676174696f6e20697320646973616c6c6f7765642e0000600082015250565b6000610ded601e83610bae565b9150610df882610db7565b602082019050919050565b60006020820190508181036000830152610e1c81610de0565b9050919050565b7f466f756e64206c6f6f7020696e2064656c65676174696f6e2e00000000000000600082015250565b6000610e59601983610bae565b9150610e6482610e23565b602082019050919050565b60006020820190508181036000830152610e8881610e4c565b9050919050565b6000610e9a826109af565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610ecd57610ecc610cc6565b5b600182019050919050565b7f4f6e6c79206368616972706572736f6e2063616e20676976652072696768742060008201527f746f20766f74652e000000000000000000000000000000000000000000000000602082015250565b6000610f34602883610bae565b9150610f3f82610ed8565b604082019050919050565b60006020820190508181036000830152610f6381610f27565b9050919050565b7f54686520766f74657220616c726561647920766f7465642e0000000000000000600082015250565b6000610fa0601883610bae565b9150610fab82610f6a565b602082019050919050565b60006020820190508181036000830152610fcf81610f93565b905091905056fea2646970667358221220567adabd19edc7ae85073705af2aa994f6314b7b5debc74f9c25841a1c6bd9e164736f6c637828302e382e31322d646576656c6f702e323032322e312e32302b636f6d6d69742e30623961623333660059", 35 } 36 37 // BallotABI is the input ABI used to generate the binding from. 38 // Deprecated: Use BallotMetaData.ABI instead. 39 var BallotABI = BallotMetaData.ABI 40 41 // BallotBin is the compiled bytecode used for deploying new contracts. 42 // Deprecated: Use BallotMetaData.Bin instead. 43 var BallotBin = BallotMetaData.Bin 44 45 // DeployBallot deploys a new Ethereum contract, binding an instance of Ballot to it. 46 func DeployBallot(auth *bind.TransactOpts, backend bind.ContractBackend, proposalNames [][32]byte) (common.Address, *types.Transaction, *Ballot, error) { 47 parsed, err := BallotMetaData.GetAbi() 48 if err != nil { 49 return common.Address{}, nil, nil, err 50 } 51 if parsed == nil { 52 return common.Address{}, nil, nil, errors.New("GetABI returned nil") 53 } 54 55 address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(BallotBin), backend, proposalNames) 56 if err != nil { 57 return common.Address{}, nil, nil, err 58 } 59 return address, tx, &Ballot{BallotCaller: BallotCaller{contract: contract}, BallotTransactor: BallotTransactor{contract: contract}, BallotFilterer: BallotFilterer{contract: contract}}, nil 60 } 61 62 // Ballot is an auto generated Go binding around an Ethereum contract. 63 type Ballot struct { 64 BallotCaller // Read-only binding to the contract 65 BallotTransactor // Write-only binding to the contract 66 BallotFilterer // Log filterer for contract events 67 } 68 69 // BallotCaller is an auto generated read-only Go binding around an Ethereum contract. 70 type BallotCaller struct { 71 contract *bind.BoundContract // Generic contract wrapper for the low level calls 72 } 73 74 // BallotTransactor is an auto generated write-only Go binding around an Ethereum contract. 75 type BallotTransactor struct { 76 contract *bind.BoundContract // Generic contract wrapper for the low level calls 77 } 78 79 // BallotFilterer is an auto generated log filtering Go binding around an Ethereum contract events. 80 type BallotFilterer struct { 81 contract *bind.BoundContract // Generic contract wrapper for the low level calls 82 } 83 84 // BallotSession is an auto generated Go binding around an Ethereum contract, 85 // with pre-set call and transact options. 86 type BallotSession struct { 87 Contract *Ballot // Generic contract binding to set the session for 88 CallOpts bind.CallOpts // Call options to use throughout this session 89 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 90 } 91 92 // BallotCallerSession is an auto generated read-only Go binding around an Ethereum contract, 93 // with pre-set call options. 94 type BallotCallerSession struct { 95 Contract *BallotCaller // Generic contract caller binding to set the session for 96 CallOpts bind.CallOpts // Call options to use throughout this session 97 } 98 99 // BallotTransactorSession is an auto generated write-only Go binding around an Ethereum contract, 100 // with pre-set transact options. 101 type BallotTransactorSession struct { 102 Contract *BallotTransactor // Generic contract transactor binding to set the session for 103 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 104 } 105 106 // BallotRaw is an auto generated low-level Go binding around an Ethereum contract. 107 type BallotRaw struct { 108 Contract *Ballot // Generic contract binding to access the raw methods on 109 } 110 111 // BallotCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 112 type BallotCallerRaw struct { 113 Contract *BallotCaller // Generic read-only contract binding to access the raw methods on 114 } 115 116 // BallotTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 117 type BallotTransactorRaw struct { 118 Contract *BallotTransactor // Generic write-only contract binding to access the raw methods on 119 } 120 121 // NewBallot creates a new instance of Ballot, bound to a specific deployed contract. 122 func NewBallot(address common.Address, backend bind.ContractBackend) (*Ballot, error) { 123 contract, err := bindBallot(address, backend, backend, backend) 124 if err != nil { 125 return nil, err 126 } 127 return &Ballot{BallotCaller: BallotCaller{contract: contract}, BallotTransactor: BallotTransactor{contract: contract}, BallotFilterer: BallotFilterer{contract: contract}}, nil 128 } 129 130 // NewBallotCaller creates a new read-only instance of Ballot, bound to a specific deployed contract. 131 func NewBallotCaller(address common.Address, caller bind.ContractCaller) (*BallotCaller, error) { 132 contract, err := bindBallot(address, caller, nil, nil) 133 if err != nil { 134 return nil, err 135 } 136 return &BallotCaller{contract: contract}, nil 137 } 138 139 // NewBallotTransactor creates a new write-only instance of Ballot, bound to a specific deployed contract. 140 func NewBallotTransactor(address common.Address, transactor bind.ContractTransactor) (*BallotTransactor, error) { 141 contract, err := bindBallot(address, nil, transactor, nil) 142 if err != nil { 143 return nil, err 144 } 145 return &BallotTransactor{contract: contract}, nil 146 } 147 148 // NewBallotFilterer creates a new log filterer instance of Ballot, bound to a specific deployed contract. 149 func NewBallotFilterer(address common.Address, filterer bind.ContractFilterer) (*BallotFilterer, error) { 150 contract, err := bindBallot(address, nil, nil, filterer) 151 if err != nil { 152 return nil, err 153 } 154 return &BallotFilterer{contract: contract}, nil 155 } 156 157 // bindBallot binds a generic wrapper to an already deployed contract. 158 func bindBallot(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 159 parsed, err := abi.JSON(strings.NewReader(BallotABI)) 160 if err != nil { 161 return nil, err 162 } 163 return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil 164 } 165 166 // Call invokes the (constant) contract method with params as input values and 167 // sets the output to result. The result type might be a single field for simple 168 // returns, a slice of interfaces for anonymous returns and a struct for named 169 // returns. 170 func (_Ballot *BallotRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 171 return _Ballot.Contract.BallotCaller.contract.Call(opts, result, method, params...) 172 } 173 174 // Transfer initiates a plain transaction to move funds to the contract, calling 175 // its default method if one is available. 176 func (_Ballot *BallotRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 177 return _Ballot.Contract.BallotTransactor.contract.Transfer(opts) 178 } 179 180 // Transact invokes the (paid) contract method with params as input values. 181 func (_Ballot *BallotRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 182 return _Ballot.Contract.BallotTransactor.contract.Transact(opts, method, params...) 183 } 184 185 // Call invokes the (constant) contract method with params as input values and 186 // sets the output to result. The result type might be a single field for simple 187 // returns, a slice of interfaces for anonymous returns and a struct for named 188 // returns. 189 func (_Ballot *BallotCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 190 return _Ballot.Contract.contract.Call(opts, result, method, params...) 191 } 192 193 // Transfer initiates a plain transaction to move funds to the contract, calling 194 // its default method if one is available. 195 func (_Ballot *BallotTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 196 return _Ballot.Contract.contract.Transfer(opts) 197 } 198 199 // Transact invokes the (paid) contract method with params as input values. 200 func (_Ballot *BallotTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 201 return _Ballot.Contract.contract.Transact(opts, method, params...) 202 } 203 204 // Chairperson is a free data retrieval call binding the contract method 0x2e4176cf. 205 // 206 // Solidity: function chairperson() view returns(address) 207 func (_Ballot *BallotCaller) Chairperson(opts *bind.CallOpts) (common.Address, error) { 208 var out []interface{} 209 err := _Ballot.contract.Call(opts, &out, "chairperson") 210 211 if err != nil { 212 return *new(common.Address), err 213 } 214 215 out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) 216 217 return out0, err 218 219 } 220 221 // Chairperson is a free data retrieval call binding the contract method 0x2e4176cf. 222 // 223 // Solidity: function chairperson() view returns(address) 224 func (_Ballot *BallotSession) Chairperson() (common.Address, error) { 225 return _Ballot.Contract.Chairperson(&_Ballot.CallOpts) 226 } 227 228 // Chairperson is a free data retrieval call binding the contract method 0x2e4176cf. 229 // 230 // Solidity: function chairperson() view returns(address) 231 func (_Ballot *BallotCallerSession) Chairperson() (common.Address, error) { 232 return _Ballot.Contract.Chairperson(&_Ballot.CallOpts) 233 } 234 235 // Proposals is a free data retrieval call binding the contract method 0x013cf08b. 236 // 237 // Solidity: function proposals(uint256 ) view returns(bytes32 name, uint256 voteCount) 238 func (_Ballot *BallotCaller) Proposals(opts *bind.CallOpts, arg0 *big.Int) (struct { 239 Name [32]byte 240 VoteCount *big.Int 241 }, error) { 242 var out []interface{} 243 err := _Ballot.contract.Call(opts, &out, "proposals", arg0) 244 245 outstruct := new(struct { 246 Name [32]byte 247 VoteCount *big.Int 248 }) 249 if err != nil { 250 return *outstruct, err 251 } 252 253 outstruct.Name = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) 254 outstruct.VoteCount = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) 255 256 return *outstruct, err 257 258 } 259 260 // Proposals is a free data retrieval call binding the contract method 0x013cf08b. 261 // 262 // Solidity: function proposals(uint256 ) view returns(bytes32 name, uint256 voteCount) 263 func (_Ballot *BallotSession) Proposals(arg0 *big.Int) (struct { 264 Name [32]byte 265 VoteCount *big.Int 266 }, error) { 267 return _Ballot.Contract.Proposals(&_Ballot.CallOpts, arg0) 268 } 269 270 // Proposals is a free data retrieval call binding the contract method 0x013cf08b. 271 // 272 // Solidity: function proposals(uint256 ) view returns(bytes32 name, uint256 voteCount) 273 func (_Ballot *BallotCallerSession) Proposals(arg0 *big.Int) (struct { 274 Name [32]byte 275 VoteCount *big.Int 276 }, error) { 277 return _Ballot.Contract.Proposals(&_Ballot.CallOpts, arg0) 278 } 279 280 // Voters is a free data retrieval call binding the contract method 0xa3ec138d. 281 // 282 // Solidity: function voters(address ) view returns(uint256 weight, bool voted, address delegate, uint256 vote) 283 func (_Ballot *BallotCaller) Voters(opts *bind.CallOpts, arg0 common.Address) (struct { 284 Weight *big.Int 285 Voted bool 286 Delegate common.Address 287 Vote *big.Int 288 }, error) { 289 var out []interface{} 290 err := _Ballot.contract.Call(opts, &out, "voters", arg0) 291 292 outstruct := new(struct { 293 Weight *big.Int 294 Voted bool 295 Delegate common.Address 296 Vote *big.Int 297 }) 298 if err != nil { 299 return *outstruct, err 300 } 301 302 outstruct.Weight = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 303 outstruct.Voted = *abi.ConvertType(out[1], new(bool)).(*bool) 304 outstruct.Delegate = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) 305 outstruct.Vote = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) 306 307 return *outstruct, err 308 309 } 310 311 // Voters is a free data retrieval call binding the contract method 0xa3ec138d. 312 // 313 // Solidity: function voters(address ) view returns(uint256 weight, bool voted, address delegate, uint256 vote) 314 func (_Ballot *BallotSession) Voters(arg0 common.Address) (struct { 315 Weight *big.Int 316 Voted bool 317 Delegate common.Address 318 Vote *big.Int 319 }, error) { 320 return _Ballot.Contract.Voters(&_Ballot.CallOpts, arg0) 321 } 322 323 // Voters is a free data retrieval call binding the contract method 0xa3ec138d. 324 // 325 // Solidity: function voters(address ) view returns(uint256 weight, bool voted, address delegate, uint256 vote) 326 func (_Ballot *BallotCallerSession) Voters(arg0 common.Address) (struct { 327 Weight *big.Int 328 Voted bool 329 Delegate common.Address 330 Vote *big.Int 331 }, error) { 332 return _Ballot.Contract.Voters(&_Ballot.CallOpts, arg0) 333 } 334 335 // WinnerName is a free data retrieval call binding the contract method 0xe2ba53f0. 336 // 337 // Solidity: function winnerName() view returns(bytes32 winnerName_) 338 func (_Ballot *BallotCaller) WinnerName(opts *bind.CallOpts) ([32]byte, error) { 339 var out []interface{} 340 err := _Ballot.contract.Call(opts, &out, "winnerName") 341 342 if err != nil { 343 return *new([32]byte), err 344 } 345 346 out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) 347 348 return out0, err 349 350 } 351 352 // WinnerName is a free data retrieval call binding the contract method 0xe2ba53f0. 353 // 354 // Solidity: function winnerName() view returns(bytes32 winnerName_) 355 func (_Ballot *BallotSession) WinnerName() ([32]byte, error) { 356 return _Ballot.Contract.WinnerName(&_Ballot.CallOpts) 357 } 358 359 // WinnerName is a free data retrieval call binding the contract method 0xe2ba53f0. 360 // 361 // Solidity: function winnerName() view returns(bytes32 winnerName_) 362 func (_Ballot *BallotCallerSession) WinnerName() ([32]byte, error) { 363 return _Ballot.Contract.WinnerName(&_Ballot.CallOpts) 364 } 365 366 // WinningProposal is a free data retrieval call binding the contract method 0x609ff1bd. 367 // 368 // Solidity: function winningProposal() view returns(uint256 winningProposal_) 369 func (_Ballot *BallotCaller) WinningProposal(opts *bind.CallOpts) (*big.Int, error) { 370 var out []interface{} 371 err := _Ballot.contract.Call(opts, &out, "winningProposal") 372 373 if err != nil { 374 return *new(*big.Int), err 375 } 376 377 out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 378 379 return out0, err 380 381 } 382 383 // WinningProposal is a free data retrieval call binding the contract method 0x609ff1bd. 384 // 385 // Solidity: function winningProposal() view returns(uint256 winningProposal_) 386 func (_Ballot *BallotSession) WinningProposal() (*big.Int, error) { 387 return _Ballot.Contract.WinningProposal(&_Ballot.CallOpts) 388 } 389 390 // WinningProposal is a free data retrieval call binding the contract method 0x609ff1bd. 391 // 392 // Solidity: function winningProposal() view returns(uint256 winningProposal_) 393 func (_Ballot *BallotCallerSession) WinningProposal() (*big.Int, error) { 394 return _Ballot.Contract.WinningProposal(&_Ballot.CallOpts) 395 } 396 397 // Delegate is a paid mutator transaction binding the contract method 0x5c19a95c. 398 // 399 // Solidity: function delegate(address to) returns() 400 func (_Ballot *BallotTransactor) Delegate(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { 401 return _Ballot.contract.Transact(opts, "delegate", to) 402 } 403 404 // Delegate is a paid mutator transaction binding the contract method 0x5c19a95c. 405 // 406 // Solidity: function delegate(address to) returns() 407 func (_Ballot *BallotSession) Delegate(to common.Address) (*types.Transaction, error) { 408 return _Ballot.Contract.Delegate(&_Ballot.TransactOpts, to) 409 } 410 411 // Delegate is a paid mutator transaction binding the contract method 0x5c19a95c. 412 // 413 // Solidity: function delegate(address to) returns() 414 func (_Ballot *BallotTransactorSession) Delegate(to common.Address) (*types.Transaction, error) { 415 return _Ballot.Contract.Delegate(&_Ballot.TransactOpts, to) 416 } 417 418 // GiveRightToVote is a paid mutator transaction binding the contract method 0x9e7b8d61. 419 // 420 // Solidity: function giveRightToVote(address voter) returns() 421 func (_Ballot *BallotTransactor) GiveRightToVote(opts *bind.TransactOpts, voter common.Address) (*types.Transaction, error) { 422 return _Ballot.contract.Transact(opts, "giveRightToVote", voter) 423 } 424 425 // GiveRightToVote is a paid mutator transaction binding the contract method 0x9e7b8d61. 426 // 427 // Solidity: function giveRightToVote(address voter) returns() 428 func (_Ballot *BallotSession) GiveRightToVote(voter common.Address) (*types.Transaction, error) { 429 return _Ballot.Contract.GiveRightToVote(&_Ballot.TransactOpts, voter) 430 } 431 432 // GiveRightToVote is a paid mutator transaction binding the contract method 0x9e7b8d61. 433 // 434 // Solidity: function giveRightToVote(address voter) returns() 435 func (_Ballot *BallotTransactorSession) GiveRightToVote(voter common.Address) (*types.Transaction, error) { 436 return _Ballot.Contract.GiveRightToVote(&_Ballot.TransactOpts, voter) 437 } 438 439 // Vote is a paid mutator transaction binding the contract method 0x0121b93f. 440 // 441 // Solidity: function vote(uint256 proposal) returns() 442 func (_Ballot *BallotTransactor) Vote(opts *bind.TransactOpts, proposal *big.Int) (*types.Transaction, error) { 443 return _Ballot.contract.Transact(opts, "vote", proposal) 444 } 445 446 // Vote is a paid mutator transaction binding the contract method 0x0121b93f. 447 // 448 // Solidity: function vote(uint256 proposal) returns() 449 func (_Ballot *BallotSession) Vote(proposal *big.Int) (*types.Transaction, error) { 450 return _Ballot.Contract.Vote(&_Ballot.TransactOpts, proposal) 451 } 452 453 // Vote is a paid mutator transaction binding the contract method 0x0121b93f. 454 // 455 // Solidity: function vote(uint256 proposal) returns() 456 func (_Ballot *BallotTransactorSession) Vote(proposal *big.Int) (*types.Transaction, error) { 457 return _Ballot.Contract.Vote(&_Ballot.TransactOpts, proposal) 458 } 459 460 // BallotNewProposalIterator is returned from FilterNewProposal and is used to iterate over the raw logs and unpacked data for NewProposal events raised by the Ballot contract. 461 type BallotNewProposalIterator struct { 462 Event *BallotNewProposal // Event containing the contract specifics and raw log 463 464 contract *bind.BoundContract // Generic contract to use for unpacking event data 465 event string // Event name to use for unpacking event data 466 467 logs chan types.Log // Log channel receiving the found contract events 468 sub u2u.Subscription // Subscription for errors, completion and termination 469 done bool // Whether the subscription completed delivering logs 470 fail error // Occurred error to stop iteration 471 } 472 473 // Next advances the iterator to the subsequent event, returning whether there 474 // are any more events found. In case of a retrieval or parsing error, false is 475 // returned and Error() can be queried for the exact failure. 476 func (it *BallotNewProposalIterator) Next() bool { 477 // If the iterator failed, stop iterating 478 if it.fail != nil { 479 return false 480 } 481 // If the iterator completed, deliver directly whatever's available 482 if it.done { 483 select { 484 case log := <-it.logs: 485 it.Event = new(BallotNewProposal) 486 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 487 it.fail = err 488 return false 489 } 490 it.Event.Raw = log 491 return true 492 493 default: 494 return false 495 } 496 } 497 // Iterator still in progress, wait for either a data or an error event 498 select { 499 case log := <-it.logs: 500 it.Event = new(BallotNewProposal) 501 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 502 it.fail = err 503 return false 504 } 505 it.Event.Raw = log 506 return true 507 508 case err := <-it.sub.Err(): 509 it.done = true 510 it.fail = err 511 return it.Next() 512 } 513 } 514 515 // Error returns any retrieval or parsing error occurred during filtering. 516 func (it *BallotNewProposalIterator) Error() error { 517 return it.fail 518 } 519 520 // Close terminates the iteration process, releasing any pending underlying 521 // resources. 522 func (it *BallotNewProposalIterator) Close() error { 523 it.sub.Unsubscribe() 524 return nil 525 } 526 527 // BallotNewProposal represents a NewProposal event raised by the Ballot contract. 528 type BallotNewProposal struct { 529 From common.Address 530 Name [32]byte 531 VoteCount *big.Int 532 Raw types.Log // Blockchain specific contextual infos 533 } 534 535 // FilterNewProposal is a free log retrieval operation binding the contract event 0x4913a1b403184a1c69ab16947e9f4c7a1e48c069dccde91f2bf550ea77becc5b. 536 // 537 // Solidity: event NewProposal(address indexed from, bytes32 name, uint256 voteCount) 538 func (_Ballot *BallotFilterer) FilterNewProposal(opts *bind.FilterOpts, from []common.Address) (*BallotNewProposalIterator, error) { 539 540 var fromRule []interface{} 541 for _, fromItem := range from { 542 fromRule = append(fromRule, fromItem) 543 } 544 545 logs, sub, err := _Ballot.contract.FilterLogs(opts, "NewProposal", fromRule) 546 if err != nil { 547 return nil, err 548 } 549 return &BallotNewProposalIterator{contract: _Ballot.contract, event: "NewProposal", logs: logs, sub: sub}, nil 550 } 551 552 // WatchNewProposal is a free log subscription operation binding the contract event 0x4913a1b403184a1c69ab16947e9f4c7a1e48c069dccde91f2bf550ea77becc5b. 553 // 554 // Solidity: event NewProposal(address indexed from, bytes32 name, uint256 voteCount) 555 func (_Ballot *BallotFilterer) WatchNewProposal(opts *bind.WatchOpts, sink chan<- *BallotNewProposal, from []common.Address) (event.Subscription, error) { 556 557 var fromRule []interface{} 558 for _, fromItem := range from { 559 fromRule = append(fromRule, fromItem) 560 } 561 562 logs, sub, err := _Ballot.contract.WatchLogs(opts, "NewProposal", fromRule) 563 if err != nil { 564 return nil, err 565 } 566 return event.NewSubscription(func(quit <-chan struct{}) error { 567 defer sub.Unsubscribe() 568 for { 569 select { 570 case log := <-logs: 571 // New log arrived, parse the event and forward to the user 572 event := new(BallotNewProposal) 573 if err := _Ballot.contract.UnpackLog(event, "NewProposal", log); err != nil { 574 return err 575 } 576 event.Raw = log 577 578 select { 579 case sink <- event: 580 case err := <-sub.Err(): 581 return err 582 case <-quit: 583 return nil 584 } 585 case err := <-sub.Err(): 586 return err 587 case <-quit: 588 return nil 589 } 590 } 591 }), nil 592 } 593 594 // ParseNewProposal is a log parse operation binding the contract event 0x4913a1b403184a1c69ab16947e9f4c7a1e48c069dccde91f2bf550ea77becc5b. 595 // 596 // Solidity: event NewProposal(address indexed from, bytes32 name, uint256 voteCount) 597 func (_Ballot *BallotFilterer) ParseNewProposal(log types.Log) (*BallotNewProposal, error) { 598 event := new(BallotNewProposal) 599 if err := _Ballot.contract.UnpackLog(event, "NewProposal", log); err != nil { 600 return nil, err 601 } 602 event.Raw = log 603 return event, nil 604 }