diff --git a/Dockerfile b/Dockerfile index 5077fdf..a082b08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.19-alpine as buildbase -WORKDIR /go/src/github.com/rarimo/evm-identity-saver-svc +WORKDIR /go/src/github.com/rarimo/evm-worldcoin-saver-svc COPY vendor . COPY . . @@ -9,13 +9,13 @@ ENV CGO_ENABLED=1 ENV GOOS="linux" RUN apk add build-base -RUN go build -o /usr/local/bin/evm-identity-saver-svc github.com/rarimo/evm-identity-saver-svc +RUN go build -o /usr/local/bin/evm-worldcoin-saver-svc github.com/rarimo/evm-worldcoin-saver-svc ### FROM alpine:3.9 -COPY --from=buildbase /usr/local/bin/evm-identity-saver-svc /usr/local/bin/evm-identity-saver-svc +COPY --from=buildbase /usr/local/bin/evm-worldcoin-saver-svc /usr/local/bin/evm-worldcoin-saver-svc RUN apk add --no-cache ca-certificates -ENTRYPOINT ["evm-identity-saver-svc"] +ENTRYPOINT ["evm-worldcoin-saver-svc"] diff --git a/README.md b/README.md index 8432de7..f33a4c1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# evm-identity-saver-svc +# evm-worldcoin-saver-svc [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -66,10 +66,10 @@ You will also need some environment variables to run: ## Run To start the service (in vote mode) use the following command: ```shell -evm-identity-saver-svc run state-update-voter +evm-worldcoin-saver-svc run state-update-voter ``` To run in full mode: ```shell -evm-identity-saver-svc run state-update-all +evm-worldcoin-saver-svc run state-update-all ``` \ No newline at end of file diff --git a/config.yaml b/config.yaml index 575ce99..9d33f65 100644 --- a/config.yaml +++ b/config.yaml @@ -14,6 +14,7 @@ evm: start_from_block: network_name: block_window: + max_blocks_per_request: broadcaster: addr: "" @@ -32,9 +33,3 @@ subscriber: profiler: enabled: true addr: :8080 - -state_contract_cfg: - issuer_id: ['', ''] - disable_filtration: true - states_per_request: 15 - max_blocks_per_request: 100 \ No newline at end of file diff --git a/go.mod b/go.mod index 4d178cc..7e0123e 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,12 @@ -module github.com/rarimo/evm-identity-saver-svc +module github.com/rarimo/evm-worldcoin-saver-svc go 1.19 require ( github.com/alecthomas/kingpin v2.2.6+incompatible github.com/ethereum/go-ethereum v1.10.26 - github.com/go-redis/redis/v8 v8.11.5 github.com/gogo/protobuf v1.3.3 - github.com/rarimo/rarimo-core v1.0.7-0.20231123231906-566dc0033e75 + github.com/rarimo/rarimo-core v1.0.7-0.20231206161857-c1f9b5f9a6f5 github.com/rarimo/saver-grpc-lib v1.0.0 github.com/spf13/cast v1.5.1 github.com/tendermint/tendermint v0.34.27 @@ -55,7 +54,6 @@ require ( github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/fatih/color v1.13.0 // indirect @@ -110,6 +108,8 @@ require ( github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/olegfomenko/solana-go v1.4.1 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.18.1 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 // indirect diff --git a/go.sum b/go.sum index 9815ea2..37b3c88 100644 --- a/go.sum +++ b/go.sum @@ -697,8 +697,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -777,14 +775,13 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= -github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -881,6 +878,7 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -1131,6 +1129,7 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olegfomenko/solana-go v1.4.1 h1:lDZiikpXjQOuVZY14mpuqqfwy7WJMvHtdS1+qthpOjM= github.com/olegfomenko/solana-go v1.4.1/go.mod h1:UTSTTiLq4f8/gZ0o/00xcbCRdHpKg1JjGaZUh2WC134= @@ -1139,11 +1138,16 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -1200,8 +1204,8 @@ github.com/rarimo/broadcaster-svc v1.0.2 h1:ExQcjjWCRP5+POLDlZHrTD1ffUsBH+Dgv5FA github.com/rarimo/broadcaster-svc v1.0.2/go.mod h1:lYIHy+X4IqQt4eBdtMN/V352H3EV0/gO8G+32SFwUWI= github.com/rarimo/cosmos-sdk v0.46.7 h1:jU2PiWzc+19SF02cXM0O0puKPeH1C6Q6t2lzJ9s1ejc= github.com/rarimo/cosmos-sdk v0.46.7/go.mod h1:fqKqz39U5IlEFb4nbQ72951myztsDzFKKDtffYJ63nk= -github.com/rarimo/rarimo-core v1.0.7-0.20231123231906-566dc0033e75 h1:gCVlgChRHbV6aemA+WM6BDyexRvr/V8MtG7cInwF/k4= -github.com/rarimo/rarimo-core v1.0.7-0.20231123231906-566dc0033e75/go.mod h1:S8d3kZWPFuNsy7llrzUd8Rj92WSCrjSH2YEUD+2A+Ww= +github.com/rarimo/rarimo-core v1.0.7-0.20231206161857-c1f9b5f9a6f5 h1:/waQ2jEJ/ZUQVhpGTOBBvzxPqB5+yQlfjxOsIlVCEvw= +github.com/rarimo/rarimo-core v1.0.7-0.20231206161857-c1f9b5f9a6f5/go.mod h1:S8d3kZWPFuNsy7llrzUd8Rj92WSCrjSH2YEUD+2A+Ww= github.com/rarimo/saver-grpc-lib v1.0.0 h1:MGUVjYg7unmodYczVsLqlqZNkT4CIgKqdo6aQtL1qdE= github.com/rarimo/saver-grpc-lib v1.0.0/go.mod h1:DpugWK5B7Hi0bdC3MPe/9FD2zCxaRwsyykdwxtF1Zgg= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= @@ -1282,6 +1286,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -1524,6 +1529,7 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1643,6 +1649,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1779,6 +1786,7 @@ golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= diff --git a/internal/cli/main.go b/internal/cli/main.go index f624df2..d451c51 100644 --- a/internal/cli/main.go +++ b/internal/cli/main.go @@ -10,13 +10,13 @@ import ( "gitlab.com/distributed_lab/logan/v3" "gitlab.com/distributed_lab/logan/v3/errors" - "github.com/rarimo/evm-identity-saver-svc/internal/services/grpc" - "github.com/rarimo/evm-identity-saver-svc/internal/services/voting" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/services/grpc" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/services/voting" - "github.com/rarimo/evm-identity-saver-svc/internal/services/evm" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/services/evm" "github.com/alecthomas/kingpin" - "github.com/rarimo/evm-identity-saver-svc/internal/config" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/config" "gitlab.com/distributed_lab/kit/kv" ) @@ -32,7 +32,7 @@ func Run(args []string) bool { cfg := config.New(kv.MustFromEnv()) log = cfg.Log() - app := kingpin.New("evm-identity-saver-svc", "") + app := kingpin.New("evm-worldcoin-saver-svc", "") runCmd := app.Command("run", "run command") @@ -71,7 +71,7 @@ func Run(args []string) bool { run(voting.RunVoter, "voter") run(grpc.RunAPI, "grpc-api") - run(evm.RunStateChangeListener, "state-change-listener") + run(evm.RunWorldCoinListener, "state-change-listener") } if profiler := cfg.Profiler(); profiler.Enabled { @@ -86,7 +86,7 @@ func Run(args []string) bool { case stateUpdateVoter.FullCommand(): run(voting.RunVoter, "voter") case stateUpdateSaver.FullCommand(): - run(evm.RunStateChangeListener, "state-change-listener") + run(evm.RunWorldCoinListener, "state-change-listener") default: panic(errors.From(errors.New("unknown command"), logan.F{ "raw_command": cmd, diff --git a/internal/config/cosmos.go b/internal/config/cosmos.go index c656eaa..3640304 100644 --- a/internal/config/cosmos.go +++ b/internal/config/cosmos.go @@ -14,15 +14,15 @@ import ( func (c *config) Cosmos() *grpc.ClientConn { return c.cosmos.Do(func() interface{} { - var config struct { + var cfg struct { Addr string `fig:"addr"` } - if err := figure.Out(&config).From(kv.MustGetStringMap(c.getter, "cosmos")).Please(); err != nil { - panic(errors.Wrap(err, "failed to figure out")) + if err := figure.Out(&cfg).From(kv.MustGetStringMap(c.getter, "cosmos")).Please(); err != nil { + panic(errors.Wrap(err, "failed to figure out cosmos config")) } - con, err := grpc.Dial(config.Addr, grpc.WithInsecure(), grpc.WithKeepaliveParams(keepalive.ClientParameters{ + con, err := grpc.Dial(cfg.Addr, grpc.WithInsecure(), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 10 * time.Second, // wait time before ping if no activity Timeout: 20 * time.Second, // ping timeout })) @@ -36,15 +36,15 @@ func (c *config) Cosmos() *grpc.ClientConn { func (c *config) Tendermint() *http.HTTP { return c.tendermint.Do(func() interface{} { - var config struct { + var cfg struct { Addr string `fig:"addr"` } - if err := figure.Out(&config).From(kv.MustGetStringMap(c.getter, "core")).Please(); err != nil { - panic(errors.Wrap(err, "failed to figure out")) + if err := figure.Out(&cfg).From(kv.MustGetStringMap(c.getter, "core")).Please(); err != nil { + panic(errors.Wrap(err, "failed to figure out core config")) } - client, err := http.New(config.Addr, "/websocket") + client, err := http.New(cfg.Addr, "/websocket") if err != nil { panic(errors.Wrap(err, "failed to create tendermint client")) } diff --git a/internal/config/evm.go b/internal/config/evm.go index 1ce9e06..2bffab2 100644 --- a/internal/config/evm.go +++ b/internal/config/evm.go @@ -13,11 +13,12 @@ import ( ) type Ethereum struct { - ContractAddr common.Address `fig:"contract_addr,required"` - RPCClient *ethclient.Client `fig:"rpc,required"` - StartFromBlock uint64 `fig:"start_from_block"` - NetworkName string `fig:"network_name,required"` - BlockWindow uint64 `fig:"block_window,required"` + ContractAddr common.Address `fig:"contract_addr,required"` + RPCClient *ethclient.Client `fig:"rpc,required"` + StartFromBlock uint64 `fig:"start_from_block"` + NetworkName string `fig:"network_name,required"` + BlockWindow uint64 `fig:"block_window,required"` + MaxBlocksPerRequest uint64 `fig:"max_blocks_per_request"` } func (c *config) Ethereum() *Ethereum { diff --git a/internal/config/main.go b/internal/config/main.go index f91e48a..9eba071 100644 --- a/internal/config/main.go +++ b/internal/config/main.go @@ -20,7 +20,6 @@ type Config interface { Ethereum() *Ethereum Cosmos() *grpc.ClientConn Tendermint() *http.HTTP - States() StateV2Config } type config struct { @@ -33,8 +32,6 @@ type config struct { ethereum comfig.Once cosmos comfig.Once tendermint comfig.Once - states comfig.Once - redis comfig.Once getter kv.Getter } diff --git a/internal/config/redis.go b/internal/config/redis.go deleted file mode 100644 index 8374fc2..0000000 --- a/internal/config/redis.go +++ /dev/null @@ -1,28 +0,0 @@ -package config - -import ( - redis "github.com/go-redis/redis/v8" - "gitlab.com/distributed_lab/figure" - "gitlab.com/distributed_lab/kit/kv" - "gitlab.com/distributed_lab/logan/v3/errors" -) - -type Redis struct { - Addr string `fig:"addr,required"` - Password string `fig:"password"` -} - -func (c *config) Redis() *redis.Client { - return c.redis.Do(func() interface{} { - const serviceName = "redis" - - var cfg Redis - - err := figure.Out(&cfg).From(kv.MustGetStringMap(c.getter, serviceName)).Please() - if err != nil { - panic(errors.Wrap(err, "failed to figure out "+serviceName)) - } - - return redis.NewClient(&redis.Options{Addr: cfg.Addr, Password: cfg.Password}) - }).(*redis.Client) -} diff --git a/internal/config/states.go b/internal/config/states.go deleted file mode 100644 index c9c6d05..0000000 --- a/internal/config/states.go +++ /dev/null @@ -1,29 +0,0 @@ -package config - -import ( - "gitlab.com/distributed_lab/figure" - "gitlab.com/distributed_lab/kit/kv" - "gitlab.com/distributed_lab/logan/v3/errors" -) - -type StateV2Config struct { - IssuerID []string `fig:"issuer_id"` - DisableFiltration bool `fig:"disable_filtration"` - StatesPerRequest int64 `fig:"states_per_request"` - MaxBlocksPerRequest uint64 `fig:"max_blocks_per_request"` -} - -func (c *config) States() StateV2Config { - return c.states.Do(func() interface{} { - const serviceName = "state_contract_cfg" - - var cfg StateV2Config - - err := figure.Out(&cfg).From(kv.MustGetStringMap(c.getter, serviceName)).Please() - if err != nil { - panic(errors.Wrap(err, "failed to figure out "+serviceName)) - } - - return cfg - }).(StateV2Config) -} diff --git a/internal/rarimo/stateupdate.go b/internal/rarimo/stateupdate.go deleted file mode 100644 index 0576568..0000000 --- a/internal/rarimo/stateupdate.go +++ /dev/null @@ -1,210 +0,0 @@ -package rarimo - -import ( - "context" - "math/big" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common/hexutil" - - statebind "github.com/rarimo/evm-identity-saver-svc/pkg/state" - oracletypes "github.com/rarimo/rarimo-core/x/oraclemanager/types" - "gitlab.com/distributed_lab/logan/v3/errors" -) - -type StateDataProvider interface { - GetStateInfoByIdAndState(opts *bind.CallOpts, id *big.Int, state *big.Int) (statebind.IStateStateInfo, error) - GetGISTRootInfo(opts *bind.CallOpts, root *big.Int) (statebind.IStateGistRootInfo, error) - - GetStateInfoHistoryLengthById(opts *bind.CallOpts, id *big.Int) (*big.Int, error) - GetStateInfoHistoryById(opts *bind.CallOpts, id *big.Int, startIndex *big.Int, length *big.Int) ([]statebind.IStateStateInfo, error) - - GetGISTRootHistory(opts *bind.CallOpts, start *big.Int, length *big.Int) ([]statebind.IStateGistRootInfo, error) - GetGISTRootHistoryLength(opts *bind.CallOpts) (*big.Int, error) -} - -type StateUpdateMessageMaker struct { - txCreatorAddr string - contract string - homeChain string - statesPerRequest int64 - stateDataProvider StateDataProvider -} - -func NewStateUpdateMessageMaker(txCreatorAddr string, contract string, homeChain string, statesPerRequest int64, stateDataProvider StateDataProvider) *StateUpdateMessageMaker { - return &StateUpdateMessageMaker{txCreatorAddr: txCreatorAddr, contract: contract, homeChain: homeChain, statesPerRequest: statesPerRequest, stateDataProvider: stateDataProvider} -} - -func (m *StateUpdateMessageMaker) StateUpdateMsgByBlock(ctx context.Context, issuer, block *big.Int) (*oracletypes.MsgCreateIdentityStateTransferOp, error) { - latestState, replacedState, err := m.getStatesOnBlock(ctx, issuer, block) - if err != nil { - return nil, err - } - - if latestState == nil || replacedState == nil { - return nil, nil - } - - return m.StateUpdateMsgByStates(ctx, *latestState, *replacedState) -} - -func (m *StateUpdateMessageMaker) GISTUpdateMsgByBlock(ctx context.Context, block *big.Int) (*oracletypes.MsgCreateIdentityGISTTransferOp, error) { - latestGIST, replacedGIST, err := m.getGISTsOnBlock(ctx, block) - if err != nil { - return nil, err - } - - if latestGIST == nil || replacedGIST == nil { - return nil, nil - } - - return m.GISTUpdateMsgByGISTs(ctx, *latestGIST, *replacedGIST) -} - -func (m *StateUpdateMessageMaker) StateUpdateMsgByHashes(ctx context.Context, issuer, latestStateHash, replacedStateHash string) (*oracletypes.MsgCreateIdentityStateTransferOp, error) { - latestState, err := m.stateDataProvider.GetStateInfoByIdAndState(&bind.CallOpts{ - Context: ctx, - }, new(big.Int).SetBytes(hexutil.MustDecode(issuer)), new(big.Int).SetBytes(hexutil.MustDecode(latestStateHash))) - if err != nil { - return nil, errors.Wrap(err, "failed to get latest state") - } - - replacedState, err := m.stateDataProvider.GetStateInfoByIdAndState(&bind.CallOpts{ - Context: ctx, - }, new(big.Int).SetBytes(hexutil.MustDecode(issuer)), new(big.Int).SetBytes(hexutil.MustDecode(replacedStateHash))) - if err != nil { - return nil, errors.Wrap(err, "failed to get replaced state") - } - - return m.StateUpdateMsgByStates(ctx, latestState, replacedState) -} - -func (m *StateUpdateMessageMaker) GISTUpdateMsgByHashes(ctx context.Context, latestGISTHash, replacedGISTHash string) (*oracletypes.MsgCreateIdentityGISTTransferOp, error) { - latestGIST, err := m.stateDataProvider.GetGISTRootInfo(&bind.CallOpts{ - Context: ctx, - }, new(big.Int).SetBytes(hexutil.MustDecode(latestGISTHash))) - if err != nil { - return nil, errors.Wrap(err, "failed to get latest state") - } - - replacedGIST, err := m.stateDataProvider.GetGISTRootInfo(&bind.CallOpts{ - Context: ctx, - }, new(big.Int).SetBytes(hexutil.MustDecode(replacedGISTHash))) - if err != nil { - return nil, errors.Wrap(err, "failed to get replaced state") - } - - return m.GISTUpdateMsgByGISTs(ctx, latestGIST, replacedGIST) -} - -func (m *StateUpdateMessageMaker) StateUpdateMsgByStates(_ context.Context, latestState, replacedState statebind.IStateStateInfo) (*oracletypes.MsgCreateIdentityStateTransferOp, error) { - if latestState.State.Cmp(replacedState.ReplacedByState) != 0 { - return nil, errors.New("replaced state does not correspond latest state") - } - - return &oracletypes.MsgCreateIdentityStateTransferOp{ - Creator: m.txCreatorAddr, - Contract: m.contract, - Chain: m.homeChain, - Id: hexutil.Encode(latestState.Id.Bytes()), // should be issuer id only - StateHash: hexutil.Encode(latestState.State.Bytes()), - StateCreatedAtTimestamp: latestState.CreatedAtTimestamp.String(), - StateCreatedAtBlock: latestState.CreatedAtBlock.String(), - ReplacedStateHash: hexutil.Encode(replacedState.State.Bytes()), - }, nil -} - -func (m *StateUpdateMessageMaker) GISTUpdateMsgByGISTs(_ context.Context, latestGIST, replacedGIST statebind.IStateGistRootInfo) (*oracletypes.MsgCreateIdentityGISTTransferOp, error) { - if latestGIST.Root.Cmp(replacedGIST.ReplacedByRoot) != 0 { - return nil, errors.New("replaced gist does not correspond latest state") - } - - return &oracletypes.MsgCreateIdentityGISTTransferOp{ - Creator: m.txCreatorAddr, - Contract: m.contract, - Chain: m.homeChain, - GISTHash: hexutil.Encode(latestGIST.Root.Bytes()), - GISTCreatedAtTimestamp: latestGIST.CreatedAtTimestamp.String(), - GISTCreatedAtBlock: latestGIST.CreatedAtBlock.String(), - ReplacedGISTtHash: hexutil.Encode(replacedGIST.Root.Bytes()), - }, nil -} - -func (m *StateUpdateMessageMaker) getStatesOnBlock(ctx context.Context, issuer, block *big.Int) (*statebind.IStateStateInfo, *statebind.IStateStateInfo, error) { - length, err := m.stateDataProvider.GetStateInfoHistoryLengthById(&bind.CallOpts{ - Context: ctx, - }, issuer) - if err != nil { - return nil, nil, errors.Wrap(err, "failed to get overall states count") - } - - if length.Cmp(big.NewInt(m.statesPerRequest)) <= 0 { - // We need more states on contract. Ignore that state transition. - return nil, nil, errors.New("states count less then required") - } - - length = new(big.Int).Sub(length, big.NewInt(m.statesPerRequest)) - - for { - states, err := m.stateDataProvider.GetStateInfoHistoryById(&bind.CallOpts{ - Context: ctx, - }, issuer, length, big.NewInt(m.statesPerRequest)) - - if err != nil { - return nil, nil, errors.Wrap(err, "failed to get last two states") - } - - for i := 1; i < len(states); i++ { - replacedState := states[i-1] - latestState := states[i] - if latestState.CreatedAtBlock.Cmp(block) == 0 { - return &latestState, &replacedState, nil - } - } - - length = new(big.Int).Sub(length, big.NewInt(m.statesPerRequest-1)) - if length.Cmp(big.NewInt(1)) <= 0 { - return nil, nil, errors.Wrap(err, "requested state on block does not exist") - } - } -} - -func (m *StateUpdateMessageMaker) getGISTsOnBlock(ctx context.Context, block *big.Int) (*statebind.IStateGistRootInfo, *statebind.IStateGistRootInfo, error) { - length, err := m.stateDataProvider.GetGISTRootHistoryLength(&bind.CallOpts{ - Context: ctx, - }) - if err != nil { - return nil, nil, errors.Wrap(err, "failed to get overall gists count") - } - - if length.Cmp(big.NewInt(m.statesPerRequest)) <= 0 { - // We need more states on contract. Ignore that state transition. - return nil, nil, errors.New("GISTs count less then required") - } - - length = new(big.Int).Sub(length, big.NewInt(m.statesPerRequest)) - - for { - gists, err := m.stateDataProvider.GetGISTRootHistory(&bind.CallOpts{ - Context: ctx, - }, length, big.NewInt(m.statesPerRequest)) - - if err != nil { - return nil, nil, errors.Wrap(err, "failed to get last two gists") - } - - for i := 1; i < len(gists); i++ { - replacedGIST := gists[i-1] - latestGIST := gists[i] - - if latestGIST.CreatedAtBlock.Cmp(block) == 0 { - return &latestGIST, &replacedGIST, nil - } - } - - length = new(big.Int).Sub(length, big.NewInt(m.statesPerRequest-1)) - if length.Cmp(big.NewInt(1)) <= 0 { - return nil, nil, errors.Wrap(err, "requested gist on block does not exist") - } - } -} diff --git a/internal/services/evm/stateChangeListener.go b/internal/services/evm/stateChangeListener.go deleted file mode 100644 index 78b0940..0000000 --- a/internal/services/evm/stateChangeListener.go +++ /dev/null @@ -1,193 +0,0 @@ -package evm - -import ( - "context" - "math/big" - "time" - - "github.com/rarimo/evm-identity-saver-svc/internal/rarimo" - "gitlab.com/distributed_lab/logan/v3" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/rarimo/evm-identity-saver-svc/internal/config" - statebind "github.com/rarimo/evm-identity-saver-svc/pkg/state" - oracletypes "github.com/rarimo/rarimo-core/x/oraclemanager/types" - "github.com/rarimo/saver-grpc-lib/broadcaster" - "gitlab.com/distributed_lab/logan/v3/errors" - "gitlab.com/distributed_lab/running" -) - -func RunStateChangeListener(ctx context.Context, cfg config.Config) { - const runnerName = "state_change_listener" - - log := cfg.Log().WithField("who", runnerName) - - handler, err := statebind.NewStateLib(cfg.Ethereum().ContractAddr, cfg.Ethereum().RPCClient) - if err != nil { - panic(errors.Wrap(err, "failed to init state change handler")) - } - - stateData, err := statebind.NewStateV2Handler(cfg.Ethereum().ContractAddr, cfg.Ethereum().RPCClient) - if err != nil { - panic(errors.Wrap(err, "failed to init state change handler")) - } - - filtrationDisabled := cfg.States().DisableFiltration - allowList := Map(cfg.States().IssuerID) - - filter := func(id string) bool { - if filtrationDisabled { - return true - } - _, ok := allowList[id] - return ok - } - - listener := stateChangeListener{ - log: log, - broadcaster: cfg.Broadcaster(), - handler: handler, - blockHandler: cfg.Ethereum().RPCClient, - msger: rarimo.NewStateUpdateMessageMaker( - cfg.Broadcaster().Sender(), - cfg.Ethereum().ContractAddr.String(), - cfg.Ethereum().NetworkName, - cfg.States().StatesPerRequest, - stateData, - ), - filter: filter, - fromBlock: cfg.Ethereum().StartFromBlock, - blockWindow: cfg.Ethereum().BlockWindow, - maxBlocks: cfg.States().MaxBlocksPerRequest, - } - - running.WithBackOff(ctx, log, runnerName, - listener.subscription, - 30*time.Second, 5*time.Second, 30*time.Second) -} - -type stateUpdateMsger interface { - StateUpdateMsgByBlock(ctx context.Context, issuer, block *big.Int) (*oracletypes.MsgCreateIdentityStateTransferOp, error) - GISTUpdateMsgByBlock(ctx context.Context, block *big.Int) (*oracletypes.MsgCreateIdentityGISTTransferOp, error) -} - -type blockHandler interface { - BlockNumber(ctx context.Context) (uint64, error) -} - -type stateChangeListener struct { - log *logan.Entry - handler *statebind.StateLib - broadcaster broadcaster.Broadcaster - msger stateUpdateMsger - blockHandler blockHandler - - filter func(string) bool - fromBlock uint64 - blockWindow uint64 - maxBlocks uint64 -} - -func (l *stateChangeListener) subscription(ctx context.Context) error { - lastBlock, err := l.blockHandler.BlockNumber(ctx) - if err != nil { - return errors.Wrap(err, "failed to get recent block") - } - - lastBlock -= l.blockWindow - - if lastBlock < l.fromBlock { - l.log.Infof("Skipping window: start %d > finish %d", l.fromBlock, lastBlock) - return nil - } - - if l.fromBlock+l.maxBlocks < lastBlock { - l.log.Debugf("maxBlockPerRequest limit exceeded: setting last block to %d instead of %d", l.fromBlock+l.maxBlocks, lastBlock) - lastBlock = l.fromBlock + l.maxBlocks - } - - l.log.Infof("Starting subscription from %d to %d", l.fromBlock, lastBlock) - defer l.log.Info("Subscription finished") - - const chanelBufSize = 10 - sink := make(chan *statebind.StateLibStateUpdated, chanelBufSize) - defer close(sink) - - iter, err := l.handler.FilterStateUpdated(&bind.FilterOpts{ - Start: l.fromBlock, - End: &lastBlock, - Context: ctx, - }) - - if err != nil { - return errors.Wrap(err, "failed to filter state update events") - } - - defer func() { - // https://ethereum.stackexchange.com/questions/8199/are-both-the-eth-newfilter-from-to-fields-inclusive - // End in FilterLogs is inclusive - l.fromBlock = lastBlock + 1 - }() - - for iter.Next() { - e := iter.Event - - if e == nil { - l.log.Error("got nil event") - continue - } - - l.log.WithFields(logan.F{ - "tx_hash": e.Raw.TxHash, - "tx_index": e.Raw.TxIndex, - "log_index": e.Raw.Index, - }).Debugf("got event: id: %s block: %s timestamp: %s state: %s", e.Id.String(), e.BlockN.String(), e.Timestamp.String(), e.State.String()) - - msg1, err := l.msger.GISTUpdateMsgByBlock(ctx, e.BlockN) - if err != nil { - l.log.WithError(err).WithField("tx_hash", e.Raw.TxHash.String()).Error("failed to craft GIST updated msg") - continue - } - - if msg1 == nil { - l.log.WithField("tx_hash", e.Raw.TxHash.String()).Info("ignoring that GIST transition") - continue - } - - if err := l.broadcaster.BroadcastTx(ctx, msg1); err != nil { - l.log.WithError(err).WithField("tx_hash", e.Raw.TxHash.String()).Error(err, "failed to broadcast GIST updated msg") - continue - } - - if !l.filter(e.Id.String()) { - l.log.WithField("tx_hash", e.Raw.TxHash.String()).Info("Issuer ID is not supported for state update messages") - return nil - } - - msg, err := l.msger.StateUpdateMsgByBlock(ctx, e.Id, e.BlockN) - if err != nil { - l.log.WithError(err).WithField("tx_hash", e.Raw.TxHash.String()).Error("failed to craft state updated msg") - continue - } - - if msg == nil { - l.log.WithField("tx_hash", e.Raw.TxHash.String()).Info("ignoring that state transition") - continue - } - - if err := l.broadcaster.BroadcastTx(ctx, msg); err != nil { - l.log.WithError(err).WithField("tx_hash", e.Raw.TxHash.String()).Error(err, "failed to broadcast state updated msg") - continue - } - } - - return nil -} - -func Map[T comparable](arr []T) map[T]struct{} { - res := make(map[T]struct{}) - for _, v := range arr { - res[v] = struct{}{} - } - return res -} diff --git a/internal/services/evm/tree_changed_listener.go b/internal/services/evm/tree_changed_listener.go new file mode 100644 index 0000000..db05858 --- /dev/null +++ b/internal/services/evm/tree_changed_listener.go @@ -0,0 +1,163 @@ +package evm + +import ( + "context" + "fmt" + "math/big" + "strconv" + "time" + + "github.com/ethereum/go-ethereum/common/hexutil" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/rarimo/evm-worldcoin-saver-svc/pkg/worldid" + "gitlab.com/distributed_lab/logan/v3" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/config" + oracletypes "github.com/rarimo/rarimo-core/x/oraclemanager/types" + "github.com/rarimo/saver-grpc-lib/broadcaster" + "gitlab.com/distributed_lab/logan/v3/errors" + "gitlab.com/distributed_lab/running" +) + +type listener struct { + log *logan.Entry + filter filterer + broadcaster broadcaster.Broadcaster + block blockGetter + listenerCfg +} + +type listenerCfg struct { + txCreatorAddr string + homeChain string + fromBlock uint64 + blockWindow uint64 + maxBlocks uint64 +} + +type filterer interface { + FilterTreeChanged(*bind.FilterOpts, []*big.Int, []uint8, []*big.Int) (*worldid.WorldIdTreeChangedIterator, error) +} + +type blockGetter interface { + BlockNumber(context.Context) (uint64, error) + HeaderByNumber(context.Context, *big.Int) (*ethtypes.Header, error) +} + +func RunWorldCoinListener(ctx context.Context, cfg config.Config) { + const runnerName = "worldcoin_listener" + log := cfg.Log().WithField("who", runnerName) + + handler, err := worldid.NewWorldIdFilterer(cfg.Ethereum().ContractAddr, cfg.Ethereum().RPCClient) + if err != nil { + panic(errors.Wrap(err, "failed to init WorldCoin tree change filterer")) + } + + l := listener{ + log: log, + broadcaster: cfg.Broadcaster(), + filter: handler, + block: cfg.Ethereum().RPCClient, + listenerCfg: listenerCfg{ + txCreatorAddr: cfg.Broadcaster().Sender(), + homeChain: cfg.Ethereum().NetworkName, + fromBlock: cfg.Ethereum().StartFromBlock, + blockWindow: cfg.Ethereum().BlockWindow, + maxBlocks: cfg.Ethereum().MaxBlocksPerRequest, + }, + } + + running.WithBackOff(ctx, log, runnerName, + l.subscription, + 30*time.Second, 5*time.Second, 30*time.Second) +} + +func (l *listener) subscription(ctx context.Context) error { + lastBlock, err := l.defineLastBlock(ctx) + if err != nil { + return fmt.Errorf("failed to define last block: %w", err) + } + + l.log.Infof("Starting subscription from %d to %d", l.fromBlock, lastBlock) + defer l.log.Info("Subscription finished") + + iter, err := l.filter.FilterTreeChanged(&bind.FilterOpts{ + Start: l.fromBlock, + End: &lastBlock, + Context: ctx, + }, nil, nil, nil) + if err != nil { + return fmt.Errorf("failed to filter WorldID TreeChanged events: %w", err) + } + + l.processEvents(ctx, iter) + // https://ethereum.stackexchange.com/questions/8199/are-both-the-eth-newfilter-from-to-fields-inclusive + // End in FilterLogs is inclusive + l.fromBlock = lastBlock + 1 + return nil +} + +func (l *listener) defineLastBlock(ctx context.Context) (uint64, error) { + lastBlock, err := l.block.BlockNumber(ctx) + if err != nil { + return 0, fmt.Errorf("failed to get latest block number: %w", err) + } + + lastBlock -= l.blockWindow + if lastBlock < l.fromBlock { + l.log.Infof("Skipping window: start %d > finish %d", l.fromBlock, lastBlock) + return 0, nil + } + + if l.fromBlock+l.maxBlocks < lastBlock { + l.log.Debugf("maxBlockPerRequest limit would be exceeded: setting last block to %d instead of %d", l.fromBlock+l.maxBlocks, lastBlock) + lastBlock = l.fromBlock + l.maxBlocks + } + + return lastBlock, nil +} + +func (l *listener) processEvents(ctx context.Context, iter *worldid.WorldIdTreeChangedIterator) { + for iter.Next() { + evt := iter.Event + if evt == nil { + l.log.Error("got nil event") + continue + } + + l.log.WithFields(logan.F{ + "tx_hash": evt.Raw.TxHash, + "tx_index": evt.Raw.TxIndex, + "log_index": evt.Raw.Index, + }).Debugf("Got event: preRoot=%s kind=%d postRoot=%s", evt.PreRoot, evt.Kind, evt.PostRoot) + + msg, err := l.msgFromEvent(ctx, evt) + if err != nil { + l.log.WithError(err).WithField("tx_hash", evt.Raw.TxHash.String()).Error("failed to convert event to WorldCoin msg") + continue + } + + if err = l.broadcaster.BroadcastTx(ctx, msg); err != nil { + l.log.WithError(err).WithField("tx_hash", evt.Raw.TxHash.String()).Error(err, "failed to broadcast WorldCoin identity transfer msg") + continue + } + } +} + +func (l *listener) msgFromEvent(ctx context.Context, evt *worldid.WorldIdTreeChanged) (*oracletypes.MsgCreateWorldCoinIdentityTransferOp, error) { + num := new(big.Int).SetUint64(evt.Raw.BlockNumber) + header, err := l.block.HeaderByNumber(ctx, num) + if err != nil { + return nil, fmt.Errorf("failed to get block header by number from event: %w", err) + } + + return &oracletypes.MsgCreateWorldCoinIdentityTransferOp{ + Creator: l.txCreatorAddr, + Contract: evt.Raw.Address.String(), + Chain: l.homeChain, + PrevState: hexutil.EncodeBig(evt.PreRoot), + State: hexutil.EncodeBig(evt.PostRoot), + Timestamp: strconv.FormatUint(header.Time, 10), + }, nil +} diff --git a/internal/services/grpc/grpc_impl.go b/internal/services/grpc/grpc_impl.go index ad4adb9..cd30375 100644 --- a/internal/services/grpc/grpc_impl.go +++ b/internal/services/grpc/grpc_impl.go @@ -4,8 +4,8 @@ import ( "context" "net" - "github.com/rarimo/evm-identity-saver-svc/internal/config" - "github.com/rarimo/evm-identity-saver-svc/internal/services/voting" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/config" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/services/voting" rarimotypes "github.com/rarimo/rarimo-core/x/rarimocore/types" lib "github.com/rarimo/saver-grpc-lib/grpc" "github.com/rarimo/saver-grpc-lib/voter" @@ -37,8 +37,7 @@ func RunAPI(ctx context.Context, cfg config.Config) { cfg.Log().WithField("who", "grpc-voter"), cfg.Broadcaster(), map[rarimotypes.OpType]voter.Verifier{ - rarimotypes.OpType_IDENTITY_STATE_TRANSFER: voting.NewStateUpdateVerifier(cfg), - rarimotypes.OpType_IDENTITY_GIST_TRANSFER: voting.NewGISTUpdateVerifier(cfg), + rarimotypes.OpType_WORLDCOIN_IDENTITY_TRANSFER: voting.NewWorldCoinVerifier(cfg), }, ), }) diff --git a/internal/services/voting/main.go b/internal/services/voting/main.go index fabc35c..d4bb481 100644 --- a/internal/services/voting/main.go +++ b/internal/services/voting/main.go @@ -5,24 +5,17 @@ import ( "sync" "time" - "github.com/rarimo/evm-identity-saver-svc/internal/config" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/config" rarimocore "github.com/rarimo/rarimo-core/x/rarimocore/types" "github.com/rarimo/saver-grpc-lib/voter" "gitlab.com/distributed_lab/running" ) -const ( - OpQueryGISTUpdate = "tm.event='Tx' AND new_operation.operation_type='IDENTITY_GIST_TRANSFER'" - OpQueryStateUpdate = "tm.event='Tx' AND new_operation.operation_type='IDENTITY_STATE_TRANSFER'" -) +const opQueryWorldCoin = "tm.event='Tx' AND new_operation.operation_type='WORLDCOIN_IDENTITY_TRANSFER'" func RunVoter(ctx context.Context, cfg config.Config) { - gistV := NewGISTUpdateVerifier(cfg) - stateV := NewStateUpdateVerifier(cfg) - v := voter.NewVoter(cfg.Ethereum().NetworkName, cfg.Log(), cfg.Broadcaster(), map[rarimocore.OpType]voter.Verifier{ - rarimocore.OpType_IDENTITY_STATE_TRANSFER: stateV, - rarimocore.OpType_IDENTITY_GIST_TRANSFER: gistV, + rarimocore.OpType_WORLDCOIN_IDENTITY_TRANSFER: NewWorldCoinVerifier(cfg), }) // catchup tends to panic on startup and doesn't handle it by itself, so we wrap it into retry loop @@ -30,7 +23,6 @@ func RunVoter(ctx context.Context, cfg config.Config) { voter. NewCatchupper(cfg.Cosmos(), v, cfg.Log()). Run(ctx) - return true, nil }, 1*time.Second, 5*time.Second) @@ -40,14 +32,7 @@ func RunVoter(ctx context.Context, cfg config.Config) { go func() { defer wg.Done() voter. - NewSubscriber(v, cfg.Tendermint(), cfg.Cosmos(), OpQueryStateUpdate, cfg.Log(), cfg.Subscriber()). - Run(ctx) - }() - - go func() { - defer wg.Done() - voter. - NewSubscriber(v, cfg.Tendermint(), cfg.Cosmos(), OpQueryGISTUpdate, cfg.Log(), cfg.Subscriber()). + NewSubscriber(v, cfg.Tendermint(), cfg.Cosmos(), opQueryWorldCoin, cfg.Log(), cfg.Subscriber()). Run(ctx) }() diff --git a/internal/services/voting/types.go b/internal/services/voting/types.go index abe7034..d9fc157 100644 --- a/internal/services/voting/types.go +++ b/internal/services/voting/types.go @@ -8,5 +8,5 @@ import ( type stateUpdateMsger interface { StateUpdateMsgByHashes(ctx context.Context, issuer, latestStateHash, replacedStateHash string) (*oracletypes.MsgCreateIdentityStateTransferOp, error) - GISTUpdateMsgByHashes(ctx context.Context, latestGISTHash, replacedGISTHash string) (*oracletypes.MsgCreateIdentityGISTTransferOp, error) + WorldCoinMsgByHashes(ctx context.Context, latestGISTHash, replacedGISTHash string) (*oracletypes.MsgCreateWorldCoinIdentityTransferOp, error) } diff --git a/internal/services/voting/vote.go b/internal/services/voting/vote.go new file mode 100644 index 0000000..8c0e6c3 --- /dev/null +++ b/internal/services/voting/vote.go @@ -0,0 +1,78 @@ +package voting + +import ( + "context" + + "github.com/gogo/protobuf/proto" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/config" + oracletypes "github.com/rarimo/rarimo-core/x/oraclemanager/types" + rarimocore "github.com/rarimo/rarimo-core/x/rarimocore/types" + "github.com/rarimo/saver-grpc-lib/voter" + "github.com/rarimo/saver-grpc-lib/voter/verifiers" + "gitlab.com/distributed_lab/logan/v3" + "gitlab.com/distributed_lab/logan/v3/errors" +) + +type WorldCoinVerifier struct { + log *logan.Entry + oracleQueryClient oracletypes.QueryClient +} + +var _ voter.Verifier = &WorldCoinVerifier{} + +func NewWorldCoinVerifier(cfg config.Config) *WorldCoinVerifier { + return &WorldCoinVerifier{ + log: cfg.Log(), + oracleQueryClient: oracletypes.NewQueryClient(cfg.Cosmos()), + } +} + +func (s *WorldCoinVerifier) Verify(ctx context.Context, operation rarimocore.Operation) (rarimocore.VoteType, error) { + if operation.OperationType != rarimocore.OpType_WORLDCOIN_IDENTITY_TRANSFER { + s.log.Debugf("Voted NO: invalid operation type") + return rarimocore.VoteType_NO, verifiers.ErrInvalidOperationType + } + + var op rarimocore.WorldCoinIdentityTransfer + if err := proto.Unmarshal(operation.Details.Value, &op); err != nil { + s.log.Debugf("Voted NO: failed to unmarshal") + return rarimocore.VoteType_NO, err + } + + err := s.verify(ctx, op) + if err == nil { + return rarimocore.VoteType_YES, nil + } + + s.log.WithError(err).Debugf("Voted NO: received an error from verifier") + switch errors.Cause(err) { + case verifiers.ErrUnsupportedNetwork: + return rarimocore.VoteType_NO, verifiers.ErrUnsupportedNetwork + case verifiers.ErrWrongOperationContent: + return rarimocore.VoteType_NO, nil + default: + return rarimocore.VoteType_NO, err + } +} + +func (s *WorldCoinVerifier) verify(ctx context.Context, op rarimocore.WorldCoinIdentityTransfer) error { + // TODO. Get data from Ethereum, then compare with Rarimo op (current logic is wrong) + msg := oracletypes.MsgCreateWorldCoinIdentityTransferOp{ + Contract: op.Contract, + Chain: op.Chain, + PrevState: op.PrevState, + State: op.State, + Timestamp: op.Timestamp, + } + // we can avoid the transfer and just use the op + resp, err := s.oracleQueryClient.WorldCoinIdentityTransfer(ctx, &oracletypes.QueryGetWorldCoinIdentityTransferRequest{Msg: msg}) + if err != nil { + return errors.Wrap(err, "failed to fetch operation details from core") + } + + if !proto.Equal(&resp.Transfer, &op) { + return verifiers.ErrWrongOperationContent + } + + return nil +} diff --git a/internal/services/voting/vote_gist.go b/internal/services/voting/vote_gist.go deleted file mode 100644 index 2038503..0000000 --- a/internal/services/voting/vote_gist.go +++ /dev/null @@ -1,89 +0,0 @@ -package voting - -import ( - "context" - - "github.com/gogo/protobuf/proto" - "github.com/rarimo/evm-identity-saver-svc/internal/config" - "github.com/rarimo/evm-identity-saver-svc/internal/rarimo" - statebind "github.com/rarimo/evm-identity-saver-svc/pkg/state" - oracletypes "github.com/rarimo/rarimo-core/x/oraclemanager/types" - rarimocore "github.com/rarimo/rarimo-core/x/rarimocore/types" - "github.com/rarimo/saver-grpc-lib/voter" - "github.com/rarimo/saver-grpc-lib/voter/verifiers" - "gitlab.com/distributed_lab/logan/v3" - "gitlab.com/distributed_lab/logan/v3/errors" -) - -type GistUpdateVerifier struct { - log *logan.Entry - oracleQueryClient oracletypes.QueryClient - msger stateUpdateMsger -} - -var _ voter.Verifier = &GistUpdateVerifier{} - -func NewGISTUpdateVerifier(cfg config.Config) *GistUpdateVerifier { - stateV2, err := statebind.NewStateV2Handler(cfg.Ethereum().ContractAddr, cfg.Ethereum().RPCClient) - if err != nil { - panic(errors.Wrap(err, "failed to init StateV2 filterer")) - } - - return &GistUpdateVerifier{ - log: cfg.Log(), - oracleQueryClient: oracletypes.NewQueryClient(cfg.Cosmos()), - msger: rarimo.NewStateUpdateMessageMaker( - cfg.Broadcaster().Sender(), - cfg.Ethereum().ContractAddr.String(), - cfg.Ethereum().NetworkName, - cfg.States().StatesPerRequest, - stateV2, - ), - } -} - -func (s *GistUpdateVerifier) Verify(ctx context.Context, operation rarimocore.Operation) (rarimocore.VoteType, error) { - if operation.OperationType != rarimocore.OpType_IDENTITY_GIST_TRANSFER { - s.log.Debugf("Voted NO: invalid operation type") - return rarimocore.VoteType_NO, verifiers.ErrInvalidOperationType - } - - var op rarimocore.IdentityGISTTransfer - if err := proto.Unmarshal(operation.Details.Value, &op); err != nil { - s.log.Debugf("Voted NO: failed to unmarshal") - return rarimocore.VoteType_NO, err - } - - if err := s.verifyIdentityGISTTransfer(ctx, op); err != nil { - s.log.WithError(err).Debugf("Voted NO: received an error from verifier") - switch errors.Cause(err) { - case verifiers.ErrUnsupportedNetwork: - return rarimocore.VoteType_NO, verifiers.ErrUnsupportedNetwork - case verifiers.ErrWrongOperationContent: - return rarimocore.VoteType_NO, nil - default: - return rarimocore.VoteType_NO, err - } - } - - return rarimocore.VoteType_YES, nil - -} - -func (s *GistUpdateVerifier) verifyIdentityGISTTransfer(ctx context.Context, op rarimocore.IdentityGISTTransfer) error { - msg, err := s.msger.GISTUpdateMsgByHashes(ctx, op.GISTHash, op.ReplacedGISTHash) - if err != nil { - return errors.Wrap(err, "failed to get msg") - } - - resp, err := s.oracleQueryClient.IdentityGISTTransfer(ctx, &oracletypes.QueryGetIdentityGISTTransferRequest{Msg: *msg}) - if err != nil { - return errors.Wrap(err, "failed to fetch operation details from core") - } - - if !proto.Equal(&resp.Transfer, &op) { - return verifiers.ErrWrongOperationContent - } - - return nil -} diff --git a/internal/services/voting/vote_state.go b/internal/services/voting/vote_state.go deleted file mode 100644 index 398cfbc..0000000 --- a/internal/services/voting/vote_state.go +++ /dev/null @@ -1,89 +0,0 @@ -package voting - -import ( - "context" - - "github.com/gogo/protobuf/proto" - "github.com/rarimo/evm-identity-saver-svc/internal/config" - "github.com/rarimo/evm-identity-saver-svc/internal/rarimo" - statebind "github.com/rarimo/evm-identity-saver-svc/pkg/state" - oracletypes "github.com/rarimo/rarimo-core/x/oraclemanager/types" - rarimocore "github.com/rarimo/rarimo-core/x/rarimocore/types" - "github.com/rarimo/saver-grpc-lib/voter" - "github.com/rarimo/saver-grpc-lib/voter/verifiers" - "gitlab.com/distributed_lab/logan/v3" - "gitlab.com/distributed_lab/logan/v3/errors" -) - -type StateUpdateVerifier struct { - log *logan.Entry - oracleQueryClient oracletypes.QueryClient - msger stateUpdateMsger -} - -var _ voter.Verifier = &StateUpdateVerifier{} - -func NewStateUpdateVerifier(cfg config.Config) *StateUpdateVerifier { - stateV2, err := statebind.NewStateV2Handler(cfg.Ethereum().ContractAddr, cfg.Ethereum().RPCClient) - if err != nil { - panic(errors.Wrap(err, "failed to init StateV2 filterer")) - } - - return &StateUpdateVerifier{ - log: cfg.Log(), - oracleQueryClient: oracletypes.NewQueryClient(cfg.Cosmos()), - msger: rarimo.NewStateUpdateMessageMaker( - cfg.Broadcaster().Sender(), - cfg.Ethereum().ContractAddr.String(), - cfg.Ethereum().NetworkName, - cfg.States().StatesPerRequest, - stateV2, - ), - } -} - -func (s *StateUpdateVerifier) Verify(ctx context.Context, operation rarimocore.Operation) (rarimocore.VoteType, error) { - if operation.OperationType != rarimocore.OpType_IDENTITY_STATE_TRANSFER { - s.log.Debugf("Voted NO: invalid operation type") - return rarimocore.VoteType_NO, verifiers.ErrInvalidOperationType - } - - var op rarimocore.IdentityStateTransfer - if err := proto.Unmarshal(operation.Details.Value, &op); err != nil { - s.log.Debugf("Voted NO: failed to unmarshal") - return rarimocore.VoteType_NO, err - } - - if err := s.verifyIdentityStateTransfer(ctx, op); err != nil { - s.log.WithError(err).Debugf("Voted NO: received an error from verifier") - switch errors.Cause(err) { - case verifiers.ErrUnsupportedNetwork: - return rarimocore.VoteType_NO, verifiers.ErrUnsupportedNetwork - case verifiers.ErrWrongOperationContent: - return rarimocore.VoteType_NO, nil - default: - return rarimocore.VoteType_NO, err - } - } - - return rarimocore.VoteType_YES, nil - -} - -func (s *StateUpdateVerifier) verifyIdentityStateTransfer(ctx context.Context, transfer rarimocore.IdentityStateTransfer) error { - msg, err := s.msger.StateUpdateMsgByHashes(ctx, transfer.Id, transfer.StateHash, transfer.ReplacedStateHash) - if err != nil { - return errors.Wrap(err, "failed to get msg") - } - - resp, err := s.oracleQueryClient.IdentityStateTransfer(ctx, &oracletypes.QueryGetIdentityStateTransferRequest{Msg: *msg}) - if err != nil { - return errors.Wrap(err, "failed to fetch operation details from core") - } - - if !proto.Equal(&resp.Transfer, &transfer) { - return verifiers.ErrWrongOperationContent - } - - return nil -} diff --git a/main.go b/main.go index e8eb352..8f4e5c3 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,7 @@ package main import ( "os" - "github.com/rarimo/evm-identity-saver-svc/internal/cli" + "github.com/rarimo/evm-worldcoin-saver-svc/internal/cli" ) func main() { diff --git a/pkg/state/state_lib.abi.json b/pkg/state/state_lib.abi.json deleted file mode 100644 index f625ae1..0000000 --- a/pkg/state/state_lib.abi.json +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "blockN", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "state", - "type": "uint256" - } - ], - "name": "StateUpdated", - "type": "event" - }, - { - "inputs": [], - "name": "ID_HISTORY_RETURN_LIMIT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/pkg/state/state_lib.go b/pkg/state/state_lib.go deleted file mode 100644 index 30d4489..0000000 --- a/pkg/state/state_lib.go +++ /dev/null @@ -1,349 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package state - -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 -) - -// StateLibMetaData contains all meta data concerning the StateLib contract. -var StateLibMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockN\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"state\",\"type\":\"uint256\"}],\"name\":\"StateUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ID_HISTORY_RETURN_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// StateLibABI is the input ABI used to generate the binding from. -// Deprecated: Use StateLibMetaData.ABI instead. -var StateLibABI = StateLibMetaData.ABI - -// StateLib is an auto generated Go binding around an Ethereum contract. -type StateLib struct { - StateLibCaller // Read-only binding to the contract - StateLibTransactor // Write-only binding to the contract - StateLibFilterer // Log filterer for contract events -} - -// StateLibCaller is an auto generated read-only Go binding around an Ethereum contract. -type StateLibCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StateLibTransactor is an auto generated write-only Go binding around an Ethereum contract. -type StateLibTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StateLibFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type StateLibFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StateLibSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type StateLibSession struct { - Contract *StateLib // 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 -} - -// StateLibCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type StateLibCallerSession struct { - Contract *StateLibCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// StateLibTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type StateLibTransactorSession struct { - Contract *StateLibTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StateLibRaw is an auto generated low-level Go binding around an Ethereum contract. -type StateLibRaw struct { - Contract *StateLib // Generic contract binding to access the raw methods on -} - -// StateLibCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type StateLibCallerRaw struct { - Contract *StateLibCaller // Generic read-only contract binding to access the raw methods on -} - -// StateLibTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type StateLibTransactorRaw struct { - Contract *StateLibTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewStateLib creates a new instance of StateLib, bound to a specific deployed contract. -func NewStateLib(address common.Address, backend bind.ContractBackend) (*StateLib, error) { - contract, err := bindStateLib(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &StateLib{StateLibCaller: StateLibCaller{contract: contract}, StateLibTransactor: StateLibTransactor{contract: contract}, StateLibFilterer: StateLibFilterer{contract: contract}}, nil -} - -// NewStateLibCaller creates a new read-only instance of StateLib, bound to a specific deployed contract. -func NewStateLibCaller(address common.Address, caller bind.ContractCaller) (*StateLibCaller, error) { - contract, err := bindStateLib(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &StateLibCaller{contract: contract}, nil -} - -// NewStateLibTransactor creates a new write-only instance of StateLib, bound to a specific deployed contract. -func NewStateLibTransactor(address common.Address, transactor bind.ContractTransactor) (*StateLibTransactor, error) { - contract, err := bindStateLib(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &StateLibTransactor{contract: contract}, nil -} - -// NewStateLibFilterer creates a new log filterer instance of StateLib, bound to a specific deployed contract. -func NewStateLibFilterer(address common.Address, filterer bind.ContractFilterer) (*StateLibFilterer, error) { - contract, err := bindStateLib(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &StateLibFilterer{contract: contract}, nil -} - -// bindStateLib binds a generic wrapper to an already deployed contract. -func bindStateLib(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := StateLibMetaData.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 (_StateLib *StateLibRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StateLib.Contract.StateLibCaller.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 (_StateLib *StateLibRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StateLib.Contract.StateLibTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StateLib *StateLibRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StateLib.Contract.StateLibTransactor.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 (_StateLib *StateLibCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StateLib.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 (_StateLib *StateLibTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StateLib.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StateLib *StateLibTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StateLib.Contract.contract.Transact(opts, method, params...) -} - -// IDHISTORYRETURNLIMIT is a free data retrieval call binding the contract method 0xeaa6b26c. -// -// Solidity: function ID_HISTORY_RETURN_LIMIT() view returns(uint256) -func (_StateLib *StateLibCaller) IDHISTORYRETURNLIMIT(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _StateLib.contract.Call(opts, &out, "ID_HISTORY_RETURN_LIMIT") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// IDHISTORYRETURNLIMIT is a free data retrieval call binding the contract method 0xeaa6b26c. -// -// Solidity: function ID_HISTORY_RETURN_LIMIT() view returns(uint256) -func (_StateLib *StateLibSession) IDHISTORYRETURNLIMIT() (*big.Int, error) { - return _StateLib.Contract.IDHISTORYRETURNLIMIT(&_StateLib.CallOpts) -} - -// IDHISTORYRETURNLIMIT is a free data retrieval call binding the contract method 0xeaa6b26c. -// -// Solidity: function ID_HISTORY_RETURN_LIMIT() view returns(uint256) -func (_StateLib *StateLibCallerSession) IDHISTORYRETURNLIMIT() (*big.Int, error) { - return _StateLib.Contract.IDHISTORYRETURNLIMIT(&_StateLib.CallOpts) -} - -// StateLibStateUpdatedIterator is returned from FilterStateUpdated and is used to iterate over the raw logs and unpacked data for StateUpdated events raised by the StateLib contract. -type StateLibStateUpdatedIterator struct { - Event *StateLibStateUpdated // 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 *StateLibStateUpdatedIterator) 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(StateLibStateUpdated) - 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(StateLibStateUpdated) - 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 *StateLibStateUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StateLibStateUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StateLibStateUpdated represents a StateUpdated event raised by the StateLib contract. -type StateLibStateUpdated struct { - Id *big.Int - BlockN *big.Int - Timestamp *big.Int - State *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterStateUpdated is a free log retrieval operation binding the contract event 0x88aef4d78ad30d12a12a98e96007f5b09c1610b5364b2b99960b7d07e00a8838. -// -// Solidity: event StateUpdated(uint256 id, uint256 blockN, uint256 timestamp, uint256 state) -func (_StateLib *StateLibFilterer) FilterStateUpdated(opts *bind.FilterOpts) (*StateLibStateUpdatedIterator, error) { - - logs, sub, err := _StateLib.contract.FilterLogs(opts, "StateUpdated") - if err != nil { - return nil, err - } - return &StateLibStateUpdatedIterator{contract: _StateLib.contract, event: "StateUpdated", logs: logs, sub: sub}, nil -} - -// WatchStateUpdated is a free log subscription operation binding the contract event 0x88aef4d78ad30d12a12a98e96007f5b09c1610b5364b2b99960b7d07e00a8838. -// -// Solidity: event StateUpdated(uint256 id, uint256 blockN, uint256 timestamp, uint256 state) -func (_StateLib *StateLibFilterer) WatchStateUpdated(opts *bind.WatchOpts, sink chan<- *StateLibStateUpdated) (event.Subscription, error) { - - logs, sub, err := _StateLib.contract.WatchLogs(opts, "StateUpdated") - 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(StateLibStateUpdated) - if err := _StateLib.contract.UnpackLog(event, "StateUpdated", 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 -} - -// ParseStateUpdated is a log parse operation binding the contract event 0x88aef4d78ad30d12a12a98e96007f5b09c1610b5364b2b99960b7d07e00a8838. -// -// Solidity: event StateUpdated(uint256 id, uint256 blockN, uint256 timestamp, uint256 state) -func (_StateLib *StateLibFilterer) ParseStateUpdated(log types.Log) (*StateLibStateUpdated, error) { - event := new(StateLibStateUpdated) - if err := _StateLib.contract.UnpackLog(event, "StateUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/pkg/state/state_v2.abi.json b/pkg/state/state_v2.abi.json deleted file mode 100644 index e613633..0000000 --- a/pkg/state/state_v2.abi.json +++ /dev/null @@ -1,1014 +0,0 @@ -[ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferStarted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "VERSION", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getDefaultIdType", - "outputs": [ - { - "internalType": "bytes2", - "name": "", - "type": "bytes2" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "getGISTProof", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "existence", - "type": "bool" - }, - { - "internalType": "uint256[64]", - "name": "siblings", - "type": "uint256[64]" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "auxExistence", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "auxIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "auxValue", - "type": "uint256" - } - ], - "internalType": "struct IState.GistProof", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getGISTProofByBlock", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "existence", - "type": "bool" - }, - { - "internalType": "uint256[64]", - "name": "siblings", - "type": "uint256[64]" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "auxExistence", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "auxIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "auxValue", - "type": "uint256" - } - ], - "internalType": "struct IState.GistProof", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - } - ], - "name": "getGISTProofByRoot", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "existence", - "type": "bool" - }, - { - "internalType": "uint256[64]", - "name": "siblings", - "type": "uint256[64]" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "auxExistence", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "auxIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "auxValue", - "type": "uint256" - } - ], - "internalType": "struct IState.GistProof", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "getGISTProofByTime", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "existence", - "type": "bool" - }, - { - "internalType": "uint256[64]", - "name": "siblings", - "type": "uint256[64]" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "auxExistence", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "auxIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "auxValue", - "type": "uint256" - } - ], - "internalType": "struct IState.GistProof", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGISTRoot", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "length", - "type": "uint256" - } - ], - "name": "getGISTRootHistory", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedByRoot", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct IState.GistRootInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGISTRootHistoryLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - } - ], - "name": "getGISTRootInfo", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedByRoot", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct IState.GistRootInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - } - ], - "name": "getGISTRootInfoByBlock", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedByRoot", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct IState.GistRootInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "getGISTRootInfoByTime", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "root", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedByRoot", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct IState.GistRootInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "getStateInfoById", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "state", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedByState", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct IState.StateInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "state", - "type": "uint256" - } - ], - "name": "getStateInfoByIdAndState", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "state", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedByState", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct IState.StateInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "length", - "type": "uint256" - } - ], - "name": "getStateInfoHistoryById", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "state", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedByState", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "replacedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct IState.StateInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "getStateInfoHistoryLengthById", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getVerifier", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "idExists", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IStateTransitionVerifier", - "name": "verifierContractAddr", - "type": "address" - }, - { - "internalType": "bytes2", - "name": "defaultIdType", - "type": "bytes2" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes2", - "name": "defaultIdType", - "type": "bytes2" - } - ], - "name": "setDefaultIdType", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newVerifierAddr", - "type": "address" - } - ], - "name": "setVerifier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "state", - "type": "uint256" - } - ], - "name": "stateExists", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "oldState", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newState", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isOldStateGenesis", - "type": "bool" - }, - { - "internalType": "uint256[2]", - "name": "a", - "type": "uint256[2]" - }, - { - "internalType": "uint256[2][2]", - "name": "b", - "type": "uint256[2][2]" - }, - { - "internalType": "uint256[2]", - "name": "c", - "type": "uint256[2]" - } - ], - "name": "transitState", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "oldState", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newState", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isOldStateGenesis", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "methodId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "methodParams", - "type": "bytes" - } - ], - "name": "transitStateGeneric", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/pkg/state/state_v2.go b/pkg/state/state_v2.go deleted file mode 100644 index 4237026..0000000 --- a/pkg/state/state_v2.go +++ /dev/null @@ -1,1473 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package state - -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 -) - -// IStateGistProof is an auto generated low-level Go binding around an user-defined struct. -type IStateGistProof struct { - Root *big.Int - Existence bool - Siblings [64]*big.Int - Index *big.Int - Value *big.Int - AuxExistence bool - AuxIndex *big.Int - AuxValue *big.Int -} - -// IStateGistRootInfo is an auto generated low-level Go binding around an user-defined struct. -type IStateGistRootInfo struct { - Root *big.Int - ReplacedByRoot *big.Int - CreatedAtTimestamp *big.Int - ReplacedAtTimestamp *big.Int - CreatedAtBlock *big.Int - ReplacedAtBlock *big.Int -} - -// IStateStateInfo is an auto generated low-level Go binding around an user-defined struct. -type IStateStateInfo struct { - Id *big.Int - State *big.Int - ReplacedByState *big.Int - CreatedAtTimestamp *big.Int - ReplacedAtTimestamp *big.Int - CreatedAtBlock *big.Int - ReplacedAtBlock *big.Int -} - -// StateV2HandlerMetaData contains all meta data concerning the StateV2Handler contract. -var StateV2HandlerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"VERSION\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDefaultIdType\",\"outputs\":[{\"internalType\":\"bytes2\",\"name\":\"\",\"type\":\"bytes2\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getGISTProof\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"existence\",\"type\":\"bool\"},{\"internalType\":\"uint256[64]\",\"name\":\"siblings\",\"type\":\"uint256[64]\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"auxExistence\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"auxIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"auxValue\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistProof\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getGISTProofByBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"existence\",\"type\":\"bool\"},{\"internalType\":\"uint256[64]\",\"name\":\"siblings\",\"type\":\"uint256[64]\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"auxExistence\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"auxIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"auxValue\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistProof\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"}],\"name\":\"getGISTProofByRoot\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"existence\",\"type\":\"bool\"},{\"internalType\":\"uint256[64]\",\"name\":\"siblings\",\"type\":\"uint256[64]\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"auxExistence\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"auxIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"auxValue\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistProof\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getGISTProofByTime\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"existence\",\"type\":\"bool\"},{\"internalType\":\"uint256[64]\",\"name\":\"siblings\",\"type\":\"uint256[64]\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"auxExistence\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"auxIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"auxValue\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistProof\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGISTRoot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"getGISTRootHistory\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedByRoot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtBlock\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistRootInfo[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGISTRootHistoryLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"}],\"name\":\"getGISTRootInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedByRoot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtBlock\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistRootInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getGISTRootInfoByBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedByRoot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtBlock\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistRootInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"getGISTRootInfoByTime\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"root\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedByRoot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtBlock\",\"type\":\"uint256\"}],\"internalType\":\"structIState.GistRootInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getStateInfoById\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"state\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedByState\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtBlock\",\"type\":\"uint256\"}],\"internalType\":\"structIState.StateInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"state\",\"type\":\"uint256\"}],\"name\":\"getStateInfoByIdAndState\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"state\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedByState\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtBlock\",\"type\":\"uint256\"}],\"internalType\":\"structIState.StateInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"getStateInfoHistoryById\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"state\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedByState\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"replacedAtBlock\",\"type\":\"uint256\"}],\"internalType\":\"structIState.StateInfo[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getStateInfoHistoryLengthById\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVerifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"idExists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIStateTransitionVerifier\",\"name\":\"verifierContractAddr\",\"type\":\"address\"},{\"internalType\":\"bytes2\",\"name\":\"defaultIdType\",\"type\":\"bytes2\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes2\",\"name\":\"defaultIdType\",\"type\":\"bytes2\"}],\"name\":\"setDefaultIdType\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newVerifierAddr\",\"type\":\"address\"}],\"name\":\"setVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"state\",\"type\":\"uint256\"}],\"name\":\"stateExists\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oldState\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newState\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isOldStateGenesis\",\"type\":\"bool\"},{\"internalType\":\"uint256[2]\",\"name\":\"a\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2][2]\",\"name\":\"b\",\"type\":\"uint256[2][2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"c\",\"type\":\"uint256[2]\"}],\"name\":\"transitState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oldState\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newState\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isOldStateGenesis\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"methodId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"methodParams\",\"type\":\"bytes\"}],\"name\":\"transitStateGeneric\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// StateV2HandlerABI is the input ABI used to generate the binding from. -// Deprecated: Use StateV2HandlerMetaData.ABI instead. -var StateV2HandlerABI = StateV2HandlerMetaData.ABI - -// StateV2Handler is an auto generated Go binding around an Ethereum contract. -type StateV2Handler struct { - StateV2HandlerCaller // Read-only binding to the contract - StateV2HandlerTransactor // Write-only binding to the contract - StateV2HandlerFilterer // Log filterer for contract events -} - -// StateV2HandlerCaller is an auto generated read-only Go binding around an Ethereum contract. -type StateV2HandlerCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StateV2HandlerTransactor is an auto generated write-only Go binding around an Ethereum contract. -type StateV2HandlerTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StateV2HandlerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type StateV2HandlerFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StateV2HandlerSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type StateV2HandlerSession struct { - Contract *StateV2Handler // 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 -} - -// StateV2HandlerCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type StateV2HandlerCallerSession struct { - Contract *StateV2HandlerCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// StateV2HandlerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type StateV2HandlerTransactorSession struct { - Contract *StateV2HandlerTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StateV2HandlerRaw is an auto generated low-level Go binding around an Ethereum contract. -type StateV2HandlerRaw struct { - Contract *StateV2Handler // Generic contract binding to access the raw methods on -} - -// StateV2HandlerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type StateV2HandlerCallerRaw struct { - Contract *StateV2HandlerCaller // Generic read-only contract binding to access the raw methods on -} - -// StateV2HandlerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type StateV2HandlerTransactorRaw struct { - Contract *StateV2HandlerTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewStateV2Handler creates a new instance of StateV2Handler, bound to a specific deployed contract. -func NewStateV2Handler(address common.Address, backend bind.ContractBackend) (*StateV2Handler, error) { - contract, err := bindStateV2Handler(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &StateV2Handler{StateV2HandlerCaller: StateV2HandlerCaller{contract: contract}, StateV2HandlerTransactor: StateV2HandlerTransactor{contract: contract}, StateV2HandlerFilterer: StateV2HandlerFilterer{contract: contract}}, nil -} - -// NewStateV2HandlerCaller creates a new read-only instance of StateV2Handler, bound to a specific deployed contract. -func NewStateV2HandlerCaller(address common.Address, caller bind.ContractCaller) (*StateV2HandlerCaller, error) { - contract, err := bindStateV2Handler(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &StateV2HandlerCaller{contract: contract}, nil -} - -// NewStateV2HandlerTransactor creates a new write-only instance of StateV2Handler, bound to a specific deployed contract. -func NewStateV2HandlerTransactor(address common.Address, transactor bind.ContractTransactor) (*StateV2HandlerTransactor, error) { - contract, err := bindStateV2Handler(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &StateV2HandlerTransactor{contract: contract}, nil -} - -// NewStateV2HandlerFilterer creates a new log filterer instance of StateV2Handler, bound to a specific deployed contract. -func NewStateV2HandlerFilterer(address common.Address, filterer bind.ContractFilterer) (*StateV2HandlerFilterer, error) { - contract, err := bindStateV2Handler(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &StateV2HandlerFilterer{contract: contract}, nil -} - -// bindStateV2Handler binds a generic wrapper to an already deployed contract. -func bindStateV2Handler(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := StateV2HandlerMetaData.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 (_StateV2Handler *StateV2HandlerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StateV2Handler.Contract.StateV2HandlerCaller.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 (_StateV2Handler *StateV2HandlerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StateV2Handler.Contract.StateV2HandlerTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StateV2Handler *StateV2HandlerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StateV2Handler.Contract.StateV2HandlerTransactor.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 (_StateV2Handler *StateV2HandlerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StateV2Handler.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 (_StateV2Handler *StateV2HandlerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StateV2Handler.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_StateV2Handler *StateV2HandlerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StateV2Handler.Contract.contract.Transact(opts, method, params...) -} - -// VERSION is a free data retrieval call binding the contract method 0xffa1ad74. -// -// Solidity: function VERSION() view returns(string) -func (_StateV2Handler *StateV2HandlerCaller) VERSION(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "VERSION") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -// VERSION is a free data retrieval call binding the contract method 0xffa1ad74. -// -// Solidity: function VERSION() view returns(string) -func (_StateV2Handler *StateV2HandlerSession) VERSION() (string, error) { - return _StateV2Handler.Contract.VERSION(&_StateV2Handler.CallOpts) -} - -// VERSION is a free data retrieval call binding the contract method 0xffa1ad74. -// -// Solidity: function VERSION() view returns(string) -func (_StateV2Handler *StateV2HandlerCallerSession) VERSION() (string, error) { - return _StateV2Handler.Contract.VERSION(&_StateV2Handler.CallOpts) -} - -// GetDefaultIdType is a free data retrieval call binding the contract method 0x133fe385. -// -// Solidity: function getDefaultIdType() view returns(bytes2) -func (_StateV2Handler *StateV2HandlerCaller) GetDefaultIdType(opts *bind.CallOpts) ([2]byte, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getDefaultIdType") - - if err != nil { - return *new([2]byte), err - } - - out0 := *abi.ConvertType(out[0], new([2]byte)).(*[2]byte) - - return out0, err - -} - -// GetDefaultIdType is a free data retrieval call binding the contract method 0x133fe385. -// -// Solidity: function getDefaultIdType() view returns(bytes2) -func (_StateV2Handler *StateV2HandlerSession) GetDefaultIdType() ([2]byte, error) { - return _StateV2Handler.Contract.GetDefaultIdType(&_StateV2Handler.CallOpts) -} - -// GetDefaultIdType is a free data retrieval call binding the contract method 0x133fe385. -// -// Solidity: function getDefaultIdType() view returns(bytes2) -func (_StateV2Handler *StateV2HandlerCallerSession) GetDefaultIdType() ([2]byte, error) { - return _StateV2Handler.Contract.GetDefaultIdType(&_StateV2Handler.CallOpts) -} - -// GetGISTProof is a free data retrieval call binding the contract method 0x3025bb8c. -// -// Solidity: function getGISTProof(uint256 id) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTProof(opts *bind.CallOpts, id *big.Int) (IStateGistProof, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTProof", id) - - if err != nil { - return *new(IStateGistProof), err - } - - out0 := *abi.ConvertType(out[0], new(IStateGistProof)).(*IStateGistProof) - - return out0, err - -} - -// GetGISTProof is a free data retrieval call binding the contract method 0x3025bb8c. -// -// Solidity: function getGISTProof(uint256 id) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetGISTProof(id *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProof(&_StateV2Handler.CallOpts, id) -} - -// GetGISTProof is a free data retrieval call binding the contract method 0x3025bb8c. -// -// Solidity: function getGISTProof(uint256 id) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTProof(id *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProof(&_StateV2Handler.CallOpts, id) -} - -// GetGISTProofByBlock is a free data retrieval call binding the contract method 0x046ff140. -// -// Solidity: function getGISTProofByBlock(uint256 id, uint256 blockNumber) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTProofByBlock(opts *bind.CallOpts, id *big.Int, blockNumber *big.Int) (IStateGistProof, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTProofByBlock", id, blockNumber) - - if err != nil { - return *new(IStateGistProof), err - } - - out0 := *abi.ConvertType(out[0], new(IStateGistProof)).(*IStateGistProof) - - return out0, err - -} - -// GetGISTProofByBlock is a free data retrieval call binding the contract method 0x046ff140. -// -// Solidity: function getGISTProofByBlock(uint256 id, uint256 blockNumber) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetGISTProofByBlock(id *big.Int, blockNumber *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProofByBlock(&_StateV2Handler.CallOpts, id, blockNumber) -} - -// GetGISTProofByBlock is a free data retrieval call binding the contract method 0x046ff140. -// -// Solidity: function getGISTProofByBlock(uint256 id, uint256 blockNumber) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTProofByBlock(id *big.Int, blockNumber *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProofByBlock(&_StateV2Handler.CallOpts, id, blockNumber) -} - -// GetGISTProofByRoot is a free data retrieval call binding the contract method 0xe12a36c0. -// -// Solidity: function getGISTProofByRoot(uint256 id, uint256 root) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTProofByRoot(opts *bind.CallOpts, id *big.Int, root *big.Int) (IStateGistProof, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTProofByRoot", id, root) - - if err != nil { - return *new(IStateGistProof), err - } - - out0 := *abi.ConvertType(out[0], new(IStateGistProof)).(*IStateGistProof) - - return out0, err - -} - -// GetGISTProofByRoot is a free data retrieval call binding the contract method 0xe12a36c0. -// -// Solidity: function getGISTProofByRoot(uint256 id, uint256 root) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetGISTProofByRoot(id *big.Int, root *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProofByRoot(&_StateV2Handler.CallOpts, id, root) -} - -// GetGISTProofByRoot is a free data retrieval call binding the contract method 0xe12a36c0. -// -// Solidity: function getGISTProofByRoot(uint256 id, uint256 root) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTProofByRoot(id *big.Int, root *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProofByRoot(&_StateV2Handler.CallOpts, id, root) -} - -// GetGISTProofByTime is a free data retrieval call binding the contract method 0xd51afebf. -// -// Solidity: function getGISTProofByTime(uint256 id, uint256 timestamp) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTProofByTime(opts *bind.CallOpts, id *big.Int, timestamp *big.Int) (IStateGistProof, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTProofByTime", id, timestamp) - - if err != nil { - return *new(IStateGistProof), err - } - - out0 := *abi.ConvertType(out[0], new(IStateGistProof)).(*IStateGistProof) - - return out0, err - -} - -// GetGISTProofByTime is a free data retrieval call binding the contract method 0xd51afebf. -// -// Solidity: function getGISTProofByTime(uint256 id, uint256 timestamp) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetGISTProofByTime(id *big.Int, timestamp *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProofByTime(&_StateV2Handler.CallOpts, id, timestamp) -} - -// GetGISTProofByTime is a free data retrieval call binding the contract method 0xd51afebf. -// -// Solidity: function getGISTProofByTime(uint256 id, uint256 timestamp) view returns((uint256,bool,uint256[64],uint256,uint256,bool,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTProofByTime(id *big.Int, timestamp *big.Int) (IStateGistProof, error) { - return _StateV2Handler.Contract.GetGISTProofByTime(&_StateV2Handler.CallOpts, id, timestamp) -} - -// GetGISTRoot is a free data retrieval call binding the contract method 0x2439e3a6. -// -// Solidity: function getGISTRoot() view returns(uint256) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTRoot(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTRoot") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetGISTRoot is a free data retrieval call binding the contract method 0x2439e3a6. -// -// Solidity: function getGISTRoot() view returns(uint256) -func (_StateV2Handler *StateV2HandlerSession) GetGISTRoot() (*big.Int, error) { - return _StateV2Handler.Contract.GetGISTRoot(&_StateV2Handler.CallOpts) -} - -// GetGISTRoot is a free data retrieval call binding the contract method 0x2439e3a6. -// -// Solidity: function getGISTRoot() view returns(uint256) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTRoot() (*big.Int, error) { - return _StateV2Handler.Contract.GetGISTRoot(&_StateV2Handler.CallOpts) -} - -// GetGISTRootHistory is a free data retrieval call binding the contract method 0x2f7670e4. -// -// Solidity: function getGISTRootHistory(uint256 start, uint256 length) view returns((uint256,uint256,uint256,uint256,uint256,uint256)[]) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTRootHistory(opts *bind.CallOpts, start *big.Int, length *big.Int) ([]IStateGistRootInfo, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTRootHistory", start, length) - - if err != nil { - return *new([]IStateGistRootInfo), err - } - - out0 := *abi.ConvertType(out[0], new([]IStateGistRootInfo)).(*[]IStateGistRootInfo) - - return out0, err - -} - -// GetGISTRootHistory is a free data retrieval call binding the contract method 0x2f7670e4. -// -// Solidity: function getGISTRootHistory(uint256 start, uint256 length) view returns((uint256,uint256,uint256,uint256,uint256,uint256)[]) -func (_StateV2Handler *StateV2HandlerSession) GetGISTRootHistory(start *big.Int, length *big.Int) ([]IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootHistory(&_StateV2Handler.CallOpts, start, length) -} - -// GetGISTRootHistory is a free data retrieval call binding the contract method 0x2f7670e4. -// -// Solidity: function getGISTRootHistory(uint256 start, uint256 length) view returns((uint256,uint256,uint256,uint256,uint256,uint256)[]) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTRootHistory(start *big.Int, length *big.Int) ([]IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootHistory(&_StateV2Handler.CallOpts, start, length) -} - -// GetGISTRootHistoryLength is a free data retrieval call binding the contract method 0xdccbd57a. -// -// Solidity: function getGISTRootHistoryLength() view returns(uint256) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTRootHistoryLength(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTRootHistoryLength") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetGISTRootHistoryLength is a free data retrieval call binding the contract method 0xdccbd57a. -// -// Solidity: function getGISTRootHistoryLength() view returns(uint256) -func (_StateV2Handler *StateV2HandlerSession) GetGISTRootHistoryLength() (*big.Int, error) { - return _StateV2Handler.Contract.GetGISTRootHistoryLength(&_StateV2Handler.CallOpts) -} - -// GetGISTRootHistoryLength is a free data retrieval call binding the contract method 0xdccbd57a. -// -// Solidity: function getGISTRootHistoryLength() view returns(uint256) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTRootHistoryLength() (*big.Int, error) { - return _StateV2Handler.Contract.GetGISTRootHistoryLength(&_StateV2Handler.CallOpts) -} - -// GetGISTRootInfo is a free data retrieval call binding the contract method 0x7c1a66de. -// -// Solidity: function getGISTRootInfo(uint256 root) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTRootInfo(opts *bind.CallOpts, root *big.Int) (IStateGistRootInfo, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTRootInfo", root) - - if err != nil { - return *new(IStateGistRootInfo), err - } - - out0 := *abi.ConvertType(out[0], new(IStateGistRootInfo)).(*IStateGistRootInfo) - - return out0, err - -} - -// GetGISTRootInfo is a free data retrieval call binding the contract method 0x7c1a66de. -// -// Solidity: function getGISTRootInfo(uint256 root) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetGISTRootInfo(root *big.Int) (IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootInfo(&_StateV2Handler.CallOpts, root) -} - -// GetGISTRootInfo is a free data retrieval call binding the contract method 0x7c1a66de. -// -// Solidity: function getGISTRootInfo(uint256 root) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTRootInfo(root *big.Int) (IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootInfo(&_StateV2Handler.CallOpts, root) -} - -// GetGISTRootInfoByBlock is a free data retrieval call binding the contract method 0x5845e530. -// -// Solidity: function getGISTRootInfoByBlock(uint256 blockNumber) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTRootInfoByBlock(opts *bind.CallOpts, blockNumber *big.Int) (IStateGistRootInfo, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTRootInfoByBlock", blockNumber) - - if err != nil { - return *new(IStateGistRootInfo), err - } - - out0 := *abi.ConvertType(out[0], new(IStateGistRootInfo)).(*IStateGistRootInfo) - - return out0, err - -} - -// GetGISTRootInfoByBlock is a free data retrieval call binding the contract method 0x5845e530. -// -// Solidity: function getGISTRootInfoByBlock(uint256 blockNumber) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetGISTRootInfoByBlock(blockNumber *big.Int) (IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootInfoByBlock(&_StateV2Handler.CallOpts, blockNumber) -} - -// GetGISTRootInfoByBlock is a free data retrieval call binding the contract method 0x5845e530. -// -// Solidity: function getGISTRootInfoByBlock(uint256 blockNumber) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTRootInfoByBlock(blockNumber *big.Int) (IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootInfoByBlock(&_StateV2Handler.CallOpts, blockNumber) -} - -// GetGISTRootInfoByTime is a free data retrieval call binding the contract method 0x0ef6e65b. -// -// Solidity: function getGISTRootInfoByTime(uint256 timestamp) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetGISTRootInfoByTime(opts *bind.CallOpts, timestamp *big.Int) (IStateGistRootInfo, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getGISTRootInfoByTime", timestamp) - - if err != nil { - return *new(IStateGistRootInfo), err - } - - out0 := *abi.ConvertType(out[0], new(IStateGistRootInfo)).(*IStateGistRootInfo) - - return out0, err - -} - -// GetGISTRootInfoByTime is a free data retrieval call binding the contract method 0x0ef6e65b. -// -// Solidity: function getGISTRootInfoByTime(uint256 timestamp) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetGISTRootInfoByTime(timestamp *big.Int) (IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootInfoByTime(&_StateV2Handler.CallOpts, timestamp) -} - -// GetGISTRootInfoByTime is a free data retrieval call binding the contract method 0x0ef6e65b. -// -// Solidity: function getGISTRootInfoByTime(uint256 timestamp) view returns((uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetGISTRootInfoByTime(timestamp *big.Int) (IStateGistRootInfo, error) { - return _StateV2Handler.Contract.GetGISTRootInfoByTime(&_StateV2Handler.CallOpts, timestamp) -} - -// GetStateInfoById is a free data retrieval call binding the contract method 0xb4bdea55. -// -// Solidity: function getStateInfoById(uint256 id) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetStateInfoById(opts *bind.CallOpts, id *big.Int) (IStateStateInfo, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getStateInfoById", id) - - if err != nil { - return *new(IStateStateInfo), err - } - - out0 := *abi.ConvertType(out[0], new(IStateStateInfo)).(*IStateStateInfo) - - return out0, err - -} - -// GetStateInfoById is a free data retrieval call binding the contract method 0xb4bdea55. -// -// Solidity: function getStateInfoById(uint256 id) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetStateInfoById(id *big.Int) (IStateStateInfo, error) { - return _StateV2Handler.Contract.GetStateInfoById(&_StateV2Handler.CallOpts, id) -} - -// GetStateInfoById is a free data retrieval call binding the contract method 0xb4bdea55. -// -// Solidity: function getStateInfoById(uint256 id) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetStateInfoById(id *big.Int) (IStateStateInfo, error) { - return _StateV2Handler.Contract.GetStateInfoById(&_StateV2Handler.CallOpts, id) -} - -// GetStateInfoByIdAndState is a free data retrieval call binding the contract method 0x53c87312. -// -// Solidity: function getStateInfoByIdAndState(uint256 id, uint256 state) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCaller) GetStateInfoByIdAndState(opts *bind.CallOpts, id *big.Int, state *big.Int) (IStateStateInfo, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getStateInfoByIdAndState", id, state) - - if err != nil { - return *new(IStateStateInfo), err - } - - out0 := *abi.ConvertType(out[0], new(IStateStateInfo)).(*IStateStateInfo) - - return out0, err - -} - -// GetStateInfoByIdAndState is a free data retrieval call binding the contract method 0x53c87312. -// -// Solidity: function getStateInfoByIdAndState(uint256 id, uint256 state) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerSession) GetStateInfoByIdAndState(id *big.Int, state *big.Int) (IStateStateInfo, error) { - return _StateV2Handler.Contract.GetStateInfoByIdAndState(&_StateV2Handler.CallOpts, id, state) -} - -// GetStateInfoByIdAndState is a free data retrieval call binding the contract method 0x53c87312. -// -// Solidity: function getStateInfoByIdAndState(uint256 id, uint256 state) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)) -func (_StateV2Handler *StateV2HandlerCallerSession) GetStateInfoByIdAndState(id *big.Int, state *big.Int) (IStateStateInfo, error) { - return _StateV2Handler.Contract.GetStateInfoByIdAndState(&_StateV2Handler.CallOpts, id, state) -} - -// GetStateInfoHistoryById is a free data retrieval call binding the contract method 0xe99858fe. -// -// Solidity: function getStateInfoHistoryById(uint256 id, uint256 startIndex, uint256 length) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)[]) -func (_StateV2Handler *StateV2HandlerCaller) GetStateInfoHistoryById(opts *bind.CallOpts, id *big.Int, startIndex *big.Int, length *big.Int) ([]IStateStateInfo, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getStateInfoHistoryById", id, startIndex, length) - - if err != nil { - return *new([]IStateStateInfo), err - } - - out0 := *abi.ConvertType(out[0], new([]IStateStateInfo)).(*[]IStateStateInfo) - - return out0, err - -} - -// GetStateInfoHistoryById is a free data retrieval call binding the contract method 0xe99858fe. -// -// Solidity: function getStateInfoHistoryById(uint256 id, uint256 startIndex, uint256 length) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)[]) -func (_StateV2Handler *StateV2HandlerSession) GetStateInfoHistoryById(id *big.Int, startIndex *big.Int, length *big.Int) ([]IStateStateInfo, error) { - return _StateV2Handler.Contract.GetStateInfoHistoryById(&_StateV2Handler.CallOpts, id, startIndex, length) -} - -// GetStateInfoHistoryById is a free data retrieval call binding the contract method 0xe99858fe. -// -// Solidity: function getStateInfoHistoryById(uint256 id, uint256 startIndex, uint256 length) view returns((uint256,uint256,uint256,uint256,uint256,uint256,uint256)[]) -func (_StateV2Handler *StateV2HandlerCallerSession) GetStateInfoHistoryById(id *big.Int, startIndex *big.Int, length *big.Int) ([]IStateStateInfo, error) { - return _StateV2Handler.Contract.GetStateInfoHistoryById(&_StateV2Handler.CallOpts, id, startIndex, length) -} - -// GetStateInfoHistoryLengthById is a free data retrieval call binding the contract method 0x676d5b5a. -// -// Solidity: function getStateInfoHistoryLengthById(uint256 id) view returns(uint256) -func (_StateV2Handler *StateV2HandlerCaller) GetStateInfoHistoryLengthById(opts *bind.CallOpts, id *big.Int) (*big.Int, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getStateInfoHistoryLengthById", id) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetStateInfoHistoryLengthById is a free data retrieval call binding the contract method 0x676d5b5a. -// -// Solidity: function getStateInfoHistoryLengthById(uint256 id) view returns(uint256) -func (_StateV2Handler *StateV2HandlerSession) GetStateInfoHistoryLengthById(id *big.Int) (*big.Int, error) { - return _StateV2Handler.Contract.GetStateInfoHistoryLengthById(&_StateV2Handler.CallOpts, id) -} - -// GetStateInfoHistoryLengthById is a free data retrieval call binding the contract method 0x676d5b5a. -// -// Solidity: function getStateInfoHistoryLengthById(uint256 id) view returns(uint256) -func (_StateV2Handler *StateV2HandlerCallerSession) GetStateInfoHistoryLengthById(id *big.Int) (*big.Int, error) { - return _StateV2Handler.Contract.GetStateInfoHistoryLengthById(&_StateV2Handler.CallOpts, id) -} - -// GetVerifier is a free data retrieval call binding the contract method 0x46657fe9. -// -// Solidity: function getVerifier() view returns(address) -func (_StateV2Handler *StateV2HandlerCaller) GetVerifier(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "getVerifier") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// GetVerifier is a free data retrieval call binding the contract method 0x46657fe9. -// -// Solidity: function getVerifier() view returns(address) -func (_StateV2Handler *StateV2HandlerSession) GetVerifier() (common.Address, error) { - return _StateV2Handler.Contract.GetVerifier(&_StateV2Handler.CallOpts) -} - -// GetVerifier is a free data retrieval call binding the contract method 0x46657fe9. -// -// Solidity: function getVerifier() view returns(address) -func (_StateV2Handler *StateV2HandlerCallerSession) GetVerifier() (common.Address, error) { - return _StateV2Handler.Contract.GetVerifier(&_StateV2Handler.CallOpts) -} - -// IdExists is a free data retrieval call binding the contract method 0x0b8a295a. -// -// Solidity: function idExists(uint256 id) view returns(bool) -func (_StateV2Handler *StateV2HandlerCaller) IdExists(opts *bind.CallOpts, id *big.Int) (bool, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "idExists", id) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IdExists is a free data retrieval call binding the contract method 0x0b8a295a. -// -// Solidity: function idExists(uint256 id) view returns(bool) -func (_StateV2Handler *StateV2HandlerSession) IdExists(id *big.Int) (bool, error) { - return _StateV2Handler.Contract.IdExists(&_StateV2Handler.CallOpts, id) -} - -// IdExists is a free data retrieval call binding the contract method 0x0b8a295a. -// -// Solidity: function idExists(uint256 id) view returns(bool) -func (_StateV2Handler *StateV2HandlerCallerSession) IdExists(id *big.Int) (bool, error) { - return _StateV2Handler.Contract.IdExists(&_StateV2Handler.CallOpts, id) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StateV2Handler *StateV2HandlerCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StateV2Handler *StateV2HandlerSession) Owner() (common.Address, error) { - return _StateV2Handler.Contract.Owner(&_StateV2Handler.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_StateV2Handler *StateV2HandlerCallerSession) Owner() (common.Address, error) { - return _StateV2Handler.Contract.Owner(&_StateV2Handler.CallOpts) -} - -// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. -// -// Solidity: function pendingOwner() view returns(address) -func (_StateV2Handler *StateV2HandlerCaller) PendingOwner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "pendingOwner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. -// -// Solidity: function pendingOwner() view returns(address) -func (_StateV2Handler *StateV2HandlerSession) PendingOwner() (common.Address, error) { - return _StateV2Handler.Contract.PendingOwner(&_StateV2Handler.CallOpts) -} - -// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. -// -// Solidity: function pendingOwner() view returns(address) -func (_StateV2Handler *StateV2HandlerCallerSession) PendingOwner() (common.Address, error) { - return _StateV2Handler.Contract.PendingOwner(&_StateV2Handler.CallOpts) -} - -// StateExists is a free data retrieval call binding the contract method 0x233a4d23. -// -// Solidity: function stateExists(uint256 id, uint256 state) view returns(bool) -func (_StateV2Handler *StateV2HandlerCaller) StateExists(opts *bind.CallOpts, id *big.Int, state *big.Int) (bool, error) { - var out []interface{} - err := _StateV2Handler.contract.Call(opts, &out, "stateExists", id, state) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// StateExists is a free data retrieval call binding the contract method 0x233a4d23. -// -// Solidity: function stateExists(uint256 id, uint256 state) view returns(bool) -func (_StateV2Handler *StateV2HandlerSession) StateExists(id *big.Int, state *big.Int) (bool, error) { - return _StateV2Handler.Contract.StateExists(&_StateV2Handler.CallOpts, id, state) -} - -// StateExists is a free data retrieval call binding the contract method 0x233a4d23. -// -// Solidity: function stateExists(uint256 id, uint256 state) view returns(bool) -func (_StateV2Handler *StateV2HandlerCallerSession) StateExists(id *big.Int, state *big.Int) (bool, error) { - return _StateV2Handler.Contract.StateExists(&_StateV2Handler.CallOpts, id, state) -} - -// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. -// -// Solidity: function acceptOwnership() returns() -func (_StateV2Handler *StateV2HandlerTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "acceptOwnership") -} - -// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. -// -// Solidity: function acceptOwnership() returns() -func (_StateV2Handler *StateV2HandlerSession) AcceptOwnership() (*types.Transaction, error) { - return _StateV2Handler.Contract.AcceptOwnership(&_StateV2Handler.TransactOpts) -} - -// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. -// -// Solidity: function acceptOwnership() returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _StateV2Handler.Contract.AcceptOwnership(&_StateV2Handler.TransactOpts) -} - -// Initialize is a paid mutator transaction binding the contract method 0x406e8b4c. -// -// Solidity: function initialize(address verifierContractAddr, bytes2 defaultIdType) returns() -func (_StateV2Handler *StateV2HandlerTransactor) Initialize(opts *bind.TransactOpts, verifierContractAddr common.Address, defaultIdType [2]byte) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "initialize", verifierContractAddr, defaultIdType) -} - -// Initialize is a paid mutator transaction binding the contract method 0x406e8b4c. -// -// Solidity: function initialize(address verifierContractAddr, bytes2 defaultIdType) returns() -func (_StateV2Handler *StateV2HandlerSession) Initialize(verifierContractAddr common.Address, defaultIdType [2]byte) (*types.Transaction, error) { - return _StateV2Handler.Contract.Initialize(&_StateV2Handler.TransactOpts, verifierContractAddr, defaultIdType) -} - -// Initialize is a paid mutator transaction binding the contract method 0x406e8b4c. -// -// Solidity: function initialize(address verifierContractAddr, bytes2 defaultIdType) returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) Initialize(verifierContractAddr common.Address, defaultIdType [2]byte) (*types.Transaction, error) { - return _StateV2Handler.Contract.Initialize(&_StateV2Handler.TransactOpts, verifierContractAddr, defaultIdType) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StateV2Handler *StateV2HandlerTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StateV2Handler *StateV2HandlerSession) RenounceOwnership() (*types.Transaction, error) { - return _StateV2Handler.Contract.RenounceOwnership(&_StateV2Handler.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _StateV2Handler.Contract.RenounceOwnership(&_StateV2Handler.TransactOpts) -} - -// SetDefaultIdType is a paid mutator transaction binding the contract method 0xa7c57eeb. -// -// Solidity: function setDefaultIdType(bytes2 defaultIdType) returns() -func (_StateV2Handler *StateV2HandlerTransactor) SetDefaultIdType(opts *bind.TransactOpts, defaultIdType [2]byte) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "setDefaultIdType", defaultIdType) -} - -// SetDefaultIdType is a paid mutator transaction binding the contract method 0xa7c57eeb. -// -// Solidity: function setDefaultIdType(bytes2 defaultIdType) returns() -func (_StateV2Handler *StateV2HandlerSession) SetDefaultIdType(defaultIdType [2]byte) (*types.Transaction, error) { - return _StateV2Handler.Contract.SetDefaultIdType(&_StateV2Handler.TransactOpts, defaultIdType) -} - -// SetDefaultIdType is a paid mutator transaction binding the contract method 0xa7c57eeb. -// -// Solidity: function setDefaultIdType(bytes2 defaultIdType) returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) SetDefaultIdType(defaultIdType [2]byte) (*types.Transaction, error) { - return _StateV2Handler.Contract.SetDefaultIdType(&_StateV2Handler.TransactOpts, defaultIdType) -} - -// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. -// -// Solidity: function setVerifier(address newVerifierAddr) returns() -func (_StateV2Handler *StateV2HandlerTransactor) SetVerifier(opts *bind.TransactOpts, newVerifierAddr common.Address) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "setVerifier", newVerifierAddr) -} - -// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. -// -// Solidity: function setVerifier(address newVerifierAddr) returns() -func (_StateV2Handler *StateV2HandlerSession) SetVerifier(newVerifierAddr common.Address) (*types.Transaction, error) { - return _StateV2Handler.Contract.SetVerifier(&_StateV2Handler.TransactOpts, newVerifierAddr) -} - -// SetVerifier is a paid mutator transaction binding the contract method 0x5437988d. -// -// Solidity: function setVerifier(address newVerifierAddr) returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) SetVerifier(newVerifierAddr common.Address) (*types.Transaction, error) { - return _StateV2Handler.Contract.SetVerifier(&_StateV2Handler.TransactOpts, newVerifierAddr) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StateV2Handler *StateV2HandlerTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StateV2Handler *StateV2HandlerSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _StateV2Handler.Contract.TransferOwnership(&_StateV2Handler.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _StateV2Handler.Contract.TransferOwnership(&_StateV2Handler.TransactOpts, newOwner) -} - -// TransitState is a paid mutator transaction binding the contract method 0x28f88a65. -// -// Solidity: function transitState(uint256 id, uint256 oldState, uint256 newState, bool isOldStateGenesis, uint256[2] a, uint256[2][2] b, uint256[2] c) returns() -func (_StateV2Handler *StateV2HandlerTransactor) TransitState(opts *bind.TransactOpts, id *big.Int, oldState *big.Int, newState *big.Int, isOldStateGenesis bool, a [2]*big.Int, b [2][2]*big.Int, c [2]*big.Int) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "transitState", id, oldState, newState, isOldStateGenesis, a, b, c) -} - -// TransitState is a paid mutator transaction binding the contract method 0x28f88a65. -// -// Solidity: function transitState(uint256 id, uint256 oldState, uint256 newState, bool isOldStateGenesis, uint256[2] a, uint256[2][2] b, uint256[2] c) returns() -func (_StateV2Handler *StateV2HandlerSession) TransitState(id *big.Int, oldState *big.Int, newState *big.Int, isOldStateGenesis bool, a [2]*big.Int, b [2][2]*big.Int, c [2]*big.Int) (*types.Transaction, error) { - return _StateV2Handler.Contract.TransitState(&_StateV2Handler.TransactOpts, id, oldState, newState, isOldStateGenesis, a, b, c) -} - -// TransitState is a paid mutator transaction binding the contract method 0x28f88a65. -// -// Solidity: function transitState(uint256 id, uint256 oldState, uint256 newState, bool isOldStateGenesis, uint256[2] a, uint256[2][2] b, uint256[2] c) returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) TransitState(id *big.Int, oldState *big.Int, newState *big.Int, isOldStateGenesis bool, a [2]*big.Int, b [2][2]*big.Int, c [2]*big.Int) (*types.Transaction, error) { - return _StateV2Handler.Contract.TransitState(&_StateV2Handler.TransactOpts, id, oldState, newState, isOldStateGenesis, a, b, c) -} - -// TransitStateGeneric is a paid mutator transaction binding the contract method 0x7d0dcba5. -// -// Solidity: function transitStateGeneric(uint256 id, uint256 oldState, uint256 newState, bool isOldStateGenesis, uint256 methodId, bytes methodParams) returns() -func (_StateV2Handler *StateV2HandlerTransactor) TransitStateGeneric(opts *bind.TransactOpts, id *big.Int, oldState *big.Int, newState *big.Int, isOldStateGenesis bool, methodId *big.Int, methodParams []byte) (*types.Transaction, error) { - return _StateV2Handler.contract.Transact(opts, "transitStateGeneric", id, oldState, newState, isOldStateGenesis, methodId, methodParams) -} - -// TransitStateGeneric is a paid mutator transaction binding the contract method 0x7d0dcba5. -// -// Solidity: function transitStateGeneric(uint256 id, uint256 oldState, uint256 newState, bool isOldStateGenesis, uint256 methodId, bytes methodParams) returns() -func (_StateV2Handler *StateV2HandlerSession) TransitStateGeneric(id *big.Int, oldState *big.Int, newState *big.Int, isOldStateGenesis bool, methodId *big.Int, methodParams []byte) (*types.Transaction, error) { - return _StateV2Handler.Contract.TransitStateGeneric(&_StateV2Handler.TransactOpts, id, oldState, newState, isOldStateGenesis, methodId, methodParams) -} - -// TransitStateGeneric is a paid mutator transaction binding the contract method 0x7d0dcba5. -// -// Solidity: function transitStateGeneric(uint256 id, uint256 oldState, uint256 newState, bool isOldStateGenesis, uint256 methodId, bytes methodParams) returns() -func (_StateV2Handler *StateV2HandlerTransactorSession) TransitStateGeneric(id *big.Int, oldState *big.Int, newState *big.Int, isOldStateGenesis bool, methodId *big.Int, methodParams []byte) (*types.Transaction, error) { - return _StateV2Handler.Contract.TransitStateGeneric(&_StateV2Handler.TransactOpts, id, oldState, newState, isOldStateGenesis, methodId, methodParams) -} - -// StateV2HandlerInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the StateV2Handler contract. -type StateV2HandlerInitializedIterator struct { - Event *StateV2HandlerInitialized // 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 *StateV2HandlerInitializedIterator) 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(StateV2HandlerInitialized) - 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(StateV2HandlerInitialized) - 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 *StateV2HandlerInitializedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StateV2HandlerInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StateV2HandlerInitialized represents a Initialized event raised by the StateV2Handler contract. -type StateV2HandlerInitialized struct { - Version uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StateV2Handler *StateV2HandlerFilterer) FilterInitialized(opts *bind.FilterOpts) (*StateV2HandlerInitializedIterator, error) { - - logs, sub, err := _StateV2Handler.contract.FilterLogs(opts, "Initialized") - if err != nil { - return nil, err - } - return &StateV2HandlerInitializedIterator{contract: _StateV2Handler.contract, event: "Initialized", logs: logs, sub: sub}, nil -} - -// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StateV2Handler *StateV2HandlerFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *StateV2HandlerInitialized) (event.Subscription, error) { - - logs, sub, err := _StateV2Handler.contract.WatchLogs(opts, "Initialized") - 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(StateV2HandlerInitialized) - if err := _StateV2Handler.contract.UnpackLog(event, "Initialized", 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 -} - -// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. -// -// Solidity: event Initialized(uint8 version) -func (_StateV2Handler *StateV2HandlerFilterer) ParseInitialized(log types.Log) (*StateV2HandlerInitialized, error) { - event := new(StateV2HandlerInitialized) - if err := _StateV2Handler.contract.UnpackLog(event, "Initialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StateV2HandlerOwnershipTransferStartedIterator is returned from FilterOwnershipTransferStarted and is used to iterate over the raw logs and unpacked data for OwnershipTransferStarted events raised by the StateV2Handler contract. -type StateV2HandlerOwnershipTransferStartedIterator struct { - Event *StateV2HandlerOwnershipTransferStarted // 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 *StateV2HandlerOwnershipTransferStartedIterator) 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(StateV2HandlerOwnershipTransferStarted) - 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(StateV2HandlerOwnershipTransferStarted) - 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 *StateV2HandlerOwnershipTransferStartedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StateV2HandlerOwnershipTransferStartedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StateV2HandlerOwnershipTransferStarted represents a OwnershipTransferStarted event raised by the StateV2Handler contract. -type StateV2HandlerOwnershipTransferStarted struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferStarted is a free log retrieval operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. -// -// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) -func (_StateV2Handler *StateV2HandlerFilterer) FilterOwnershipTransferStarted(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*StateV2HandlerOwnershipTransferStartedIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StateV2Handler.contract.FilterLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &StateV2HandlerOwnershipTransferStartedIterator{contract: _StateV2Handler.contract, event: "OwnershipTransferStarted", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferStarted is a free log subscription operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. -// -// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) -func (_StateV2Handler *StateV2HandlerFilterer) WatchOwnershipTransferStarted(opts *bind.WatchOpts, sink chan<- *StateV2HandlerOwnershipTransferStarted, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StateV2Handler.contract.WatchLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) - 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(StateV2HandlerOwnershipTransferStarted) - if err := _StateV2Handler.contract.UnpackLog(event, "OwnershipTransferStarted", 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 -} - -// ParseOwnershipTransferStarted is a log parse operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. -// -// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) -func (_StateV2Handler *StateV2HandlerFilterer) ParseOwnershipTransferStarted(log types.Log) (*StateV2HandlerOwnershipTransferStarted, error) { - event := new(StateV2HandlerOwnershipTransferStarted) - if err := _StateV2Handler.contract.UnpackLog(event, "OwnershipTransferStarted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StateV2HandlerOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the StateV2Handler contract. -type StateV2HandlerOwnershipTransferredIterator struct { - Event *StateV2HandlerOwnershipTransferred // 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 *StateV2HandlerOwnershipTransferredIterator) 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(StateV2HandlerOwnershipTransferred) - 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(StateV2HandlerOwnershipTransferred) - 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 *StateV2HandlerOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StateV2HandlerOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StateV2HandlerOwnershipTransferred represents a OwnershipTransferred event raised by the StateV2Handler contract. -type StateV2HandlerOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StateV2Handler *StateV2HandlerFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*StateV2HandlerOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StateV2Handler.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &StateV2HandlerOwnershipTransferredIterator{contract: _StateV2Handler.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StateV2Handler *StateV2HandlerFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *StateV2HandlerOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _StateV2Handler.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - 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(StateV2HandlerOwnershipTransferred) - if err := _StateV2Handler.contract.UnpackLog(event, "OwnershipTransferred", 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 -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_StateV2Handler *StateV2HandlerFilterer) ParseOwnershipTransferred(log types.Log) (*StateV2HandlerOwnershipTransferred, error) { - event := new(StateV2HandlerOwnershipTransferred) - if err := _StateV2Handler.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/pkg/worldid/worldid.go b/pkg/worldid/worldid.go new file mode 100644 index 0000000..9e3d745 --- /dev/null +++ b/pkg/worldid/worldid.go @@ -0,0 +1,2629 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package worldid + +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 +) + +// WorldIDIdentityManagerImplV1RootInfo is an auto generated low-level Go binding around an user-defined struct. +type WorldIDIdentityManagerImplV1RootInfo struct { + Root *big.Int + SupersededTimestamp *big.Int + IsValid bool +} + +// WorldIdMetaData contains all meta data concerning the WorldId contract. +var WorldIdMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"NO_SUCH_ROOT\",\"inputs\":[],\"outputs\":[{\"name\":\"rootInfo\",\"type\":\"tuple\",\"internalType\":\"structWorldIDIdentityManagerImplV1.RootInfo\",\"components\":[{\"name\":\"root\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"supersededTimestamp\",\"type\":\"uint128\",\"internalType\":\"uint128\"},{\"name\":\"isValid\",\"type\":\"bool\",\"internalType\":\"bool\"}]}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"calculateIdentityRegistrationInputHash\",\"inputs\":[{\"name\":\"startIndex\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"preRoot\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"postRoot\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"identityCommitments\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[{\"name\":\"hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getRegisterIdentitiesVerifierLookupTableAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getRootHistoryExpiry\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getSemaphoreVerifierAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTreeDepth\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"identityOperator\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"_treeDepth\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"initialRoot\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_batchInsertionVerifiers\",\"type\":\"address\",\"internalType\":\"contractVerifierLookupTable\"},{\"name\":\"_batchUpdateVerifiers\",\"type\":\"address\",\"internalType\":\"contractVerifierLookupTable\"},{\"name\":\"_semaphoreVerifier\",\"type\":\"address\",\"internalType\":\"contractISemaphoreVerifier\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"latestRoot\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"queryRoot\",\"inputs\":[{\"name\":\"root\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structWorldIDIdentityManagerImplV1.RootInfo\",\"components\":[{\"name\":\"root\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"supersededTimestamp\",\"type\":\"uint128\",\"internalType\":\"uint128\"},{\"name\":\"isValid\",\"type\":\"bool\",\"internalType\":\"bool\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"registerIdentities\",\"inputs\":[{\"name\":\"insertionProof\",\"type\":\"uint256[8]\",\"internalType\":\"uint256[8]\"},{\"name\":\"preRoot\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"startIndex\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"identityCommitments\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"},{\"name\":\"postRoot\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"requireValidRoot\",\"inputs\":[{\"name\":\"root\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setIdentityOperator\",\"inputs\":[{\"name\":\"newIdentityOperator\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setRegisterIdentitiesVerifierLookupTable\",\"inputs\":[{\"name\":\"newTable\",\"type\":\"address\",\"internalType\":\"contractVerifierLookupTable\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setRootHistoryExpiry\",\"inputs\":[{\"name\":\"newExpiryTime\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSemaphoreVerifier\",\"inputs\":[{\"name\":\"newVerifier\",\"type\":\"address\",\"internalType\":\"contractISemaphoreVerifier\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeTo\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"verifyProof\",\"inputs\":[{\"name\":\"root\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"signalHash\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"nullifierHash\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"externalNullifierHash\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"proof\",\"type\":\"uint256[8]\",\"internalType\":\"uint256[8]\"}],\"outputs\":[],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"AdminChanged\",\"inputs\":[{\"name\":\"previousAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"newAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"inputs\":[{\"name\":\"beacon\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"DependencyUpdated\",\"inputs\":[{\"name\":\"kind\",\"type\":\"uint8\",\"indexed\":true,\"internalType\":\"enumWorldIDIdentityManagerImplV1.Dependency\"},{\"name\":\"oldAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"IdentityOperatorChanged\",\"inputs\":[{\"name\":\"oldOperator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOperator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RootHistoryExpirySet\",\"inputs\":[{\"name\":\"oldExpiryTime\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"newExpiryTime\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StateBridgeStateChange\",\"inputs\":[{\"name\":\"isEnabled\",\"type\":\"bool\",\"indexed\":true,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TreeChanged\",\"inputs\":[{\"name\":\"preRoot\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"kind\",\"type\":\"uint8\",\"indexed\":true,\"internalType\":\"enumWorldIDIdentityManagerImplV1.TreeChange\"},{\"name\":\"postRoot\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"WorldIDIdentityManagerImplInitialized\",\"inputs\":[{\"name\":\"_treeDepth\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"},{\"name\":\"initialRoot\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"CannotRenounceOwnership\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ExpiredRoot\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ImplementationNotInitialized\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidCommitment\",\"inputs\":[{\"name\":\"index\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"InvalidStateBridgeAddress\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidVerifier\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidVerifierLUT\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MismatchedInputLengths\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NonExistentRoot\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotLatestRoot\",\"inputs\":[{\"name\":\"providedRoot\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"latestRoot\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ProofValidationFailure\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"StateBridgeAlreadyDisabled\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"StateBridgeAlreadyEnabled\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"Unauthorized\",\"inputs\":[{\"name\":\"user\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"UnreducedElement\",\"inputs\":[{\"name\":\"elementType\",\"type\":\"uint8\",\"internalType\":\"enumWorldIDIdentityManagerImplV1.UnreducedElementType\"},{\"name\":\"element\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"UnsupportedTreeDepth\",\"inputs\":[{\"name\":\"depth\",\"type\":\"uint8\",\"internalType\":\"uint8\"}]}]", +} + +// WorldIdABI is the input ABI used to generate the binding from. +// Deprecated: Use WorldIdMetaData.ABI instead. +var WorldIdABI = WorldIdMetaData.ABI + +// WorldId is an auto generated Go binding around an Ethereum contract. +type WorldId struct { + WorldIdCaller // Read-only binding to the contract + WorldIdTransactor // Write-only binding to the contract + WorldIdFilterer // Log filterer for contract events +} + +// WorldIdCaller is an auto generated read-only Go binding around an Ethereum contract. +type WorldIdCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// WorldIdTransactor is an auto generated write-only Go binding around an Ethereum contract. +type WorldIdTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// WorldIdFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type WorldIdFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// WorldIdSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type WorldIdSession struct { + Contract *WorldId // 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 +} + +// WorldIdCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type WorldIdCallerSession struct { + Contract *WorldIdCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// WorldIdTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type WorldIdTransactorSession struct { + Contract *WorldIdTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// WorldIdRaw is an auto generated low-level Go binding around an Ethereum contract. +type WorldIdRaw struct { + Contract *WorldId // Generic contract binding to access the raw methods on +} + +// WorldIdCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type WorldIdCallerRaw struct { + Contract *WorldIdCaller // Generic read-only contract binding to access the raw methods on +} + +// WorldIdTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type WorldIdTransactorRaw struct { + Contract *WorldIdTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewWorldId creates a new instance of WorldId, bound to a specific deployed contract. +func NewWorldId(address common.Address, backend bind.ContractBackend) (*WorldId, error) { + contract, err := bindWorldId(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &WorldId{WorldIdCaller: WorldIdCaller{contract: contract}, WorldIdTransactor: WorldIdTransactor{contract: contract}, WorldIdFilterer: WorldIdFilterer{contract: contract}}, nil +} + +// NewWorldIdCaller creates a new read-only instance of WorldId, bound to a specific deployed contract. +func NewWorldIdCaller(address common.Address, caller bind.ContractCaller) (*WorldIdCaller, error) { + contract, err := bindWorldId(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &WorldIdCaller{contract: contract}, nil +} + +// NewWorldIdTransactor creates a new write-only instance of WorldId, bound to a specific deployed contract. +func NewWorldIdTransactor(address common.Address, transactor bind.ContractTransactor) (*WorldIdTransactor, error) { + contract, err := bindWorldId(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &WorldIdTransactor{contract: contract}, nil +} + +// NewWorldIdFilterer creates a new log filterer instance of WorldId, bound to a specific deployed contract. +func NewWorldIdFilterer(address common.Address, filterer bind.ContractFilterer) (*WorldIdFilterer, error) { + contract, err := bindWorldId(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &WorldIdFilterer{contract: contract}, nil +} + +// bindWorldId binds a generic wrapper to an already deployed contract. +func bindWorldId(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := WorldIdMetaData.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 (_WorldId *WorldIdRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _WorldId.Contract.WorldIdCaller.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 (_WorldId *WorldIdRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _WorldId.Contract.WorldIdTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_WorldId *WorldIdRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _WorldId.Contract.WorldIdTransactor.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 (_WorldId *WorldIdCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _WorldId.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 (_WorldId *WorldIdTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _WorldId.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_WorldId *WorldIdTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _WorldId.Contract.contract.Transact(opts, method, params...) +} + +// NOSUCHROOT is a free data retrieval call binding the contract method 0x561f204b. +// +// Solidity: function NO_SUCH_ROOT() pure returns((uint256,uint128,bool) rootInfo) +func (_WorldId *WorldIdCaller) NOSUCHROOT(opts *bind.CallOpts) (WorldIDIdentityManagerImplV1RootInfo, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "NO_SUCH_ROOT") + + if err != nil { + return *new(WorldIDIdentityManagerImplV1RootInfo), err + } + + out0 := *abi.ConvertType(out[0], new(WorldIDIdentityManagerImplV1RootInfo)).(*WorldIDIdentityManagerImplV1RootInfo) + + return out0, err + +} + +// NOSUCHROOT is a free data retrieval call binding the contract method 0x561f204b. +// +// Solidity: function NO_SUCH_ROOT() pure returns((uint256,uint128,bool) rootInfo) +func (_WorldId *WorldIdSession) NOSUCHROOT() (WorldIDIdentityManagerImplV1RootInfo, error) { + return _WorldId.Contract.NOSUCHROOT(&_WorldId.CallOpts) +} + +// NOSUCHROOT is a free data retrieval call binding the contract method 0x561f204b. +// +// Solidity: function NO_SUCH_ROOT() pure returns((uint256,uint128,bool) rootInfo) +func (_WorldId *WorldIdCallerSession) NOSUCHROOT() (WorldIDIdentityManagerImplV1RootInfo, error) { + return _WorldId.Contract.NOSUCHROOT(&_WorldId.CallOpts) +} + +// CalculateIdentityRegistrationInputHash is a free data retrieval call binding the contract method 0x8c76a909. +// +// Solidity: function calculateIdentityRegistrationInputHash(uint32 startIndex, uint256 preRoot, uint256 postRoot, uint256[] identityCommitments) view returns(bytes32 hash) +func (_WorldId *WorldIdCaller) CalculateIdentityRegistrationInputHash(opts *bind.CallOpts, startIndex uint32, preRoot *big.Int, postRoot *big.Int, identityCommitments []*big.Int) ([32]byte, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "calculateIdentityRegistrationInputHash", startIndex, preRoot, postRoot, identityCommitments) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// CalculateIdentityRegistrationInputHash is a free data retrieval call binding the contract method 0x8c76a909. +// +// Solidity: function calculateIdentityRegistrationInputHash(uint32 startIndex, uint256 preRoot, uint256 postRoot, uint256[] identityCommitments) view returns(bytes32 hash) +func (_WorldId *WorldIdSession) CalculateIdentityRegistrationInputHash(startIndex uint32, preRoot *big.Int, postRoot *big.Int, identityCommitments []*big.Int) ([32]byte, error) { + return _WorldId.Contract.CalculateIdentityRegistrationInputHash(&_WorldId.CallOpts, startIndex, preRoot, postRoot, identityCommitments) +} + +// CalculateIdentityRegistrationInputHash is a free data retrieval call binding the contract method 0x8c76a909. +// +// Solidity: function calculateIdentityRegistrationInputHash(uint32 startIndex, uint256 preRoot, uint256 postRoot, uint256[] identityCommitments) view returns(bytes32 hash) +func (_WorldId *WorldIdCallerSession) CalculateIdentityRegistrationInputHash(startIndex uint32, preRoot *big.Int, postRoot *big.Int, identityCommitments []*big.Int) ([32]byte, error) { + return _WorldId.Contract.CalculateIdentityRegistrationInputHash(&_WorldId.CallOpts, startIndex, preRoot, postRoot, identityCommitments) +} + +// GetRegisterIdentitiesVerifierLookupTableAddress is a free data retrieval call binding the contract method 0x8fc22e9f. +// +// Solidity: function getRegisterIdentitiesVerifierLookupTableAddress() view returns(address) +func (_WorldId *WorldIdCaller) GetRegisterIdentitiesVerifierLookupTableAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "getRegisterIdentitiesVerifierLookupTableAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetRegisterIdentitiesVerifierLookupTableAddress is a free data retrieval call binding the contract method 0x8fc22e9f. +// +// Solidity: function getRegisterIdentitiesVerifierLookupTableAddress() view returns(address) +func (_WorldId *WorldIdSession) GetRegisterIdentitiesVerifierLookupTableAddress() (common.Address, error) { + return _WorldId.Contract.GetRegisterIdentitiesVerifierLookupTableAddress(&_WorldId.CallOpts) +} + +// GetRegisterIdentitiesVerifierLookupTableAddress is a free data retrieval call binding the contract method 0x8fc22e9f. +// +// Solidity: function getRegisterIdentitiesVerifierLookupTableAddress() view returns(address) +func (_WorldId *WorldIdCallerSession) GetRegisterIdentitiesVerifierLookupTableAddress() (common.Address, error) { + return _WorldId.Contract.GetRegisterIdentitiesVerifierLookupTableAddress(&_WorldId.CallOpts) +} + +// GetRootHistoryExpiry is a free data retrieval call binding the contract method 0x43f974cb. +// +// Solidity: function getRootHistoryExpiry() view returns(uint256) +func (_WorldId *WorldIdCaller) GetRootHistoryExpiry(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "getRootHistoryExpiry") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetRootHistoryExpiry is a free data retrieval call binding the contract method 0x43f974cb. +// +// Solidity: function getRootHistoryExpiry() view returns(uint256) +func (_WorldId *WorldIdSession) GetRootHistoryExpiry() (*big.Int, error) { + return _WorldId.Contract.GetRootHistoryExpiry(&_WorldId.CallOpts) +} + +// GetRootHistoryExpiry is a free data retrieval call binding the contract method 0x43f974cb. +// +// Solidity: function getRootHistoryExpiry() view returns(uint256) +func (_WorldId *WorldIdCallerSession) GetRootHistoryExpiry() (*big.Int, error) { + return _WorldId.Contract.GetRootHistoryExpiry(&_WorldId.CallOpts) +} + +// GetSemaphoreVerifierAddress is a free data retrieval call binding the contract method 0xf2038f95. +// +// Solidity: function getSemaphoreVerifierAddress() view returns(address) +func (_WorldId *WorldIdCaller) GetSemaphoreVerifierAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "getSemaphoreVerifierAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetSemaphoreVerifierAddress is a free data retrieval call binding the contract method 0xf2038f95. +// +// Solidity: function getSemaphoreVerifierAddress() view returns(address) +func (_WorldId *WorldIdSession) GetSemaphoreVerifierAddress() (common.Address, error) { + return _WorldId.Contract.GetSemaphoreVerifierAddress(&_WorldId.CallOpts) +} + +// GetSemaphoreVerifierAddress is a free data retrieval call binding the contract method 0xf2038f95. +// +// Solidity: function getSemaphoreVerifierAddress() view returns(address) +func (_WorldId *WorldIdCallerSession) GetSemaphoreVerifierAddress() (common.Address, error) { + return _WorldId.Contract.GetSemaphoreVerifierAddress(&_WorldId.CallOpts) +} + +// GetTreeDepth is a free data retrieval call binding the contract method 0x8e5cdd50. +// +// Solidity: function getTreeDepth() view returns(uint8) +func (_WorldId *WorldIdCaller) GetTreeDepth(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "getTreeDepth") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// GetTreeDepth is a free data retrieval call binding the contract method 0x8e5cdd50. +// +// Solidity: function getTreeDepth() view returns(uint8) +func (_WorldId *WorldIdSession) GetTreeDepth() (uint8, error) { + return _WorldId.Contract.GetTreeDepth(&_WorldId.CallOpts) +} + +// GetTreeDepth is a free data retrieval call binding the contract method 0x8e5cdd50. +// +// Solidity: function getTreeDepth() view returns(uint8) +func (_WorldId *WorldIdCallerSession) GetTreeDepth() (uint8, error) { + return _WorldId.Contract.GetTreeDepth(&_WorldId.CallOpts) +} + +// IdentityOperator is a free data retrieval call binding the contract method 0xf134b6ca. +// +// Solidity: function identityOperator() view returns(address) +func (_WorldId *WorldIdCaller) IdentityOperator(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "identityOperator") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// IdentityOperator is a free data retrieval call binding the contract method 0xf134b6ca. +// +// Solidity: function identityOperator() view returns(address) +func (_WorldId *WorldIdSession) IdentityOperator() (common.Address, error) { + return _WorldId.Contract.IdentityOperator(&_WorldId.CallOpts) +} + +// IdentityOperator is a free data retrieval call binding the contract method 0xf134b6ca. +// +// Solidity: function identityOperator() view returns(address) +func (_WorldId *WorldIdCallerSession) IdentityOperator() (common.Address, error) { + return _WorldId.Contract.IdentityOperator(&_WorldId.CallOpts) +} + +// LatestRoot is a free data retrieval call binding the contract method 0xd7b0fef1. +// +// Solidity: function latestRoot() view returns(uint256) +func (_WorldId *WorldIdCaller) LatestRoot(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "latestRoot") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// LatestRoot is a free data retrieval call binding the contract method 0xd7b0fef1. +// +// Solidity: function latestRoot() view returns(uint256) +func (_WorldId *WorldIdSession) LatestRoot() (*big.Int, error) { + return _WorldId.Contract.LatestRoot(&_WorldId.CallOpts) +} + +// LatestRoot is a free data retrieval call binding the contract method 0xd7b0fef1. +// +// Solidity: function latestRoot() view returns(uint256) +func (_WorldId *WorldIdCallerSession) LatestRoot() (*big.Int, error) { + return _WorldId.Contract.LatestRoot(&_WorldId.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_WorldId *WorldIdCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_WorldId *WorldIdSession) Owner() (common.Address, error) { + return _WorldId.Contract.Owner(&_WorldId.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_WorldId *WorldIdCallerSession) Owner() (common.Address, error) { + return _WorldId.Contract.Owner(&_WorldId.CallOpts) +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_WorldId *WorldIdCaller) PendingOwner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "pendingOwner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_WorldId *WorldIdSession) PendingOwner() (common.Address, error) { + return _WorldId.Contract.PendingOwner(&_WorldId.CallOpts) +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_WorldId *WorldIdCallerSession) PendingOwner() (common.Address, error) { + return _WorldId.Contract.PendingOwner(&_WorldId.CallOpts) +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_WorldId *WorldIdCaller) ProxiableUUID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "proxiableUUID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_WorldId *WorldIdSession) ProxiableUUID() ([32]byte, error) { + return _WorldId.Contract.ProxiableUUID(&_WorldId.CallOpts) +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_WorldId *WorldIdCallerSession) ProxiableUUID() ([32]byte, error) { + return _WorldId.Contract.ProxiableUUID(&_WorldId.CallOpts) +} + +// QueryRoot is a free data retrieval call binding the contract method 0x3f7c178d. +// +// Solidity: function queryRoot(uint256 root) view returns((uint256,uint128,bool)) +func (_WorldId *WorldIdCaller) QueryRoot(opts *bind.CallOpts, root *big.Int) (WorldIDIdentityManagerImplV1RootInfo, error) { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "queryRoot", root) + + if err != nil { + return *new(WorldIDIdentityManagerImplV1RootInfo), err + } + + out0 := *abi.ConvertType(out[0], new(WorldIDIdentityManagerImplV1RootInfo)).(*WorldIDIdentityManagerImplV1RootInfo) + + return out0, err + +} + +// QueryRoot is a free data retrieval call binding the contract method 0x3f7c178d. +// +// Solidity: function queryRoot(uint256 root) view returns((uint256,uint128,bool)) +func (_WorldId *WorldIdSession) QueryRoot(root *big.Int) (WorldIDIdentityManagerImplV1RootInfo, error) { + return _WorldId.Contract.QueryRoot(&_WorldId.CallOpts, root) +} + +// QueryRoot is a free data retrieval call binding the contract method 0x3f7c178d. +// +// Solidity: function queryRoot(uint256 root) view returns((uint256,uint128,bool)) +func (_WorldId *WorldIdCallerSession) QueryRoot(root *big.Int) (WorldIDIdentityManagerImplV1RootInfo, error) { + return _WorldId.Contract.QueryRoot(&_WorldId.CallOpts, root) +} + +// RenounceOwnership is a free data retrieval call binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() view returns() +func (_WorldId *WorldIdCaller) RenounceOwnership(opts *bind.CallOpts) error { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "renounceOwnership") + + if err != nil { + return err + } + + return err + +} + +// RenounceOwnership is a free data retrieval call binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() view returns() +func (_WorldId *WorldIdSession) RenounceOwnership() error { + return _WorldId.Contract.RenounceOwnership(&_WorldId.CallOpts) +} + +// RenounceOwnership is a free data retrieval call binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() view returns() +func (_WorldId *WorldIdCallerSession) RenounceOwnership() error { + return _WorldId.Contract.RenounceOwnership(&_WorldId.CallOpts) +} + +// RequireValidRoot is a free data retrieval call binding the contract method 0xf2358e1d. +// +// Solidity: function requireValidRoot(uint256 root) view returns() +func (_WorldId *WorldIdCaller) RequireValidRoot(opts *bind.CallOpts, root *big.Int) error { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "requireValidRoot", root) + + if err != nil { + return err + } + + return err + +} + +// RequireValidRoot is a free data retrieval call binding the contract method 0xf2358e1d. +// +// Solidity: function requireValidRoot(uint256 root) view returns() +func (_WorldId *WorldIdSession) RequireValidRoot(root *big.Int) error { + return _WorldId.Contract.RequireValidRoot(&_WorldId.CallOpts, root) +} + +// RequireValidRoot is a free data retrieval call binding the contract method 0xf2358e1d. +// +// Solidity: function requireValidRoot(uint256 root) view returns() +func (_WorldId *WorldIdCallerSession) RequireValidRoot(root *big.Int) error { + return _WorldId.Contract.RequireValidRoot(&_WorldId.CallOpts, root) +} + +// VerifyProof is a free data retrieval call binding the contract method 0x354ca120. +// +// Solidity: function verifyProof(uint256 root, uint256 signalHash, uint256 nullifierHash, uint256 externalNullifierHash, uint256[8] proof) view returns() +func (_WorldId *WorldIdCaller) VerifyProof(opts *bind.CallOpts, root *big.Int, signalHash *big.Int, nullifierHash *big.Int, externalNullifierHash *big.Int, proof [8]*big.Int) error { + var out []interface{} + err := _WorldId.contract.Call(opts, &out, "verifyProof", root, signalHash, nullifierHash, externalNullifierHash, proof) + + if err != nil { + return err + } + + return err + +} + +// VerifyProof is a free data retrieval call binding the contract method 0x354ca120. +// +// Solidity: function verifyProof(uint256 root, uint256 signalHash, uint256 nullifierHash, uint256 externalNullifierHash, uint256[8] proof) view returns() +func (_WorldId *WorldIdSession) VerifyProof(root *big.Int, signalHash *big.Int, nullifierHash *big.Int, externalNullifierHash *big.Int, proof [8]*big.Int) error { + return _WorldId.Contract.VerifyProof(&_WorldId.CallOpts, root, signalHash, nullifierHash, externalNullifierHash, proof) +} + +// VerifyProof is a free data retrieval call binding the contract method 0x354ca120. +// +// Solidity: function verifyProof(uint256 root, uint256 signalHash, uint256 nullifierHash, uint256 externalNullifierHash, uint256[8] proof) view returns() +func (_WorldId *WorldIdCallerSession) VerifyProof(root *big.Int, signalHash *big.Int, nullifierHash *big.Int, externalNullifierHash *big.Int, proof [8]*big.Int) error { + return _WorldId.Contract.VerifyProof(&_WorldId.CallOpts, root, signalHash, nullifierHash, externalNullifierHash, proof) +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_WorldId *WorldIdTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "acceptOwnership") +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_WorldId *WorldIdSession) AcceptOwnership() (*types.Transaction, error) { + return _WorldId.Contract.AcceptOwnership(&_WorldId.TransactOpts) +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_WorldId *WorldIdTransactorSession) AcceptOwnership() (*types.Transaction, error) { + return _WorldId.Contract.AcceptOwnership(&_WorldId.TransactOpts) +} + +// Initialize is a paid mutator transaction binding the contract method 0x38c87065. +// +// Solidity: function initialize(uint8 _treeDepth, uint256 initialRoot, address _batchInsertionVerifiers, address _batchUpdateVerifiers, address _semaphoreVerifier) returns() +func (_WorldId *WorldIdTransactor) Initialize(opts *bind.TransactOpts, _treeDepth uint8, initialRoot *big.Int, _batchInsertionVerifiers common.Address, _batchUpdateVerifiers common.Address, _semaphoreVerifier common.Address) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "initialize", _treeDepth, initialRoot, _batchInsertionVerifiers, _batchUpdateVerifiers, _semaphoreVerifier) +} + +// Initialize is a paid mutator transaction binding the contract method 0x38c87065. +// +// Solidity: function initialize(uint8 _treeDepth, uint256 initialRoot, address _batchInsertionVerifiers, address _batchUpdateVerifiers, address _semaphoreVerifier) returns() +func (_WorldId *WorldIdSession) Initialize(_treeDepth uint8, initialRoot *big.Int, _batchInsertionVerifiers common.Address, _batchUpdateVerifiers common.Address, _semaphoreVerifier common.Address) (*types.Transaction, error) { + return _WorldId.Contract.Initialize(&_WorldId.TransactOpts, _treeDepth, initialRoot, _batchInsertionVerifiers, _batchUpdateVerifiers, _semaphoreVerifier) +} + +// Initialize is a paid mutator transaction binding the contract method 0x38c87065. +// +// Solidity: function initialize(uint8 _treeDepth, uint256 initialRoot, address _batchInsertionVerifiers, address _batchUpdateVerifiers, address _semaphoreVerifier) returns() +func (_WorldId *WorldIdTransactorSession) Initialize(_treeDepth uint8, initialRoot *big.Int, _batchInsertionVerifiers common.Address, _batchUpdateVerifiers common.Address, _semaphoreVerifier common.Address) (*types.Transaction, error) { + return _WorldId.Contract.Initialize(&_WorldId.TransactOpts, _treeDepth, initialRoot, _batchInsertionVerifiers, _batchUpdateVerifiers, _semaphoreVerifier) +} + +// RegisterIdentities is a paid mutator transaction binding the contract method 0x2217b211. +// +// Solidity: function registerIdentities(uint256[8] insertionProof, uint256 preRoot, uint32 startIndex, uint256[] identityCommitments, uint256 postRoot) returns() +func (_WorldId *WorldIdTransactor) RegisterIdentities(opts *bind.TransactOpts, insertionProof [8]*big.Int, preRoot *big.Int, startIndex uint32, identityCommitments []*big.Int, postRoot *big.Int) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "registerIdentities", insertionProof, preRoot, startIndex, identityCommitments, postRoot) +} + +// RegisterIdentities is a paid mutator transaction binding the contract method 0x2217b211. +// +// Solidity: function registerIdentities(uint256[8] insertionProof, uint256 preRoot, uint32 startIndex, uint256[] identityCommitments, uint256 postRoot) returns() +func (_WorldId *WorldIdSession) RegisterIdentities(insertionProof [8]*big.Int, preRoot *big.Int, startIndex uint32, identityCommitments []*big.Int, postRoot *big.Int) (*types.Transaction, error) { + return _WorldId.Contract.RegisterIdentities(&_WorldId.TransactOpts, insertionProof, preRoot, startIndex, identityCommitments, postRoot) +} + +// RegisterIdentities is a paid mutator transaction binding the contract method 0x2217b211. +// +// Solidity: function registerIdentities(uint256[8] insertionProof, uint256 preRoot, uint32 startIndex, uint256[] identityCommitments, uint256 postRoot) returns() +func (_WorldId *WorldIdTransactorSession) RegisterIdentities(insertionProof [8]*big.Int, preRoot *big.Int, startIndex uint32, identityCommitments []*big.Int, postRoot *big.Int) (*types.Transaction, error) { + return _WorldId.Contract.RegisterIdentities(&_WorldId.TransactOpts, insertionProof, preRoot, startIndex, identityCommitments, postRoot) +} + +// SetIdentityOperator is a paid mutator transaction binding the contract method 0xa7bba582. +// +// Solidity: function setIdentityOperator(address newIdentityOperator) returns(address) +func (_WorldId *WorldIdTransactor) SetIdentityOperator(opts *bind.TransactOpts, newIdentityOperator common.Address) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "setIdentityOperator", newIdentityOperator) +} + +// SetIdentityOperator is a paid mutator transaction binding the contract method 0xa7bba582. +// +// Solidity: function setIdentityOperator(address newIdentityOperator) returns(address) +func (_WorldId *WorldIdSession) SetIdentityOperator(newIdentityOperator common.Address) (*types.Transaction, error) { + return _WorldId.Contract.SetIdentityOperator(&_WorldId.TransactOpts, newIdentityOperator) +} + +// SetIdentityOperator is a paid mutator transaction binding the contract method 0xa7bba582. +// +// Solidity: function setIdentityOperator(address newIdentityOperator) returns(address) +func (_WorldId *WorldIdTransactorSession) SetIdentityOperator(newIdentityOperator common.Address) (*types.Transaction, error) { + return _WorldId.Contract.SetIdentityOperator(&_WorldId.TransactOpts, newIdentityOperator) +} + +// SetRegisterIdentitiesVerifierLookupTable is a paid mutator transaction binding the contract method 0x2f059fca. +// +// Solidity: function setRegisterIdentitiesVerifierLookupTable(address newTable) returns() +func (_WorldId *WorldIdTransactor) SetRegisterIdentitiesVerifierLookupTable(opts *bind.TransactOpts, newTable common.Address) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "setRegisterIdentitiesVerifierLookupTable", newTable) +} + +// SetRegisterIdentitiesVerifierLookupTable is a paid mutator transaction binding the contract method 0x2f059fca. +// +// Solidity: function setRegisterIdentitiesVerifierLookupTable(address newTable) returns() +func (_WorldId *WorldIdSession) SetRegisterIdentitiesVerifierLookupTable(newTable common.Address) (*types.Transaction, error) { + return _WorldId.Contract.SetRegisterIdentitiesVerifierLookupTable(&_WorldId.TransactOpts, newTable) +} + +// SetRegisterIdentitiesVerifierLookupTable is a paid mutator transaction binding the contract method 0x2f059fca. +// +// Solidity: function setRegisterIdentitiesVerifierLookupTable(address newTable) returns() +func (_WorldId *WorldIdTransactorSession) SetRegisterIdentitiesVerifierLookupTable(newTable common.Address) (*types.Transaction, error) { + return _WorldId.Contract.SetRegisterIdentitiesVerifierLookupTable(&_WorldId.TransactOpts, newTable) +} + +// SetRootHistoryExpiry is a paid mutator transaction binding the contract method 0xc70aa727. +// +// Solidity: function setRootHistoryExpiry(uint256 newExpiryTime) returns() +func (_WorldId *WorldIdTransactor) SetRootHistoryExpiry(opts *bind.TransactOpts, newExpiryTime *big.Int) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "setRootHistoryExpiry", newExpiryTime) +} + +// SetRootHistoryExpiry is a paid mutator transaction binding the contract method 0xc70aa727. +// +// Solidity: function setRootHistoryExpiry(uint256 newExpiryTime) returns() +func (_WorldId *WorldIdSession) SetRootHistoryExpiry(newExpiryTime *big.Int) (*types.Transaction, error) { + return _WorldId.Contract.SetRootHistoryExpiry(&_WorldId.TransactOpts, newExpiryTime) +} + +// SetRootHistoryExpiry is a paid mutator transaction binding the contract method 0xc70aa727. +// +// Solidity: function setRootHistoryExpiry(uint256 newExpiryTime) returns() +func (_WorldId *WorldIdTransactorSession) SetRootHistoryExpiry(newExpiryTime *big.Int) (*types.Transaction, error) { + return _WorldId.Contract.SetRootHistoryExpiry(&_WorldId.TransactOpts, newExpiryTime) +} + +// SetSemaphoreVerifier is a paid mutator transaction binding the contract method 0x0e3a12f3. +// +// Solidity: function setSemaphoreVerifier(address newVerifier) returns() +func (_WorldId *WorldIdTransactor) SetSemaphoreVerifier(opts *bind.TransactOpts, newVerifier common.Address) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "setSemaphoreVerifier", newVerifier) +} + +// SetSemaphoreVerifier is a paid mutator transaction binding the contract method 0x0e3a12f3. +// +// Solidity: function setSemaphoreVerifier(address newVerifier) returns() +func (_WorldId *WorldIdSession) SetSemaphoreVerifier(newVerifier common.Address) (*types.Transaction, error) { + return _WorldId.Contract.SetSemaphoreVerifier(&_WorldId.TransactOpts, newVerifier) +} + +// SetSemaphoreVerifier is a paid mutator transaction binding the contract method 0x0e3a12f3. +// +// Solidity: function setSemaphoreVerifier(address newVerifier) returns() +func (_WorldId *WorldIdTransactorSession) SetSemaphoreVerifier(newVerifier common.Address) (*types.Transaction, error) { + return _WorldId.Contract.SetSemaphoreVerifier(&_WorldId.TransactOpts, newVerifier) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_WorldId *WorldIdTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_WorldId *WorldIdSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _WorldId.Contract.TransferOwnership(&_WorldId.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_WorldId *WorldIdTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _WorldId.Contract.TransferOwnership(&_WorldId.TransactOpts, newOwner) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_WorldId *WorldIdTransactor) UpgradeTo(opts *bind.TransactOpts, newImplementation common.Address) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "upgradeTo", newImplementation) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_WorldId *WorldIdSession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) { + return _WorldId.Contract.UpgradeTo(&_WorldId.TransactOpts, newImplementation) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_WorldId *WorldIdTransactorSession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) { + return _WorldId.Contract.UpgradeTo(&_WorldId.TransactOpts, newImplementation) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_WorldId *WorldIdTransactor) UpgradeToAndCall(opts *bind.TransactOpts, newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _WorldId.contract.Transact(opts, "upgradeToAndCall", newImplementation, data) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_WorldId *WorldIdSession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _WorldId.Contract.UpgradeToAndCall(&_WorldId.TransactOpts, newImplementation, data) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_WorldId *WorldIdTransactorSession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _WorldId.Contract.UpgradeToAndCall(&_WorldId.TransactOpts, newImplementation, data) +} + +// WorldIdAdminChangedIterator is returned from FilterAdminChanged and is used to iterate over the raw logs and unpacked data for AdminChanged events raised by the WorldId contract. +type WorldIdAdminChangedIterator struct { + Event *WorldIdAdminChanged // 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 *WorldIdAdminChangedIterator) 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(WorldIdAdminChanged) + 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(WorldIdAdminChanged) + 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 *WorldIdAdminChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdAdminChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdAdminChanged represents a AdminChanged event raised by the WorldId contract. +type WorldIdAdminChanged struct { + PreviousAdmin common.Address + NewAdmin common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAdminChanged is a free log retrieval operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_WorldId *WorldIdFilterer) FilterAdminChanged(opts *bind.FilterOpts) (*WorldIdAdminChangedIterator, error) { + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "AdminChanged") + if err != nil { + return nil, err + } + return &WorldIdAdminChangedIterator{contract: _WorldId.contract, event: "AdminChanged", logs: logs, sub: sub}, nil +} + +// WatchAdminChanged is a free log subscription operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_WorldId *WorldIdFilterer) WatchAdminChanged(opts *bind.WatchOpts, sink chan<- *WorldIdAdminChanged) (event.Subscription, error) { + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "AdminChanged") + 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(WorldIdAdminChanged) + if err := _WorldId.contract.UnpackLog(event, "AdminChanged", 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 +} + +// ParseAdminChanged is a log parse operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_WorldId *WorldIdFilterer) ParseAdminChanged(log types.Log) (*WorldIdAdminChanged, error) { + event := new(WorldIdAdminChanged) + if err := _WorldId.contract.UnpackLog(event, "AdminChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdBeaconUpgradedIterator is returned from FilterBeaconUpgraded and is used to iterate over the raw logs and unpacked data for BeaconUpgraded events raised by the WorldId contract. +type WorldIdBeaconUpgradedIterator struct { + Event *WorldIdBeaconUpgraded // 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 *WorldIdBeaconUpgradedIterator) 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(WorldIdBeaconUpgraded) + 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(WorldIdBeaconUpgraded) + 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 *WorldIdBeaconUpgradedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdBeaconUpgradedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdBeaconUpgraded represents a BeaconUpgraded event raised by the WorldId contract. +type WorldIdBeaconUpgraded struct { + Beacon common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBeaconUpgraded is a free log retrieval operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_WorldId *WorldIdFilterer) FilterBeaconUpgraded(opts *bind.FilterOpts, beacon []common.Address) (*WorldIdBeaconUpgradedIterator, error) { + + var beaconRule []interface{} + for _, beaconItem := range beacon { + beaconRule = append(beaconRule, beaconItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "BeaconUpgraded", beaconRule) + if err != nil { + return nil, err + } + return &WorldIdBeaconUpgradedIterator{contract: _WorldId.contract, event: "BeaconUpgraded", logs: logs, sub: sub}, nil +} + +// WatchBeaconUpgraded is a free log subscription operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_WorldId *WorldIdFilterer) WatchBeaconUpgraded(opts *bind.WatchOpts, sink chan<- *WorldIdBeaconUpgraded, beacon []common.Address) (event.Subscription, error) { + + var beaconRule []interface{} + for _, beaconItem := range beacon { + beaconRule = append(beaconRule, beaconItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "BeaconUpgraded", beaconRule) + 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(WorldIdBeaconUpgraded) + if err := _WorldId.contract.UnpackLog(event, "BeaconUpgraded", 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 +} + +// ParseBeaconUpgraded is a log parse operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_WorldId *WorldIdFilterer) ParseBeaconUpgraded(log types.Log) (*WorldIdBeaconUpgraded, error) { + event := new(WorldIdBeaconUpgraded) + if err := _WorldId.contract.UnpackLog(event, "BeaconUpgraded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdDependencyUpdatedIterator is returned from FilterDependencyUpdated and is used to iterate over the raw logs and unpacked data for DependencyUpdated events raised by the WorldId contract. +type WorldIdDependencyUpdatedIterator struct { + Event *WorldIdDependencyUpdated // 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 *WorldIdDependencyUpdatedIterator) 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(WorldIdDependencyUpdated) + 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(WorldIdDependencyUpdated) + 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 *WorldIdDependencyUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdDependencyUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdDependencyUpdated represents a DependencyUpdated event raised by the WorldId contract. +type WorldIdDependencyUpdated struct { + Kind uint8 + OldAddress common.Address + NewAddress common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDependencyUpdated is a free log retrieval operation binding the contract event 0xd194b8423e9cb3c7cbebbbc3fe7f79dc2cbe0b40e03270d975abff491504c7b1. +// +// Solidity: event DependencyUpdated(uint8 indexed kind, address indexed oldAddress, address indexed newAddress) +func (_WorldId *WorldIdFilterer) FilterDependencyUpdated(opts *bind.FilterOpts, kind []uint8, oldAddress []common.Address, newAddress []common.Address) (*WorldIdDependencyUpdatedIterator, error) { + + var kindRule []interface{} + for _, kindItem := range kind { + kindRule = append(kindRule, kindItem) + } + var oldAddressRule []interface{} + for _, oldAddressItem := range oldAddress { + oldAddressRule = append(oldAddressRule, oldAddressItem) + } + var newAddressRule []interface{} + for _, newAddressItem := range newAddress { + newAddressRule = append(newAddressRule, newAddressItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "DependencyUpdated", kindRule, oldAddressRule, newAddressRule) + if err != nil { + return nil, err + } + return &WorldIdDependencyUpdatedIterator{contract: _WorldId.contract, event: "DependencyUpdated", logs: logs, sub: sub}, nil +} + +// WatchDependencyUpdated is a free log subscription operation binding the contract event 0xd194b8423e9cb3c7cbebbbc3fe7f79dc2cbe0b40e03270d975abff491504c7b1. +// +// Solidity: event DependencyUpdated(uint8 indexed kind, address indexed oldAddress, address indexed newAddress) +func (_WorldId *WorldIdFilterer) WatchDependencyUpdated(opts *bind.WatchOpts, sink chan<- *WorldIdDependencyUpdated, kind []uint8, oldAddress []common.Address, newAddress []common.Address) (event.Subscription, error) { + + var kindRule []interface{} + for _, kindItem := range kind { + kindRule = append(kindRule, kindItem) + } + var oldAddressRule []interface{} + for _, oldAddressItem := range oldAddress { + oldAddressRule = append(oldAddressRule, oldAddressItem) + } + var newAddressRule []interface{} + for _, newAddressItem := range newAddress { + newAddressRule = append(newAddressRule, newAddressItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "DependencyUpdated", kindRule, oldAddressRule, newAddressRule) + 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(WorldIdDependencyUpdated) + if err := _WorldId.contract.UnpackLog(event, "DependencyUpdated", 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 +} + +// ParseDependencyUpdated is a log parse operation binding the contract event 0xd194b8423e9cb3c7cbebbbc3fe7f79dc2cbe0b40e03270d975abff491504c7b1. +// +// Solidity: event DependencyUpdated(uint8 indexed kind, address indexed oldAddress, address indexed newAddress) +func (_WorldId *WorldIdFilterer) ParseDependencyUpdated(log types.Log) (*WorldIdDependencyUpdated, error) { + event := new(WorldIdDependencyUpdated) + if err := _WorldId.contract.UnpackLog(event, "DependencyUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdIdentityOperatorChangedIterator is returned from FilterIdentityOperatorChanged and is used to iterate over the raw logs and unpacked data for IdentityOperatorChanged events raised by the WorldId contract. +type WorldIdIdentityOperatorChangedIterator struct { + Event *WorldIdIdentityOperatorChanged // 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 *WorldIdIdentityOperatorChangedIterator) 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(WorldIdIdentityOperatorChanged) + 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(WorldIdIdentityOperatorChanged) + 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 *WorldIdIdentityOperatorChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdIdentityOperatorChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdIdentityOperatorChanged represents a IdentityOperatorChanged event raised by the WorldId contract. +type WorldIdIdentityOperatorChanged struct { + OldOperator common.Address + NewOperator common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterIdentityOperatorChanged is a free log retrieval operation binding the contract event 0x5a674c516c196404869e5f502b5634ce442416bb016dde54b5de4c812cc019e6. +// +// Solidity: event IdentityOperatorChanged(address indexed oldOperator, address indexed newOperator) +func (_WorldId *WorldIdFilterer) FilterIdentityOperatorChanged(opts *bind.FilterOpts, oldOperator []common.Address, newOperator []common.Address) (*WorldIdIdentityOperatorChangedIterator, error) { + + var oldOperatorRule []interface{} + for _, oldOperatorItem := range oldOperator { + oldOperatorRule = append(oldOperatorRule, oldOperatorItem) + } + var newOperatorRule []interface{} + for _, newOperatorItem := range newOperator { + newOperatorRule = append(newOperatorRule, newOperatorItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "IdentityOperatorChanged", oldOperatorRule, newOperatorRule) + if err != nil { + return nil, err + } + return &WorldIdIdentityOperatorChangedIterator{contract: _WorldId.contract, event: "IdentityOperatorChanged", logs: logs, sub: sub}, nil +} + +// WatchIdentityOperatorChanged is a free log subscription operation binding the contract event 0x5a674c516c196404869e5f502b5634ce442416bb016dde54b5de4c812cc019e6. +// +// Solidity: event IdentityOperatorChanged(address indexed oldOperator, address indexed newOperator) +func (_WorldId *WorldIdFilterer) WatchIdentityOperatorChanged(opts *bind.WatchOpts, sink chan<- *WorldIdIdentityOperatorChanged, oldOperator []common.Address, newOperator []common.Address) (event.Subscription, error) { + + var oldOperatorRule []interface{} + for _, oldOperatorItem := range oldOperator { + oldOperatorRule = append(oldOperatorRule, oldOperatorItem) + } + var newOperatorRule []interface{} + for _, newOperatorItem := range newOperator { + newOperatorRule = append(newOperatorRule, newOperatorItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "IdentityOperatorChanged", oldOperatorRule, newOperatorRule) + 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(WorldIdIdentityOperatorChanged) + if err := _WorldId.contract.UnpackLog(event, "IdentityOperatorChanged", 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 +} + +// ParseIdentityOperatorChanged is a log parse operation binding the contract event 0x5a674c516c196404869e5f502b5634ce442416bb016dde54b5de4c812cc019e6. +// +// Solidity: event IdentityOperatorChanged(address indexed oldOperator, address indexed newOperator) +func (_WorldId *WorldIdFilterer) ParseIdentityOperatorChanged(log types.Log) (*WorldIdIdentityOperatorChanged, error) { + event := new(WorldIdIdentityOperatorChanged) + if err := _WorldId.contract.UnpackLog(event, "IdentityOperatorChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the WorldId contract. +type WorldIdInitializedIterator struct { + Event *WorldIdInitialized // 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 *WorldIdInitializedIterator) 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(WorldIdInitialized) + 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(WorldIdInitialized) + 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 *WorldIdInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdInitialized represents a Initialized event raised by the WorldId contract. +type WorldIdInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_WorldId *WorldIdFilterer) FilterInitialized(opts *bind.FilterOpts) (*WorldIdInitializedIterator, error) { + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &WorldIdInitializedIterator{contract: _WorldId.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_WorldId *WorldIdFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *WorldIdInitialized) (event.Subscription, error) { + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "Initialized") + 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(WorldIdInitialized) + if err := _WorldId.contract.UnpackLog(event, "Initialized", 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 +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_WorldId *WorldIdFilterer) ParseInitialized(log types.Log) (*WorldIdInitialized, error) { + event := new(WorldIdInitialized) + if err := _WorldId.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdOwnershipTransferStartedIterator is returned from FilterOwnershipTransferStarted and is used to iterate over the raw logs and unpacked data for OwnershipTransferStarted events raised by the WorldId contract. +type WorldIdOwnershipTransferStartedIterator struct { + Event *WorldIdOwnershipTransferStarted // 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 *WorldIdOwnershipTransferStartedIterator) 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(WorldIdOwnershipTransferStarted) + 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(WorldIdOwnershipTransferStarted) + 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 *WorldIdOwnershipTransferStartedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdOwnershipTransferStartedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdOwnershipTransferStarted represents a OwnershipTransferStarted event raised by the WorldId contract. +type WorldIdOwnershipTransferStarted struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferStarted is a free log retrieval operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_WorldId *WorldIdFilterer) FilterOwnershipTransferStarted(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*WorldIdOwnershipTransferStartedIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &WorldIdOwnershipTransferStartedIterator{contract: _WorldId.contract, event: "OwnershipTransferStarted", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferStarted is a free log subscription operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_WorldId *WorldIdFilterer) WatchOwnershipTransferStarted(opts *bind.WatchOpts, sink chan<- *WorldIdOwnershipTransferStarted, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) + 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(WorldIdOwnershipTransferStarted) + if err := _WorldId.contract.UnpackLog(event, "OwnershipTransferStarted", 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 +} + +// ParseOwnershipTransferStarted is a log parse operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_WorldId *WorldIdFilterer) ParseOwnershipTransferStarted(log types.Log) (*WorldIdOwnershipTransferStarted, error) { + event := new(WorldIdOwnershipTransferStarted) + if err := _WorldId.contract.UnpackLog(event, "OwnershipTransferStarted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the WorldId contract. +type WorldIdOwnershipTransferredIterator struct { + Event *WorldIdOwnershipTransferred // 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 *WorldIdOwnershipTransferredIterator) 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(WorldIdOwnershipTransferred) + 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(WorldIdOwnershipTransferred) + 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 *WorldIdOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdOwnershipTransferred represents a OwnershipTransferred event raised by the WorldId contract. +type WorldIdOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_WorldId *WorldIdFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*WorldIdOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &WorldIdOwnershipTransferredIterator{contract: _WorldId.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_WorldId *WorldIdFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *WorldIdOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + 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(WorldIdOwnershipTransferred) + if err := _WorldId.contract.UnpackLog(event, "OwnershipTransferred", 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 +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_WorldId *WorldIdFilterer) ParseOwnershipTransferred(log types.Log) (*WorldIdOwnershipTransferred, error) { + event := new(WorldIdOwnershipTransferred) + if err := _WorldId.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdRootHistoryExpirySetIterator is returned from FilterRootHistoryExpirySet and is used to iterate over the raw logs and unpacked data for RootHistoryExpirySet events raised by the WorldId contract. +type WorldIdRootHistoryExpirySetIterator struct { + Event *WorldIdRootHistoryExpirySet // 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 *WorldIdRootHistoryExpirySetIterator) 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(WorldIdRootHistoryExpirySet) + 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(WorldIdRootHistoryExpirySet) + 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 *WorldIdRootHistoryExpirySetIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdRootHistoryExpirySetIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdRootHistoryExpirySet represents a RootHistoryExpirySet event raised by the WorldId contract. +type WorldIdRootHistoryExpirySet struct { + OldExpiryTime *big.Int + NewExpiryTime *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRootHistoryExpirySet is a free log retrieval operation binding the contract event 0xf62a6f06fde00a303cd5939e6b53762854412c96a196cda26720cedd28af9e70. +// +// Solidity: event RootHistoryExpirySet(uint256 indexed oldExpiryTime, uint256 indexed newExpiryTime) +func (_WorldId *WorldIdFilterer) FilterRootHistoryExpirySet(opts *bind.FilterOpts, oldExpiryTime []*big.Int, newExpiryTime []*big.Int) (*WorldIdRootHistoryExpirySetIterator, error) { + + var oldExpiryTimeRule []interface{} + for _, oldExpiryTimeItem := range oldExpiryTime { + oldExpiryTimeRule = append(oldExpiryTimeRule, oldExpiryTimeItem) + } + var newExpiryTimeRule []interface{} + for _, newExpiryTimeItem := range newExpiryTime { + newExpiryTimeRule = append(newExpiryTimeRule, newExpiryTimeItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "RootHistoryExpirySet", oldExpiryTimeRule, newExpiryTimeRule) + if err != nil { + return nil, err + } + return &WorldIdRootHistoryExpirySetIterator{contract: _WorldId.contract, event: "RootHistoryExpirySet", logs: logs, sub: sub}, nil +} + +// WatchRootHistoryExpirySet is a free log subscription operation binding the contract event 0xf62a6f06fde00a303cd5939e6b53762854412c96a196cda26720cedd28af9e70. +// +// Solidity: event RootHistoryExpirySet(uint256 indexed oldExpiryTime, uint256 indexed newExpiryTime) +func (_WorldId *WorldIdFilterer) WatchRootHistoryExpirySet(opts *bind.WatchOpts, sink chan<- *WorldIdRootHistoryExpirySet, oldExpiryTime []*big.Int, newExpiryTime []*big.Int) (event.Subscription, error) { + + var oldExpiryTimeRule []interface{} + for _, oldExpiryTimeItem := range oldExpiryTime { + oldExpiryTimeRule = append(oldExpiryTimeRule, oldExpiryTimeItem) + } + var newExpiryTimeRule []interface{} + for _, newExpiryTimeItem := range newExpiryTime { + newExpiryTimeRule = append(newExpiryTimeRule, newExpiryTimeItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "RootHistoryExpirySet", oldExpiryTimeRule, newExpiryTimeRule) + 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(WorldIdRootHistoryExpirySet) + if err := _WorldId.contract.UnpackLog(event, "RootHistoryExpirySet", 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 +} + +// ParseRootHistoryExpirySet is a log parse operation binding the contract event 0xf62a6f06fde00a303cd5939e6b53762854412c96a196cda26720cedd28af9e70. +// +// Solidity: event RootHistoryExpirySet(uint256 indexed oldExpiryTime, uint256 indexed newExpiryTime) +func (_WorldId *WorldIdFilterer) ParseRootHistoryExpirySet(log types.Log) (*WorldIdRootHistoryExpirySet, error) { + event := new(WorldIdRootHistoryExpirySet) + if err := _WorldId.contract.UnpackLog(event, "RootHistoryExpirySet", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdStateBridgeStateChangeIterator is returned from FilterStateBridgeStateChange and is used to iterate over the raw logs and unpacked data for StateBridgeStateChange events raised by the WorldId contract. +type WorldIdStateBridgeStateChangeIterator struct { + Event *WorldIdStateBridgeStateChange // 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 *WorldIdStateBridgeStateChangeIterator) 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(WorldIdStateBridgeStateChange) + 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(WorldIdStateBridgeStateChange) + 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 *WorldIdStateBridgeStateChangeIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdStateBridgeStateChangeIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdStateBridgeStateChange represents a StateBridgeStateChange event raised by the WorldId contract. +type WorldIdStateBridgeStateChange struct { + IsEnabled bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterStateBridgeStateChange is a free log retrieval operation binding the contract event 0xc2481c150ab648d8248c5a0b452a12da07a6a26d8e11b0ed6cee10375e14d5e4. +// +// Solidity: event StateBridgeStateChange(bool indexed isEnabled) +func (_WorldId *WorldIdFilterer) FilterStateBridgeStateChange(opts *bind.FilterOpts, isEnabled []bool) (*WorldIdStateBridgeStateChangeIterator, error) { + + var isEnabledRule []interface{} + for _, isEnabledItem := range isEnabled { + isEnabledRule = append(isEnabledRule, isEnabledItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "StateBridgeStateChange", isEnabledRule) + if err != nil { + return nil, err + } + return &WorldIdStateBridgeStateChangeIterator{contract: _WorldId.contract, event: "StateBridgeStateChange", logs: logs, sub: sub}, nil +} + +// WatchStateBridgeStateChange is a free log subscription operation binding the contract event 0xc2481c150ab648d8248c5a0b452a12da07a6a26d8e11b0ed6cee10375e14d5e4. +// +// Solidity: event StateBridgeStateChange(bool indexed isEnabled) +func (_WorldId *WorldIdFilterer) WatchStateBridgeStateChange(opts *bind.WatchOpts, sink chan<- *WorldIdStateBridgeStateChange, isEnabled []bool) (event.Subscription, error) { + + var isEnabledRule []interface{} + for _, isEnabledItem := range isEnabled { + isEnabledRule = append(isEnabledRule, isEnabledItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "StateBridgeStateChange", isEnabledRule) + 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(WorldIdStateBridgeStateChange) + if err := _WorldId.contract.UnpackLog(event, "StateBridgeStateChange", 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 +} + +// ParseStateBridgeStateChange is a log parse operation binding the contract event 0xc2481c150ab648d8248c5a0b452a12da07a6a26d8e11b0ed6cee10375e14d5e4. +// +// Solidity: event StateBridgeStateChange(bool indexed isEnabled) +func (_WorldId *WorldIdFilterer) ParseStateBridgeStateChange(log types.Log) (*WorldIdStateBridgeStateChange, error) { + event := new(WorldIdStateBridgeStateChange) + if err := _WorldId.contract.UnpackLog(event, "StateBridgeStateChange", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdTreeChangedIterator is returned from FilterTreeChanged and is used to iterate over the raw logs and unpacked data for TreeChanged events raised by the WorldId contract. +type WorldIdTreeChangedIterator struct { + Event *WorldIdTreeChanged // 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 *WorldIdTreeChangedIterator) 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(WorldIdTreeChanged) + 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(WorldIdTreeChanged) + 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 *WorldIdTreeChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdTreeChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdTreeChanged represents a TreeChanged event raised by the WorldId contract. +type WorldIdTreeChanged struct { + PreRoot *big.Int + Kind uint8 + PostRoot *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTreeChanged is a free log retrieval operation binding the contract event 0x25f6d5cc356ee0b49cf708c13c68197947f5740a878a298765e4b18e4afdaf04. +// +// Solidity: event TreeChanged(uint256 indexed preRoot, uint8 indexed kind, uint256 indexed postRoot) +func (_WorldId *WorldIdFilterer) FilterTreeChanged(opts *bind.FilterOpts, preRoot []*big.Int, kind []uint8, postRoot []*big.Int) (*WorldIdTreeChangedIterator, error) { + + var preRootRule []interface{} + for _, preRootItem := range preRoot { + preRootRule = append(preRootRule, preRootItem) + } + var kindRule []interface{} + for _, kindItem := range kind { + kindRule = append(kindRule, kindItem) + } + var postRootRule []interface{} + for _, postRootItem := range postRoot { + postRootRule = append(postRootRule, postRootItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "TreeChanged", preRootRule, kindRule, postRootRule) + if err != nil { + return nil, err + } + return &WorldIdTreeChangedIterator{contract: _WorldId.contract, event: "TreeChanged", logs: logs, sub: sub}, nil +} + +// WatchTreeChanged is a free log subscription operation binding the contract event 0x25f6d5cc356ee0b49cf708c13c68197947f5740a878a298765e4b18e4afdaf04. +// +// Solidity: event TreeChanged(uint256 indexed preRoot, uint8 indexed kind, uint256 indexed postRoot) +func (_WorldId *WorldIdFilterer) WatchTreeChanged(opts *bind.WatchOpts, sink chan<- *WorldIdTreeChanged, preRoot []*big.Int, kind []uint8, postRoot []*big.Int) (event.Subscription, error) { + + var preRootRule []interface{} + for _, preRootItem := range preRoot { + preRootRule = append(preRootRule, preRootItem) + } + var kindRule []interface{} + for _, kindItem := range kind { + kindRule = append(kindRule, kindItem) + } + var postRootRule []interface{} + for _, postRootItem := range postRoot { + postRootRule = append(postRootRule, postRootItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "TreeChanged", preRootRule, kindRule, postRootRule) + 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(WorldIdTreeChanged) + if err := _WorldId.contract.UnpackLog(event, "TreeChanged", 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 +} + +// ParseTreeChanged is a log parse operation binding the contract event 0x25f6d5cc356ee0b49cf708c13c68197947f5740a878a298765e4b18e4afdaf04. +// +// Solidity: event TreeChanged(uint256 indexed preRoot, uint8 indexed kind, uint256 indexed postRoot) +func (_WorldId *WorldIdFilterer) ParseTreeChanged(log types.Log) (*WorldIdTreeChanged, error) { + event := new(WorldIdTreeChanged) + if err := _WorldId.contract.UnpackLog(event, "TreeChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdUpgradedIterator is returned from FilterUpgraded and is used to iterate over the raw logs and unpacked data for Upgraded events raised by the WorldId contract. +type WorldIdUpgradedIterator struct { + Event *WorldIdUpgraded // 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 *WorldIdUpgradedIterator) 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(WorldIdUpgraded) + 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(WorldIdUpgraded) + 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 *WorldIdUpgradedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdUpgradedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdUpgraded represents a Upgraded event raised by the WorldId contract. +type WorldIdUpgraded struct { + Implementation common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpgraded is a free log retrieval operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_WorldId *WorldIdFilterer) FilterUpgraded(opts *bind.FilterOpts, implementation []common.Address) (*WorldIdUpgradedIterator, error) { + + var implementationRule []interface{} + for _, implementationItem := range implementation { + implementationRule = append(implementationRule, implementationItem) + } + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "Upgraded", implementationRule) + if err != nil { + return nil, err + } + return &WorldIdUpgradedIterator{contract: _WorldId.contract, event: "Upgraded", logs: logs, sub: sub}, nil +} + +// WatchUpgraded is a free log subscription operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_WorldId *WorldIdFilterer) WatchUpgraded(opts *bind.WatchOpts, sink chan<- *WorldIdUpgraded, implementation []common.Address) (event.Subscription, error) { + + var implementationRule []interface{} + for _, implementationItem := range implementation { + implementationRule = append(implementationRule, implementationItem) + } + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "Upgraded", implementationRule) + 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(WorldIdUpgraded) + if err := _WorldId.contract.UnpackLog(event, "Upgraded", 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 +} + +// ParseUpgraded is a log parse operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_WorldId *WorldIdFilterer) ParseUpgraded(log types.Log) (*WorldIdUpgraded, error) { + event := new(WorldIdUpgraded) + if err := _WorldId.contract.UnpackLog(event, "Upgraded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// WorldIdWorldIDIdentityManagerImplInitializedIterator is returned from FilterWorldIDIdentityManagerImplInitialized and is used to iterate over the raw logs and unpacked data for WorldIDIdentityManagerImplInitialized events raised by the WorldId contract. +type WorldIdWorldIDIdentityManagerImplInitializedIterator struct { + Event *WorldIdWorldIDIdentityManagerImplInitialized // 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 *WorldIdWorldIDIdentityManagerImplInitializedIterator) 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(WorldIdWorldIDIdentityManagerImplInitialized) + 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(WorldIdWorldIDIdentityManagerImplInitialized) + 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 *WorldIdWorldIDIdentityManagerImplInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *WorldIdWorldIDIdentityManagerImplInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// WorldIdWorldIDIdentityManagerImplInitialized represents a WorldIDIdentityManagerImplInitialized event raised by the WorldId contract. +type WorldIdWorldIDIdentityManagerImplInitialized struct { + TreeDepth uint8 + InitialRoot *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWorldIDIdentityManagerImplInitialized is a free log retrieval operation binding the contract event 0xd1bcc66c061c32a21f569d138c2dadef4a38a0636309881954af5f44010ec1d8. +// +// Solidity: event WorldIDIdentityManagerImplInitialized(uint8 _treeDepth, uint256 initialRoot) +func (_WorldId *WorldIdFilterer) FilterWorldIDIdentityManagerImplInitialized(opts *bind.FilterOpts) (*WorldIdWorldIDIdentityManagerImplInitializedIterator, error) { + + logs, sub, err := _WorldId.contract.FilterLogs(opts, "WorldIDIdentityManagerImplInitialized") + if err != nil { + return nil, err + } + return &WorldIdWorldIDIdentityManagerImplInitializedIterator{contract: _WorldId.contract, event: "WorldIDIdentityManagerImplInitialized", logs: logs, sub: sub}, nil +} + +// WatchWorldIDIdentityManagerImplInitialized is a free log subscription operation binding the contract event 0xd1bcc66c061c32a21f569d138c2dadef4a38a0636309881954af5f44010ec1d8. +// +// Solidity: event WorldIDIdentityManagerImplInitialized(uint8 _treeDepth, uint256 initialRoot) +func (_WorldId *WorldIdFilterer) WatchWorldIDIdentityManagerImplInitialized(opts *bind.WatchOpts, sink chan<- *WorldIdWorldIDIdentityManagerImplInitialized) (event.Subscription, error) { + + logs, sub, err := _WorldId.contract.WatchLogs(opts, "WorldIDIdentityManagerImplInitialized") + 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(WorldIdWorldIDIdentityManagerImplInitialized) + if err := _WorldId.contract.UnpackLog(event, "WorldIDIdentityManagerImplInitialized", 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 +} + +// ParseWorldIDIdentityManagerImplInitialized is a log parse operation binding the contract event 0xd1bcc66c061c32a21f569d138c2dadef4a38a0636309881954af5f44010ec1d8. +// +// Solidity: event WorldIDIdentityManagerImplInitialized(uint8 _treeDepth, uint256 initialRoot) +func (_WorldId *WorldIdFilterer) ParseWorldIDIdentityManagerImplInitialized(log types.Log) (*WorldIdWorldIDIdentityManagerImplInitialized, error) { + event := new(WorldIdWorldIDIdentityManagerImplInitialized) + if err := _WorldId.contract.UnpackLog(event, "WorldIDIdentityManagerImplInitialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/werf.yaml b/werf.yaml index a0a9093..a9c3fc3 100644 --- a/werf.yaml +++ b/werf.yaml @@ -4,10 +4,10 @@ project: "backend" image: builder from: golang:1.19-alpine docker: - WORKDIR: /go/src/github.com/rarimo/evm-identity-saver-svc + WORKDIR: /go/src/github.com/rarimo/evm-worldcoin-saver-svc git: - add: / - to: /go/src/github.com/rarimo/evm-identity-saver-svc + to: /go/src/github.com/rarimo/evm-worldcoin-saver-svc stageDependencies: setup: - "**/*" @@ -17,24 +17,24 @@ shell: - go env -w GOPRIVATE=github.com/* - go env -w GONOSUMDB=github.com/* - go env -w GONOPROXY=github.com/* - - cd /go/src/github.com/rarimo/evm-identity-saver-svc + - cd /go/src/github.com/rarimo/evm-worldcoin-saver-svc - go mod tidy setup: - export CGO_ENABLED=0 - export GOOS=linux - - cd /go/src/github.com/rarimo/evm-identity-saver-svc - - go build -o /usr/local/bin/evm-identity-saver-svc /go/src/github.com/rarimo/evm-identity-saver-svc + - cd /go/src/github.com/rarimo/evm-worldcoin-saver-svc + - go build -o /usr/local/bin/evm-worldcoin-saver-svc /go/src/github.com/rarimo/evm-worldcoin-saver-svc --- image: service from: alpine:3.14.6 docker: - ENTRYPOINT: evm-identity-saver-svc + ENTRYPOINT: evm-worldcoin-saver-svc shell: setup: - apk add --no-cache ca-certificates import: - image: builder - add: /usr/local/bin/evm-identity-saver-svc - to: /usr/local/bin/evm-identity-saver-svc + add: /usr/local/bin/evm-worldcoin-saver-svc + to: /usr/local/bin/evm-worldcoin-saver-svc after: setup