github.com/diadata-org/diadata@v1.4.593/config/nftContracts/erc20/erc20.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 erc20 5 6 import ( 7 "math/big" 8 "strings" 9 10 ethereum "github.com/ethereum/go-ethereum" 11 "github.com/ethereum/go-ethereum/accounts/abi" 12 "github.com/ethereum/go-ethereum/accounts/abi/bind" 13 "github.com/ethereum/go-ethereum/common" 14 "github.com/ethereum/go-ethereum/core/types" 15 "github.com/ethereum/go-ethereum/event" 16 ) 17 18 // Reference imports to suppress errors if they are not otherwise used. 19 var ( 20 _ = big.NewInt 21 _ = strings.NewReader 22 _ = ethereum.NotFound 23 _ = bind.Bind 24 _ = common.Big1 25 _ = types.BloomLookup 26 _ = event.NewSubscription 27 ) 28 29 // ERC20ABI is the input ABI used to generate the binding from. 30 const ERC20ABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" 31 32 // ERC20 is an auto generated Go binding around an Ethereum contract. 33 type ERC20 struct { 34 ERC20Caller // Read-only binding to the contract 35 ERC20Transactor // Write-only binding to the contract 36 ERC20Filterer // Log filterer for contract events 37 } 38 39 // ERC20Caller is an auto generated read-only Go binding around an Ethereum contract. 40 type ERC20Caller struct { 41 contract *bind.BoundContract // Generic contract wrapper for the low level calls 42 } 43 44 // ERC20Transactor is an auto generated write-only Go binding around an Ethereum contract. 45 type ERC20Transactor struct { 46 contract *bind.BoundContract // Generic contract wrapper for the low level calls 47 } 48 49 // ERC20Filterer is an auto generated log filtering Go binding around an Ethereum contract events. 50 type ERC20Filterer struct { 51 contract *bind.BoundContract // Generic contract wrapper for the low level calls 52 } 53 54 // ERC20Session is an auto generated Go binding around an Ethereum contract, 55 // with pre-set call and transact options. 56 type ERC20Session struct { 57 Contract *ERC20 // Generic contract binding to set the session for 58 CallOpts bind.CallOpts // Call options to use throughout this session 59 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 60 } 61 62 // ERC20CallerSession is an auto generated read-only Go binding around an Ethereum contract, 63 // with pre-set call options. 64 type ERC20CallerSession struct { 65 Contract *ERC20Caller // Generic contract caller binding to set the session for 66 CallOpts bind.CallOpts // Call options to use throughout this session 67 } 68 69 // ERC20TransactorSession is an auto generated write-only Go binding around an Ethereum contract, 70 // with pre-set transact options. 71 type ERC20TransactorSession struct { 72 Contract *ERC20Transactor // Generic contract transactor binding to set the session for 73 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 74 } 75 76 // ERC20Raw is an auto generated low-level Go binding around an Ethereum contract. 77 type ERC20Raw struct { 78 Contract *ERC20 // Generic contract binding to access the raw methods on 79 } 80 81 // ERC20CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 82 type ERC20CallerRaw struct { 83 Contract *ERC20Caller // Generic read-only contract binding to access the raw methods on 84 } 85 86 // ERC20TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 87 type ERC20TransactorRaw struct { 88 Contract *ERC20Transactor // Generic write-only contract binding to access the raw methods on 89 } 90 91 // NewERC20 creates a new instance of ERC20, bound to a specific deployed contract. 92 func NewERC20(address common.Address, backend bind.ContractBackend) (*ERC20, error) { 93 contract, err := bindERC20(address, backend, backend, backend) 94 if err != nil { 95 return nil, err 96 } 97 return &ERC20{ERC20Caller: ERC20Caller{contract: contract}, ERC20Transactor: ERC20Transactor{contract: contract}, ERC20Filterer: ERC20Filterer{contract: contract}}, nil 98 } 99 100 // NewERC20Caller creates a new read-only instance of ERC20, bound to a specific deployed contract. 101 func NewERC20Caller(address common.Address, caller bind.ContractCaller) (*ERC20Caller, error) { 102 contract, err := bindERC20(address, caller, nil, nil) 103 if err != nil { 104 return nil, err 105 } 106 return &ERC20Caller{contract: contract}, nil 107 } 108 109 // NewERC20Transactor creates a new write-only instance of ERC20, bound to a specific deployed contract. 110 func NewERC20Transactor(address common.Address, transactor bind.ContractTransactor) (*ERC20Transactor, error) { 111 contract, err := bindERC20(address, nil, transactor, nil) 112 if err != nil { 113 return nil, err 114 } 115 return &ERC20Transactor{contract: contract}, nil 116 } 117 118 // NewERC20Filterer creates a new log filterer instance of ERC20, bound to a specific deployed contract. 119 func NewERC20Filterer(address common.Address, filterer bind.ContractFilterer) (*ERC20Filterer, error) { 120 contract, err := bindERC20(address, nil, nil, filterer) 121 if err != nil { 122 return nil, err 123 } 124 return &ERC20Filterer{contract: contract}, nil 125 } 126 127 // bindERC20 binds a generic wrapper to an already deployed contract. 128 func bindERC20(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 129 parsed, err := abi.JSON(strings.NewReader(ERC20ABI)) 130 if err != nil { 131 return nil, err 132 } 133 return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil 134 } 135 136 // Call invokes the (constant) contract method with params as input values and 137 // sets the output to result. The result type might be a single field for simple 138 // returns, a slice of interfaces for anonymous returns and a struct for named 139 // returns. 140 func (_ERC20 *ERC20Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 141 return _ERC20.Contract.ERC20Caller.contract.Call(opts, result, method, params...) 142 } 143 144 // Transfer initiates a plain transaction to move funds to the contract, calling 145 // its default method if one is available. 146 func (_ERC20 *ERC20Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 147 return _ERC20.Contract.ERC20Transactor.contract.Transfer(opts) 148 } 149 150 // Transact invokes the (paid) contract method with params as input values. 151 func (_ERC20 *ERC20Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 152 return _ERC20.Contract.ERC20Transactor.contract.Transact(opts, method, params...) 153 } 154 155 // Call invokes the (constant) contract method with params as input values and 156 // sets the output to result. The result type might be a single field for simple 157 // returns, a slice of interfaces for anonymous returns and a struct for named 158 // returns. 159 func (_ERC20 *ERC20CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 160 return _ERC20.Contract.contract.Call(opts, result, method, params...) 161 } 162 163 // Transfer initiates a plain transaction to move funds to the contract, calling 164 // its default method if one is available. 165 func (_ERC20 *ERC20TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 166 return _ERC20.Contract.contract.Transfer(opts) 167 } 168 169 // Transact invokes the (paid) contract method with params as input values. 170 func (_ERC20 *ERC20TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 171 return _ERC20.Contract.contract.Transact(opts, method, params...) 172 } 173 174 // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 175 // 176 // Solidity: function allowance(address owner, address spender) view returns(uint256) 177 func (_ERC20 *ERC20Caller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { 178 var out []interface{} 179 err := _ERC20.contract.Call(opts, &out, "allowance", owner, spender) 180 181 if err != nil { 182 return *new(*big.Int), err 183 } 184 185 out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 186 187 return out0, err 188 189 } 190 191 // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 192 // 193 // Solidity: function allowance(address owner, address spender) view returns(uint256) 194 func (_ERC20 *ERC20Session) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { 195 return _ERC20.Contract.Allowance(&_ERC20.CallOpts, owner, spender) 196 } 197 198 // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 199 // 200 // Solidity: function allowance(address owner, address spender) view returns(uint256) 201 func (_ERC20 *ERC20CallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { 202 return _ERC20.Contract.Allowance(&_ERC20.CallOpts, owner, spender) 203 } 204 205 // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 206 // 207 // Solidity: function balanceOf(address account) view returns(uint256) 208 func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { 209 var out []interface{} 210 err := _ERC20.contract.Call(opts, &out, "balanceOf", account) 211 212 if err != nil { 213 return *new(*big.Int), err 214 } 215 216 out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 217 218 return out0, err 219 220 } 221 222 // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 223 // 224 // Solidity: function balanceOf(address account) view returns(uint256) 225 func (_ERC20 *ERC20Session) BalanceOf(account common.Address) (*big.Int, error) { 226 return _ERC20.Contract.BalanceOf(&_ERC20.CallOpts, account) 227 } 228 229 // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 230 // 231 // Solidity: function balanceOf(address account) view returns(uint256) 232 func (_ERC20 *ERC20CallerSession) BalanceOf(account common.Address) (*big.Int, error) { 233 return _ERC20.Contract.BalanceOf(&_ERC20.CallOpts, account) 234 } 235 236 // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 237 // 238 // Solidity: function totalSupply() view returns(uint256) 239 func (_ERC20 *ERC20Caller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { 240 var out []interface{} 241 err := _ERC20.contract.Call(opts, &out, "totalSupply") 242 243 if err != nil { 244 return *new(*big.Int), err 245 } 246 247 out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 248 249 return out0, err 250 251 } 252 253 // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 254 // 255 // Solidity: function totalSupply() view returns(uint256) 256 func (_ERC20 *ERC20Session) TotalSupply() (*big.Int, error) { 257 return _ERC20.Contract.TotalSupply(&_ERC20.CallOpts) 258 } 259 260 // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 261 // 262 // Solidity: function totalSupply() view returns(uint256) 263 func (_ERC20 *ERC20CallerSession) TotalSupply() (*big.Int, error) { 264 return _ERC20.Contract.TotalSupply(&_ERC20.CallOpts) 265 } 266 267 // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 268 // 269 // Solidity: function approve(address spender, uint256 amount) returns(bool) 270 func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { 271 return _ERC20.contract.Transact(opts, "approve", spender, amount) 272 } 273 274 // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 275 // 276 // Solidity: function approve(address spender, uint256 amount) returns(bool) 277 func (_ERC20 *ERC20Session) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { 278 return _ERC20.Contract.Approve(&_ERC20.TransactOpts, spender, amount) 279 } 280 281 // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 282 // 283 // Solidity: function approve(address spender, uint256 amount) returns(bool) 284 func (_ERC20 *ERC20TransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { 285 return _ERC20.Contract.Approve(&_ERC20.TransactOpts, spender, amount) 286 } 287 288 // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 289 // 290 // Solidity: function transfer(address recipient, uint256 amount) returns(bool) 291 func (_ERC20 *ERC20Transactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 292 return _ERC20.contract.Transact(opts, "transfer", recipient, amount) 293 } 294 295 // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 296 // 297 // Solidity: function transfer(address recipient, uint256 amount) returns(bool) 298 func (_ERC20 *ERC20Session) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { 299 return _ERC20.Contract.Transfer(&_ERC20.TransactOpts, recipient, amount) 300 } 301 302 // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 303 // 304 // Solidity: function transfer(address recipient, uint256 amount) returns(bool) 305 func (_ERC20 *ERC20TransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { 306 return _ERC20.Contract.Transfer(&_ERC20.TransactOpts, recipient, amount) 307 } 308 309 // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 310 // 311 // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) 312 func (_ERC20 *ERC20Transactor) TransferFrom(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 313 return _ERC20.contract.Transact(opts, "transferFrom", sender, recipient, amount) 314 } 315 316 // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 317 // 318 // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) 319 func (_ERC20 *ERC20Session) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 320 return _ERC20.Contract.TransferFrom(&_ERC20.TransactOpts, sender, recipient, amount) 321 } 322 323 // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 324 // 325 // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) 326 func (_ERC20 *ERC20TransactorSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 327 return _ERC20.Contract.TransferFrom(&_ERC20.TransactOpts, sender, recipient, amount) 328 } 329 330 // ERC20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC20 contract. 331 type ERC20ApprovalIterator struct { 332 Event *ERC20Approval // Event containing the contract specifics and raw log 333 334 contract *bind.BoundContract // Generic contract to use for unpacking event data 335 event string // Event name to use for unpacking event data 336 337 logs chan types.Log // Log channel receiving the found contract events 338 sub ethereum.Subscription // Subscription for errors, completion and termination 339 done bool // Whether the subscription completed delivering logs 340 fail error // Occurred error to stop iteration 341 } 342 343 // Next advances the iterator to the subsequent event, returning whether there 344 // are any more events found. In case of a retrieval or parsing error, false is 345 // returned and Error() can be queried for the exact failure. 346 func (it *ERC20ApprovalIterator) Next() bool { 347 // If the iterator failed, stop iterating 348 if it.fail != nil { 349 return false 350 } 351 // If the iterator completed, deliver directly whatever's available 352 if it.done { 353 select { 354 case log := <-it.logs: 355 it.Event = new(ERC20Approval) 356 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 357 it.fail = err 358 return false 359 } 360 it.Event.Raw = log 361 return true 362 363 default: 364 return false 365 } 366 } 367 // Iterator still in progress, wait for either a data or an error event 368 select { 369 case log := <-it.logs: 370 it.Event = new(ERC20Approval) 371 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 372 it.fail = err 373 return false 374 } 375 it.Event.Raw = log 376 return true 377 378 case err := <-it.sub.Err(): 379 it.done = true 380 it.fail = err 381 return it.Next() 382 } 383 } 384 385 // Error returns any retrieval or parsing error occurred during filtering. 386 func (it *ERC20ApprovalIterator) Error() error { 387 return it.fail 388 } 389 390 // Close terminates the iteration process, releasing any pending underlying 391 // resources. 392 func (it *ERC20ApprovalIterator) Close() error { 393 it.sub.Unsubscribe() 394 return nil 395 } 396 397 // ERC20Approval represents a Approval event raised by the ERC20 contract. 398 type ERC20Approval struct { 399 Owner common.Address 400 Spender common.Address 401 Value *big.Int 402 Raw types.Log // Blockchain specific contextual infos 403 } 404 405 // FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 406 // 407 // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 408 func (_ERC20 *ERC20Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20ApprovalIterator, error) { 409 410 var ownerRule []interface{} 411 for _, ownerItem := range owner { 412 ownerRule = append(ownerRule, ownerItem) 413 } 414 var spenderRule []interface{} 415 for _, spenderItem := range spender { 416 spenderRule = append(spenderRule, spenderItem) 417 } 418 419 logs, sub, err := _ERC20.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) 420 if err != nil { 421 return nil, err 422 } 423 return &ERC20ApprovalIterator{contract: _ERC20.contract, event: "Approval", logs: logs, sub: sub}, nil 424 } 425 426 // WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 427 // 428 // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 429 func (_ERC20 *ERC20Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error) { 430 431 var ownerRule []interface{} 432 for _, ownerItem := range owner { 433 ownerRule = append(ownerRule, ownerItem) 434 } 435 var spenderRule []interface{} 436 for _, spenderItem := range spender { 437 spenderRule = append(spenderRule, spenderItem) 438 } 439 440 logs, sub, err := _ERC20.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) 441 if err != nil { 442 return nil, err 443 } 444 return event.NewSubscription(func(quit <-chan struct{}) error { 445 defer sub.Unsubscribe() 446 for { 447 select { 448 case log := <-logs: 449 // New log arrived, parse the event and forward to the user 450 event := new(ERC20Approval) 451 if err := _ERC20.contract.UnpackLog(event, "Approval", log); err != nil { 452 return err 453 } 454 event.Raw = log 455 456 select { 457 case sink <- event: 458 case err := <-sub.Err(): 459 return err 460 case <-quit: 461 return nil 462 } 463 case err := <-sub.Err(): 464 return err 465 case <-quit: 466 return nil 467 } 468 } 469 }), nil 470 } 471 472 // ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 473 // 474 // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 475 func (_ERC20 *ERC20Filterer) ParseApproval(log types.Log) (*ERC20Approval, error) { 476 event := new(ERC20Approval) 477 if err := _ERC20.contract.UnpackLog(event, "Approval", log); err != nil { 478 return nil, err 479 } 480 event.Raw = log 481 return event, nil 482 } 483 484 // ERC20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC20 contract. 485 type ERC20TransferIterator struct { 486 Event *ERC20Transfer // Event containing the contract specifics and raw log 487 488 contract *bind.BoundContract // Generic contract to use for unpacking event data 489 event string // Event name to use for unpacking event data 490 491 logs chan types.Log // Log channel receiving the found contract events 492 sub ethereum.Subscription // Subscription for errors, completion and termination 493 done bool // Whether the subscription completed delivering logs 494 fail error // Occurred error to stop iteration 495 } 496 497 // Next advances the iterator to the subsequent event, returning whether there 498 // are any more events found. In case of a retrieval or parsing error, false is 499 // returned and Error() can be queried for the exact failure. 500 func (it *ERC20TransferIterator) Next() bool { 501 // If the iterator failed, stop iterating 502 if it.fail != nil { 503 return false 504 } 505 // If the iterator completed, deliver directly whatever's available 506 if it.done { 507 select { 508 case log := <-it.logs: 509 it.Event = new(ERC20Transfer) 510 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 511 it.fail = err 512 return false 513 } 514 it.Event.Raw = log 515 return true 516 517 default: 518 return false 519 } 520 } 521 // Iterator still in progress, wait for either a data or an error event 522 select { 523 case log := <-it.logs: 524 it.Event = new(ERC20Transfer) 525 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 526 it.fail = err 527 return false 528 } 529 it.Event.Raw = log 530 return true 531 532 case err := <-it.sub.Err(): 533 it.done = true 534 it.fail = err 535 return it.Next() 536 } 537 } 538 539 // Error returns any retrieval or parsing error occurred during filtering. 540 func (it *ERC20TransferIterator) Error() error { 541 return it.fail 542 } 543 544 // Close terminates the iteration process, releasing any pending underlying 545 // resources. 546 func (it *ERC20TransferIterator) Close() error { 547 it.sub.Unsubscribe() 548 return nil 549 } 550 551 // ERC20Transfer represents a Transfer event raised by the ERC20 contract. 552 type ERC20Transfer struct { 553 From common.Address 554 To common.Address 555 Value *big.Int 556 Raw types.Log // Blockchain specific contextual infos 557 } 558 559 // FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 560 // 561 // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 562 func (_ERC20 *ERC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ERC20TransferIterator, error) { 563 564 var fromRule []interface{} 565 for _, fromItem := range from { 566 fromRule = append(fromRule, fromItem) 567 } 568 var toRule []interface{} 569 for _, toItem := range to { 570 toRule = append(toRule, toItem) 571 } 572 573 logs, sub, err := _ERC20.contract.FilterLogs(opts, "Transfer", fromRule, toRule) 574 if err != nil { 575 return nil, err 576 } 577 return &ERC20TransferIterator{contract: _ERC20.contract, event: "Transfer", logs: logs, sub: sub}, nil 578 } 579 580 // WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 581 // 582 // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 583 func (_ERC20 *ERC20Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error) { 584 585 var fromRule []interface{} 586 for _, fromItem := range from { 587 fromRule = append(fromRule, fromItem) 588 } 589 var toRule []interface{} 590 for _, toItem := range to { 591 toRule = append(toRule, toItem) 592 } 593 594 logs, sub, err := _ERC20.contract.WatchLogs(opts, "Transfer", fromRule, toRule) 595 if err != nil { 596 return nil, err 597 } 598 return event.NewSubscription(func(quit <-chan struct{}) error { 599 defer sub.Unsubscribe() 600 for { 601 select { 602 case log := <-logs: 603 // New log arrived, parse the event and forward to the user 604 event := new(ERC20Transfer) 605 if err := _ERC20.contract.UnpackLog(event, "Transfer", log); err != nil { 606 return err 607 } 608 event.Raw = log 609 610 select { 611 case sink <- event: 612 case err := <-sub.Err(): 613 return err 614 case <-quit: 615 return nil 616 } 617 case err := <-sub.Err(): 618 return err 619 case <-quit: 620 return nil 621 } 622 } 623 }), nil 624 } 625 626 // ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 627 // 628 // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 629 func (_ERC20 *ERC20Filterer) ParseTransfer(log types.Log) (*ERC20Transfer, error) { 630 event := new(ERC20Transfer) 631 if err := _ERC20.contract.UnpackLog(event, "Transfer", log); err != nil { 632 return nil, err 633 } 634 event.Raw = log 635 return event, nil 636 } 637 638 // ERC20MetadataABI is the input ABI used to generate the binding from. 639 const ERC20MetadataABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" 640 641 // ERC20Metadata is an auto generated Go binding around an Ethereum contract. 642 type ERC20Metadata struct { 643 ERC20MetadataCaller // Read-only binding to the contract 644 ERC20MetadataTransactor // Write-only binding to the contract 645 ERC20MetadataFilterer // Log filterer for contract events 646 } 647 648 // ERC20MetadataCaller is an auto generated read-only Go binding around an Ethereum contract. 649 type ERC20MetadataCaller struct { 650 contract *bind.BoundContract // Generic contract wrapper for the low level calls 651 } 652 653 // ERC20MetadataTransactor is an auto generated write-only Go binding around an Ethereum contract. 654 type ERC20MetadataTransactor struct { 655 contract *bind.BoundContract // Generic contract wrapper for the low level calls 656 } 657 658 // ERC20MetadataFilterer is an auto generated log filtering Go binding around an Ethereum contract events. 659 type ERC20MetadataFilterer struct { 660 contract *bind.BoundContract // Generic contract wrapper for the low level calls 661 } 662 663 // ERC20MetadataSession is an auto generated Go binding around an Ethereum contract, 664 // with pre-set call and transact options. 665 type ERC20MetadataSession struct { 666 Contract *ERC20Metadata // Generic contract binding to set the session for 667 CallOpts bind.CallOpts // Call options to use throughout this session 668 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 669 } 670 671 // ERC20MetadataCallerSession is an auto generated read-only Go binding around an Ethereum contract, 672 // with pre-set call options. 673 type ERC20MetadataCallerSession struct { 674 Contract *ERC20MetadataCaller // Generic contract caller binding to set the session for 675 CallOpts bind.CallOpts // Call options to use throughout this session 676 } 677 678 // ERC20MetadataTransactorSession is an auto generated write-only Go binding around an Ethereum contract, 679 // with pre-set transact options. 680 type ERC20MetadataTransactorSession struct { 681 Contract *ERC20MetadataTransactor // Generic contract transactor binding to set the session for 682 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 683 } 684 685 // ERC20MetadataRaw is an auto generated low-level Go binding around an Ethereum contract. 686 type ERC20MetadataRaw struct { 687 Contract *ERC20Metadata // Generic contract binding to access the raw methods on 688 } 689 690 // ERC20MetadataCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 691 type ERC20MetadataCallerRaw struct { 692 Contract *ERC20MetadataCaller // Generic read-only contract binding to access the raw methods on 693 } 694 695 // ERC20MetadataTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 696 type ERC20MetadataTransactorRaw struct { 697 Contract *ERC20MetadataTransactor // Generic write-only contract binding to access the raw methods on 698 } 699 700 // NewERC20Metadata creates a new instance of ERC20Metadata, bound to a specific deployed contract. 701 func NewERC20Metadata(address common.Address, backend bind.ContractBackend) (*ERC20Metadata, error) { 702 contract, err := bindERC20Metadata(address, backend, backend, backend) 703 if err != nil { 704 return nil, err 705 } 706 return &ERC20Metadata{ERC20MetadataCaller: ERC20MetadataCaller{contract: contract}, ERC20MetadataTransactor: ERC20MetadataTransactor{contract: contract}, ERC20MetadataFilterer: ERC20MetadataFilterer{contract: contract}}, nil 707 } 708 709 // NewERC20MetadataCaller creates a new read-only instance of ERC20Metadata, bound to a specific deployed contract. 710 func NewERC20MetadataCaller(address common.Address, caller bind.ContractCaller) (*ERC20MetadataCaller, error) { 711 contract, err := bindERC20Metadata(address, caller, nil, nil) 712 if err != nil { 713 return nil, err 714 } 715 return &ERC20MetadataCaller{contract: contract}, nil 716 } 717 718 // NewERC20MetadataTransactor creates a new write-only instance of ERC20Metadata, bound to a specific deployed contract. 719 func NewERC20MetadataTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20MetadataTransactor, error) { 720 contract, err := bindERC20Metadata(address, nil, transactor, nil) 721 if err != nil { 722 return nil, err 723 } 724 return &ERC20MetadataTransactor{contract: contract}, nil 725 } 726 727 // NewERC20MetadataFilterer creates a new log filterer instance of ERC20Metadata, bound to a specific deployed contract. 728 func NewERC20MetadataFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20MetadataFilterer, error) { 729 contract, err := bindERC20Metadata(address, nil, nil, filterer) 730 if err != nil { 731 return nil, err 732 } 733 return &ERC20MetadataFilterer{contract: contract}, nil 734 } 735 736 // bindERC20Metadata binds a generic wrapper to an already deployed contract. 737 func bindERC20Metadata(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 738 parsed, err := abi.JSON(strings.NewReader(ERC20MetadataABI)) 739 if err != nil { 740 return nil, err 741 } 742 return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil 743 } 744 745 // Call invokes the (constant) contract method with params as input values and 746 // sets the output to result. The result type might be a single field for simple 747 // returns, a slice of interfaces for anonymous returns and a struct for named 748 // returns. 749 func (_ERC20Metadata *ERC20MetadataRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 750 return _ERC20Metadata.Contract.ERC20MetadataCaller.contract.Call(opts, result, method, params...) 751 } 752 753 // Transfer initiates a plain transaction to move funds to the contract, calling 754 // its default method if one is available. 755 func (_ERC20Metadata *ERC20MetadataRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 756 return _ERC20Metadata.Contract.ERC20MetadataTransactor.contract.Transfer(opts) 757 } 758 759 // Transact invokes the (paid) contract method with params as input values. 760 func (_ERC20Metadata *ERC20MetadataRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 761 return _ERC20Metadata.Contract.ERC20MetadataTransactor.contract.Transact(opts, method, params...) 762 } 763 764 // Call invokes the (constant) contract method with params as input values and 765 // sets the output to result. The result type might be a single field for simple 766 // returns, a slice of interfaces for anonymous returns and a struct for named 767 // returns. 768 func (_ERC20Metadata *ERC20MetadataCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 769 return _ERC20Metadata.Contract.contract.Call(opts, result, method, params...) 770 } 771 772 // Transfer initiates a plain transaction to move funds to the contract, calling 773 // its default method if one is available. 774 func (_ERC20Metadata *ERC20MetadataTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 775 return _ERC20Metadata.Contract.contract.Transfer(opts) 776 } 777 778 // Transact invokes the (paid) contract method with params as input values. 779 func (_ERC20Metadata *ERC20MetadataTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 780 return _ERC20Metadata.Contract.contract.Transact(opts, method, params...) 781 } 782 783 // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 784 // 785 // Solidity: function allowance(address owner, address spender) view returns(uint256) 786 func (_ERC20Metadata *ERC20MetadataCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { 787 var out []interface{} 788 err := _ERC20Metadata.contract.Call(opts, &out, "allowance", owner, spender) 789 790 if err != nil { 791 return *new(*big.Int), err 792 } 793 794 out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 795 796 return out0, err 797 798 } 799 800 // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 801 // 802 // Solidity: function allowance(address owner, address spender) view returns(uint256) 803 func (_ERC20Metadata *ERC20MetadataSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { 804 return _ERC20Metadata.Contract.Allowance(&_ERC20Metadata.CallOpts, owner, spender) 805 } 806 807 // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 808 // 809 // Solidity: function allowance(address owner, address spender) view returns(uint256) 810 func (_ERC20Metadata *ERC20MetadataCallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { 811 return _ERC20Metadata.Contract.Allowance(&_ERC20Metadata.CallOpts, owner, spender) 812 } 813 814 // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 815 // 816 // Solidity: function balanceOf(address account) view returns(uint256) 817 func (_ERC20Metadata *ERC20MetadataCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { 818 var out []interface{} 819 err := _ERC20Metadata.contract.Call(opts, &out, "balanceOf", account) 820 821 if err != nil { 822 return *new(*big.Int), err 823 } 824 825 out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 826 827 return out0, err 828 829 } 830 831 // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 832 // 833 // Solidity: function balanceOf(address account) view returns(uint256) 834 func (_ERC20Metadata *ERC20MetadataSession) BalanceOf(account common.Address) (*big.Int, error) { 835 return _ERC20Metadata.Contract.BalanceOf(&_ERC20Metadata.CallOpts, account) 836 } 837 838 // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 839 // 840 // Solidity: function balanceOf(address account) view returns(uint256) 841 func (_ERC20Metadata *ERC20MetadataCallerSession) BalanceOf(account common.Address) (*big.Int, error) { 842 return _ERC20Metadata.Contract.BalanceOf(&_ERC20Metadata.CallOpts, account) 843 } 844 845 // Decimals is a free data retrieval call binding the contract method 0x313ce567. 846 // 847 // Solidity: function decimals() view returns(uint8) 848 func (_ERC20Metadata *ERC20MetadataCaller) Decimals(opts *bind.CallOpts) (uint8, error) { 849 var out []interface{} 850 err := _ERC20Metadata.contract.Call(opts, &out, "decimals") 851 852 if err != nil { 853 return *new(uint8), err 854 } 855 856 out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) 857 858 return out0, err 859 860 } 861 862 // Decimals is a free data retrieval call binding the contract method 0x313ce567. 863 // 864 // Solidity: function decimals() view returns(uint8) 865 func (_ERC20Metadata *ERC20MetadataSession) Decimals() (uint8, error) { 866 return _ERC20Metadata.Contract.Decimals(&_ERC20Metadata.CallOpts) 867 } 868 869 // Decimals is a free data retrieval call binding the contract method 0x313ce567. 870 // 871 // Solidity: function decimals() view returns(uint8) 872 func (_ERC20Metadata *ERC20MetadataCallerSession) Decimals() (uint8, error) { 873 return _ERC20Metadata.Contract.Decimals(&_ERC20Metadata.CallOpts) 874 } 875 876 // Name is a free data retrieval call binding the contract method 0x06fdde03. 877 // 878 // Solidity: function name() view returns(string) 879 func (_ERC20Metadata *ERC20MetadataCaller) Name(opts *bind.CallOpts) (string, error) { 880 var out []interface{} 881 err := _ERC20Metadata.contract.Call(opts, &out, "name") 882 883 if err != nil { 884 return *new(string), err 885 } 886 887 out0 := *abi.ConvertType(out[0], new(string)).(*string) 888 889 return out0, err 890 891 } 892 893 // Name is a free data retrieval call binding the contract method 0x06fdde03. 894 // 895 // Solidity: function name() view returns(string) 896 func (_ERC20Metadata *ERC20MetadataSession) Name() (string, error) { 897 return _ERC20Metadata.Contract.Name(&_ERC20Metadata.CallOpts) 898 } 899 900 // Name is a free data retrieval call binding the contract method 0x06fdde03. 901 // 902 // Solidity: function name() view returns(string) 903 func (_ERC20Metadata *ERC20MetadataCallerSession) Name() (string, error) { 904 return _ERC20Metadata.Contract.Name(&_ERC20Metadata.CallOpts) 905 } 906 907 // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 908 // 909 // Solidity: function symbol() view returns(string) 910 func (_ERC20Metadata *ERC20MetadataCaller) Symbol(opts *bind.CallOpts) (string, error) { 911 var out []interface{} 912 err := _ERC20Metadata.contract.Call(opts, &out, "symbol") 913 914 if err != nil { 915 return *new(string), err 916 } 917 918 out0 := *abi.ConvertType(out[0], new(string)).(*string) 919 920 return out0, err 921 922 } 923 924 // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 925 // 926 // Solidity: function symbol() view returns(string) 927 func (_ERC20Metadata *ERC20MetadataSession) Symbol() (string, error) { 928 return _ERC20Metadata.Contract.Symbol(&_ERC20Metadata.CallOpts) 929 } 930 931 // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 932 // 933 // Solidity: function symbol() view returns(string) 934 func (_ERC20Metadata *ERC20MetadataCallerSession) Symbol() (string, error) { 935 return _ERC20Metadata.Contract.Symbol(&_ERC20Metadata.CallOpts) 936 } 937 938 // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 939 // 940 // Solidity: function totalSupply() view returns(uint256) 941 func (_ERC20Metadata *ERC20MetadataCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { 942 var out []interface{} 943 err := _ERC20Metadata.contract.Call(opts, &out, "totalSupply") 944 945 if err != nil { 946 return *new(*big.Int), err 947 } 948 949 out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 950 951 return out0, err 952 953 } 954 955 // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 956 // 957 // Solidity: function totalSupply() view returns(uint256) 958 func (_ERC20Metadata *ERC20MetadataSession) TotalSupply() (*big.Int, error) { 959 return _ERC20Metadata.Contract.TotalSupply(&_ERC20Metadata.CallOpts) 960 } 961 962 // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 963 // 964 // Solidity: function totalSupply() view returns(uint256) 965 func (_ERC20Metadata *ERC20MetadataCallerSession) TotalSupply() (*big.Int, error) { 966 return _ERC20Metadata.Contract.TotalSupply(&_ERC20Metadata.CallOpts) 967 } 968 969 // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 970 // 971 // Solidity: function approve(address spender, uint256 amount) returns(bool) 972 func (_ERC20Metadata *ERC20MetadataTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { 973 return _ERC20Metadata.contract.Transact(opts, "approve", spender, amount) 974 } 975 976 // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 977 // 978 // Solidity: function approve(address spender, uint256 amount) returns(bool) 979 func (_ERC20Metadata *ERC20MetadataSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { 980 return _ERC20Metadata.Contract.Approve(&_ERC20Metadata.TransactOpts, spender, amount) 981 } 982 983 // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 984 // 985 // Solidity: function approve(address spender, uint256 amount) returns(bool) 986 func (_ERC20Metadata *ERC20MetadataTransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { 987 return _ERC20Metadata.Contract.Approve(&_ERC20Metadata.TransactOpts, spender, amount) 988 } 989 990 // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 991 // 992 // Solidity: function transfer(address recipient, uint256 amount) returns(bool) 993 func (_ERC20Metadata *ERC20MetadataTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 994 return _ERC20Metadata.contract.Transact(opts, "transfer", recipient, amount) 995 } 996 997 // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 998 // 999 // Solidity: function transfer(address recipient, uint256 amount) returns(bool) 1000 func (_ERC20Metadata *ERC20MetadataSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { 1001 return _ERC20Metadata.Contract.Transfer(&_ERC20Metadata.TransactOpts, recipient, amount) 1002 } 1003 1004 // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 1005 // 1006 // Solidity: function transfer(address recipient, uint256 amount) returns(bool) 1007 func (_ERC20Metadata *ERC20MetadataTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { 1008 return _ERC20Metadata.Contract.Transfer(&_ERC20Metadata.TransactOpts, recipient, amount) 1009 } 1010 1011 // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 1012 // 1013 // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) 1014 func (_ERC20Metadata *ERC20MetadataTransactor) TransferFrom(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 1015 return _ERC20Metadata.contract.Transact(opts, "transferFrom", sender, recipient, amount) 1016 } 1017 1018 // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 1019 // 1020 // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) 1021 func (_ERC20Metadata *ERC20MetadataSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 1022 return _ERC20Metadata.Contract.TransferFrom(&_ERC20Metadata.TransactOpts, sender, recipient, amount) 1023 } 1024 1025 // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 1026 // 1027 // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) 1028 func (_ERC20Metadata *ERC20MetadataTransactorSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { 1029 return _ERC20Metadata.Contract.TransferFrom(&_ERC20Metadata.TransactOpts, sender, recipient, amount) 1030 } 1031 1032 // ERC20MetadataApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC20Metadata contract. 1033 type ERC20MetadataApprovalIterator struct { 1034 Event *ERC20MetadataApproval // Event containing the contract specifics and raw log 1035 1036 contract *bind.BoundContract // Generic contract to use for unpacking event data 1037 event string // Event name to use for unpacking event data 1038 1039 logs chan types.Log // Log channel receiving the found contract events 1040 sub ethereum.Subscription // Subscription for errors, completion and termination 1041 done bool // Whether the subscription completed delivering logs 1042 fail error // Occurred error to stop iteration 1043 } 1044 1045 // Next advances the iterator to the subsequent event, returning whether there 1046 // are any more events found. In case of a retrieval or parsing error, false is 1047 // returned and Error() can be queried for the exact failure. 1048 func (it *ERC20MetadataApprovalIterator) Next() bool { 1049 // If the iterator failed, stop iterating 1050 if it.fail != nil { 1051 return false 1052 } 1053 // If the iterator completed, deliver directly whatever's available 1054 if it.done { 1055 select { 1056 case log := <-it.logs: 1057 it.Event = new(ERC20MetadataApproval) 1058 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 1059 it.fail = err 1060 return false 1061 } 1062 it.Event.Raw = log 1063 return true 1064 1065 default: 1066 return false 1067 } 1068 } 1069 // Iterator still in progress, wait for either a data or an error event 1070 select { 1071 case log := <-it.logs: 1072 it.Event = new(ERC20MetadataApproval) 1073 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 1074 it.fail = err 1075 return false 1076 } 1077 it.Event.Raw = log 1078 return true 1079 1080 case err := <-it.sub.Err(): 1081 it.done = true 1082 it.fail = err 1083 return it.Next() 1084 } 1085 } 1086 1087 // Error returns any retrieval or parsing error occurred during filtering. 1088 func (it *ERC20MetadataApprovalIterator) Error() error { 1089 return it.fail 1090 } 1091 1092 // Close terminates the iteration process, releasing any pending underlying 1093 // resources. 1094 func (it *ERC20MetadataApprovalIterator) Close() error { 1095 it.sub.Unsubscribe() 1096 return nil 1097 } 1098 1099 // ERC20MetadataApproval represents a Approval event raised by the ERC20Metadata contract. 1100 type ERC20MetadataApproval struct { 1101 Owner common.Address 1102 Spender common.Address 1103 Value *big.Int 1104 Raw types.Log // Blockchain specific contextual infos 1105 } 1106 1107 // FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 1108 // 1109 // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 1110 func (_ERC20Metadata *ERC20MetadataFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20MetadataApprovalIterator, error) { 1111 1112 var ownerRule []interface{} 1113 for _, ownerItem := range owner { 1114 ownerRule = append(ownerRule, ownerItem) 1115 } 1116 var spenderRule []interface{} 1117 for _, spenderItem := range spender { 1118 spenderRule = append(spenderRule, spenderItem) 1119 } 1120 1121 logs, sub, err := _ERC20Metadata.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) 1122 if err != nil { 1123 return nil, err 1124 } 1125 return &ERC20MetadataApprovalIterator{contract: _ERC20Metadata.contract, event: "Approval", logs: logs, sub: sub}, nil 1126 } 1127 1128 // WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 1129 // 1130 // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 1131 func (_ERC20Metadata *ERC20MetadataFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC20MetadataApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { 1132 1133 var ownerRule []interface{} 1134 for _, ownerItem := range owner { 1135 ownerRule = append(ownerRule, ownerItem) 1136 } 1137 var spenderRule []interface{} 1138 for _, spenderItem := range spender { 1139 spenderRule = append(spenderRule, spenderItem) 1140 } 1141 1142 logs, sub, err := _ERC20Metadata.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) 1143 if err != nil { 1144 return nil, err 1145 } 1146 return event.NewSubscription(func(quit <-chan struct{}) error { 1147 defer sub.Unsubscribe() 1148 for { 1149 select { 1150 case log := <-logs: 1151 // New log arrived, parse the event and forward to the user 1152 event := new(ERC20MetadataApproval) 1153 if err := _ERC20Metadata.contract.UnpackLog(event, "Approval", log); err != nil { 1154 return err 1155 } 1156 event.Raw = log 1157 1158 select { 1159 case sink <- event: 1160 case err := <-sub.Err(): 1161 return err 1162 case <-quit: 1163 return nil 1164 } 1165 case err := <-sub.Err(): 1166 return err 1167 case <-quit: 1168 return nil 1169 } 1170 } 1171 }), nil 1172 } 1173 1174 // ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 1175 // 1176 // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 1177 func (_ERC20Metadata *ERC20MetadataFilterer) ParseApproval(log types.Log) (*ERC20MetadataApproval, error) { 1178 event := new(ERC20MetadataApproval) 1179 if err := _ERC20Metadata.contract.UnpackLog(event, "Approval", log); err != nil { 1180 return nil, err 1181 } 1182 event.Raw = log 1183 return event, nil 1184 } 1185 1186 // ERC20MetadataTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC20Metadata contract. 1187 type ERC20MetadataTransferIterator struct { 1188 Event *ERC20MetadataTransfer // Event containing the contract specifics and raw log 1189 1190 contract *bind.BoundContract // Generic contract to use for unpacking event data 1191 event string // Event name to use for unpacking event data 1192 1193 logs chan types.Log // Log channel receiving the found contract events 1194 sub ethereum.Subscription // Subscription for errors, completion and termination 1195 done bool // Whether the subscription completed delivering logs 1196 fail error // Occurred error to stop iteration 1197 } 1198 1199 // Next advances the iterator to the subsequent event, returning whether there 1200 // are any more events found. In case of a retrieval or parsing error, false is 1201 // returned and Error() can be queried for the exact failure. 1202 func (it *ERC20MetadataTransferIterator) Next() bool { 1203 // If the iterator failed, stop iterating 1204 if it.fail != nil { 1205 return false 1206 } 1207 // If the iterator completed, deliver directly whatever's available 1208 if it.done { 1209 select { 1210 case log := <-it.logs: 1211 it.Event = new(ERC20MetadataTransfer) 1212 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 1213 it.fail = err 1214 return false 1215 } 1216 it.Event.Raw = log 1217 return true 1218 1219 default: 1220 return false 1221 } 1222 } 1223 // Iterator still in progress, wait for either a data or an error event 1224 select { 1225 case log := <-it.logs: 1226 it.Event = new(ERC20MetadataTransfer) 1227 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 1228 it.fail = err 1229 return false 1230 } 1231 it.Event.Raw = log 1232 return true 1233 1234 case err := <-it.sub.Err(): 1235 it.done = true 1236 it.fail = err 1237 return it.Next() 1238 } 1239 } 1240 1241 // Error returns any retrieval or parsing error occurred during filtering. 1242 func (it *ERC20MetadataTransferIterator) Error() error { 1243 return it.fail 1244 } 1245 1246 // Close terminates the iteration process, releasing any pending underlying 1247 // resources. 1248 func (it *ERC20MetadataTransferIterator) Close() error { 1249 it.sub.Unsubscribe() 1250 return nil 1251 } 1252 1253 // ERC20MetadataTransfer represents a Transfer event raised by the ERC20Metadata contract. 1254 type ERC20MetadataTransfer struct { 1255 From common.Address 1256 To common.Address 1257 Value *big.Int 1258 Raw types.Log // Blockchain specific contextual infos 1259 } 1260 1261 // FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 1262 // 1263 // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 1264 func (_ERC20Metadata *ERC20MetadataFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ERC20MetadataTransferIterator, error) { 1265 1266 var fromRule []interface{} 1267 for _, fromItem := range from { 1268 fromRule = append(fromRule, fromItem) 1269 } 1270 var toRule []interface{} 1271 for _, toItem := range to { 1272 toRule = append(toRule, toItem) 1273 } 1274 1275 logs, sub, err := _ERC20Metadata.contract.FilterLogs(opts, "Transfer", fromRule, toRule) 1276 if err != nil { 1277 return nil, err 1278 } 1279 return &ERC20MetadataTransferIterator{contract: _ERC20Metadata.contract, event: "Transfer", logs: logs, sub: sub}, nil 1280 } 1281 1282 // WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 1283 // 1284 // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 1285 func (_ERC20Metadata *ERC20MetadataFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC20MetadataTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { 1286 1287 var fromRule []interface{} 1288 for _, fromItem := range from { 1289 fromRule = append(fromRule, fromItem) 1290 } 1291 var toRule []interface{} 1292 for _, toItem := range to { 1293 toRule = append(toRule, toItem) 1294 } 1295 1296 logs, sub, err := _ERC20Metadata.contract.WatchLogs(opts, "Transfer", fromRule, toRule) 1297 if err != nil { 1298 return nil, err 1299 } 1300 return event.NewSubscription(func(quit <-chan struct{}) error { 1301 defer sub.Unsubscribe() 1302 for { 1303 select { 1304 case log := <-logs: 1305 // New log arrived, parse the event and forward to the user 1306 event := new(ERC20MetadataTransfer) 1307 if err := _ERC20Metadata.contract.UnpackLog(event, "Transfer", log); err != nil { 1308 return err 1309 } 1310 event.Raw = log 1311 1312 select { 1313 case sink <- event: 1314 case err := <-sub.Err(): 1315 return err 1316 case <-quit: 1317 return nil 1318 } 1319 case err := <-sub.Err(): 1320 return err 1321 case <-quit: 1322 return nil 1323 } 1324 } 1325 }), nil 1326 } 1327 1328 // ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 1329 // 1330 // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 1331 func (_ERC20Metadata *ERC20MetadataFilterer) ParseTransfer(log types.Log) (*ERC20MetadataTransfer, error) { 1332 event := new(ERC20MetadataTransfer) 1333 if err := _ERC20Metadata.contract.UnpackLog(event, "Transfer", log); err != nil { 1334 return nil, err 1335 } 1336 event.Raw = log 1337 return event, nil 1338 }