diff --git a/.github/workflows/generic.yaml b/.github/workflows/generic.yaml new file mode 100644 index 0000000..a31ee52 --- /dev/null +++ b/.github/workflows/generic.yaml @@ -0,0 +1,46 @@ +# Copyright 2022 Stichting ThingsIX Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: 'Generic Checks' + +on: + pull_request: + branches: + - main + +jobs: + license: + name: Check if all files contain license header + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19.2 + - name: Install addlicense + run: go install github.com/google/addlicense@53d978ad7e086016cadd4beb6f8a92d73fde9ad0 + - name: Check out code + uses: actions/checkout@v3 + - name: Check license headers + run: ./check-license.sh + check-commit-message-style: + name: Check commit message + runs-on: ubuntu-latest + steps: + - name: Check + uses: mristin/opinionated-commit-message@v3.0.0 + with: + allow-one-liners: 'true' diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..f139dde --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,2 @@ +* @bas-vk +* @timcooijmans diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b70e4ca --- /dev/null +++ b/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2013-2018 Docker, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/apply-license.sh b/apply-license.sh new file mode 100755 index 0000000..bf8dd18 --- /dev/null +++ b/apply-license.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright 2022 Stichting ThingsIX Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + + +# Adds a license to all code files, requires the https://github.com/google/addlicense tool to be installed, add ignores for code that doesn't need a license. +# Example for Go: addlicense -c "Stichting ThingsIX Foundation" -s -ignore "external/**" . +addlicense -c "Stichting ThingsIX Foundation" -s . \ No newline at end of file diff --git a/bindings.go b/bindings.go new file mode 100644 index 0000000..01fb699 --- /dev/null +++ b/bindings.go @@ -0,0 +1,1574 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package router_registry + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// IRouterRegistryRouter is an auto generated low-level Go binding around an user-defined struct. +type IRouterRegistryRouter struct { + Id [32]byte + Owner common.Address + Networks []*big.Int + Endpoint string +} + +// RouterRegistryMetaData contains all meta data concerning the RouterRegistry contract. +var RouterRegistryMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"manager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"RouterRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"RouterRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"RouterUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ROUTER_REGISTERER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ROUTER_REMOVER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ROUTER_UPDATE_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRUSTED_FORWARDER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint24[]\",\"name\":\"networks\",\"type\":\"uint24[]\"},{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"remove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"routerCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"}],\"name\":\"routers\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint24[]\",\"name\":\"networks\",\"type\":\"uint24[]\"},{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"}],\"internalType\":\"structIRouterRegistry.Router\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"routersPaged\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint24[]\",\"name\":\"networks\",\"type\":\"uint24[]\"},{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"}],\"internalType\":\"structIRouterRegistry.Router[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint24[]\",\"name\":\"networks\",\"type\":\"uint24[]\"},{\"internalType\":\"string\",\"name\":\"endpoint\",\"type\":\"string\"}],\"name\":\"update\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// RouterRegistryABI is the input ABI used to generate the binding from. +// Deprecated: Use RouterRegistryMetaData.ABI instead. +var RouterRegistryABI = RouterRegistryMetaData.ABI + +// RouterRegistry is an auto generated Go binding around an Ethereum contract. +type RouterRegistry struct { + RouterRegistryCaller // Read-only binding to the contract + RouterRegistryTransactor // Write-only binding to the contract + RouterRegistryFilterer // Log filterer for contract events +} + +// RouterRegistryCaller is an auto generated read-only Go binding around an Ethereum contract. +type RouterRegistryCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RouterRegistryTransactor is an auto generated write-only Go binding around an Ethereum contract. +type RouterRegistryTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RouterRegistryFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type RouterRegistryFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RouterRegistrySession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type RouterRegistrySession struct { + Contract *RouterRegistry // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// RouterRegistryCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type RouterRegistryCallerSession struct { + Contract *RouterRegistryCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// RouterRegistryTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type RouterRegistryTransactorSession struct { + Contract *RouterRegistryTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// RouterRegistryRaw is an auto generated low-level Go binding around an Ethereum contract. +type RouterRegistryRaw struct { + Contract *RouterRegistry // Generic contract binding to access the raw methods on +} + +// RouterRegistryCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type RouterRegistryCallerRaw struct { + Contract *RouterRegistryCaller // Generic read-only contract binding to access the raw methods on +} + +// RouterRegistryTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type RouterRegistryTransactorRaw struct { + Contract *RouterRegistryTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewRouterRegistry creates a new instance of RouterRegistry, bound to a specific deployed contract. +func NewRouterRegistry(address common.Address, backend bind.ContractBackend) (*RouterRegistry, error) { + contract, err := bindRouterRegistry(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &RouterRegistry{RouterRegistryCaller: RouterRegistryCaller{contract: contract}, RouterRegistryTransactor: RouterRegistryTransactor{contract: contract}, RouterRegistryFilterer: RouterRegistryFilterer{contract: contract}}, nil +} + +// NewRouterRegistryCaller creates a new read-only instance of RouterRegistry, bound to a specific deployed contract. +func NewRouterRegistryCaller(address common.Address, caller bind.ContractCaller) (*RouterRegistryCaller, error) { + contract, err := bindRouterRegistry(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &RouterRegistryCaller{contract: contract}, nil +} + +// NewRouterRegistryTransactor creates a new write-only instance of RouterRegistry, bound to a specific deployed contract. +func NewRouterRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*RouterRegistryTransactor, error) { + contract, err := bindRouterRegistry(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &RouterRegistryTransactor{contract: contract}, nil +} + +// NewRouterRegistryFilterer creates a new log filterer instance of RouterRegistry, bound to a specific deployed contract. +func NewRouterRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*RouterRegistryFilterer, error) { + contract, err := bindRouterRegistry(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &RouterRegistryFilterer{contract: contract}, nil +} + +// bindRouterRegistry binds a generic wrapper to an already deployed contract. +func bindRouterRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := RouterRegistryMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_RouterRegistry *RouterRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _RouterRegistry.Contract.RouterRegistryCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_RouterRegistry *RouterRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RouterRegistry.Contract.RouterRegistryTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_RouterRegistry *RouterRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _RouterRegistry.Contract.RouterRegistryTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_RouterRegistry *RouterRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _RouterRegistry.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_RouterRegistry *RouterRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RouterRegistry.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_RouterRegistry *RouterRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _RouterRegistry.Contract.contract.Transact(opts, method, params...) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistrySession) DEFAULTADMINROLE() ([32]byte, error) { + return _RouterRegistry.Contract.DEFAULTADMINROLE(&_RouterRegistry.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCallerSession) DEFAULTADMINROLE() ([32]byte, error) { + return _RouterRegistry.Contract.DEFAULTADMINROLE(&_RouterRegistry.CallOpts) +} + +// ROUTERREGISTERERROLE is a free data retrieval call binding the contract method 0x1916b5f7. +// +// Solidity: function ROUTER_REGISTERER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCaller) ROUTERREGISTERERROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "ROUTER_REGISTERER_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ROUTERREGISTERERROLE is a free data retrieval call binding the contract method 0x1916b5f7. +// +// Solidity: function ROUTER_REGISTERER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistrySession) ROUTERREGISTERERROLE() ([32]byte, error) { + return _RouterRegistry.Contract.ROUTERREGISTERERROLE(&_RouterRegistry.CallOpts) +} + +// ROUTERREGISTERERROLE is a free data retrieval call binding the contract method 0x1916b5f7. +// +// Solidity: function ROUTER_REGISTERER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCallerSession) ROUTERREGISTERERROLE() ([32]byte, error) { + return _RouterRegistry.Contract.ROUTERREGISTERERROLE(&_RouterRegistry.CallOpts) +} + +// ROUTERREMOVERROLE is a free data retrieval call binding the contract method 0x7a97d02d. +// +// Solidity: function ROUTER_REMOVER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCaller) ROUTERREMOVERROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "ROUTER_REMOVER_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ROUTERREMOVERROLE is a free data retrieval call binding the contract method 0x7a97d02d. +// +// Solidity: function ROUTER_REMOVER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistrySession) ROUTERREMOVERROLE() ([32]byte, error) { + return _RouterRegistry.Contract.ROUTERREMOVERROLE(&_RouterRegistry.CallOpts) +} + +// ROUTERREMOVERROLE is a free data retrieval call binding the contract method 0x7a97d02d. +// +// Solidity: function ROUTER_REMOVER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCallerSession) ROUTERREMOVERROLE() ([32]byte, error) { + return _RouterRegistry.Contract.ROUTERREMOVERROLE(&_RouterRegistry.CallOpts) +} + +// ROUTERUPDATEROLE is a free data retrieval call binding the contract method 0x5487d3ce. +// +// Solidity: function ROUTER_UPDATE_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCaller) ROUTERUPDATEROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "ROUTER_UPDATE_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ROUTERUPDATEROLE is a free data retrieval call binding the contract method 0x5487d3ce. +// +// Solidity: function ROUTER_UPDATE_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistrySession) ROUTERUPDATEROLE() ([32]byte, error) { + return _RouterRegistry.Contract.ROUTERUPDATEROLE(&_RouterRegistry.CallOpts) +} + +// ROUTERUPDATEROLE is a free data retrieval call binding the contract method 0x5487d3ce. +// +// Solidity: function ROUTER_UPDATE_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCallerSession) ROUTERUPDATEROLE() ([32]byte, error) { + return _RouterRegistry.Contract.ROUTERUPDATEROLE(&_RouterRegistry.CallOpts) +} + +// TRUSTEDFORWARDERROLE is a free data retrieval call binding the contract method 0x00cba943. +// +// Solidity: function TRUSTED_FORWARDER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCaller) TRUSTEDFORWARDERROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "TRUSTED_FORWARDER_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// TRUSTEDFORWARDERROLE is a free data retrieval call binding the contract method 0x00cba943. +// +// Solidity: function TRUSTED_FORWARDER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistrySession) TRUSTEDFORWARDERROLE() ([32]byte, error) { + return _RouterRegistry.Contract.TRUSTEDFORWARDERROLE(&_RouterRegistry.CallOpts) +} + +// TRUSTEDFORWARDERROLE is a free data retrieval call binding the contract method 0x00cba943. +// +// Solidity: function TRUSTED_FORWARDER_ROLE() view returns(bytes32) +func (_RouterRegistry *RouterRegistryCallerSession) TRUSTEDFORWARDERROLE() ([32]byte, error) { + return _RouterRegistry.Contract.TRUSTEDFORWARDERROLE(&_RouterRegistry.CallOpts) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_RouterRegistry *RouterRegistryCaller) GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "getRoleAdmin", role) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_RouterRegistry *RouterRegistrySession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _RouterRegistry.Contract.GetRoleAdmin(&_RouterRegistry.CallOpts, role) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role) view returns(bytes32) +func (_RouterRegistry *RouterRegistryCallerSession) GetRoleAdmin(role [32]byte) ([32]byte, error) { + return _RouterRegistry.Contract.GetRoleAdmin(&_RouterRegistry.CallOpts, role) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_RouterRegistry *RouterRegistryCaller) HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "hasRole", role, account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_RouterRegistry *RouterRegistrySession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _RouterRegistry.Contract.HasRole(&_RouterRegistry.CallOpts, role, account) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role, address account) view returns(bool) +func (_RouterRegistry *RouterRegistryCallerSession) HasRole(role [32]byte, account common.Address) (bool, error) { + return _RouterRegistry.Contract.HasRole(&_RouterRegistry.CallOpts, role, account) +} + +// RouterCount is a free data retrieval call binding the contract method 0x8e67e049. +// +// Solidity: function routerCount() view returns(uint256) +func (_RouterRegistry *RouterRegistryCaller) RouterCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "routerCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// RouterCount is a free data retrieval call binding the contract method 0x8e67e049. +// +// Solidity: function routerCount() view returns(uint256) +func (_RouterRegistry *RouterRegistrySession) RouterCount() (*big.Int, error) { + return _RouterRegistry.Contract.RouterCount(&_RouterRegistry.CallOpts) +} + +// RouterCount is a free data retrieval call binding the contract method 0x8e67e049. +// +// Solidity: function routerCount() view returns(uint256) +func (_RouterRegistry *RouterRegistryCallerSession) RouterCount() (*big.Int, error) { + return _RouterRegistry.Contract.RouterCount(&_RouterRegistry.CallOpts) +} + +// Routers is a free data retrieval call binding the contract method 0xaa1fce69. +// +// Solidity: function routers(bytes32 id) view returns((bytes32,address,uint24[],string)) +func (_RouterRegistry *RouterRegistryCaller) Routers(opts *bind.CallOpts, id [32]byte) (IRouterRegistryRouter, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "routers", id) + + if err != nil { + return *new(IRouterRegistryRouter), err + } + + out0 := *abi.ConvertType(out[0], new(IRouterRegistryRouter)).(*IRouterRegistryRouter) + + return out0, err + +} + +// Routers is a free data retrieval call binding the contract method 0xaa1fce69. +// +// Solidity: function routers(bytes32 id) view returns((bytes32,address,uint24[],string)) +func (_RouterRegistry *RouterRegistrySession) Routers(id [32]byte) (IRouterRegistryRouter, error) { + return _RouterRegistry.Contract.Routers(&_RouterRegistry.CallOpts, id) +} + +// Routers is a free data retrieval call binding the contract method 0xaa1fce69. +// +// Solidity: function routers(bytes32 id) view returns((bytes32,address,uint24[],string)) +func (_RouterRegistry *RouterRegistryCallerSession) Routers(id [32]byte) (IRouterRegistryRouter, error) { + return _RouterRegistry.Contract.Routers(&_RouterRegistry.CallOpts, id) +} + +// RoutersPaged is a free data retrieval call binding the contract method 0x5c6201eb. +// +// Solidity: function routersPaged(uint256 start, uint256 end) view returns((bytes32,address,uint24[],string)[]) +func (_RouterRegistry *RouterRegistryCaller) RoutersPaged(opts *bind.CallOpts, start *big.Int, end *big.Int) ([]IRouterRegistryRouter, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "routersPaged", start, end) + + if err != nil { + return *new([]IRouterRegistryRouter), err + } + + out0 := *abi.ConvertType(out[0], new([]IRouterRegistryRouter)).(*[]IRouterRegistryRouter) + + return out0, err + +} + +// RoutersPaged is a free data retrieval call binding the contract method 0x5c6201eb. +// +// Solidity: function routersPaged(uint256 start, uint256 end) view returns((bytes32,address,uint24[],string)[]) +func (_RouterRegistry *RouterRegistrySession) RoutersPaged(start *big.Int, end *big.Int) ([]IRouterRegistryRouter, error) { + return _RouterRegistry.Contract.RoutersPaged(&_RouterRegistry.CallOpts, start, end) +} + +// RoutersPaged is a free data retrieval call binding the contract method 0x5c6201eb. +// +// Solidity: function routersPaged(uint256 start, uint256 end) view returns((bytes32,address,uint24[],string)[]) +func (_RouterRegistry *RouterRegistryCallerSession) RoutersPaged(start *big.Int, end *big.Int) ([]IRouterRegistryRouter, error) { + return _RouterRegistry.Contract.RoutersPaged(&_RouterRegistry.CallOpts, start, end) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_RouterRegistry *RouterRegistryCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { + var out []interface{} + err := _RouterRegistry.contract.Call(opts, &out, "supportsInterface", interfaceId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_RouterRegistry *RouterRegistrySession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _RouterRegistry.Contract.SupportsInterface(&_RouterRegistry.CallOpts, interfaceId) +} + +// SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. +// +// Solidity: function supportsInterface(bytes4 interfaceId) view returns(bool) +func (_RouterRegistry *RouterRegistryCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { + return _RouterRegistry.Contract.SupportsInterface(&_RouterRegistry.CallOpts, interfaceId) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistryTransactor) GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.contract.Transact(opts, "grantRole", role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistrySession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.GrantRole(&_RouterRegistry.TransactOpts, role, account) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistryTransactorSession) GrantRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.GrantRole(&_RouterRegistry.TransactOpts, role, account) +} + +// Register is a paid mutator transaction binding the contract method 0x5f46e4b3. +// +// Solidity: function register(bytes32 id, address owner, uint24[] networks, string endpoint) returns() +func (_RouterRegistry *RouterRegistryTransactor) Register(opts *bind.TransactOpts, id [32]byte, owner common.Address, networks []*big.Int, endpoint string) (*types.Transaction, error) { + return _RouterRegistry.contract.Transact(opts, "register", id, owner, networks, endpoint) +} + +// Register is a paid mutator transaction binding the contract method 0x5f46e4b3. +// +// Solidity: function register(bytes32 id, address owner, uint24[] networks, string endpoint) returns() +func (_RouterRegistry *RouterRegistrySession) Register(id [32]byte, owner common.Address, networks []*big.Int, endpoint string) (*types.Transaction, error) { + return _RouterRegistry.Contract.Register(&_RouterRegistry.TransactOpts, id, owner, networks, endpoint) +} + +// Register is a paid mutator transaction binding the contract method 0x5f46e4b3. +// +// Solidity: function register(bytes32 id, address owner, uint24[] networks, string endpoint) returns() +func (_RouterRegistry *RouterRegistryTransactorSession) Register(id [32]byte, owner common.Address, networks []*big.Int, endpoint string) (*types.Transaction, error) { + return _RouterRegistry.Contract.Register(&_RouterRegistry.TransactOpts, id, owner, networks, endpoint) +} + +// Remove is a paid mutator transaction binding the contract method 0x2874528e. +// +// Solidity: function remove(bytes32 id, address owner) returns() +func (_RouterRegistry *RouterRegistryTransactor) Remove(opts *bind.TransactOpts, id [32]byte, owner common.Address) (*types.Transaction, error) { + return _RouterRegistry.contract.Transact(opts, "remove", id, owner) +} + +// Remove is a paid mutator transaction binding the contract method 0x2874528e. +// +// Solidity: function remove(bytes32 id, address owner) returns() +func (_RouterRegistry *RouterRegistrySession) Remove(id [32]byte, owner common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.Remove(&_RouterRegistry.TransactOpts, id, owner) +} + +// Remove is a paid mutator transaction binding the contract method 0x2874528e. +// +// Solidity: function remove(bytes32 id, address owner) returns() +func (_RouterRegistry *RouterRegistryTransactorSession) Remove(id [32]byte, owner common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.Remove(&_RouterRegistry.TransactOpts, id, owner) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistryTransactor) RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.contract.Transact(opts, "renounceRole", role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistrySession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.RenounceRole(&_RouterRegistry.TransactOpts, role, account) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistryTransactorSession) RenounceRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.RenounceRole(&_RouterRegistry.TransactOpts, role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistryTransactor) RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.contract.Transact(opts, "revokeRole", role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistrySession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.RevokeRole(&_RouterRegistry.TransactOpts, role, account) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role, address account) returns() +func (_RouterRegistry *RouterRegistryTransactorSession) RevokeRole(role [32]byte, account common.Address) (*types.Transaction, error) { + return _RouterRegistry.Contract.RevokeRole(&_RouterRegistry.TransactOpts, role, account) +} + +// Update is a paid mutator transaction binding the contract method 0x5bb5b1e6. +// +// Solidity: function update(bytes32 id, address owner, uint24[] networks, string endpoint) returns() +func (_RouterRegistry *RouterRegistryTransactor) Update(opts *bind.TransactOpts, id [32]byte, owner common.Address, networks []*big.Int, endpoint string) (*types.Transaction, error) { + return _RouterRegistry.contract.Transact(opts, "update", id, owner, networks, endpoint) +} + +// Update is a paid mutator transaction binding the contract method 0x5bb5b1e6. +// +// Solidity: function update(bytes32 id, address owner, uint24[] networks, string endpoint) returns() +func (_RouterRegistry *RouterRegistrySession) Update(id [32]byte, owner common.Address, networks []*big.Int, endpoint string) (*types.Transaction, error) { + return _RouterRegistry.Contract.Update(&_RouterRegistry.TransactOpts, id, owner, networks, endpoint) +} + +// Update is a paid mutator transaction binding the contract method 0x5bb5b1e6. +// +// Solidity: function update(bytes32 id, address owner, uint24[] networks, string endpoint) returns() +func (_RouterRegistry *RouterRegistryTransactorSession) Update(id [32]byte, owner common.Address, networks []*big.Int, endpoint string) (*types.Transaction, error) { + return _RouterRegistry.Contract.Update(&_RouterRegistry.TransactOpts, id, owner, networks, endpoint) +} + +// RouterRegistryRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the RouterRegistry contract. +type RouterRegistryRoleAdminChangedIterator struct { + Event *RouterRegistryRoleAdminChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RouterRegistryRoleAdminChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRoleAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRoleAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RouterRegistryRoleAdminChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RouterRegistryRoleAdminChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RouterRegistryRoleAdminChanged represents a RoleAdminChanged event raised by the RouterRegistry contract. +type RouterRegistryRoleAdminChanged struct { + Role [32]byte + PreviousAdminRole [32]byte + NewAdminRole [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_RouterRegistry *RouterRegistryFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*RouterRegistryRoleAdminChangedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _RouterRegistry.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + if err != nil { + return nil, err + } + return &RouterRegistryRoleAdminChangedIterator{contract: _RouterRegistry.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil +} + +// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_RouterRegistry *RouterRegistryFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *RouterRegistryRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _RouterRegistry.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RouterRegistryRoleAdminChanged) + if err := _RouterRegistry.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_RouterRegistry *RouterRegistryFilterer) ParseRoleAdminChanged(log types.Log) (*RouterRegistryRoleAdminChanged, error) { + event := new(RouterRegistryRoleAdminChanged) + if err := _RouterRegistry.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RouterRegistryRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the RouterRegistry contract. +type RouterRegistryRoleGrantedIterator struct { + Event *RouterRegistryRoleGranted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RouterRegistryRoleGrantedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRoleGranted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRoleGranted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RouterRegistryRoleGrantedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RouterRegistryRoleGrantedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RouterRegistryRoleGranted represents a RoleGranted event raised by the RouterRegistry contract. +type RouterRegistryRoleGranted struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_RouterRegistry *RouterRegistryFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*RouterRegistryRoleGrantedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _RouterRegistry.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &RouterRegistryRoleGrantedIterator{contract: _RouterRegistry.contract, event: "RoleGranted", logs: logs, sub: sub}, nil +} + +// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_RouterRegistry *RouterRegistryFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *RouterRegistryRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _RouterRegistry.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RouterRegistryRoleGranted) + if err := _RouterRegistry.contract.UnpackLog(event, "RoleGranted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_RouterRegistry *RouterRegistryFilterer) ParseRoleGranted(log types.Log) (*RouterRegistryRoleGranted, error) { + event := new(RouterRegistryRoleGranted) + if err := _RouterRegistry.contract.UnpackLog(event, "RoleGranted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RouterRegistryRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the RouterRegistry contract. +type RouterRegistryRoleRevokedIterator struct { + Event *RouterRegistryRoleRevoked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RouterRegistryRoleRevokedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRoleRevoked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRoleRevoked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RouterRegistryRoleRevokedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RouterRegistryRoleRevokedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RouterRegistryRoleRevoked represents a RoleRevoked event raised by the RouterRegistry contract. +type RouterRegistryRoleRevoked struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_RouterRegistry *RouterRegistryFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*RouterRegistryRoleRevokedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _RouterRegistry.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &RouterRegistryRoleRevokedIterator{contract: _RouterRegistry.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil +} + +// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_RouterRegistry *RouterRegistryFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *RouterRegistryRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _RouterRegistry.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RouterRegistryRoleRevoked) + if err := _RouterRegistry.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_RouterRegistry *RouterRegistryFilterer) ParseRoleRevoked(log types.Log) (*RouterRegistryRoleRevoked, error) { + event := new(RouterRegistryRoleRevoked) + if err := _RouterRegistry.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RouterRegistryRouterRegisteredIterator is returned from FilterRouterRegistered and is used to iterate over the raw logs and unpacked data for RouterRegistered events raised by the RouterRegistry contract. +type RouterRegistryRouterRegisteredIterator struct { + Event *RouterRegistryRouterRegistered // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RouterRegistryRouterRegisteredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRouterRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRouterRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RouterRegistryRouterRegisteredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RouterRegistryRouterRegisteredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RouterRegistryRouterRegistered represents a RouterRegistered event raised by the RouterRegistry contract. +type RouterRegistryRouterRegistered struct { + Id [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRouterRegistered is a free log retrieval operation binding the contract event 0xc8c04b68c2c10643ec3b3d87b29ee62eda2d6e5c929cd2aba791fe90aecc8c1b. +// +// Solidity: event RouterRegistered(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) FilterRouterRegistered(opts *bind.FilterOpts, id [][32]byte) (*RouterRegistryRouterRegisteredIterator, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _RouterRegistry.contract.FilterLogs(opts, "RouterRegistered", idRule) + if err != nil { + return nil, err + } + return &RouterRegistryRouterRegisteredIterator{contract: _RouterRegistry.contract, event: "RouterRegistered", logs: logs, sub: sub}, nil +} + +// WatchRouterRegistered is a free log subscription operation binding the contract event 0xc8c04b68c2c10643ec3b3d87b29ee62eda2d6e5c929cd2aba791fe90aecc8c1b. +// +// Solidity: event RouterRegistered(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) WatchRouterRegistered(opts *bind.WatchOpts, sink chan<- *RouterRegistryRouterRegistered, id [][32]byte) (event.Subscription, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _RouterRegistry.contract.WatchLogs(opts, "RouterRegistered", idRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RouterRegistryRouterRegistered) + if err := _RouterRegistry.contract.UnpackLog(event, "RouterRegistered", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRouterRegistered is a log parse operation binding the contract event 0xc8c04b68c2c10643ec3b3d87b29ee62eda2d6e5c929cd2aba791fe90aecc8c1b. +// +// Solidity: event RouterRegistered(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) ParseRouterRegistered(log types.Log) (*RouterRegistryRouterRegistered, error) { + event := new(RouterRegistryRouterRegistered) + if err := _RouterRegistry.contract.UnpackLog(event, "RouterRegistered", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RouterRegistryRouterRemovedIterator is returned from FilterRouterRemoved and is used to iterate over the raw logs and unpacked data for RouterRemoved events raised by the RouterRegistry contract. +type RouterRegistryRouterRemovedIterator struct { + Event *RouterRegistryRouterRemoved // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RouterRegistryRouterRemovedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRouterRemoved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRouterRemoved) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RouterRegistryRouterRemovedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RouterRegistryRouterRemovedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RouterRegistryRouterRemoved represents a RouterRemoved event raised by the RouterRegistry contract. +type RouterRegistryRouterRemoved struct { + Id [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRouterRemoved is a free log retrieval operation binding the contract event 0x813b69b7582e7b6cbe5fbfb9fbaceeef78bb34c4297b68f138b189e96eebeead. +// +// Solidity: event RouterRemoved(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) FilterRouterRemoved(opts *bind.FilterOpts, id [][32]byte) (*RouterRegistryRouterRemovedIterator, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _RouterRegistry.contract.FilterLogs(opts, "RouterRemoved", idRule) + if err != nil { + return nil, err + } + return &RouterRegistryRouterRemovedIterator{contract: _RouterRegistry.contract, event: "RouterRemoved", logs: logs, sub: sub}, nil +} + +// WatchRouterRemoved is a free log subscription operation binding the contract event 0x813b69b7582e7b6cbe5fbfb9fbaceeef78bb34c4297b68f138b189e96eebeead. +// +// Solidity: event RouterRemoved(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) WatchRouterRemoved(opts *bind.WatchOpts, sink chan<- *RouterRegistryRouterRemoved, id [][32]byte) (event.Subscription, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _RouterRegistry.contract.WatchLogs(opts, "RouterRemoved", idRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RouterRegistryRouterRemoved) + if err := _RouterRegistry.contract.UnpackLog(event, "RouterRemoved", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRouterRemoved is a log parse operation binding the contract event 0x813b69b7582e7b6cbe5fbfb9fbaceeef78bb34c4297b68f138b189e96eebeead. +// +// Solidity: event RouterRemoved(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) ParseRouterRemoved(log types.Log) (*RouterRegistryRouterRemoved, error) { + event := new(RouterRegistryRouterRemoved) + if err := _RouterRegistry.contract.UnpackLog(event, "RouterRemoved", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RouterRegistryRouterUpdatedIterator is returned from FilterRouterUpdated and is used to iterate over the raw logs and unpacked data for RouterUpdated events raised by the RouterRegistry contract. +type RouterRegistryRouterUpdatedIterator struct { + Event *RouterRegistryRouterUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RouterRegistryRouterUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRouterUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RouterRegistryRouterUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RouterRegistryRouterUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RouterRegistryRouterUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RouterRegistryRouterUpdated represents a RouterUpdated event raised by the RouterRegistry contract. +type RouterRegistryRouterUpdated struct { + Id [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRouterUpdated is a free log retrieval operation binding the contract event 0x8af614f5e1bf8bc42df40f6ef41468c010e2f999f579ba0ec3658405ced7451c. +// +// Solidity: event RouterUpdated(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) FilterRouterUpdated(opts *bind.FilterOpts, id [][32]byte) (*RouterRegistryRouterUpdatedIterator, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _RouterRegistry.contract.FilterLogs(opts, "RouterUpdated", idRule) + if err != nil { + return nil, err + } + return &RouterRegistryRouterUpdatedIterator{contract: _RouterRegistry.contract, event: "RouterUpdated", logs: logs, sub: sub}, nil +} + +// WatchRouterUpdated is a free log subscription operation binding the contract event 0x8af614f5e1bf8bc42df40f6ef41468c010e2f999f579ba0ec3658405ced7451c. +// +// Solidity: event RouterUpdated(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) WatchRouterUpdated(opts *bind.WatchOpts, sink chan<- *RouterRegistryRouterUpdated, id [][32]byte) (event.Subscription, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _RouterRegistry.contract.WatchLogs(opts, "RouterUpdated", idRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RouterRegistryRouterUpdated) + if err := _RouterRegistry.contract.UnpackLog(event, "RouterUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRouterUpdated is a log parse operation binding the contract event 0x8af614f5e1bf8bc42df40f6ef41468c010e2f999f579ba0ec3658405ced7451c. +// +// Solidity: event RouterUpdated(bytes32 indexed id) +func (_RouterRegistry *RouterRegistryFilterer) ParseRouterUpdated(log types.Log) (*RouterRegistryRouterUpdated, error) { + event := new(RouterRegistryRouterUpdated) + if err := _RouterRegistry.contract.UnpackLog(event, "RouterUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/check-license.sh b/check-license.sh new file mode 100755 index 0000000..46c5196 --- /dev/null +++ b/check-license.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# Copyright 2022 Stichting ThingsIX Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + + +# Adds a license to all code files, requires the https://github.com/google/addlicense tool to be installed +# Example for Go: addlicense -check -c "Stichting ThingsIX Foundation" -s -ignore "external/**" . | xargs -I %s -- echo "::error file=%s,line=1::Missing license header" +errors=$(addlicense -check -c "Stichting ThingsIX Foundation" -s .) +ret=$? +echo $errors | xargs -I %s -- echo "::error file=%s,line=1::Missing license header" +exit $ret diff --git a/generate-bindings.sh b/generate-bindings.sh new file mode 100755 index 0000000..17be55e --- /dev/null +++ b/generate-bindings.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# Copyright 2022 Stichting ThingsIX Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + + +set -e + +THINGS_TOKEN_SMART_CONTRACT_REPO=git@github.com:ThingsIXFoundation/smart-contracts-evm.git + +generate_bindings() { + local work_dir=$1 + local pkg=$2 + local artifact_file=$(find $work_dir/artifacts -name "$3.json") + local abi_file="$work_dir/$3.abi" + + # extract abi from artifacts file + jq .abi "$artifact_file" > "$abi_file" + + echo "Generate bindings for package $pkg" + + abigen --abi "$abi_file" --pkg $pkg --out "bindings.go" +} + +# clone smart contract repo and install dependencies +work_dir=$(mktemp -d /tmp/thingsix-tokens-XXXXX) +echo "Clone smart contract repo in work directory $work_dir" +git clone $THINGS_TOKEN_SMART_CONTRACT_REPO $work_dir --quiet + +# generate go-bindings for router registry contract +generate_bindings $work_dir router_registry RouterRegistry + +# cleanup work directory +echo "delete work directory" +rm -rf $work_dir + +# install dependencies +echo "tidy go dependencies" +go mod tidy diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..893c0bf --- /dev/null +++ b/generate.go @@ -0,0 +1,18 @@ +// Copyright 2022 Stichting ThingsIX Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +//go:generate ./generate-bindings.sh +package router_registry diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..df59557 --- /dev/null +++ b/go.mod @@ -0,0 +1,23 @@ +module github.com/ThingsIXFoundation/router-registry-go + +go 1.18 + +require github.com/ethereum/go-ethereum v1.10.25 + +require ( + github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/deckarep/golang-set v1.8.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/google/uuid v1.2.0 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/rjeczalik/notify v0.9.1 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/tklauser/go-sysconf v0.3.5 // indirect + github.com/tklauser/numcpus v0.2.2 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ef5e98a --- /dev/null +++ b/go.sum @@ -0,0 +1,53 @@ +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/ethereum/go-ethereum v1.10.25 h1:5dFrKJDnYf8L6/5o42abCE6a9yJm9cs4EJVRyYMr55s= +github.com/ethereum/go-ethereum v1.10.25/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=