diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a8173d3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,32 @@ + + +Closes: #XXX + +## Description + + + +______ + +For contributor use: + +- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. +- [ ] Wrote unit +- [ ] Updated relevant documentation (`docs/`) +- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). +- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` +- [ ] Re-reviewed `Files changed` in the Github PR explorer + +______ + +For admin use: + +- [ ] Added appropriate labels to PR (ex. `WIP`, `R4R`, `docs`, etc) +- [ ] Reviewers assigned +- [ ] Squashed all commits, uses message "Merge pull request #XYZ: [title]" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..625a7c9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build +on: + pull_request: + branches: + - main + - dev + +jobs: + cleanup-runs: + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: 1.21 + check-latest: true + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + **/**.go + go.mod + go.sum + - run: | + make build + if: env.GIT_DIFF diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..671853e --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,65 @@ +name: Build docker images + +on: + push: + branches: + - "main" + - "dev" + tags: + - "v*.*.*" + pull_request: + branches: + - "main" + - "dev" + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Git fetch everything + run: git fetch --prune --unshallow + - + name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + ghcr.io/${{ github.repository }} + + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=sha + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64, linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0a8a4e0 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,54 @@ +name: Lint +# Lint runs golangci-lint over the entire ethermint repository This workflow is +# run on every pull request and push to main The `golangci` will pass without +# running if no *.{go, mod, sum} files have been changed. +on: + pull_request: + push: + branches: + - main + - dev +jobs: + golangci: + name: Run golangci-lint + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + # Required: setup-go, for all versions v3.0.0+ of golangci-lint + - uses: actions/setup-go@v4 + with: + go-version: 1.21 + check-latest: true + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6.1.2 + with: + PATTERNS: | + **/**.go + go.mod + go.sum + - uses: golangci/golangci-lint-action@v3.4.0 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: latest + args: --timeout 10m + github-token: ${{ secrets.github_token }} + # Check only if there are differences in the source code + if: env.GIT_DIFF + markdown-lint: + name: Run markdown-lint + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6.1.2 + with: + PATTERNS: | + docs/**/*.md + README.md + - uses: nosborn/github-action-markdown-cli@v3.3.0 + with: + files: . + config_file: .markdownlint.yml + ignore_path: .markdownlintignore + # Check only if there are differences in the source code + if: env.GIT_DIFF diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml new file mode 100644 index 0000000..db4448b --- /dev/null +++ b/.github/workflows/markdown-links.yml @@ -0,0 +1,30 @@ +name: Check Markdown links +on: + pull_request: + paths: + - '**.md' + push: + branches: + - main + - dev + paths: + - '**.md' + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + **/**.md + - uses: gaurav-nelson/github-action-markdown-link-check@master + with: + folder-path: "docs" + check-modified-files-only: "yes" + use-quiet-mode: "yes" + base-branch: "dev" + config-file: "mlc_config.json" + if: env.GIT_DIFF diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml new file mode 100644 index 0000000..ebdd6b4 --- /dev/null +++ b/.github/workflows/proto.yml @@ -0,0 +1,28 @@ +name: Protobuf +# Protobuf runs buf (https://buf.build/) lint and check-breakage +# This workflow is only run when a .proto file has been changed +on: + pull_request: + paths: + - "proto/**" + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: bufbuild/buf-setup-action@v1.16.0 + - uses: bufbuild/buf-lint-action@v1 + with: + input: "proto" + + break-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: bufbuild/buf-setup-action@v1.16.0 + - uses: bufbuild/buf-breaking-action@v1 + with: + input: "proto" + against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto" diff --git a/.gitignore b/.gitignore index 6f6f5e6..d2b4152 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ # Go workspace file go.work go.work.sum +.idea +.DS_Store + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..911b4b3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,54 @@ +stages: + - build + - deploy + +build-image-dev: + stage: build + tags: [ ikey-shell ] + only: + - develop + script: + - GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/main main.go + - docker buildx build -f Dockerfile.slim -t ${DOCKER_REGISTRY}/${IMAGE_NAME}:dev --push . + +build-image-prod: + stage: build + tags: [ ikey-shell ] + only: + - tags + script: + - GIT_TERMINAL_PROMPT=1 GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/main main.go + - docker buildx build -f Dockerfile.slim -t ${DOCKER_REGISTRY}/${IMAGE_NAME}:${CI_COMMIT_TAG} --push . + + +deploy-to-dev: + stage: deploy + tags: [ ikey-shell ] + only: + - develop + dependencies: + - build-image-dev + before_script: + - git config --global user.email "gitlab@gitlab.com" + - git config --global user.name "GitLab CI/CD" + script: + - git clone -b main ${GIT_SSH_REPO} + - cd argocd && sed -i "s/gitTag:.*/gitTag:\ '$CI_COMMIT_SHORT_SHA'/g" $PROJECT/dev-values.yaml + - git commit -am "update image tag to $CI_COMMIT_SHORT_SHA" + - git push origin main + +deploy-to-prod: + stage: deploy + tags: [ ikey-shell ] + only: + - tags + dependencies: + - build-image-prod + before_script: + - git config --global user.email "gitlab@gitlab.com" + - git config --global user.name "GitLab CI/CD" + script: + - git clone -b main ${GIT_SSH_REPO} + - cd argocd && sed -i "s/tag:.*/tag:\ '$CI_COMMIT_TAG'/g" $PROJECT/prod-values.yaml + - git commit -am "update image tag to $CI_COMMIT_TAG" + - git push origin main \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..ee2cdc4 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,75 @@ +run: + tests: false + # timeout for analysis, e.g. 30s, 5m, default is 1m + # timeout: 5m + +linters: + enable: + - bodyclose + # - depguard + - dogsled + - dupl + - errcheck + - goconst + - gocritic + - gofumpt + - revive + - gosec + - gosimple + - govet + - ineffassign + - lll + - misspell + - nakedret + - prealloc + - exportloopref + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - nolintlint + - asciicheck + - exportloopref + - gofumpt + - gomodguard + - whitespace + +issues: + exclude-rules: + - path: _test\.go + linters: + - gosec + - linters: + - lll + source: "https://" + max-same-issues: 50 + +linters-settings: + lll: + line-length: 200 + dogsled: + max-blank-identifiers: 3 + golint: + min-confidence: 0 + maligned: + suggest-new: true + misspell: + locale: US + nolintlint: + allow-unused: false + allow-leading-space: true + require-explanation: false + require-specific: false + gofumpt: + lang-version: "1.21" + gomodguard: + blocked: + versions: # List of blocked module version constraints + - https://github.com/etcd-io/etcd: # Blocked module with version constraint + version: ">= 3.4.10 || ~3.3.23" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons + reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional) + - https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint + version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons + reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional) diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 0000000..ad27776 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,21 @@ +"default": true +"MD001": false +"MD004": false +"MD007": + "indent": 4 +"MD013": false +"MD024": + "siblings_only": true +"MD025": false +"MD026": + "punctuation": ".;:" +"MD029": false +"MD033": false +"MD034": false +"MD036": false +"MD040": false +"MD041": false +"MD051": false +"MD049": + "style": "asterisk" +"no-hard-tabs": false diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 0000000..f3a830d --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1,3 @@ +CHANGELOG.md +docs/api/proto-docs.md +docs/node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c2b5048 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:latest as builder +ARG GOPROXY=https://goproxy.cn +COPY . /src +RUN apt-get update && apt install -y protobuf-compiler git && \ + cd /tmp && git clone https://github.com/googleapis/googleapis.git && \ + cp -r /tmp/googleapis/* /usr/local/include/ && \ + cd /src && \ + go get github.com/golang/protobuf/protoc-gen-go && \ + go install github.com/golang/protobuf/protoc-gen-go && \ +# PROTO_INCLUDE=/usr/local/include make proto && \ + GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/main main.go + +# ===== +FROM alpine:latest +COPY --from=builder /src/build/main /usr/bin/main +CMD ["/usr/bin/main"] + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..acf10fc --- /dev/null +++ b/Makefile @@ -0,0 +1,133 @@ +BUILDDIR ?= $(CURDIR)/build +NAMESPACE := ghcr.io/b2network +PROJECT := b2-committer +DOCKER_IMAGE := $(NAMESPACE)/$(PROJECT) +COMMIT_HASH := $(shell git rev-parse --short=7 HEAD) +DATE=$(shell date +%Y%m%d-%H%M%S) +DOCKER_TAG := ${DATE}-$(COMMIT_HASH) +DOCKER := $(shell which docker) + +############################################################################### +### Build ### +############################################################################### + +BUILD_TARGETS := build install + +build: BUILD_ARGS=-o $(BUILDDIR)/ +build-linux: + GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build + +$(BUILD_TARGETS): go.sum $(BUILDDIR)/ + go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./... + +$(BUILDDIR)/: + mkdir -p $(BUILDDIR)/ + +image-build: + docker build -t ${DOCKER_IMAGE}:${DOCKER_TAG} . + +image-push: + docker push --all-tags ${DOCKER_IMAGE} + +image-list: + docker images | grep ${DOCKER_IMAGE} + +$(MOCKS_DIR): + mkdir -p $(MOCKS_DIR) + +distclean: clean tools-clean + +clean: + rm -rf \ + $(BUILDDIR)/ \ + artifacts/ \ + tmp-swagger-gen/ + +all: build + +build-all: tools build lint test vulncheck + +.PHONY: distclean clean build-all + +############################################################################### +### Linting ### +############################################################################### + +lint: + @@test -n "$$golangci-lint version | awk '$4 >= 1.42')" + golangci-lint run --out-format=tab -n + +lint-py: + flake8 --show-source --count --statistics \ + --format="::error file=%(path)s,line=%(row)d,col=%(col)d::%(path)s:%(row)d:%(col)d: %(code)s %(text)s" \ + +format: + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' -not -name '*.pb.gw.go' | xargs gofumpt -d -e -extra + +lint-fix: + golangci-lint run --fix --out-format=tab --issues-exit-code=0 +.PHONY: lint lint-fix lint-py + +format-fix: + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' -not -name '*.pb.gw.go' | xargs gofumpt -w -s + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' -not -name '*.pb.gw.go' | xargs misspell -w +.PHONY: format + + +############################################################################### +### Protobuf ### +############################################################################### + +# ------ +# NOTE: Link to the tendermintdev/sdk-proto-gen docker images: +# https://hub.docker.com/r/tendermintdev/sdk-proto-gen/tags +# +protoVer=v0.7 +protoImageName=tendermintdev/sdk-proto-gen:$(protoVer) +protoImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) +# ------ +# NOTE: cosmos/proto-builder image is needed because clang-format is not installed +# on the tendermintdev/sdk-proto-gen docker image. +# Link to the cosmos/proto-builder docker images: +# https://github.com/cosmos/cosmos-sdk/pkgs/container/proto-builder +# +protoCosmosVer=0.11.2 +protoCosmosName=ghcr.io/cosmos/proto-builder:$(protoCosmosVer) +protoCosmosImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoCosmosName) +# ------ +# NOTE: Link to the yoheimuta/protolint docker images: +# https://hub.docker.com/r/yoheimuta/protolint/tags +# +protolintVer=0.42.2 +protolintName=yoheimuta/protolint:$(protolintVer) +protolintImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protolintName) + + +# ------ +# NOTE: If you are experiencing problems running these commands, try deleting +# the docker images and execute the desired command again. +# +proto-all: proto-format proto-lint proto-gen + +proto-gen: + @echo "Generating Protobuf files" + $(protoImage) sh ./scripts/protocgen.sh + + +# TODO: Rethink API docs generation +# proto-swagger-gen: +# @echo "Generating Protobuf Swagger" +# $(protoImage) sh ./scripts/protoc-swagger-gen.sh + +proto-format: + @echo "Formatting Protobuf files" + $(protoCosmosImage) find ./ -name *.proto -exec clang-format -i {} \; + +# NOTE: The linter configuration lives in .protolint.yaml +proto-lint: + @echo "Linting Protobuf files" + $(protolintImage) lint ./proto + +proto-check-breaking: + @echo "Checking Protobuf files for breaking changes" + $(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main diff --git a/abi/dispute_game.json b/abi/dispute_game.json new file mode 100644 index 0000000..678bf8c --- /dev/null +++ b/abi/dispute_game.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"GameType","name":"_gameType","type":"uint32"},{"internalType":"Claim","name":"_absolutePrestate","type":"bytes32"},{"internalType":"uint256","name":"_maxGameDepth","type":"uint256"},{"internalType":"uint256","name":"_splitDepth","type":"uint256"},{"internalType":"Duration","name":"_clockExtension","type":"uint64"},{"internalType":"Duration","name":"_maxClockDuration","type":"uint64"},{"internalType":"contract IBigStepper","name":"_vm","type":"address"},{"internalType":"contract IDelayedWETH","name":"_weth","type":"address"},{"internalType":"contract IAnchorStateRegistry","name":"_anchorStateRegistry","type":"address"},{"internalType":"uint256","name":"_l2ChainId","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AnchorRootNotFound","type":"error"},{"inputs":[],"name":"BlockNumberMatches","type":"error"},{"inputs":[],"name":"BondTransferFailed","type":"error"},{"inputs":[],"name":"CannotDefendRootClaim","type":"error"},{"inputs":[],"name":"ClaimAboveSplit","type":"error"},{"inputs":[],"name":"ClaimAlreadyExists","type":"error"},{"inputs":[],"name":"ClaimAlreadyResolved","type":"error"},{"inputs":[],"name":"ClockNotExpired","type":"error"},{"inputs":[],"name":"ClockTimeExceeded","type":"error"},{"inputs":[],"name":"ContentLengthMismatch","type":"error"},{"inputs":[],"name":"DuplicateStep","type":"error"},{"inputs":[],"name":"EmptyItem","type":"error"},{"inputs":[],"name":"GameDepthExceeded","type":"error"},{"inputs":[],"name":"GameNotInProgress","type":"error"},{"inputs":[],"name":"IncorrectBondAmount","type":"error"},{"inputs":[],"name":"InvalidClockExtension","type":"error"},{"inputs":[],"name":"InvalidDataRemainder","type":"error"},{"inputs":[],"name":"InvalidDisputedClaimIndex","type":"error"},{"inputs":[],"name":"InvalidHeader","type":"error"},{"inputs":[],"name":"InvalidHeaderRLP","type":"error"},{"inputs":[],"name":"InvalidLocalIdent","type":"error"},{"inputs":[],"name":"InvalidOutputRootProof","type":"error"},{"inputs":[],"name":"InvalidParent","type":"error"},{"inputs":[],"name":"InvalidPrestate","type":"error"},{"inputs":[],"name":"InvalidSplitDepth","type":"error"},{"inputs":[],"name":"L2BlockNumberChallenged","type":"error"},{"inputs":[],"name":"MaxDepthTooLarge","type":"error"},{"inputs":[],"name":"NoCreditToClaim","type":"error"},{"inputs":[],"name":"OutOfOrderResolution","type":"error"},{"inputs":[],"name":"UnexpectedList","type":"error"},{"inputs":[{"internalType":"Claim","name":"rootClaim","type":"bytes32"}],"name":"UnexpectedRootClaim","type":"error"},{"inputs":[],"name":"UnexpectedString","type":"error"},{"inputs":[],"name":"ValidStep","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"parentIndex","type":"uint256"},{"indexed":true,"internalType":"Claim","name":"claim","type":"bytes32"},{"indexed":true,"internalType":"address","name":"claimant","type":"address"}],"name":"Move","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"enum GameStatus","name":"status","type":"uint8"}],"name":"Resolved","type":"event"},{"inputs":[],"name":"absolutePrestate","outputs":[{"internalType":"Claim","name":"absolutePrestate_","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ident","type":"uint256"},{"internalType":"uint256","name":"_execLeafIdx","type":"uint256"},{"internalType":"uint256","name":"_partOffset","type":"uint256"}],"name":"addLocalData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"anchorStateRegistry","outputs":[{"internalType":"contract IAnchorStateRegistry","name":"registry_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Claim","name":"_disputed","type":"bytes32"},{"internalType":"uint256","name":"_parentIndex","type":"uint256"},{"internalType":"Claim","name":"_claim","type":"bytes32"}],"name":"attack","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"version","type":"bytes32"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"},{"internalType":"bytes32","name":"messagePasserStorageRoot","type":"bytes32"},{"internalType":"bytes32","name":"latestBlockhash","type":"bytes32"}],"internalType":"struct Types.OutputRootProof","name":"_outputRootProof","type":"tuple"},{"internalType":"bytes","name":"_headerRLP","type":"bytes"}],"name":"challengeRootL2Block","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"claimCredit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimData","outputs":[{"internalType":"uint32","name":"parentIndex","type":"uint32"},{"internalType":"address","name":"counteredBy","type":"address"},{"internalType":"address","name":"claimant","type":"address"},{"internalType":"uint128","name":"bond","type":"uint128"},{"internalType":"Claim","name":"claim","type":"bytes32"},{"internalType":"Position","name":"position","type":"uint128"},{"internalType":"Clock","name":"clock","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimDataLen","outputs":[{"internalType":"uint256","name":"len_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Hash","name":"","type":"bytes32"}],"name":"claims","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clockExtension","outputs":[{"internalType":"Duration","name":"clockExtension_","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createdAt","outputs":[{"internalType":"Timestamp","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"credit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Claim","name":"_disputed","type":"bytes32"},{"internalType":"uint256","name":"_parentIndex","type":"uint256"},{"internalType":"Claim","name":"_claim","type":"bytes32"}],"name":"defend","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"extraData","outputs":[{"internalType":"bytes","name":"extraData_","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"gameCreator","outputs":[{"internalType":"address","name":"creator_","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"gameData","outputs":[{"internalType":"GameType","name":"gameType_","type":"uint32"},{"internalType":"Claim","name":"rootClaim_","type":"bytes32"},{"internalType":"bytes","name":"extraData_","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameType","outputs":[{"internalType":"GameType","name":"gameType_","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimIndex","type":"uint256"}],"name":"getChallengerDuration","outputs":[{"internalType":"Duration","name":"duration_","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimIndex","type":"uint256"}],"name":"getNumToResolve","outputs":[{"internalType":"uint256","name":"numRemainingChildren_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Position","name":"_position","type":"uint128"}],"name":"getRequiredBond","outputs":[{"internalType":"uint256","name":"requiredBond_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"l1Head","outputs":[{"internalType":"Hash","name":"l1Head_","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"l2BlockNumber","outputs":[{"internalType":"uint256","name":"l2BlockNumber_","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"l2BlockNumberChallenged","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2BlockNumberChallenger","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2ChainId","outputs":[{"internalType":"uint256","name":"l2ChainId_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxClockDuration","outputs":[{"internalType":"Duration","name":"maxClockDuration_","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxGameDepth","outputs":[{"internalType":"uint256","name":"maxGameDepth_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Claim","name":"_disputed","type":"bytes32"},{"internalType":"uint256","name":"_challengeIndex","type":"uint256"},{"internalType":"Claim","name":"_claim","type":"bytes32"},{"internalType":"bool","name":"_isAttack","type":"bool"}],"name":"move","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"resolutionCheckpoints","outputs":[{"internalType":"bool","name":"initialCheckpointComplete","type":"bool"},{"internalType":"uint32","name":"subgameIndex","type":"uint32"},{"internalType":"Position","name":"leftmostPosition","type":"uint128"},{"internalType":"address","name":"counteredBy","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resolve","outputs":[{"internalType":"enum GameStatus","name":"status_","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimIndex","type":"uint256"},{"internalType":"uint256","name":"_numToResolve","type":"uint256"}],"name":"resolveClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resolvedAt","outputs":[{"internalType":"Timestamp","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"resolvedSubgames","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rootClaim","outputs":[{"internalType":"Claim","name":"rootClaim_","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"splitDepth","outputs":[{"internalType":"uint256","name":"splitDepth_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startingBlockNumber","outputs":[{"internalType":"uint256","name":"startingBlockNumber_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startingOutputRoot","outputs":[{"internalType":"Hash","name":"root","type":"bytes32"},{"internalType":"uint256","name":"l2BlockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startingRootHash","outputs":[{"internalType":"Hash","name":"startingRootHash_","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"status","outputs":[{"internalType":"enum GameStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimIndex","type":"uint256"},{"internalType":"bool","name":"_isAttack","type":"bool"},{"internalType":"bytes","name":"_stateData","type":"bytes"},{"internalType":"bytes","name":"_proof","type":"bytes"}],"name":"step","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"subgames","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vm","outputs":[{"internalType":"contract IBigStepper","name":"vm_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IDelayedWETH","name":"weth_","type":"address"}],"stateMutability":"view","type":"function"}] diff --git a/abi/dispute_game_proxy.json b/abi/dispute_game_proxy.json new file mode 100644 index 0000000..cb785a6 --- /dev/null +++ b/abi/dispute_game_proxy.json @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"Hash","name":"uuid","type":"bytes32"}],"name":"GameAlreadyExists","type":"error"},{"inputs":[],"name":"IncorrectBondAmount","type":"error"},{"inputs":[{"internalType":"GameType","name":"gameType","type":"uint32"}],"name":"NoImplementation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"disputeProxy","type":"address"},{"indexed":true,"internalType":"GameType","name":"gameType","type":"uint32"},{"indexed":true,"internalType":"Claim","name":"rootClaim","type":"bytes32"}],"name":"DisputeGameCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"impl","type":"address"},{"indexed":true,"internalType":"GameType","name":"gameType","type":"uint32"}],"name":"ImplementationSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"GameType","name":"gameType","type":"uint32"},{"indexed":true,"internalType":"uint256","name":"newBond","type":"uint256"}],"name":"InitBondUpdated","type":"event"},{"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":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"GameType","name":"_gameType","type":"uint32"},{"internalType":"Claim","name":"_rootClaim","type":"bytes32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"create","outputs":[{"internalType":"contract IDisputeGame","name":"proxy_","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"GameType","name":"_gameType","type":"uint32"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_n","type":"uint256"}],"name":"findLatestGames","outputs":[{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"GameId","name":"metadata","type":"bytes32"},{"internalType":"Timestamp","name":"timestamp","type":"uint64"},{"internalType":"Claim","name":"rootClaim","type":"bytes32"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct IDisputeGameFactory.GameSearchResult[]","name":"games_","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"gameAtIndex","outputs":[{"internalType":"GameType","name":"gameType_","type":"uint32"},{"internalType":"Timestamp","name":"timestamp_","type":"uint64"},{"internalType":"contract IDisputeGame","name":"proxy_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameCount","outputs":[{"internalType":"uint256","name":"gameCount_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"GameType","name":"","type":"uint32"}],"name":"gameImpls","outputs":[{"internalType":"contract IDisputeGame","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"GameType","name":"_gameType","type":"uint32"},{"internalType":"Claim","name":"_rootClaim","type":"bytes32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"games","outputs":[{"internalType":"contract IDisputeGame","name":"proxy_","type":"address"},{"internalType":"Timestamp","name":"timestamp_","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"GameType","name":"_gameType","type":"uint32"},{"internalType":"Claim","name":"_rootClaim","type":"bytes32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"getGameUUID","outputs":[{"internalType":"Hash","name":"uuid_","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"GameType","name":"","type":"uint32"}],"name":"initBonds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"GameType","name":"_gameType","type":"uint32"},{"internalType":"contract IDisputeGame","name":"_impl","type":"address"}],"name":"setImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"GameType","name":"_gameType","type":"uint32"},{"internalType":"uint256","name":"_initBond","type":"uint256"}],"name":"setInitBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}] diff --git a/dispute-explorer.iml b/dispute-explorer.iml new file mode 100644 index 0000000..eacc75a --- /dev/null +++ b/dispute-explorer.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/docs/sql/listener.sql b/docs/sql/listener.sql new file mode 100644 index 0000000..279f12e --- /dev/null +++ b/docs/sql/listener.sql @@ -0,0 +1,120 @@ +Create Database If Not Exists dispute_explorer Character Set UTF8; +USE dispute_explorer; + + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sync_blocks +-- ---------------------------- +DROP TABLE IF EXISTS `sync_blocks`; +CREATE TABLE `sync_blocks` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `blockchain` varchar(32) NOT NULL COMMENT ' chain name', + `miner` varchar(42) NOT NULL COMMENT ' miner', + `block_time` bigint NOT NULL COMMENT ' block_time', + `block_number` bigint NOT NULL COMMENT ' block_number', + `block_hash` varchar(66) NOT NULL COMMENT ' block hash', + `tx_count` bigint NOT NULL COMMENT ' tx count', + `event_count` bigint NOT NULL COMMENT ' event count', + `parent_hash` varchar(66) NOT NULL COMMENT ' parent hash', + `status` varchar(32) NOT NULL COMMENT ' status', + `check_count` bigint NOT NULL COMMENT ' check count', + PRIMARY KEY (`id`), + KEY `status_index` (`status`), + KEY `tx_count_index` (`tx_count`), + KEY `check_count_index` (`check_count`) +) ENGINE = InnoDB + AUTO_INCREMENT = 2923365 + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_0900_ai_ci; + + +-- ---------------------------- +-- Table structure for sync_events +-- ---------------------------- +DROP TABLE IF EXISTS `sync_events`; +CREATE TABLE `sync_events` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `sync_block_id` bigint NOT NULL COMMENT ' sync_block_id', + `blockchain` varchar(32) NOT NULL COMMENT ' blockchain', + `block_time` bigint NOT NULL COMMENT ' block_time', + `block_number` bigint NOT NULL COMMENT ' block_number', + `block_hash` varchar(66) NOT NULL COMMENT ' block_hash', + `block_log_indexed` bigint NOT NULL COMMENT ' block_log_indexed', + `tx_index` bigint NOT NULL COMMENT ' tx_index', + `tx_hash` varchar(66) NOT NULL COMMENT ' tx_hash', + `event_name` varchar(32) NOT NULL COMMENT ' event_name', + `event_hash` varchar(66) NOT NULL COMMENT ' event_hash', + `contract_address` varchar(42) NOT NULL COMMENT ' contract_address', + `data` json NOT NULL COMMENT ' data', + `status` varchar(32) NOT NULL COMMENT ' status', + `retry_count` bigint DEFAULT '0' COMMENT 'retry_count', + PRIMARY KEY (`id`), + KEY `status_index` (`status`) +) ENGINE = InnoDB + AUTO_INCREMENT = 1011299 + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Table structure for dispute_game +-- ---------------------------- +DROP TABLE IF EXISTS `dispute_game`; +CREATE TABLE `dispute_game` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `sync_block_id` bigint NOT NULL COMMENT ' sync_block_id', + `blockchain` varchar(32) NOT NULL COMMENT ' blockchain', + `block_time` bigint NOT NULL COMMENT ' block_time', + `block_number` bigint NOT NULL COMMENT ' block_number', + `block_hash` varchar(66) NOT NULL COMMENT ' block_hash', + `block_log_indexed` bigint NOT NULL COMMENT ' block_log_indexed', + `tx_index` bigint NOT NULL COMMENT ' tx_index', + `tx_hash` varchar(66) NOT NULL COMMENT ' tx_hash', + `event_name` varchar(32) NOT NULL COMMENT ' event_name', + `event_hash` varchar(66) NOT NULL COMMENT ' event_hash', + `contract_address` varchar(42) NOT NULL COMMENT ' contract_address', + `data` json NOT NULL COMMENT ' data', + `l2_block_number` bigint NOT NULL COMMENT ' l2_block_number', + `status` varchar(32) NOT NULL COMMENT ' status -1-initial 0-In progress 1- Challenger wins 2- Defender wins', + PRIMARY KEY (`id`), + KEY `status_index` (`status`) +) ENGINE = InnoDB + AUTO_INCREMENT = 1011299 + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Table structure for game_claim_data +-- ---------------------------- +DROP TABLE IF EXISTS `game_claim_data`; +CREATE TABLE `game_claim_data` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `game_contract` varchar(42) NOT NULL COMMENT ' game_contract', + `data_index` int NOT NULL COMMENT ' index', + `parent_index` bigint NOT NULL COMMENT ' parent_index', + `countered_by` varchar(42) NOT NULL COMMENT ' countered_by', + `claimant` varchar(42) NOT NULL COMMENT ' claimant', + `bond` bigint NOT NULL COMMENT ' bond', + `claim` varchar(42) NOT NULL COMMENT ' claim', + `position` bigint NOT NULL COMMENT ' position', + `clock` timestamp NOT NULL COMMENT ' clock', + PRIMARY KEY (`id`) +) ENGINE = InnoDB + AUTO_INCREMENT = 1011299 + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_0900_ai_ci; + diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..53560f4 --- /dev/null +++ b/go.mod @@ -0,0 +1,77 @@ +module github.com/optimism-java/dispute-explorer + +go 1.21 + +replace github.com/ethereum/go-ethereum v1.13.11 => github.com/ethereum-optimism/op-geth v1.101311.0-rc.1 + +require ( + github.com/caarlos0/env/v6 v6.10.1 + github.com/ethereum/go-ethereum v1.13.11 + github.com/pkg/errors v0.9.1 + github.com/stretchr/testify v1.9.0 + go.uber.org/zap v1.27.0 + gorm.io/driver/mysql v1.5.7 + gorm.io/gorm v1.25.10 +) + +require ( + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect + github.com/bits-and-blooms/bitset v1.10.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/deckarep/golang-set/v2 v2.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240318114348-52d3dbd1605d // indirect + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/gin-gonic/gin v1.10.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/holiman/uint256 v1.2.4 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/supranational/blst v0.3.11 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + go.uber.org/multierr v1.10.0 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + golang.org/x/tools v0.15.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + rsc.io/tmplfunc v0.0.3 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..c2981e0 --- /dev/null +++ b/go.sum @@ -0,0 +1,291 @@ +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= +github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/caarlos0/env/v6 v6.10.1 h1:t1mPSxNpei6M5yAeu1qtRdPAK29Nbcf/n3G7x+b3/II= +github.com/caarlos0/env/v6 v6.10.1/go.mod h1:hvp/ryKXKipEkcuYjs9mI4bBCg+UI0Yhgm5Zu0ddvwc= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= +github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 h1:aPEJyR4rPBvDmeyi+l/FS/VtA00IWvjeFvjen1m1l1A= +github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593/go.mod h1:6hk1eMY/u5t+Cf18q5lFMUA1Rc+Sm5I6Ra1QuPyxXCo= +github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= +github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= +github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= +github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/ethereum-optimism/op-geth v1.101311.0-rc.1 h1:3JE5FyGXNQCnXUuiK3I6ZD3zbB2DBIcEMsXCpjrXUwM= +github.com/ethereum-optimism/op-geth v1.101311.0-rc.1/go.mod h1:K23yb9efVf9DdUOv/vl/Ux57Tng00rLaFqWYlFF45CA= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240318114348-52d3dbd1605d h1:K7HdD/ZAcSFhcqqnUAbvU+8vsg0DzL8pvetHw5vRLCc= +github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240318114348-52d3dbd1605d/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0= +github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= +github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= +github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +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= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= +gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= +gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/internal/blockchain/blockchain.go b/internal/blockchain/blockchain.go new file mode 100644 index 0000000..2510331 --- /dev/null +++ b/internal/blockchain/blockchain.go @@ -0,0 +1,63 @@ +package blockchain + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + config "github.com/optimism-java/dispute-explorer/internal/types" + "github.com/optimism-java/dispute-explorer/pkg/event" +) + +type Event interface { + Name() string + EventHash() common.Hash + Data(log types.Log) (string, error) + ToObj(data string) error +} + +var ( + events = make([]common.Hash, 0) + contracts = make([]common.Address, 0) + EventMap = make(map[common.Hash][]Event, 0) + EIP1155 = make([]common.Address, 0) +) + +func init() { + Register(&event.DisputeGameCreated{}) + Register(&event.DisputeGameMove{}) + Register(&event.DisputeGameResolved{}) + cfg := config.GetConfig() + AddContract(cfg.DisputeGameProxyContract) +} + +func Register(event Event) { + if len(EventMap[event.EventHash()]) == 0 { + events = append(events, event.EventHash()) + } + EventMap[event.EventHash()] = append(EventMap[event.EventHash()], event) +} + +func AddContract(contract string) { + contracts = append(contracts, common.HexToAddress(contract)) +} + +func RemoveContract(contract string) { + for index, ct := range contracts { + if ct == common.HexToAddress(contract) { + contracts = append(contracts[:index], contracts[index+1:]...) + } + } +} + +func GetContracts() []common.Address { + return contracts +} + +func GetEvents() []common.Hash { + return events +} + +func GetEvent(eventHash common.Hash) Event { + EventList := EventMap[eventHash] + Event := EventList[0] + return Event +} diff --git a/internal/blockchain/blockchain_test.go b/internal/blockchain/blockchain_test.go new file mode 100644 index 0000000..b6a3de7 --- /dev/null +++ b/internal/blockchain/blockchain_test.go @@ -0,0 +1,19 @@ +package blockchain + +import ( + "fmt" + "testing" +) + +func TestRemoveContract(t *testing.T) { + contracts = GetContracts() + fmt.Println(GetContracts()) + AddContract("AA") + AddContract("BB") + AddContract("CC") + fmt.Println(GetContracts()) + RemoveContract("AA") + RemoveContract("BB") + RemoveContract("CC") + fmt.Println(GetContracts()) +} diff --git a/internal/handler/disputeGame.go b/internal/handler/disputeGame.go new file mode 100644 index 0000000..981d236 --- /dev/null +++ b/internal/handler/disputeGame.go @@ -0,0 +1,93 @@ +package handler + +import ( + "context" + "encoding/hex" + "fmt" + "strings" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + "github.com/optimism-java/dispute-explorer/internal/blockchain" + "github.com/optimism-java/dispute-explorer/internal/schema" + "github.com/optimism-java/dispute-explorer/internal/svc" + "github.com/optimism-java/dispute-explorer/pkg/contract" + "github.com/optimism-java/dispute-explorer/pkg/event" + "github.com/optimism-java/dispute-explorer/pkg/log" + "github.com/pkg/errors" +) + +func FilterAddAndRemove(ctx *svc.ServiceContext, evt *schema.SyncEvent) error { + dispute := event.DisputeGameCreated{} + if evt.EventName == dispute.Name() && evt.EventHash == dispute.EventHash().String() { + err := dispute.ToObj(evt.Data) + if err != nil { + log.Errorf("[FilterDisputeContractAndAdd] event data to DisputeGameCreated err: %s\n", err) + return errors.WithStack(err) + } + blockchain.AddContract(dispute.DisputeProxy) + } + disputeResolved := event.DisputeGameResolved{} + if evt.EventName == disputeResolved.Name() && evt.EventHash == disputeResolved.EventHash().String() { + err := disputeResolved.ToObj(evt.Data) + if err != nil { + log.Errorf("[FilterDisputeContractAndAdd] event data to DisputeGameResolved err: %s\n", err) + return errors.WithStack(err) + } + blockchain.RemoveContract(evt.ContractAddress) + } + return nil +} + +func BatchFilterAddAndRemove(ctx *svc.ServiceContext, events []*schema.SyncEvent) error { + for _, evt := range events { + err := FilterAddAndRemove(ctx, evt) + if err != nil { + log.Errorf("[BatchFilterAddAndRemove] FilterAddAndRemove: %s\n", err) + return err + } + } + return nil +} + +func getGameInput(ctx *svc.ServiceContext, txHash string) (map[uint64]map[string]interface{}, error) { + abiObject, err := abi.JSON(strings.NewReader(contract.DisputeGameProxyMetaData.ABI)) + if err != nil { + return nil, fmt.Errorf("[getGameInput] parse abi error: %s", errors.WithStack(err)) + } + tx, _, err := ctx.L1RPC.TransactionByHash(context.Background(), common.HexToHash(txHash)) + if err != nil { + return nil, fmt.Errorf("[getGameInput] get tx error: %s", errors.WithStack(err)) + } + inputsMap, methodName := decodeTransactionInputData(abiObject, tx.Data()) + + if methodName != "create" { + return nil, fmt.Errorf("[getGameInput] methodName is : %s parse method error: %s", methodName, errors.WithStack(err)) + } + + e := inputsMap["_gameType"].(uint32) + f := inputsMap["_rootClaim"].([32]byte) + g := inputsMap["_extraData"].([]byte) + + fmt.Println("_gameType", e) + fmt.Println("_rootClaim:", hex.EncodeToString(f[:])) + fmt.Println("_extraData: ", hex.EncodeToString(g)) + return nil, nil +} + +func decodeTransactionInputData(contractABI abi.ABI, data []byte) (map[string]interface{}, string) { + methodSigData := data[:4] + inputsSigData := data[4:] + + method, err := contractABI.MethodById(methodSigData) + if err != nil { + log.Errorf("[DecodeTransactionInputData] parse abi error: %s\n", errors.WithStack(err)) + } + + inputsMap := make(map[string]interface{}) + + if err := method.Inputs.UnpackIntoMap(inputsMap, inputsSigData); err != nil { + log.Errorf("[DecodeTransactionInputData] parse abi error: %s\n", errors.WithStack(err)) + } + return inputsMap, method.Name +} diff --git a/internal/handler/handler.go b/internal/handler/handler.go new file mode 100644 index 0000000..88967d9 --- /dev/null +++ b/internal/handler/handler.go @@ -0,0 +1,14 @@ +package handler + +import ( + "github.com/optimism-java/dispute-explorer/internal/svc" +) + +func Run(ctx *svc.ServiceContext) { + // query last block number + go LatestBlackNumber(ctx) + // sync blocks + go SyncBlock(ctx) + // sync events + go SyncEvent(ctx) +} diff --git a/internal/handler/latestBlockNumber.go b/internal/handler/latestBlockNumber.go new file mode 100644 index 0000000..3707162 --- /dev/null +++ b/internal/handler/latestBlockNumber.go @@ -0,0 +1,23 @@ +package handler + +import ( + "context" + "time" + + "github.com/optimism-java/dispute-explorer/internal/svc" + "github.com/optimism-java/dispute-explorer/pkg/log" +) + +func LatestBlackNumber(ctx *svc.ServiceContext) { + for { + latest, err := ctx.L1RPC.BlockNumber(context.Background()) + if err != nil { + log.Errorf("[Handle.LatestBlackNumber]Syncing latest block number error: %s\n", err) + time.Sleep(3 * time.Second) + continue + } + ctx.LatestBlockNumber = int64(latest) + log.Infof("[Handle.LatestBlackNumber] Syncing latest block number: %d \n", latest) + time.Sleep(3 * time.Second) + } +} diff --git a/internal/handler/logFilter.go b/internal/handler/logFilter.go new file mode 100644 index 0000000..28594ae --- /dev/null +++ b/internal/handler/logFilter.go @@ -0,0 +1,79 @@ +package handler + +import ( + "context" + "math/big" + "strings" + + "github.com/optimism-java/dispute-explorer/internal/blockchain" + "github.com/optimism-java/dispute-explorer/internal/schema" + "github.com/optimism-java/dispute-explorer/internal/svc" + "github.com/optimism-java/dispute-explorer/pkg/event" + "github.com/optimism-java/dispute-explorer/pkg/log" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/pkg/errors" +) + +func LogFilter(ctx *svc.ServiceContext, block schema.SyncBlock, addresses []common.Address, topics [][]common.Hash) ([]*schema.SyncEvent, error) { + query := ethereum.FilterQuery{ + FromBlock: big.NewInt(block.BlockNumber), + ToBlock: big.NewInt(block.BlockNumber), + Topics: topics, + Addresses: addresses, + } + logs, err := ctx.L1RPC.FilterLogs(context.Background(), query) + if err != nil { + return nil, errors.WithStack(err) + } + log.Infof("[CancelOrder.Handle] Cancel Pending List Length is %d ,block number is %d \n", len(logs), block.BlockNumber) + return LogsToEvents(ctx, logs, block.ID) +} + +func LogsToEvents(ctx *svc.ServiceContext, logs []types.Log, syncBlockID int64) ([]*schema.SyncEvent, error) { + events := []*schema.SyncEvent{} + blockTimes := make(map[int64]int64) + for _, vlog := range logs { + eventHash := event.TopicToHash(vlog, 0) + contractAddress := vlog.Address + Event := blockchain.GetEvent(eventHash) + if Event == nil { + log.Infof("[LogsToEvents] logs[txHash: %s, contractAddress:%s, eventHash: %s]\n", vlog.TxHash, strings.ToLower(contractAddress.Hex()), eventHash) + continue + } + + blockTime := blockTimes[int64(vlog.BlockNumber)] + if blockTime == 0 { + block, err := ctx.L1RPC.BlockByNumber(context.Background(), big.NewInt(int64(vlog.BlockNumber))) + if err != nil { + return nil, errors.WithStack(err) + } + blockTime = int64(block.Time()) + } + data, err := Event.Data(vlog) + if err != nil { + log.Errorf("[LogsToEvents] logs[txHash: %s, contractAddress:%s, eventHash: %s]\n", vlog.TxHash, strings.ToLower(contractAddress.Hex()), eventHash) + log.Errorf("[LogsToEvents] data err: %s\n", errors.WithStack(err)) + continue + } + + events = append(events, &schema.SyncEvent{ + Blockchain: ctx.Config.Blockchain, + SyncBlockID: syncBlockID, + BlockTime: blockTime, + BlockNumber: int64(vlog.BlockNumber), + BlockHash: vlog.BlockHash.Hex(), + BlockLogIndexed: int64(vlog.Index), + TxIndex: int64(vlog.TxIndex), + TxHash: vlog.TxHash.Hex(), + EventName: Event.Name(), + EventHash: eventHash.Hex(), + ContractAddress: strings.ToLower(contractAddress.Hex()), + Data: data, + Status: schema.EventPending, + }) + } + return events, nil +} diff --git a/internal/handler/syncBlock.go b/internal/handler/syncBlock.go new file mode 100644 index 0000000..533b012 --- /dev/null +++ b/internal/handler/syncBlock.go @@ -0,0 +1,82 @@ +package handler + +import ( + "fmt" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/optimism-java/dispute-explorer/internal/schema" + "github.com/optimism-java/dispute-explorer/internal/svc" + "github.com/optimism-java/dispute-explorer/pkg/log" + "github.com/optimism-java/dispute-explorer/pkg/rpc" + "github.com/pkg/errors" + "gorm.io/gorm" +) + +func SyncBlock(ctx *svc.ServiceContext) { + // 防止服务启停切换时同时存在2个服务同步数据 + time.Sleep(10 * time.Second) + var syncedBlock schema.SyncBlock + err := ctx.DB.Where("status = ? or status = ? ", schema.BlockValid, schema.BlockPending).Order("block_number desc").First(&syncedBlock).Error + if err != nil && err != gorm.ErrRecordNotFound { + panic(err) + } + switch err { + case gorm.ErrRecordNotFound: + ctx.SyncedBlockNumber = ctx.Config.FromBlockNumber + ctx.SyncedBlockHash = common.HexToHash(ctx.Config.FromBlockHash) + default: + ctx.SyncedBlockNumber = syncedBlock.BlockNumber + ctx.SyncedBlockHash = common.HexToHash(syncedBlock.BlockHash) + } + + log.Infof("[Handler.SyncBlock]SyncedBlockNumber: %d", ctx.SyncedBlockNumber) + log.Infof("[Handler.SyncBlock]SyncedBlockHash:%s", ctx.SyncedBlockHash.String()) + + for { + syncingBlockNumber := ctx.SyncedBlockNumber + 1 + log.Infof("[Handler.SyncBlock] Try to sync block number: %d\n", syncingBlockNumber) + + if syncingBlockNumber > ctx.LatestBlockNumber { + time.Sleep(3 * time.Second) + continue + } + + // block, err := ctx.RPC.BlockByNumber(context.Background(), big.NewInt(syncingBlockNumber)) + blockJSON, err := rpc.HTTPPostJSON("", ctx.Config.L1RPCUrl, "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\""+fmt.Sprintf("0x%X", syncingBlockNumber)+"\", true],\"id\":1}") + if err != nil { + log.Errorf("[Handler.SyncBlock] Syncing block by number error: %s\n", errors.WithStack(err)) + time.Sleep(3 * time.Second) + continue + } + block := rpc.ParseJSONBlock(string(blockJSON)) + log.Infof("[Handler.SyncBlock] Syncing block number: %d, hash: %v, parent hash: %v \n", block.Number(), block.Hash(), block.ParentHash()) + + if common.HexToHash(block.ParentHash()) != ctx.SyncedBlockHash { + log.Errorf("[Handler.SyncBlock] ParentHash of the block being synchronized is inconsistent: %s \n", ctx.SyncedBlockHash) + continue + } + + /* Create SyncBlock start */ + err = ctx.DB.Create(&schema.SyncBlock{ + Miner: block.Result.Miner, + Blockchain: ctx.Config.Blockchain, + BlockTime: block.Timestamp(), + BlockNumber: block.Number(), + BlockHash: block.Hash(), + TxCount: int64(len(block.Result.Transactions)), + EventCount: 0, + ParentHash: block.ParentHash(), + Status: schema.BlockPending, + }).Error + if err != nil { + log.Errorf("[Handler.SyncBlock] DB Create SyncBlock error: %s\n", errors.WithStack(err)) + time.Sleep(1 * time.Second) + continue + } + /* Create SyncBlock end */ + + ctx.SyncedBlockNumber = block.Number() + ctx.SyncedBlockHash = common.HexToHash(block.Hash()) + } +} diff --git a/internal/handler/syncEvent.go b/internal/handler/syncEvent.go new file mode 100644 index 0000000..b0284c1 --- /dev/null +++ b/internal/handler/syncEvent.go @@ -0,0 +1,149 @@ +package handler + +import ( + "sync" + "time" + + "github.com/optimism-java/dispute-explorer/internal/blockchain" + "github.com/optimism-java/dispute-explorer/internal/schema" + "github.com/optimism-java/dispute-explorer/internal/svc" + "github.com/optimism-java/dispute-explorer/pkg/log" + + "github.com/ethereum/go-ethereum/common" + "github.com/pkg/errors" + "gorm.io/gorm" +) + +func SyncEvent(ctx *svc.ServiceContext) { + for { + var blocks []schema.SyncBlock + err := ctx.DB.Where("status=? OR status=?", schema.BlockPending, schema.BlockRollback).Order("block_number").Limit(50).Find(&blocks).Error + if err != nil { + log.Errorf("[Handler.SyncEvent] Pending and rollback blocks err: %s\n", errors.WithStack(err)) + time.Sleep(5 * time.Second) + continue + } + if len(blocks) == 0 { + log.Infof("[Handler.SyncEvent] Pending blocks count is 0\n") + time.Sleep(2 * time.Second) + continue + } + + var wg sync.WaitGroup + for _, block := range blocks { + wg.Add(1) + go func(_wg *sync.WaitGroup, ctx *svc.ServiceContext, block schema.SyncBlock) { + defer _wg.Done() + if block.Status == schema.BlockPending { + // add events & block.status= valid + err = HandlePendingBlock(ctx, block) + if err != nil { + log.Errorf("[Handler.SyncEvent] HandlePendingBlock err: %s\n", errors.WithStack(err)) + time.Sleep(500 * time.Millisecond) + } + } else if block.Status == schema.BlockRollback { + // event.status=rollback & block.status=invalid + err = HandleRollbackBlock(ctx, block) + if err != nil { + log.Errorf("[Handler.SyncEvent] HandleRollbackBlock err: %s\n", errors.WithStack(err)) + time.Sleep(500 * time.Millisecond) + } + } + }(&wg, ctx, block) + } + wg.Wait() + } +} + +func HandlePendingBlock(ctx *svc.ServiceContext, block schema.SyncBlock) error { + log.Infof("[Handler.SyncEvent.PendingBlock]Start: %d, %s \n", block.BlockNumber, block.BlockHash) + log.Infof("[Handler.SyncEvent.PendingBlock]GetContracts: %v\n", blockchain.GetContracts()) + log.Infof("[Handler.SyncEvent.PendingBlock]GetEvents: %v\n", blockchain.GetEvents()) + events, err := LogFilter(ctx, block, blockchain.GetContracts(), [][]common.Hash{blockchain.GetEvents()}) + log.Infof("[Handler.SyncEvent.PendingBlock] block %d, events number is %d:", block.BlockNumber, len(events)) + if err != nil { + log.Errorf("[Handler.SyncEvent.PendingBlock] Log filter err: %s\n", err) + return errors.WithStack(err) + } + eventCount := len(events) + if eventCount > 0 && events[0].BlockHash != block.BlockHash { + log.Infof("[Handler.SyncEvent.PendingBlock]Don't match block hash\n") + return nil + } else if eventCount > 0 && events[0].BlockHash == block.BlockHash { + BatchEvents := make([]*schema.SyncEvent, 0) + for _, event := range events { + var one schema.SyncEvent + log.Infof("[Handler.SyncEvent.PendingBlock]BlockLogIndexed %d ,TxHash %s,EventHash %s", event.BlockLogIndexed, event.TxHash, event.EventHash) + err = ctx.DB.Select("id").Where("sync_block_id=? AND block_log_indexed=? AND tx_hash=? AND event_hash=? ", + block.ID, event.BlockLogIndexed, event.TxHash, event.EventHash).First(&one).Error + if err != nil && err != gorm.ErrRecordNotFound { + log.Errorf("[Handler.SyncEvent.PendingBlock]Query SyncEvent err: %s\n ", err) + return errors.WithStack(err) + } else if err == gorm.ErrRecordNotFound { + BatchEvents = append(BatchEvents, event) + log.Infof("[Handler.SyncEvent.PendingBlock]block %d, BatchEvents len is %d:", block.BlockNumber, len(BatchEvents)) + } + } + if len(BatchEvents) > 0 { + err = ctx.DB.Transaction(func(tx *gorm.DB) error { + err = tx.CreateInBatches(&BatchEvents, 200).Error + if err != nil { + log.Errorf("[Handler.SyncEvent.PendingBlock]CreateInBatches err: %s\n ", err) + return errors.WithStack(err) + } + block.Status = schema.BlockValid + block.EventCount = int64(eventCount) + err = tx.Save(&block).Error + if err != nil { + log.Errorf("[Handler.SyncEvent.PendingBlock]Batch Events Update SyncBlock Status err: %s\n ", err) + return errors.WithStack(err) + } + err = BatchFilterAddAndRemove(ctx, BatchEvents) + if err != nil { + log.Errorf("[Handler.SyncEvent.PendingBlock] BatchFilterAddAndRemove err: %s\n ", err) + return errors.WithStack(err) + } + return nil + }) + if err != nil { + return err + } + return nil + } + } + block.Status = schema.BlockValid + block.EventCount = int64(eventCount) + err = ctx.DB.Save(&block).Error + if err != nil { + log.Errorf("[Handler.PendingBlock]Update SyncBlock Status err: %s\n ", err) + return errors.WithStack(err) + } + log.Infof("[Handler.SyncEvent.PendingBlock]End: %d, %s \n", block.BlockNumber, block.BlockHash) + return nil +} + +func HandleRollbackBlock(ctx *svc.ServiceContext, block schema.SyncBlock) error { + log.Infof("[Handler.RollbackBlock] Start: %d, %s\n", block.BlockNumber, block.BlockHash) + err := ctx.DB.Transaction(func(tx *gorm.DB) error { + now := time.Now() + // event.status=rollback by syncBlockId + err := tx.Model(schema.SyncEvent{}).Where("sync_block_id=?", block.ID). + Updates(map[string]interface{}{"status": schema.EventRollback, "updated_at": now}).Error + if err != nil { + log.Errorf("[Handler.RollbackBlock]Query SyncBlock Status err: %s ,id : %d \n", err, block.ID) + return errors.WithStack(err) + } + block.Status = schema.BlockInvalid + err = tx.Save(&block).Error + if err != nil { + log.Errorf("[Handler.RollbackBlock]Save SyncBlock Status err: %s\n ", err) + return errors.WithStack(err) + } + return nil + }) + if err != nil { + log.Errorf("[Handler.RollbackBlock] err: %s\n ", err) + return errors.WithStack(err) + } + return nil +} diff --git a/internal/schema/base.go b/internal/schema/base.go new file mode 100644 index 0000000..b6187f8 --- /dev/null +++ b/internal/schema/base.go @@ -0,0 +1,17 @@ +package schema + +import "time" + +type Base struct { + ID int64 `json:"id"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +type Blockchain struct { + EventID int64 `json:"event_id"` + BlockTime int64 `json:"block_time"` + BlockNumber int64 `json:"block_number"` + LogIndex int64 `json:"log_index"` + TxHash string `json:"tx_hash"` +} diff --git a/internal/schema/dispute_game.go b/internal/schema/dispute_game.go new file mode 100644 index 0000000..e8823db --- /dev/null +++ b/internal/schema/dispute_game.go @@ -0,0 +1,31 @@ +package schema + +// 0-In progress 1- Challenger wins 2- Defender wins + +const ( + InProgress = "0" + ChallengerWin = "1" + DefenderWin = "2" +) + +type DisputeGame struct { + Base + SyncBlockID int64 `json:"sync_block_id"` + Blockchain string `json:"blockchain"` + BlockTime int64 `json:"block_time"` + BlockNumber int64 `json:"block_number"` + BlockHash string `json:"block_hash"` + BlockLogIndexed int64 `json:"block_log_indexed"` + TxIndex int64 `json:"tx_index"` + TxHash string `json:"tx_hash"` + EventName string `json:"event_name"` + EventHash string `json:"event_hash"` + ContractAddress string `json:"contract_address"` + Data string `json:"data"` + L2BlockNumber int64 `json:"l_2_block_number"` + Status string `json:"status"` +} + +func (DisputeGame) TableName() string { + return "sync_events" +} diff --git a/internal/schema/sync_blocks.go b/internal/schema/sync_blocks.go new file mode 100644 index 0000000..ecc8d81 --- /dev/null +++ b/internal/schema/sync_blocks.go @@ -0,0 +1,26 @@ +package schema + +const ( + BlockPending = "pending" + BlockValid = "valid" + BlockRollback = "rollback" + BlockInvalid = "invalid" +) + +type SyncBlock struct { + Base + Blockchain string `json:"blockchain"` + Miner string `json:"miner"` + BlockTime int64 `json:"block_time"` + BlockNumber int64 `json:"block_number"` + BlockHash string `json:"block_hash"` + TxCount int64 `json:"tx_count"` + EventCount int64 `json:"event_count"` + ParentHash string `json:"parent_hash"` + Status string `json:"status"` + CheckCount int64 `json:"check_count"` +} + +func (SyncBlock) TableName() string { + return "sync_blocks" +} diff --git a/internal/schema/sync_events.go b/internal/schema/sync_events.go new file mode 100644 index 0000000..79c94cb --- /dev/null +++ b/internal/schema/sync_events.go @@ -0,0 +1,30 @@ +package schema + +const ( + EventPending = "pending" + EventValid = "valid" + EventRollback = "rollback" + EventInvalid = "invalid" +) + +type SyncEvent struct { + Base + SyncBlockID int64 `json:"sync_block_id"` + Blockchain string `json:"blockchain"` + BlockTime int64 `json:"block_time"` + BlockNumber int64 `json:"block_number"` + BlockHash string `json:"block_hash"` + BlockLogIndexed int64 `json:"block_log_indexed"` + TxIndex int64 `json:"tx_index"` + TxHash string `json:"tx_hash"` + EventName string `json:"event_name"` + EventHash string `json:"event_hash"` + ContractAddress string `json:"contract_address"` + Data string `json:"data"` + Status string `json:"status"` + RetryCount int64 `json:"retry_count"` +} + +func (SyncEvent) TableName() string { + return "sync_events" +} diff --git a/internal/svc/svc.go b/internal/svc/svc.go new file mode 100644 index 0000000..1d4be52 --- /dev/null +++ b/internal/svc/svc.go @@ -0,0 +1,57 @@ +package svc + +import ( + "log" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/optimism-java/dispute-explorer/internal/types" + "gorm.io/driver/mysql" + "gorm.io/gorm" + "gorm.io/gorm/logger" +) + +var svc *ServiceContext + +type ServiceContext struct { + Config *types.Config + L1RPC *ethclient.Client + DB *gorm.DB + LatestBlockNumber int64 + SyncedBlockNumber int64 + SyncedBlockHash common.Hash +} + +func NewServiceContext(cfg *types.Config) *ServiceContext { + storage, err := gorm.Open(mysql.Open(cfg.MySQLDataSource), &gorm.Config{ + Logger: logger.Default.LogMode(logger.Error), + }) + if err != nil { + log.Panicf("[svc]gorm get db panic: %s\n", err) + } + + sqlDB, err := storage.DB() + if err != nil { + log.Panicf("[svc]gorm get sqlDB panic: %s\n", err) + } + // SetMaxIdleConns + sqlDB.SetMaxIdleConns(cfg.MySQLMaxIdleConns) + // SetMaxOpenConns + sqlDB.SetMaxOpenConns(cfg.MySQLMaxOpenConns) + // SetConnMaxLifetime + sqlDB.SetConnMaxLifetime(time.Duration(cfg.MySQLConnMaxLifetime) * time.Second) + + rpc, err := ethclient.Dial(cfg.L1RPCUrl) + if err != nil { + log.Panicf("[svc] get eth client panic: %s\n", err) + } + + svc = &ServiceContext{ + Config: cfg, + L1RPC: rpc, + DB: storage, + } + + return svc +} diff --git a/internal/types/config.go b/internal/types/config.go new file mode 100644 index 0000000..64d5a34 --- /dev/null +++ b/internal/types/config.go @@ -0,0 +1,37 @@ +package types + +import ( + "log" + + "github.com/caarlos0/env/v6" +) + +type Config struct { + // debug", "info", "warn", "error", "panic", "fatal" + LogLevel string `env:"LOG_LEVEL" envDefault:"info"` + // "console","json" + LogFormat string `env:"LOG_FORMAT" envDefault:"console"` + MySQLDataSource string `env:"MYSQL_DATA_SOURCE" envDefault:"root:root@tcp(127.0.0.1:3366)/dispute_explorer?charset=utf8mb4&parseTime=True&loc=Local&multiStatements=true"` + MySQLMaxIdleConns int `env:"MYSQL_MAX_IDLE_CONNS" envDefault:"10"` + MySQLMaxOpenConns int `env:"MYSQL_MAX_OPEN_CONNS" envDefault:"20"` + MySQLConnMaxLifetime int `env:"MYSQL_CONN_MAX_LIFETIME" envDefault:"3600"` + Blockchain string `env:"BLOCKCHAIN" envDefault:"sepolia"` + L1RPCUrl string `env:"L1_RPC_URL" envDefault:"https://quaint-white-season.ethereum-sepolia.quiknode.pro/b5c30cbb548d8743f08dd175fe50e3e923259d30"` + FromBlockNumber int64 `env:"FROM_BLOCK_NUMBER" envDefault:"6026723"` + FromBlockHash string `env:"FROM_BLOCK_HASH" envDefault:"0x013a38a1a8b5073a852134716263c1e4b911f65bd7112d90cc0e93b1defcf3a8"` + DisputeGameProxyContract string `env:"DISPUTE_GAME_PROXY_CONTRACT" envDefault:"0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"` +} + +var config *Config + +func GetConfig() *Config { + if config == nil { + cfg := &Config{} + if err := env.Parse(cfg); err != nil { + log.Panicf("parse config err: %s\n", err) + return nil + } + config = cfg + } + return config +} diff --git a/internal/websocket/server.go b/internal/websocket/server.go new file mode 100644 index 0000000..06476b3 --- /dev/null +++ b/internal/websocket/server.go @@ -0,0 +1,73 @@ +package websocket + +import ( + "encoding/json" + "fmt" + + "github.com/gorilla/websocket" +) + +type ClientManager struct { + clients map[*Client]bool + broadcast chan []byte + register chan *Client + unregister chan *Client +} + +type Client struct { + id string + socket *websocket.Conn + send chan []byte +} + +type Message struct { + Sender string `json:"sender,omitempty"` + Recipient string `json:"recipient,omitempty"` + Content string `json:"content,omitempty"` +} + +var manager = ClientManager{ + broadcast: make(chan []byte), + register: make(chan *Client), + unregister: make(chan *Client), + clients: make(map[*Client]bool), +} + +func (manager *ClientManager) start() { + for { + select { + + manager.clients[conn] = true + jsonMessage, _ := json.Marshal(&Message{Content: " a new socket has connected."}) + + case conn := <-manager.unregister: + if _, ok := manager.clients[conn]; ok { + close(conn.send) + delete(manager.clients, conn) + jsonMessage, _ := json.Marshal(&Message{Content: "a socket has disconnected."}) + manager.send(jsonMessage, conn) + } + + fmt.Println(string(message)) + for conn := range manager.clients { + fmt.Println("每个客户端", conn.id) + + select { + + default: + fmt.Println("要关闭连接啊") + close(conn.send) + delete(manager.clients, conn) + } + } + } + } +} + +func (manager *ClientManager) send(message []byte, ignore *Client) { + for conn := range manager.clients { + if conn != ignore { + + } + } +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..b4d57f2 --- /dev/null +++ b/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "github.com/optimism-java/dispute-explorer/internal/handler" + "github.com/optimism-java/dispute-explorer/internal/svc" + "github.com/optimism-java/dispute-explorer/internal/types" + "github.com/optimism-java/dispute-explorer/pkg/log" +) + +func main() { + cfg := types.GetConfig() + log.Init(cfg.LogLevel, cfg.LogFormat) + log.Infof("config: %v\n", cfg) + ctx := svc.NewServiceContext(cfg) + handler.Run(ctx) + log.Info("listener running...\n") + select {} +} diff --git a/pkg/contract/disputeGame.go b/pkg/contract/disputeGame.go new file mode 100644 index 0000000..07b6f8e --- /dev/null +++ b/pkg/contract/disputeGame.go @@ -0,0 +1,1886 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract + +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 +) + +// TypesOutputRootProof is an auto generated low-level Go binding around an user-defined struct. +type TypesOutputRootProof struct { + Version [32]byte + StateRoot [32]byte + MessagePasserStorageRoot [32]byte + LatestBlockhash [32]byte +} + +// DisputeGameMetaData contains all meta data concerning the DisputeGame contract. +var DisputeGameMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"_gameType\",\"type\":\"uint32\"},{\"internalType\":\"Claim\",\"name\":\"_absolutePrestate\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_maxGameDepth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_splitDepth\",\"type\":\"uint256\"},{\"internalType\":\"Duration\",\"name\":\"_clockExtension\",\"type\":\"uint64\"},{\"internalType\":\"Duration\",\"name\":\"_maxClockDuration\",\"type\":\"uint64\"},{\"internalType\":\"contractIBigStepper\",\"name\":\"_vm\",\"type\":\"address\"},{\"internalType\":\"contractIDelayedWETH\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"contractIAnchorStateRegistry\",\"name\":\"_anchorStateRegistry\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_l2ChainId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AnchorRootNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BlockNumberMatches\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CannotDefendRootClaim\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClaimAboveSplit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClaimAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClaimAlreadyResolved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClockNotExpired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ClockTimeExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ContentLengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DuplicateStep\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"EmptyItem\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GameDepthExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GameNotInProgress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectBondAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidClockExtension\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDataRemainder\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDisputedClaimIndex\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidHeader\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidHeaderRLP\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidLocalIdent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOutputRootProof\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPrestate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSplitDepth\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2BlockNumberChallenged\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxDepthTooLarge\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoCreditToClaim\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OutOfOrderResolution\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnexpectedList\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"Claim\",\"name\":\"rootClaim\",\"type\":\"bytes32\"}],\"name\":\"UnexpectedRootClaim\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnexpectedString\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ValidStep\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"parentIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"Claim\",\"name\":\"claim\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"claimant\",\"type\":\"address\"}],\"name\":\"Move\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"enumGameStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"Resolved\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"absolutePrestate\",\"outputs\":[{\"internalType\":\"Claim\",\"name\":\"absolutePrestate_\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ident\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_execLeafIdx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_partOffset\",\"type\":\"uint256\"}],\"name\":\"addLocalData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"anchorStateRegistry\",\"outputs\":[{\"internalType\":\"contractIAnchorStateRegistry\",\"name\":\"registry_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"Claim\",\"name\":\"_disputed\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_parentIndex\",\"type\":\"uint256\"},{\"internalType\":\"Claim\",\"name\":\"_claim\",\"type\":\"bytes32\"}],\"name\":\"attack\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"version\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"messagePasserStorageRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"latestBlockhash\",\"type\":\"bytes32\"}],\"internalType\":\"structTypes.OutputRootProof\",\"name\":\"_outputRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"_headerRLP\",\"type\":\"bytes\"}],\"name\":\"challengeRootL2Block\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_recipient\",\"type\":\"address\"}],\"name\":\"claimCredit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"claimData\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"parentIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"counteredBy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"claimant\",\"type\":\"address\"},{\"internalType\":\"uint128\",\"name\":\"bond\",\"type\":\"uint128\"},{\"internalType\":\"Claim\",\"name\":\"claim\",\"type\":\"bytes32\"},{\"internalType\":\"Position\",\"name\":\"position\",\"type\":\"uint128\"},{\"internalType\":\"Clock\",\"name\":\"clock\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimDataLen\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"len_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"Hash\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"claims\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"clockExtension\",\"outputs\":[{\"internalType\":\"Duration\",\"name\":\"clockExtension_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"createdAt\",\"outputs\":[{\"internalType\":\"Timestamp\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"credit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"Claim\",\"name\":\"_disputed\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_parentIndex\",\"type\":\"uint256\"},{\"internalType\":\"Claim\",\"name\":\"_claim\",\"type\":\"bytes32\"}],\"name\":\"defend\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"extraData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"extraData_\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gameCreator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"creator_\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gameData\",\"outputs\":[{\"internalType\":\"GameType\",\"name\":\"gameType_\",\"type\":\"uint32\"},{\"internalType\":\"Claim\",\"name\":\"rootClaim_\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"extraData_\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gameType\",\"outputs\":[{\"internalType\":\"GameType\",\"name\":\"gameType_\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_claimIndex\",\"type\":\"uint256\"}],\"name\":\"getChallengerDuration\",\"outputs\":[{\"internalType\":\"Duration\",\"name\":\"duration_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_claimIndex\",\"type\":\"uint256\"}],\"name\":\"getNumToResolve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"numRemainingChildren_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"Position\",\"name\":\"_position\",\"type\":\"uint128\"}],\"name\":\"getRequiredBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"requiredBond_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1Head\",\"outputs\":[{\"internalType\":\"Hash\",\"name\":\"l1Head_\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2BlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"l2BlockNumber_\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2BlockNumberChallenged\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2BlockNumberChallenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2ChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"l2ChainId_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxClockDuration\",\"outputs\":[{\"internalType\":\"Duration\",\"name\":\"maxClockDuration_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxGameDepth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"maxGameDepth_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"Claim\",\"name\":\"_disputed\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_challengeIndex\",\"type\":\"uint256\"},{\"internalType\":\"Claim\",\"name\":\"_claim\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"_isAttack\",\"type\":\"bool\"}],\"name\":\"move\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"resolutionCheckpoints\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"initialCheckpointComplete\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"subgameIndex\",\"type\":\"uint32\"},{\"internalType\":\"Position\",\"name\":\"leftmostPosition\",\"type\":\"uint128\"},{\"internalType\":\"address\",\"name\":\"counteredBy\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"enumGameStatus\",\"name\":\"status_\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_claimIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numToResolve\",\"type\":\"uint256\"}],\"name\":\"resolveClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resolvedAt\",\"outputs\":[{\"internalType\":\"Timestamp\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"resolvedSubgames\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rootClaim\",\"outputs\":[{\"internalType\":\"Claim\",\"name\":\"rootClaim_\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"splitDepth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"splitDepth_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startingBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"startingBlockNumber_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startingOutputRoot\",\"outputs\":[{\"internalType\":\"Hash\",\"name\":\"root\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"l2BlockNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startingRootHash\",\"outputs\":[{\"internalType\":\"Hash\",\"name\":\"startingRootHash_\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"status\",\"outputs\":[{\"internalType\":\"enumGameStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_claimIndex\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_isAttack\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_stateData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_proof\",\"type\":\"bytes\"}],\"name\":\"step\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"subgames\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vm\",\"outputs\":[{\"internalType\":\"contractIBigStepper\",\"name\":\"vm_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"weth\",\"outputs\":[{\"internalType\":\"contractIDelayedWETH\",\"name\":\"weth_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// DisputeGameABI is the input ABI used to generate the binding from. +// Deprecated: Use DisputeGameMetaData.ABI instead. +var DisputeGameABI = DisputeGameMetaData.ABI + +// DisputeGame is an auto generated Go binding around an Ethereum contract. +type DisputeGame struct { + DisputeGameCaller // Read-only binding to the contract + DisputeGameTransactor // Write-only binding to the contract + DisputeGameFilterer // Log filterer for contract events +} + +// DisputeGameCaller is an auto generated read-only Go binding around an Ethereum contract. +type DisputeGameCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DisputeGameTransactor is an auto generated write-only Go binding around an Ethereum contract. +type DisputeGameTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DisputeGameFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type DisputeGameFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DisputeGameSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type DisputeGameSession struct { + Contract *DisputeGame // 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 +} + +// DisputeGameCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type DisputeGameCallerSession struct { + Contract *DisputeGameCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// DisputeGameTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type DisputeGameTransactorSession struct { + Contract *DisputeGameTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// DisputeGameRaw is an auto generated low-level Go binding around an Ethereum contract. +type DisputeGameRaw struct { + Contract *DisputeGame // Generic contract binding to access the raw methods on +} + +// DisputeGameCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type DisputeGameCallerRaw struct { + Contract *DisputeGameCaller // Generic read-only contract binding to access the raw methods on +} + +// DisputeGameTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type DisputeGameTransactorRaw struct { + Contract *DisputeGameTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewDisputeGame creates a new instance of DisputeGame, bound to a specific deployed contract. +func NewDisputeGame(address common.Address, backend bind.ContractBackend) (*DisputeGame, error) { + contract, err := bindDisputeGame(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &DisputeGame{DisputeGameCaller: DisputeGameCaller{contract: contract}, DisputeGameTransactor: DisputeGameTransactor{contract: contract}, DisputeGameFilterer: DisputeGameFilterer{contract: contract}}, nil +} + +// NewDisputeGameCaller creates a new read-only instance of DisputeGame, bound to a specific deployed contract. +func NewDisputeGameCaller(address common.Address, caller bind.ContractCaller) (*DisputeGameCaller, error) { + contract, err := bindDisputeGame(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &DisputeGameCaller{contract: contract}, nil +} + +// NewDisputeGameTransactor creates a new write-only instance of DisputeGame, bound to a specific deployed contract. +func NewDisputeGameTransactor(address common.Address, transactor bind.ContractTransactor) (*DisputeGameTransactor, error) { + contract, err := bindDisputeGame(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &DisputeGameTransactor{contract: contract}, nil +} + +// NewDisputeGameFilterer creates a new log filterer instance of DisputeGame, bound to a specific deployed contract. +func NewDisputeGameFilterer(address common.Address, filterer bind.ContractFilterer) (*DisputeGameFilterer, error) { + contract, err := bindDisputeGame(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &DisputeGameFilterer{contract: contract}, nil +} + +// bindDisputeGame binds a generic wrapper to an already deployed contract. +func bindDisputeGame(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := DisputeGameMetaData.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 (_DisputeGame *DisputeGameRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _DisputeGame.Contract.DisputeGameCaller.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 (_DisputeGame *DisputeGameRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DisputeGame.Contract.DisputeGameTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_DisputeGame *DisputeGameRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _DisputeGame.Contract.DisputeGameTransactor.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 (_DisputeGame *DisputeGameCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _DisputeGame.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 (_DisputeGame *DisputeGameTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DisputeGame.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_DisputeGame *DisputeGameTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _DisputeGame.Contract.contract.Transact(opts, method, params...) +} + +// AbsolutePrestate is a free data retrieval call binding the contract method 0x8d450a95. +// +// Solidity: function absolutePrestate() view returns(bytes32 absolutePrestate_) +func (_DisputeGame *DisputeGameCaller) AbsolutePrestate(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "absolutePrestate") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// AbsolutePrestate is a free data retrieval call binding the contract method 0x8d450a95. +// +// Solidity: function absolutePrestate() view returns(bytes32 absolutePrestate_) +func (_DisputeGame *DisputeGameSession) AbsolutePrestate() ([32]byte, error) { + return _DisputeGame.Contract.AbsolutePrestate(&_DisputeGame.CallOpts) +} + +// AbsolutePrestate is a free data retrieval call binding the contract method 0x8d450a95. +// +// Solidity: function absolutePrestate() view returns(bytes32 absolutePrestate_) +func (_DisputeGame *DisputeGameCallerSession) AbsolutePrestate() ([32]byte, error) { + return _DisputeGame.Contract.AbsolutePrestate(&_DisputeGame.CallOpts) +} + +// AnchorStateRegistry is a free data retrieval call binding the contract method 0x5c0cba33. +// +// Solidity: function anchorStateRegistry() view returns(address registry_) +func (_DisputeGame *DisputeGameCaller) AnchorStateRegistry(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "anchorStateRegistry") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// AnchorStateRegistry is a free data retrieval call binding the contract method 0x5c0cba33. +// +// Solidity: function anchorStateRegistry() view returns(address registry_) +func (_DisputeGame *DisputeGameSession) AnchorStateRegistry() (common.Address, error) { + return _DisputeGame.Contract.AnchorStateRegistry(&_DisputeGame.CallOpts) +} + +// AnchorStateRegistry is a free data retrieval call binding the contract method 0x5c0cba33. +// +// Solidity: function anchorStateRegistry() view returns(address registry_) +func (_DisputeGame *DisputeGameCallerSession) AnchorStateRegistry() (common.Address, error) { + return _DisputeGame.Contract.AnchorStateRegistry(&_DisputeGame.CallOpts) +} + +// ClaimData is a free data retrieval call binding the contract method 0xc6f0308c. +// +// Solidity: function claimData(uint256 ) view returns(uint32 parentIndex, address counteredBy, address claimant, uint128 bond, bytes32 claim, uint128 position, uint128 clock) +func (_DisputeGame *DisputeGameCaller) ClaimData(opts *bind.CallOpts, arg0 *big.Int) (struct { + ParentIndex uint32 + CounteredBy common.Address + Claimant common.Address + Bond *big.Int + Claim [32]byte + Position *big.Int + Clock *big.Int +}, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "claimData", arg0) + + outstruct := new(struct { + ParentIndex uint32 + CounteredBy common.Address + Claimant common.Address + Bond *big.Int + Claim [32]byte + Position *big.Int + Clock *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.ParentIndex = *abi.ConvertType(out[0], new(uint32)).(*uint32) + outstruct.CounteredBy = *abi.ConvertType(out[1], new(common.Address)).(*common.Address) + outstruct.Claimant = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) + outstruct.Bond = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.Claim = *abi.ConvertType(out[4], new([32]byte)).(*[32]byte) + outstruct.Position = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) + outstruct.Clock = *abi.ConvertType(out[6], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// ClaimData is a free data retrieval call binding the contract method 0xc6f0308c. +// +// Solidity: function claimData(uint256 ) view returns(uint32 parentIndex, address counteredBy, address claimant, uint128 bond, bytes32 claim, uint128 position, uint128 clock) +func (_DisputeGame *DisputeGameSession) ClaimData(arg0 *big.Int) (struct { + ParentIndex uint32 + CounteredBy common.Address + Claimant common.Address + Bond *big.Int + Claim [32]byte + Position *big.Int + Clock *big.Int +}, error) { + return _DisputeGame.Contract.ClaimData(&_DisputeGame.CallOpts, arg0) +} + +// ClaimData is a free data retrieval call binding the contract method 0xc6f0308c. +// +// Solidity: function claimData(uint256 ) view returns(uint32 parentIndex, address counteredBy, address claimant, uint128 bond, bytes32 claim, uint128 position, uint128 clock) +func (_DisputeGame *DisputeGameCallerSession) ClaimData(arg0 *big.Int) (struct { + ParentIndex uint32 + CounteredBy common.Address + Claimant common.Address + Bond *big.Int + Claim [32]byte + Position *big.Int + Clock *big.Int +}, error) { + return _DisputeGame.Contract.ClaimData(&_DisputeGame.CallOpts, arg0) +} + +// ClaimDataLen is a free data retrieval call binding the contract method 0x8980e0cc. +// +// Solidity: function claimDataLen() view returns(uint256 len_) +func (_DisputeGame *DisputeGameCaller) ClaimDataLen(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "claimDataLen") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ClaimDataLen is a free data retrieval call binding the contract method 0x8980e0cc. +// +// Solidity: function claimDataLen() view returns(uint256 len_) +func (_DisputeGame *DisputeGameSession) ClaimDataLen() (*big.Int, error) { + return _DisputeGame.Contract.ClaimDataLen(&_DisputeGame.CallOpts) +} + +// ClaimDataLen is a free data retrieval call binding the contract method 0x8980e0cc. +// +// Solidity: function claimDataLen() view returns(uint256 len_) +func (_DisputeGame *DisputeGameCallerSession) ClaimDataLen() (*big.Int, error) { + return _DisputeGame.Contract.ClaimDataLen(&_DisputeGame.CallOpts) +} + +// Claims is a free data retrieval call binding the contract method 0xeff0f592. +// +// Solidity: function claims(bytes32 ) view returns(bool) +func (_DisputeGame *DisputeGameCaller) Claims(opts *bind.CallOpts, arg0 [32]byte) (bool, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "claims", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// Claims is a free data retrieval call binding the contract method 0xeff0f592. +// +// Solidity: function claims(bytes32 ) view returns(bool) +func (_DisputeGame *DisputeGameSession) Claims(arg0 [32]byte) (bool, error) { + return _DisputeGame.Contract.Claims(&_DisputeGame.CallOpts, arg0) +} + +// Claims is a free data retrieval call binding the contract method 0xeff0f592. +// +// Solidity: function claims(bytes32 ) view returns(bool) +func (_DisputeGame *DisputeGameCallerSession) Claims(arg0 [32]byte) (bool, error) { + return _DisputeGame.Contract.Claims(&_DisputeGame.CallOpts, arg0) +} + +// ClockExtension is a free data retrieval call binding the contract method 0x6b6716c0. +// +// Solidity: function clockExtension() view returns(uint64 clockExtension_) +func (_DisputeGame *DisputeGameCaller) ClockExtension(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "clockExtension") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// ClockExtension is a free data retrieval call binding the contract method 0x6b6716c0. +// +// Solidity: function clockExtension() view returns(uint64 clockExtension_) +func (_DisputeGame *DisputeGameSession) ClockExtension() (uint64, error) { + return _DisputeGame.Contract.ClockExtension(&_DisputeGame.CallOpts) +} + +// ClockExtension is a free data retrieval call binding the contract method 0x6b6716c0. +// +// Solidity: function clockExtension() view returns(uint64 clockExtension_) +func (_DisputeGame *DisputeGameCallerSession) ClockExtension() (uint64, error) { + return _DisputeGame.Contract.ClockExtension(&_DisputeGame.CallOpts) +} + +// CreatedAt is a free data retrieval call binding the contract method 0xcf09e0d0. +// +// Solidity: function createdAt() view returns(uint64) +func (_DisputeGame *DisputeGameCaller) CreatedAt(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "createdAt") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// CreatedAt is a free data retrieval call binding the contract method 0xcf09e0d0. +// +// Solidity: function createdAt() view returns(uint64) +func (_DisputeGame *DisputeGameSession) CreatedAt() (uint64, error) { + return _DisputeGame.Contract.CreatedAt(&_DisputeGame.CallOpts) +} + +// CreatedAt is a free data retrieval call binding the contract method 0xcf09e0d0. +// +// Solidity: function createdAt() view returns(uint64) +func (_DisputeGame *DisputeGameCallerSession) CreatedAt() (uint64, error) { + return _DisputeGame.Contract.CreatedAt(&_DisputeGame.CallOpts) +} + +// Credit is a free data retrieval call binding the contract method 0xd5d44d80. +// +// Solidity: function credit(address ) view returns(uint256) +func (_DisputeGame *DisputeGameCaller) Credit(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "credit", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Credit is a free data retrieval call binding the contract method 0xd5d44d80. +// +// Solidity: function credit(address ) view returns(uint256) +func (_DisputeGame *DisputeGameSession) Credit(arg0 common.Address) (*big.Int, error) { + return _DisputeGame.Contract.Credit(&_DisputeGame.CallOpts, arg0) +} + +// Credit is a free data retrieval call binding the contract method 0xd5d44d80. +// +// Solidity: function credit(address ) view returns(uint256) +func (_DisputeGame *DisputeGameCallerSession) Credit(arg0 common.Address) (*big.Int, error) { + return _DisputeGame.Contract.Credit(&_DisputeGame.CallOpts, arg0) +} + +// ExtraData is a free data retrieval call binding the contract method 0x609d3334. +// +// Solidity: function extraData() pure returns(bytes extraData_) +func (_DisputeGame *DisputeGameCaller) ExtraData(opts *bind.CallOpts) ([]byte, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "extraData") + + if err != nil { + return *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err + +} + +// ExtraData is a free data retrieval call binding the contract method 0x609d3334. +// +// Solidity: function extraData() pure returns(bytes extraData_) +func (_DisputeGame *DisputeGameSession) ExtraData() ([]byte, error) { + return _DisputeGame.Contract.ExtraData(&_DisputeGame.CallOpts) +} + +// ExtraData is a free data retrieval call binding the contract method 0x609d3334. +// +// Solidity: function extraData() pure returns(bytes extraData_) +func (_DisputeGame *DisputeGameCallerSession) ExtraData() ([]byte, error) { + return _DisputeGame.Contract.ExtraData(&_DisputeGame.CallOpts) +} + +// GameCreator is a free data retrieval call binding the contract method 0x37b1b229. +// +// Solidity: function gameCreator() pure returns(address creator_) +func (_DisputeGame *DisputeGameCaller) GameCreator(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "gameCreator") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GameCreator is a free data retrieval call binding the contract method 0x37b1b229. +// +// Solidity: function gameCreator() pure returns(address creator_) +func (_DisputeGame *DisputeGameSession) GameCreator() (common.Address, error) { + return _DisputeGame.Contract.GameCreator(&_DisputeGame.CallOpts) +} + +// GameCreator is a free data retrieval call binding the contract method 0x37b1b229. +// +// Solidity: function gameCreator() pure returns(address creator_) +func (_DisputeGame *DisputeGameCallerSession) GameCreator() (common.Address, error) { + return _DisputeGame.Contract.GameCreator(&_DisputeGame.CallOpts) +} + +// GameData is a free data retrieval call binding the contract method 0xfa24f743. +// +// Solidity: function gameData() view returns(uint32 gameType_, bytes32 rootClaim_, bytes extraData_) +func (_DisputeGame *DisputeGameCaller) GameData(opts *bind.CallOpts) (struct { + GameType uint32 + RootClaim [32]byte + ExtraData []byte +}, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "gameData") + + outstruct := new(struct { + GameType uint32 + RootClaim [32]byte + ExtraData []byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.GameType = *abi.ConvertType(out[0], new(uint32)).(*uint32) + outstruct.RootClaim = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) + outstruct.ExtraData = *abi.ConvertType(out[2], new([]byte)).(*[]byte) + + return *outstruct, err + +} + +// GameData is a free data retrieval call binding the contract method 0xfa24f743. +// +// Solidity: function gameData() view returns(uint32 gameType_, bytes32 rootClaim_, bytes extraData_) +func (_DisputeGame *DisputeGameSession) GameData() (struct { + GameType uint32 + RootClaim [32]byte + ExtraData []byte +}, error) { + return _DisputeGame.Contract.GameData(&_DisputeGame.CallOpts) +} + +// GameData is a free data retrieval call binding the contract method 0xfa24f743. +// +// Solidity: function gameData() view returns(uint32 gameType_, bytes32 rootClaim_, bytes extraData_) +func (_DisputeGame *DisputeGameCallerSession) GameData() (struct { + GameType uint32 + RootClaim [32]byte + ExtraData []byte +}, error) { + return _DisputeGame.Contract.GameData(&_DisputeGame.CallOpts) +} + +// GameType is a free data retrieval call binding the contract method 0xbbdc02db. +// +// Solidity: function gameType() view returns(uint32 gameType_) +func (_DisputeGame *DisputeGameCaller) GameType(opts *bind.CallOpts) (uint32, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "gameType") + + if err != nil { + return *new(uint32), err + } + + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) + + return out0, err + +} + +// GameType is a free data retrieval call binding the contract method 0xbbdc02db. +// +// Solidity: function gameType() view returns(uint32 gameType_) +func (_DisputeGame *DisputeGameSession) GameType() (uint32, error) { + return _DisputeGame.Contract.GameType(&_DisputeGame.CallOpts) +} + +// GameType is a free data retrieval call binding the contract method 0xbbdc02db. +// +// Solidity: function gameType() view returns(uint32 gameType_) +func (_DisputeGame *DisputeGameCallerSession) GameType() (uint32, error) { + return _DisputeGame.Contract.GameType(&_DisputeGame.CallOpts) +} + +// GetChallengerDuration is a free data retrieval call binding the contract method 0xbd8da956. +// +// Solidity: function getChallengerDuration(uint256 _claimIndex) view returns(uint64 duration_) +func (_DisputeGame *DisputeGameCaller) GetChallengerDuration(opts *bind.CallOpts, _claimIndex *big.Int) (uint64, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "getChallengerDuration", _claimIndex) + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// GetChallengerDuration is a free data retrieval call binding the contract method 0xbd8da956. +// +// Solidity: function getChallengerDuration(uint256 _claimIndex) view returns(uint64 duration_) +func (_DisputeGame *DisputeGameSession) GetChallengerDuration(_claimIndex *big.Int) (uint64, error) { + return _DisputeGame.Contract.GetChallengerDuration(&_DisputeGame.CallOpts, _claimIndex) +} + +// GetChallengerDuration is a free data retrieval call binding the contract method 0xbd8da956. +// +// Solidity: function getChallengerDuration(uint256 _claimIndex) view returns(uint64 duration_) +func (_DisputeGame *DisputeGameCallerSession) GetChallengerDuration(_claimIndex *big.Int) (uint64, error) { + return _DisputeGame.Contract.GetChallengerDuration(&_DisputeGame.CallOpts, _claimIndex) +} + +// GetNumToResolve is a free data retrieval call binding the contract method 0x5a5fa2d9. +// +// Solidity: function getNumToResolve(uint256 _claimIndex) view returns(uint256 numRemainingChildren_) +func (_DisputeGame *DisputeGameCaller) GetNumToResolve(opts *bind.CallOpts, _claimIndex *big.Int) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "getNumToResolve", _claimIndex) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetNumToResolve is a free data retrieval call binding the contract method 0x5a5fa2d9. +// +// Solidity: function getNumToResolve(uint256 _claimIndex) view returns(uint256 numRemainingChildren_) +func (_DisputeGame *DisputeGameSession) GetNumToResolve(_claimIndex *big.Int) (*big.Int, error) { + return _DisputeGame.Contract.GetNumToResolve(&_DisputeGame.CallOpts, _claimIndex) +} + +// GetNumToResolve is a free data retrieval call binding the contract method 0x5a5fa2d9. +// +// Solidity: function getNumToResolve(uint256 _claimIndex) view returns(uint256 numRemainingChildren_) +func (_DisputeGame *DisputeGameCallerSession) GetNumToResolve(_claimIndex *big.Int) (*big.Int, error) { + return _DisputeGame.Contract.GetNumToResolve(&_DisputeGame.CallOpts, _claimIndex) +} + +// GetRequiredBond is a free data retrieval call binding the contract method 0xc395e1ca. +// +// Solidity: function getRequiredBond(uint128 _position) view returns(uint256 requiredBond_) +func (_DisputeGame *DisputeGameCaller) GetRequiredBond(opts *bind.CallOpts, _position *big.Int) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "getRequiredBond", _position) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetRequiredBond is a free data retrieval call binding the contract method 0xc395e1ca. +// +// Solidity: function getRequiredBond(uint128 _position) view returns(uint256 requiredBond_) +func (_DisputeGame *DisputeGameSession) GetRequiredBond(_position *big.Int) (*big.Int, error) { + return _DisputeGame.Contract.GetRequiredBond(&_DisputeGame.CallOpts, _position) +} + +// GetRequiredBond is a free data retrieval call binding the contract method 0xc395e1ca. +// +// Solidity: function getRequiredBond(uint128 _position) view returns(uint256 requiredBond_) +func (_DisputeGame *DisputeGameCallerSession) GetRequiredBond(_position *big.Int) (*big.Int, error) { + return _DisputeGame.Contract.GetRequiredBond(&_DisputeGame.CallOpts, _position) +} + +// L1Head is a free data retrieval call binding the contract method 0x6361506d. +// +// Solidity: function l1Head() pure returns(bytes32 l1Head_) +func (_DisputeGame *DisputeGameCaller) L1Head(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "l1Head") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// L1Head is a free data retrieval call binding the contract method 0x6361506d. +// +// Solidity: function l1Head() pure returns(bytes32 l1Head_) +func (_DisputeGame *DisputeGameSession) L1Head() ([32]byte, error) { + return _DisputeGame.Contract.L1Head(&_DisputeGame.CallOpts) +} + +// L1Head is a free data retrieval call binding the contract method 0x6361506d. +// +// Solidity: function l1Head() pure returns(bytes32 l1Head_) +func (_DisputeGame *DisputeGameCallerSession) L1Head() ([32]byte, error) { + return _DisputeGame.Contract.L1Head(&_DisputeGame.CallOpts) +} + +// L2BlockNumber is a free data retrieval call binding the contract method 0x8b85902b. +// +// Solidity: function l2BlockNumber() pure returns(uint256 l2BlockNumber_) +func (_DisputeGame *DisputeGameCaller) L2BlockNumber(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "l2BlockNumber") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// L2BlockNumber is a free data retrieval call binding the contract method 0x8b85902b. +// +// Solidity: function l2BlockNumber() pure returns(uint256 l2BlockNumber_) +func (_DisputeGame *DisputeGameSession) L2BlockNumber() (*big.Int, error) { + return _DisputeGame.Contract.L2BlockNumber(&_DisputeGame.CallOpts) +} + +// L2BlockNumber is a free data retrieval call binding the contract method 0x8b85902b. +// +// Solidity: function l2BlockNumber() pure returns(uint256 l2BlockNumber_) +func (_DisputeGame *DisputeGameCallerSession) L2BlockNumber() (*big.Int, error) { + return _DisputeGame.Contract.L2BlockNumber(&_DisputeGame.CallOpts) +} + +// L2BlockNumberChallenged is a free data retrieval call binding the contract method 0x3e3ac912. +// +// Solidity: function l2BlockNumberChallenged() view returns(bool) +func (_DisputeGame *DisputeGameCaller) L2BlockNumberChallenged(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "l2BlockNumberChallenged") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// L2BlockNumberChallenged is a free data retrieval call binding the contract method 0x3e3ac912. +// +// Solidity: function l2BlockNumberChallenged() view returns(bool) +func (_DisputeGame *DisputeGameSession) L2BlockNumberChallenged() (bool, error) { + return _DisputeGame.Contract.L2BlockNumberChallenged(&_DisputeGame.CallOpts) +} + +// L2BlockNumberChallenged is a free data retrieval call binding the contract method 0x3e3ac912. +// +// Solidity: function l2BlockNumberChallenged() view returns(bool) +func (_DisputeGame *DisputeGameCallerSession) L2BlockNumberChallenged() (bool, error) { + return _DisputeGame.Contract.L2BlockNumberChallenged(&_DisputeGame.CallOpts) +} + +// L2BlockNumberChallenger is a free data retrieval call binding the contract method 0x30dbe570. +// +// Solidity: function l2BlockNumberChallenger() view returns(address) +func (_DisputeGame *DisputeGameCaller) L2BlockNumberChallenger(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "l2BlockNumberChallenger") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// L2BlockNumberChallenger is a free data retrieval call binding the contract method 0x30dbe570. +// +// Solidity: function l2BlockNumberChallenger() view returns(address) +func (_DisputeGame *DisputeGameSession) L2BlockNumberChallenger() (common.Address, error) { + return _DisputeGame.Contract.L2BlockNumberChallenger(&_DisputeGame.CallOpts) +} + +// L2BlockNumberChallenger is a free data retrieval call binding the contract method 0x30dbe570. +// +// Solidity: function l2BlockNumberChallenger() view returns(address) +func (_DisputeGame *DisputeGameCallerSession) L2BlockNumberChallenger() (common.Address, error) { + return _DisputeGame.Contract.L2BlockNumberChallenger(&_DisputeGame.CallOpts) +} + +// L2ChainId is a free data retrieval call binding the contract method 0xd6ae3cd5. +// +// Solidity: function l2ChainId() view returns(uint256 l2ChainId_) +func (_DisputeGame *DisputeGameCaller) L2ChainId(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "l2ChainId") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// L2ChainId is a free data retrieval call binding the contract method 0xd6ae3cd5. +// +// Solidity: function l2ChainId() view returns(uint256 l2ChainId_) +func (_DisputeGame *DisputeGameSession) L2ChainId() (*big.Int, error) { + return _DisputeGame.Contract.L2ChainId(&_DisputeGame.CallOpts) +} + +// L2ChainId is a free data retrieval call binding the contract method 0xd6ae3cd5. +// +// Solidity: function l2ChainId() view returns(uint256 l2ChainId_) +func (_DisputeGame *DisputeGameCallerSession) L2ChainId() (*big.Int, error) { + return _DisputeGame.Contract.L2ChainId(&_DisputeGame.CallOpts) +} + +// MaxClockDuration is a free data retrieval call binding the contract method 0xdabd396d. +// +// Solidity: function maxClockDuration() view returns(uint64 maxClockDuration_) +func (_DisputeGame *DisputeGameCaller) MaxClockDuration(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "maxClockDuration") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// MaxClockDuration is a free data retrieval call binding the contract method 0xdabd396d. +// +// Solidity: function maxClockDuration() view returns(uint64 maxClockDuration_) +func (_DisputeGame *DisputeGameSession) MaxClockDuration() (uint64, error) { + return _DisputeGame.Contract.MaxClockDuration(&_DisputeGame.CallOpts) +} + +// MaxClockDuration is a free data retrieval call binding the contract method 0xdabd396d. +// +// Solidity: function maxClockDuration() view returns(uint64 maxClockDuration_) +func (_DisputeGame *DisputeGameCallerSession) MaxClockDuration() (uint64, error) { + return _DisputeGame.Contract.MaxClockDuration(&_DisputeGame.CallOpts) +} + +// MaxGameDepth is a free data retrieval call binding the contract method 0xfa315aa9. +// +// Solidity: function maxGameDepth() view returns(uint256 maxGameDepth_) +func (_DisputeGame *DisputeGameCaller) MaxGameDepth(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "maxGameDepth") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxGameDepth is a free data retrieval call binding the contract method 0xfa315aa9. +// +// Solidity: function maxGameDepth() view returns(uint256 maxGameDepth_) +func (_DisputeGame *DisputeGameSession) MaxGameDepth() (*big.Int, error) { + return _DisputeGame.Contract.MaxGameDepth(&_DisputeGame.CallOpts) +} + +// MaxGameDepth is a free data retrieval call binding the contract method 0xfa315aa9. +// +// Solidity: function maxGameDepth() view returns(uint256 maxGameDepth_) +func (_DisputeGame *DisputeGameCallerSession) MaxGameDepth() (*big.Int, error) { + return _DisputeGame.Contract.MaxGameDepth(&_DisputeGame.CallOpts) +} + +// ResolutionCheckpoints is a free data retrieval call binding the contract method 0xa445ece6. +// +// Solidity: function resolutionCheckpoints(uint256 ) view returns(bool initialCheckpointComplete, uint32 subgameIndex, uint128 leftmostPosition, address counteredBy) +func (_DisputeGame *DisputeGameCaller) ResolutionCheckpoints(opts *bind.CallOpts, arg0 *big.Int) (struct { + InitialCheckpointComplete bool + SubgameIndex uint32 + LeftmostPosition *big.Int + CounteredBy common.Address +}, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "resolutionCheckpoints", arg0) + + outstruct := new(struct { + InitialCheckpointComplete bool + SubgameIndex uint32 + LeftmostPosition *big.Int + CounteredBy common.Address + }) + if err != nil { + return *outstruct, err + } + + outstruct.InitialCheckpointComplete = *abi.ConvertType(out[0], new(bool)).(*bool) + outstruct.SubgameIndex = *abi.ConvertType(out[1], new(uint32)).(*uint32) + outstruct.LeftmostPosition = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + outstruct.CounteredBy = *abi.ConvertType(out[3], new(common.Address)).(*common.Address) + + return *outstruct, err + +} + +// ResolutionCheckpoints is a free data retrieval call binding the contract method 0xa445ece6. +// +// Solidity: function resolutionCheckpoints(uint256 ) view returns(bool initialCheckpointComplete, uint32 subgameIndex, uint128 leftmostPosition, address counteredBy) +func (_DisputeGame *DisputeGameSession) ResolutionCheckpoints(arg0 *big.Int) (struct { + InitialCheckpointComplete bool + SubgameIndex uint32 + LeftmostPosition *big.Int + CounteredBy common.Address +}, error) { + return _DisputeGame.Contract.ResolutionCheckpoints(&_DisputeGame.CallOpts, arg0) +} + +// ResolutionCheckpoints is a free data retrieval call binding the contract method 0xa445ece6. +// +// Solidity: function resolutionCheckpoints(uint256 ) view returns(bool initialCheckpointComplete, uint32 subgameIndex, uint128 leftmostPosition, address counteredBy) +func (_DisputeGame *DisputeGameCallerSession) ResolutionCheckpoints(arg0 *big.Int) (struct { + InitialCheckpointComplete bool + SubgameIndex uint32 + LeftmostPosition *big.Int + CounteredBy common.Address +}, error) { + return _DisputeGame.Contract.ResolutionCheckpoints(&_DisputeGame.CallOpts, arg0) +} + +// ResolvedAt is a free data retrieval call binding the contract method 0x19effeb4. +// +// Solidity: function resolvedAt() view returns(uint64) +func (_DisputeGame *DisputeGameCaller) ResolvedAt(opts *bind.CallOpts) (uint64, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "resolvedAt") + + if err != nil { + return *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + + return out0, err + +} + +// ResolvedAt is a free data retrieval call binding the contract method 0x19effeb4. +// +// Solidity: function resolvedAt() view returns(uint64) +func (_DisputeGame *DisputeGameSession) ResolvedAt() (uint64, error) { + return _DisputeGame.Contract.ResolvedAt(&_DisputeGame.CallOpts) +} + +// ResolvedAt is a free data retrieval call binding the contract method 0x19effeb4. +// +// Solidity: function resolvedAt() view returns(uint64) +func (_DisputeGame *DisputeGameCallerSession) ResolvedAt() (uint64, error) { + return _DisputeGame.Contract.ResolvedAt(&_DisputeGame.CallOpts) +} + +// ResolvedSubgames is a free data retrieval call binding the contract method 0xfe2bbeb2. +// +// Solidity: function resolvedSubgames(uint256 ) view returns(bool) +func (_DisputeGame *DisputeGameCaller) ResolvedSubgames(opts *bind.CallOpts, arg0 *big.Int) (bool, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "resolvedSubgames", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// ResolvedSubgames is a free data retrieval call binding the contract method 0xfe2bbeb2. +// +// Solidity: function resolvedSubgames(uint256 ) view returns(bool) +func (_DisputeGame *DisputeGameSession) ResolvedSubgames(arg0 *big.Int) (bool, error) { + return _DisputeGame.Contract.ResolvedSubgames(&_DisputeGame.CallOpts, arg0) +} + +// ResolvedSubgames is a free data retrieval call binding the contract method 0xfe2bbeb2. +// +// Solidity: function resolvedSubgames(uint256 ) view returns(bool) +func (_DisputeGame *DisputeGameCallerSession) ResolvedSubgames(arg0 *big.Int) (bool, error) { + return _DisputeGame.Contract.ResolvedSubgames(&_DisputeGame.CallOpts, arg0) +} + +// RootClaim is a free data retrieval call binding the contract method 0xbcef3b55. +// +// Solidity: function rootClaim() pure returns(bytes32 rootClaim_) +func (_DisputeGame *DisputeGameCaller) RootClaim(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "rootClaim") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// RootClaim is a free data retrieval call binding the contract method 0xbcef3b55. +// +// Solidity: function rootClaim() pure returns(bytes32 rootClaim_) +func (_DisputeGame *DisputeGameSession) RootClaim() ([32]byte, error) { + return _DisputeGame.Contract.RootClaim(&_DisputeGame.CallOpts) +} + +// RootClaim is a free data retrieval call binding the contract method 0xbcef3b55. +// +// Solidity: function rootClaim() pure returns(bytes32 rootClaim_) +func (_DisputeGame *DisputeGameCallerSession) RootClaim() ([32]byte, error) { + return _DisputeGame.Contract.RootClaim(&_DisputeGame.CallOpts) +} + +// SplitDepth is a free data retrieval call binding the contract method 0xec5e6308. +// +// Solidity: function splitDepth() view returns(uint256 splitDepth_) +func (_DisputeGame *DisputeGameCaller) SplitDepth(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "splitDepth") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SplitDepth is a free data retrieval call binding the contract method 0xec5e6308. +// +// Solidity: function splitDepth() view returns(uint256 splitDepth_) +func (_DisputeGame *DisputeGameSession) SplitDepth() (*big.Int, error) { + return _DisputeGame.Contract.SplitDepth(&_DisputeGame.CallOpts) +} + +// SplitDepth is a free data retrieval call binding the contract method 0xec5e6308. +// +// Solidity: function splitDepth() view returns(uint256 splitDepth_) +func (_DisputeGame *DisputeGameCallerSession) SplitDepth() (*big.Int, error) { + return _DisputeGame.Contract.SplitDepth(&_DisputeGame.CallOpts) +} + +// StartingBlockNumber is a free data retrieval call binding the contract method 0x70872aa5. +// +// Solidity: function startingBlockNumber() view returns(uint256 startingBlockNumber_) +func (_DisputeGame *DisputeGameCaller) StartingBlockNumber(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "startingBlockNumber") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// StartingBlockNumber is a free data retrieval call binding the contract method 0x70872aa5. +// +// Solidity: function startingBlockNumber() view returns(uint256 startingBlockNumber_) +func (_DisputeGame *DisputeGameSession) StartingBlockNumber() (*big.Int, error) { + return _DisputeGame.Contract.StartingBlockNumber(&_DisputeGame.CallOpts) +} + +// StartingBlockNumber is a free data retrieval call binding the contract method 0x70872aa5. +// +// Solidity: function startingBlockNumber() view returns(uint256 startingBlockNumber_) +func (_DisputeGame *DisputeGameCallerSession) StartingBlockNumber() (*big.Int, error) { + return _DisputeGame.Contract.StartingBlockNumber(&_DisputeGame.CallOpts) +} + +// StartingOutputRoot is a free data retrieval call binding the contract method 0x57da950e. +// +// Solidity: function startingOutputRoot() view returns(bytes32 root, uint256 l2BlockNumber) +func (_DisputeGame *DisputeGameCaller) StartingOutputRoot(opts *bind.CallOpts) (struct { + Root [32]byte + L2BlockNumber *big.Int +}, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "startingOutputRoot") + + outstruct := new(struct { + Root [32]byte + L2BlockNumber *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Root = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + outstruct.L2BlockNumber = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// StartingOutputRoot is a free data retrieval call binding the contract method 0x57da950e. +// +// Solidity: function startingOutputRoot() view returns(bytes32 root, uint256 l2BlockNumber) +func (_DisputeGame *DisputeGameSession) StartingOutputRoot() (struct { + Root [32]byte + L2BlockNumber *big.Int +}, error) { + return _DisputeGame.Contract.StartingOutputRoot(&_DisputeGame.CallOpts) +} + +// StartingOutputRoot is a free data retrieval call binding the contract method 0x57da950e. +// +// Solidity: function startingOutputRoot() view returns(bytes32 root, uint256 l2BlockNumber) +func (_DisputeGame *DisputeGameCallerSession) StartingOutputRoot() (struct { + Root [32]byte + L2BlockNumber *big.Int +}, error) { + return _DisputeGame.Contract.StartingOutputRoot(&_DisputeGame.CallOpts) +} + +// StartingRootHash is a free data retrieval call binding the contract method 0x25fc2ace. +// +// Solidity: function startingRootHash() view returns(bytes32 startingRootHash_) +func (_DisputeGame *DisputeGameCaller) StartingRootHash(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "startingRootHash") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// StartingRootHash is a free data retrieval call binding the contract method 0x25fc2ace. +// +// Solidity: function startingRootHash() view returns(bytes32 startingRootHash_) +func (_DisputeGame *DisputeGameSession) StartingRootHash() ([32]byte, error) { + return _DisputeGame.Contract.StartingRootHash(&_DisputeGame.CallOpts) +} + +// StartingRootHash is a free data retrieval call binding the contract method 0x25fc2ace. +// +// Solidity: function startingRootHash() view returns(bytes32 startingRootHash_) +func (_DisputeGame *DisputeGameCallerSession) StartingRootHash() ([32]byte, error) { + return _DisputeGame.Contract.StartingRootHash(&_DisputeGame.CallOpts) +} + +// Status is a free data retrieval call binding the contract method 0x200d2ed2. +// +// Solidity: function status() view returns(uint8) +func (_DisputeGame *DisputeGameCaller) Status(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "status") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// Status is a free data retrieval call binding the contract method 0x200d2ed2. +// +// Solidity: function status() view returns(uint8) +func (_DisputeGame *DisputeGameSession) Status() (uint8, error) { + return _DisputeGame.Contract.Status(&_DisputeGame.CallOpts) +} + +// Status is a free data retrieval call binding the contract method 0x200d2ed2. +// +// Solidity: function status() view returns(uint8) +func (_DisputeGame *DisputeGameCallerSession) Status() (uint8, error) { + return _DisputeGame.Contract.Status(&_DisputeGame.CallOpts) +} + +// Subgames is a free data retrieval call binding the contract method 0x2ad69aeb. +// +// Solidity: function subgames(uint256 , uint256 ) view returns(uint256) +func (_DisputeGame *DisputeGameCaller) Subgames(opts *bind.CallOpts, arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "subgames", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Subgames is a free data retrieval call binding the contract method 0x2ad69aeb. +// +// Solidity: function subgames(uint256 , uint256 ) view returns(uint256) +func (_DisputeGame *DisputeGameSession) Subgames(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { + return _DisputeGame.Contract.Subgames(&_DisputeGame.CallOpts, arg0, arg1) +} + +// Subgames is a free data retrieval call binding the contract method 0x2ad69aeb. +// +// Solidity: function subgames(uint256 , uint256 ) view returns(uint256) +func (_DisputeGame *DisputeGameCallerSession) Subgames(arg0 *big.Int, arg1 *big.Int) (*big.Int, error) { + return _DisputeGame.Contract.Subgames(&_DisputeGame.CallOpts, arg0, arg1) +} + +// Version is a free data retrieval call binding the contract method 0x54fd4d50. +// +// Solidity: function version() view returns(string) +func (_DisputeGame *DisputeGameCaller) Version(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _DisputeGame.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 0x54fd4d50. +// +// Solidity: function version() view returns(string) +func (_DisputeGame *DisputeGameSession) Version() (string, error) { + return _DisputeGame.Contract.Version(&_DisputeGame.CallOpts) +} + +// Version is a free data retrieval call binding the contract method 0x54fd4d50. +// +// Solidity: function version() view returns(string) +func (_DisputeGame *DisputeGameCallerSession) Version() (string, error) { + return _DisputeGame.Contract.Version(&_DisputeGame.CallOpts) +} + +// Vm is a free data retrieval call binding the contract method 0x3a768463. +// +// Solidity: function vm() view returns(address vm_) +func (_DisputeGame *DisputeGameCaller) Vm(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "vm") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Vm is a free data retrieval call binding the contract method 0x3a768463. +// +// Solidity: function vm() view returns(address vm_) +func (_DisputeGame *DisputeGameSession) Vm() (common.Address, error) { + return _DisputeGame.Contract.Vm(&_DisputeGame.CallOpts) +} + +// Vm is a free data retrieval call binding the contract method 0x3a768463. +// +// Solidity: function vm() view returns(address vm_) +func (_DisputeGame *DisputeGameCallerSession) Vm() (common.Address, error) { + return _DisputeGame.Contract.Vm(&_DisputeGame.CallOpts) +} + +// Weth is a free data retrieval call binding the contract method 0x3fc8cef3. +// +// Solidity: function weth() view returns(address weth_) +func (_DisputeGame *DisputeGameCaller) Weth(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _DisputeGame.contract.Call(opts, &out, "weth") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Weth is a free data retrieval call binding the contract method 0x3fc8cef3. +// +// Solidity: function weth() view returns(address weth_) +func (_DisputeGame *DisputeGameSession) Weth() (common.Address, error) { + return _DisputeGame.Contract.Weth(&_DisputeGame.CallOpts) +} + +// Weth is a free data retrieval call binding the contract method 0x3fc8cef3. +// +// Solidity: function weth() view returns(address weth_) +func (_DisputeGame *DisputeGameCallerSession) Weth() (common.Address, error) { + return _DisputeGame.Contract.Weth(&_DisputeGame.CallOpts) +} + +// AddLocalData is a paid mutator transaction binding the contract method 0xf8f43ff6. +// +// Solidity: function addLocalData(uint256 _ident, uint256 _execLeafIdx, uint256 _partOffset) returns() +func (_DisputeGame *DisputeGameTransactor) AddLocalData(opts *bind.TransactOpts, _ident *big.Int, _execLeafIdx *big.Int, _partOffset *big.Int) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "addLocalData", _ident, _execLeafIdx, _partOffset) +} + +// AddLocalData is a paid mutator transaction binding the contract method 0xf8f43ff6. +// +// Solidity: function addLocalData(uint256 _ident, uint256 _execLeafIdx, uint256 _partOffset) returns() +func (_DisputeGame *DisputeGameSession) AddLocalData(_ident *big.Int, _execLeafIdx *big.Int, _partOffset *big.Int) (*types.Transaction, error) { + return _DisputeGame.Contract.AddLocalData(&_DisputeGame.TransactOpts, _ident, _execLeafIdx, _partOffset) +} + +// AddLocalData is a paid mutator transaction binding the contract method 0xf8f43ff6. +// +// Solidity: function addLocalData(uint256 _ident, uint256 _execLeafIdx, uint256 _partOffset) returns() +func (_DisputeGame *DisputeGameTransactorSession) AddLocalData(_ident *big.Int, _execLeafIdx *big.Int, _partOffset *big.Int) (*types.Transaction, error) { + return _DisputeGame.Contract.AddLocalData(&_DisputeGame.TransactOpts, _ident, _execLeafIdx, _partOffset) +} + +// Attack is a paid mutator transaction binding the contract method 0x472777c6. +// +// Solidity: function attack(bytes32 _disputed, uint256 _parentIndex, bytes32 _claim) payable returns() +func (_DisputeGame *DisputeGameTransactor) Attack(opts *bind.TransactOpts, _disputed [32]byte, _parentIndex *big.Int, _claim [32]byte) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "attack", _disputed, _parentIndex, _claim) +} + +// Attack is a paid mutator transaction binding the contract method 0x472777c6. +// +// Solidity: function attack(bytes32 _disputed, uint256 _parentIndex, bytes32 _claim) payable returns() +func (_DisputeGame *DisputeGameSession) Attack(_disputed [32]byte, _parentIndex *big.Int, _claim [32]byte) (*types.Transaction, error) { + return _DisputeGame.Contract.Attack(&_DisputeGame.TransactOpts, _disputed, _parentIndex, _claim) +} + +// Attack is a paid mutator transaction binding the contract method 0x472777c6. +// +// Solidity: function attack(bytes32 _disputed, uint256 _parentIndex, bytes32 _claim) payable returns() +func (_DisputeGame *DisputeGameTransactorSession) Attack(_disputed [32]byte, _parentIndex *big.Int, _claim [32]byte) (*types.Transaction, error) { + return _DisputeGame.Contract.Attack(&_DisputeGame.TransactOpts, _disputed, _parentIndex, _claim) +} + +// ChallengeRootL2Block is a paid mutator transaction binding the contract method 0x01935130. +// +// Solidity: function challengeRootL2Block((bytes32,bytes32,bytes32,bytes32) _outputRootProof, bytes _headerRLP) returns() +func (_DisputeGame *DisputeGameTransactor) ChallengeRootL2Block(opts *bind.TransactOpts, _outputRootProof TypesOutputRootProof, _headerRLP []byte) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "challengeRootL2Block", _outputRootProof, _headerRLP) +} + +// ChallengeRootL2Block is a paid mutator transaction binding the contract method 0x01935130. +// +// Solidity: function challengeRootL2Block((bytes32,bytes32,bytes32,bytes32) _outputRootProof, bytes _headerRLP) returns() +func (_DisputeGame *DisputeGameSession) ChallengeRootL2Block(_outputRootProof TypesOutputRootProof, _headerRLP []byte) (*types.Transaction, error) { + return _DisputeGame.Contract.ChallengeRootL2Block(&_DisputeGame.TransactOpts, _outputRootProof, _headerRLP) +} + +// ChallengeRootL2Block is a paid mutator transaction binding the contract method 0x01935130. +// +// Solidity: function challengeRootL2Block((bytes32,bytes32,bytes32,bytes32) _outputRootProof, bytes _headerRLP) returns() +func (_DisputeGame *DisputeGameTransactorSession) ChallengeRootL2Block(_outputRootProof TypesOutputRootProof, _headerRLP []byte) (*types.Transaction, error) { + return _DisputeGame.Contract.ChallengeRootL2Block(&_DisputeGame.TransactOpts, _outputRootProof, _headerRLP) +} + +// ClaimCredit is a paid mutator transaction binding the contract method 0x60e27464. +// +// Solidity: function claimCredit(address _recipient) returns() +func (_DisputeGame *DisputeGameTransactor) ClaimCredit(opts *bind.TransactOpts, _recipient common.Address) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "claimCredit", _recipient) +} + +// ClaimCredit is a paid mutator transaction binding the contract method 0x60e27464. +// +// Solidity: function claimCredit(address _recipient) returns() +func (_DisputeGame *DisputeGameSession) ClaimCredit(_recipient common.Address) (*types.Transaction, error) { + return _DisputeGame.Contract.ClaimCredit(&_DisputeGame.TransactOpts, _recipient) +} + +// ClaimCredit is a paid mutator transaction binding the contract method 0x60e27464. +// +// Solidity: function claimCredit(address _recipient) returns() +func (_DisputeGame *DisputeGameTransactorSession) ClaimCredit(_recipient common.Address) (*types.Transaction, error) { + return _DisputeGame.Contract.ClaimCredit(&_DisputeGame.TransactOpts, _recipient) +} + +// Defend is a paid mutator transaction binding the contract method 0x7b0f0adc. +// +// Solidity: function defend(bytes32 _disputed, uint256 _parentIndex, bytes32 _claim) payable returns() +func (_DisputeGame *DisputeGameTransactor) Defend(opts *bind.TransactOpts, _disputed [32]byte, _parentIndex *big.Int, _claim [32]byte) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "defend", _disputed, _parentIndex, _claim) +} + +// Defend is a paid mutator transaction binding the contract method 0x7b0f0adc. +// +// Solidity: function defend(bytes32 _disputed, uint256 _parentIndex, bytes32 _claim) payable returns() +func (_DisputeGame *DisputeGameSession) Defend(_disputed [32]byte, _parentIndex *big.Int, _claim [32]byte) (*types.Transaction, error) { + return _DisputeGame.Contract.Defend(&_DisputeGame.TransactOpts, _disputed, _parentIndex, _claim) +} + +// Defend is a paid mutator transaction binding the contract method 0x7b0f0adc. +// +// Solidity: function defend(bytes32 _disputed, uint256 _parentIndex, bytes32 _claim) payable returns() +func (_DisputeGame *DisputeGameTransactorSession) Defend(_disputed [32]byte, _parentIndex *big.Int, _claim [32]byte) (*types.Transaction, error) { + return _DisputeGame.Contract.Defend(&_DisputeGame.TransactOpts, _disputed, _parentIndex, _claim) +} + +// Initialize is a paid mutator transaction binding the contract method 0x8129fc1c. +// +// Solidity: function initialize() payable returns() +func (_DisputeGame *DisputeGameTransactor) Initialize(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "initialize") +} + +// Initialize is a paid mutator transaction binding the contract method 0x8129fc1c. +// +// Solidity: function initialize() payable returns() +func (_DisputeGame *DisputeGameSession) Initialize() (*types.Transaction, error) { + return _DisputeGame.Contract.Initialize(&_DisputeGame.TransactOpts) +} + +// Initialize is a paid mutator transaction binding the contract method 0x8129fc1c. +// +// Solidity: function initialize() payable returns() +func (_DisputeGame *DisputeGameTransactorSession) Initialize() (*types.Transaction, error) { + return _DisputeGame.Contract.Initialize(&_DisputeGame.TransactOpts) +} + +// Move is a paid mutator transaction binding the contract method 0x6f034409. +// +// Solidity: function move(bytes32 _disputed, uint256 _challengeIndex, bytes32 _claim, bool _isAttack) payable returns() +func (_DisputeGame *DisputeGameTransactor) Move(opts *bind.TransactOpts, _disputed [32]byte, _challengeIndex *big.Int, _claim [32]byte, _isAttack bool) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "move", _disputed, _challengeIndex, _claim, _isAttack) +} + +// Move is a paid mutator transaction binding the contract method 0x6f034409. +// +// Solidity: function move(bytes32 _disputed, uint256 _challengeIndex, bytes32 _claim, bool _isAttack) payable returns() +func (_DisputeGame *DisputeGameSession) Move(_disputed [32]byte, _challengeIndex *big.Int, _claim [32]byte, _isAttack bool) (*types.Transaction, error) { + return _DisputeGame.Contract.Move(&_DisputeGame.TransactOpts, _disputed, _challengeIndex, _claim, _isAttack) +} + +// Move is a paid mutator transaction binding the contract method 0x6f034409. +// +// Solidity: function move(bytes32 _disputed, uint256 _challengeIndex, bytes32 _claim, bool _isAttack) payable returns() +func (_DisputeGame *DisputeGameTransactorSession) Move(_disputed [32]byte, _challengeIndex *big.Int, _claim [32]byte, _isAttack bool) (*types.Transaction, error) { + return _DisputeGame.Contract.Move(&_DisputeGame.TransactOpts, _disputed, _challengeIndex, _claim, _isAttack) +} + +// Resolve is a paid mutator transaction binding the contract method 0x2810e1d6. +// +// Solidity: function resolve() returns(uint8 status_) +func (_DisputeGame *DisputeGameTransactor) Resolve(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "resolve") +} + +// Resolve is a paid mutator transaction binding the contract method 0x2810e1d6. +// +// Solidity: function resolve() returns(uint8 status_) +func (_DisputeGame *DisputeGameSession) Resolve() (*types.Transaction, error) { + return _DisputeGame.Contract.Resolve(&_DisputeGame.TransactOpts) +} + +// Resolve is a paid mutator transaction binding the contract method 0x2810e1d6. +// +// Solidity: function resolve() returns(uint8 status_) +func (_DisputeGame *DisputeGameTransactorSession) Resolve() (*types.Transaction, error) { + return _DisputeGame.Contract.Resolve(&_DisputeGame.TransactOpts) +} + +// ResolveClaim is a paid mutator transaction binding the contract method 0x03c2924d. +// +// Solidity: function resolveClaim(uint256 _claimIndex, uint256 _numToResolve) returns() +func (_DisputeGame *DisputeGameTransactor) ResolveClaim(opts *bind.TransactOpts, _claimIndex *big.Int, _numToResolve *big.Int) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "resolveClaim", _claimIndex, _numToResolve) +} + +// ResolveClaim is a paid mutator transaction binding the contract method 0x03c2924d. +// +// Solidity: function resolveClaim(uint256 _claimIndex, uint256 _numToResolve) returns() +func (_DisputeGame *DisputeGameSession) ResolveClaim(_claimIndex *big.Int, _numToResolve *big.Int) (*types.Transaction, error) { + return _DisputeGame.Contract.ResolveClaim(&_DisputeGame.TransactOpts, _claimIndex, _numToResolve) +} + +// ResolveClaim is a paid mutator transaction binding the contract method 0x03c2924d. +// +// Solidity: function resolveClaim(uint256 _claimIndex, uint256 _numToResolve) returns() +func (_DisputeGame *DisputeGameTransactorSession) ResolveClaim(_claimIndex *big.Int, _numToResolve *big.Int) (*types.Transaction, error) { + return _DisputeGame.Contract.ResolveClaim(&_DisputeGame.TransactOpts, _claimIndex, _numToResolve) +} + +// Step is a paid mutator transaction binding the contract method 0xd8cc1a3c. +// +// Solidity: function step(uint256 _claimIndex, bool _isAttack, bytes _stateData, bytes _proof) returns() +func (_DisputeGame *DisputeGameTransactor) Step(opts *bind.TransactOpts, _claimIndex *big.Int, _isAttack bool, _stateData []byte, _proof []byte) (*types.Transaction, error) { + return _DisputeGame.contract.Transact(opts, "step", _claimIndex, _isAttack, _stateData, _proof) +} + +// Step is a paid mutator transaction binding the contract method 0xd8cc1a3c. +// +// Solidity: function step(uint256 _claimIndex, bool _isAttack, bytes _stateData, bytes _proof) returns() +func (_DisputeGame *DisputeGameSession) Step(_claimIndex *big.Int, _isAttack bool, _stateData []byte, _proof []byte) (*types.Transaction, error) { + return _DisputeGame.Contract.Step(&_DisputeGame.TransactOpts, _claimIndex, _isAttack, _stateData, _proof) +} + +// Step is a paid mutator transaction binding the contract method 0xd8cc1a3c. +// +// Solidity: function step(uint256 _claimIndex, bool _isAttack, bytes _stateData, bytes _proof) returns() +func (_DisputeGame *DisputeGameTransactorSession) Step(_claimIndex *big.Int, _isAttack bool, _stateData []byte, _proof []byte) (*types.Transaction, error) { + return _DisputeGame.Contract.Step(&_DisputeGame.TransactOpts, _claimIndex, _isAttack, _stateData, _proof) +} + +// DisputeGameMoveIterator is returned from FilterMove and is used to iterate over the raw logs and unpacked data for Move events raised by the DisputeGame contract. +type DisputeGameMoveIterator struct { + Event *DisputeGameMove // 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 *DisputeGameMoveIterator) 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(DisputeGameMove) + 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(DisputeGameMove) + 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 *DisputeGameMoveIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DisputeGameMoveIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DisputeGameMove represents a Move event raised by the DisputeGame contract. +type DisputeGameMove struct { + ParentIndex *big.Int + Claim [32]byte + Claimant common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMove is a free log retrieval operation binding the contract event 0x9b3245740ec3b155098a55be84957a4da13eaf7f14a8bc6f53126c0b9350f2be. +// +// Solidity: event Move(uint256 indexed parentIndex, bytes32 indexed claim, address indexed claimant) +func (_DisputeGame *DisputeGameFilterer) FilterMove(opts *bind.FilterOpts, parentIndex []*big.Int, claim [][32]byte, claimant []common.Address) (*DisputeGameMoveIterator, error) { + + var parentIndexRule []interface{} + for _, parentIndexItem := range parentIndex { + parentIndexRule = append(parentIndexRule, parentIndexItem) + } + var claimRule []interface{} + for _, claimItem := range claim { + claimRule = append(claimRule, claimItem) + } + var claimantRule []interface{} + for _, claimantItem := range claimant { + claimantRule = append(claimantRule, claimantItem) + } + + logs, sub, err := _DisputeGame.contract.FilterLogs(opts, "Move", parentIndexRule, claimRule, claimantRule) + if err != nil { + return nil, err + } + return &DisputeGameMoveIterator{contract: _DisputeGame.contract, event: "Move", logs: logs, sub: sub}, nil +} + +// WatchMove is a free log subscription operation binding the contract event 0x9b3245740ec3b155098a55be84957a4da13eaf7f14a8bc6f53126c0b9350f2be. +// +// Solidity: event Move(uint256 indexed parentIndex, bytes32 indexed claim, address indexed claimant) +func (_DisputeGame *DisputeGameFilterer) WatchMove(opts *bind.WatchOpts, sink chan<- *DisputeGameMove, parentIndex []*big.Int, claim [][32]byte, claimant []common.Address) (event.Subscription, error) { + + var parentIndexRule []interface{} + for _, parentIndexItem := range parentIndex { + parentIndexRule = append(parentIndexRule, parentIndexItem) + } + var claimRule []interface{} + for _, claimItem := range claim { + claimRule = append(claimRule, claimItem) + } + var claimantRule []interface{} + for _, claimantItem := range claimant { + claimantRule = append(claimantRule, claimantItem) + } + + logs, sub, err := _DisputeGame.contract.WatchLogs(opts, "Move", parentIndexRule, claimRule, claimantRule) + 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(DisputeGameMove) + if err := _DisputeGame.contract.UnpackLog(event, "Move", 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 +} + +// ParseMove is a log parse operation binding the contract event 0x9b3245740ec3b155098a55be84957a4da13eaf7f14a8bc6f53126c0b9350f2be. +// +// Solidity: event Move(uint256 indexed parentIndex, bytes32 indexed claim, address indexed claimant) +func (_DisputeGame *DisputeGameFilterer) ParseMove(log types.Log) (*DisputeGameMove, error) { + event := new(DisputeGameMove) + if err := _DisputeGame.contract.UnpackLog(event, "Move", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// DisputeGameResolvedIterator is returned from FilterResolved and is used to iterate over the raw logs and unpacked data for Resolved events raised by the DisputeGame contract. +type DisputeGameResolvedIterator struct { + Event *DisputeGameResolved // 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 *DisputeGameResolvedIterator) 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(DisputeGameResolved) + 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(DisputeGameResolved) + 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 *DisputeGameResolvedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DisputeGameResolvedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DisputeGameResolved represents a Resolved event raised by the DisputeGame contract. +type DisputeGameResolved struct { + Status uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterResolved is a free log retrieval operation binding the contract event 0x5e186f09b9c93491f14e277eea7faa5de6a2d4bda75a79af7a3684fbfb42da60. +// +// Solidity: event Resolved(uint8 indexed status) +func (_DisputeGame *DisputeGameFilterer) FilterResolved(opts *bind.FilterOpts, status []uint8) (*DisputeGameResolvedIterator, error) { + + var statusRule []interface{} + for _, statusItem := range status { + statusRule = append(statusRule, statusItem) + } + + logs, sub, err := _DisputeGame.contract.FilterLogs(opts, "Resolved", statusRule) + if err != nil { + return nil, err + } + return &DisputeGameResolvedIterator{contract: _DisputeGame.contract, event: "Resolved", logs: logs, sub: sub}, nil +} + +// WatchResolved is a free log subscription operation binding the contract event 0x5e186f09b9c93491f14e277eea7faa5de6a2d4bda75a79af7a3684fbfb42da60. +// +// Solidity: event Resolved(uint8 indexed status) +func (_DisputeGame *DisputeGameFilterer) WatchResolved(opts *bind.WatchOpts, sink chan<- *DisputeGameResolved, status []uint8) (event.Subscription, error) { + + var statusRule []interface{} + for _, statusItem := range status { + statusRule = append(statusRule, statusItem) + } + + logs, sub, err := _DisputeGame.contract.WatchLogs(opts, "Resolved", statusRule) + 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(DisputeGameResolved) + if err := _DisputeGame.contract.UnpackLog(event, "Resolved", 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 +} + +// ParseResolved is a log parse operation binding the contract event 0x5e186f09b9c93491f14e277eea7faa5de6a2d4bda75a79af7a3684fbfb42da60. +// +// Solidity: event Resolved(uint8 indexed status) +func (_DisputeGame *DisputeGameFilterer) ParseResolved(log types.Log) (*DisputeGameResolved, error) { + event := new(DisputeGameResolved) + if err := _DisputeGame.contract.UnpackLog(event, "Resolved", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/contract/disputeGameProxy.go b/pkg/contract/disputeGameProxy.go new file mode 100644 index 0000000..f61692c --- /dev/null +++ b/pkg/contract/disputeGameProxy.go @@ -0,0 +1,1383 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract + +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 +) + +// IDisputeGameFactoryGameSearchResult is an auto generated low-level Go binding around an user-defined struct. +type IDisputeGameFactoryGameSearchResult struct { + Index *big.Int + Metadata [32]byte + Timestamp uint64 + RootClaim [32]byte + ExtraData []byte +} + +// DisputeGameProxyMetaData contains all meta data concerning the DisputeGameProxy contract. +var DisputeGameProxyMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"Hash\",\"name\":\"uuid\",\"type\":\"bytes32\"}],\"name\":\"GameAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectBondAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"gameType\",\"type\":\"uint32\"}],\"name\":\"NoImplementation\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"disputeProxy\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"GameType\",\"name\":\"gameType\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"Claim\",\"name\":\"rootClaim\",\"type\":\"bytes32\"}],\"name\":\"DisputeGameCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"impl\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"GameType\",\"name\":\"gameType\",\"type\":\"uint32\"}],\"name\":\"ImplementationSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"GameType\",\"name\":\"gameType\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newBond\",\"type\":\"uint256\"}],\"name\":\"InitBondUpdated\",\"type\":\"event\"},{\"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\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"_gameType\",\"type\":\"uint32\"},{\"internalType\":\"Claim\",\"name\":\"_rootClaim\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"create\",\"outputs\":[{\"internalType\":\"contractIDisputeGame\",\"name\":\"proxy_\",\"type\":\"address\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"_gameType\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"_start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_n\",\"type\":\"uint256\"}],\"name\":\"findLatestGames\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"GameId\",\"name\":\"metadata\",\"type\":\"bytes32\"},{\"internalType\":\"Timestamp\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"Claim\",\"name\":\"rootClaim\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"structIDisputeGameFactory.GameSearchResult[]\",\"name\":\"games_\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"gameAtIndex\",\"outputs\":[{\"internalType\":\"GameType\",\"name\":\"gameType_\",\"type\":\"uint32\"},{\"internalType\":\"Timestamp\",\"name\":\"timestamp_\",\"type\":\"uint64\"},{\"internalType\":\"contractIDisputeGame\",\"name\":\"proxy_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gameCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gameCount_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"gameImpls\",\"outputs\":[{\"internalType\":\"contractIDisputeGame\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"_gameType\",\"type\":\"uint32\"},{\"internalType\":\"Claim\",\"name\":\"_rootClaim\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"games\",\"outputs\":[{\"internalType\":\"contractIDisputeGame\",\"name\":\"proxy_\",\"type\":\"address\"},{\"internalType\":\"Timestamp\",\"name\":\"timestamp_\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"_gameType\",\"type\":\"uint32\"},{\"internalType\":\"Claim\",\"name\":\"_rootClaim\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"getGameUUID\",\"outputs\":[{\"internalType\":\"Hash\",\"name\":\"uuid_\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"initBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"_gameType\",\"type\":\"uint32\"},{\"internalType\":\"contractIDisputeGame\",\"name\":\"_impl\",\"type\":\"address\"}],\"name\":\"setImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"GameType\",\"name\":\"_gameType\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"_initBond\",\"type\":\"uint256\"}],\"name\":\"setInitBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// DisputeGameProxyABI is the input ABI used to generate the binding from. +// Deprecated: Use DisputeGameProxyMetaData.ABI instead. +var DisputeGameProxyABI = DisputeGameProxyMetaData.ABI + +// DisputeGameProxy is an auto generated Go binding around an Ethereum contract. +type DisputeGameProxy struct { + DisputeGameProxyCaller // Read-only binding to the contract + DisputeGameProxyTransactor // Write-only binding to the contract + DisputeGameProxyFilterer // Log filterer for contract events +} + +// DisputeGameProxyCaller is an auto generated read-only Go binding around an Ethereum contract. +type DisputeGameProxyCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DisputeGameProxyTransactor is an auto generated write-only Go binding around an Ethereum contract. +type DisputeGameProxyTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DisputeGameProxyFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type DisputeGameProxyFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// DisputeGameProxySession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type DisputeGameProxySession struct { + Contract *DisputeGameProxy // 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 +} + +// DisputeGameProxyCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type DisputeGameProxyCallerSession struct { + Contract *DisputeGameProxyCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// DisputeGameProxyTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type DisputeGameProxyTransactorSession struct { + Contract *DisputeGameProxyTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// DisputeGameProxyRaw is an auto generated low-level Go binding around an Ethereum contract. +type DisputeGameProxyRaw struct { + Contract *DisputeGameProxy // Generic contract binding to access the raw methods on +} + +// DisputeGameProxyCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type DisputeGameProxyCallerRaw struct { + Contract *DisputeGameProxyCaller // Generic read-only contract binding to access the raw methods on +} + +// DisputeGameProxyTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type DisputeGameProxyTransactorRaw struct { + Contract *DisputeGameProxyTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewDisputeGameProxy creates a new instance of DisputeGameProxy, bound to a specific deployed contract. +func NewDisputeGameProxy(address common.Address, backend bind.ContractBackend) (*DisputeGameProxy, error) { + contract, err := bindDisputeGameProxy(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &DisputeGameProxy{DisputeGameProxyCaller: DisputeGameProxyCaller{contract: contract}, DisputeGameProxyTransactor: DisputeGameProxyTransactor{contract: contract}, DisputeGameProxyFilterer: DisputeGameProxyFilterer{contract: contract}}, nil +} + +// NewDisputeGameProxyCaller creates a new read-only instance of DisputeGameProxy, bound to a specific deployed contract. +func NewDisputeGameProxyCaller(address common.Address, caller bind.ContractCaller) (*DisputeGameProxyCaller, error) { + contract, err := bindDisputeGameProxy(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &DisputeGameProxyCaller{contract: contract}, nil +} + +// NewDisputeGameProxyTransactor creates a new write-only instance of DisputeGameProxy, bound to a specific deployed contract. +func NewDisputeGameProxyTransactor(address common.Address, transactor bind.ContractTransactor) (*DisputeGameProxyTransactor, error) { + contract, err := bindDisputeGameProxy(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &DisputeGameProxyTransactor{contract: contract}, nil +} + +// NewDisputeGameProxyFilterer creates a new log filterer instance of DisputeGameProxy, bound to a specific deployed contract. +func NewDisputeGameProxyFilterer(address common.Address, filterer bind.ContractFilterer) (*DisputeGameProxyFilterer, error) { + contract, err := bindDisputeGameProxy(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &DisputeGameProxyFilterer{contract: contract}, nil +} + +// bindDisputeGameProxy binds a generic wrapper to an already deployed contract. +func bindDisputeGameProxy(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := DisputeGameProxyMetaData.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 (_DisputeGameProxy *DisputeGameProxyRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _DisputeGameProxy.Contract.DisputeGameProxyCaller.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 (_DisputeGameProxy *DisputeGameProxyRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.DisputeGameProxyTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_DisputeGameProxy *DisputeGameProxyRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.DisputeGameProxyTransactor.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 (_DisputeGameProxy *DisputeGameProxyCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _DisputeGameProxy.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 (_DisputeGameProxy *DisputeGameProxyTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_DisputeGameProxy *DisputeGameProxyTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.contract.Transact(opts, method, params...) +} + +// FindLatestGames is a free data retrieval call binding the contract method 0x254bd683. +// +// Solidity: function findLatestGames(uint32 _gameType, uint256 _start, uint256 _n) view returns((uint256,bytes32,uint64,bytes32,bytes)[] games_) +func (_DisputeGameProxy *DisputeGameProxyCaller) FindLatestGames(opts *bind.CallOpts, _gameType uint32, _start *big.Int, _n *big.Int) ([]IDisputeGameFactoryGameSearchResult, error) { + var out []interface{} + err := _DisputeGameProxy.contract.Call(opts, &out, "findLatestGames", _gameType, _start, _n) + + if err != nil { + return *new([]IDisputeGameFactoryGameSearchResult), err + } + + out0 := *abi.ConvertType(out[0], new([]IDisputeGameFactoryGameSearchResult)).(*[]IDisputeGameFactoryGameSearchResult) + + return out0, err + +} + +// FindLatestGames is a free data retrieval call binding the contract method 0x254bd683. +// +// Solidity: function findLatestGames(uint32 _gameType, uint256 _start, uint256 _n) view returns((uint256,bytes32,uint64,bytes32,bytes)[] games_) +func (_DisputeGameProxy *DisputeGameProxySession) FindLatestGames(_gameType uint32, _start *big.Int, _n *big.Int) ([]IDisputeGameFactoryGameSearchResult, error) { + return _DisputeGameProxy.Contract.FindLatestGames(&_DisputeGameProxy.CallOpts, _gameType, _start, _n) +} + +// FindLatestGames is a free data retrieval call binding the contract method 0x254bd683. +// +// Solidity: function findLatestGames(uint32 _gameType, uint256 _start, uint256 _n) view returns((uint256,bytes32,uint64,bytes32,bytes)[] games_) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) FindLatestGames(_gameType uint32, _start *big.Int, _n *big.Int) ([]IDisputeGameFactoryGameSearchResult, error) { + return _DisputeGameProxy.Contract.FindLatestGames(&_DisputeGameProxy.CallOpts, _gameType, _start, _n) +} + +// GameAtIndex is a free data retrieval call binding the contract method 0xbb8aa1fc. +// +// Solidity: function gameAtIndex(uint256 _index) view returns(uint32 gameType_, uint64 timestamp_, address proxy_) +func (_DisputeGameProxy *DisputeGameProxyCaller) GameAtIndex(opts *bind.CallOpts, _index *big.Int) (struct { + GameType uint32 + Timestamp uint64 + Proxy common.Address +}, error) { + var out []interface{} + err := _DisputeGameProxy.contract.Call(opts, &out, "gameAtIndex", _index) + + outstruct := new(struct { + GameType uint32 + Timestamp uint64 + Proxy common.Address + }) + if err != nil { + return *outstruct, err + } + + outstruct.GameType = *abi.ConvertType(out[0], new(uint32)).(*uint32) + outstruct.Timestamp = *abi.ConvertType(out[1], new(uint64)).(*uint64) + outstruct.Proxy = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) + + return *outstruct, err + +} + +// GameAtIndex is a free data retrieval call binding the contract method 0xbb8aa1fc. +// +// Solidity: function gameAtIndex(uint256 _index) view returns(uint32 gameType_, uint64 timestamp_, address proxy_) +func (_DisputeGameProxy *DisputeGameProxySession) GameAtIndex(_index *big.Int) (struct { + GameType uint32 + Timestamp uint64 + Proxy common.Address +}, error) { + return _DisputeGameProxy.Contract.GameAtIndex(&_DisputeGameProxy.CallOpts, _index) +} + +// GameAtIndex is a free data retrieval call binding the contract method 0xbb8aa1fc. +// +// Solidity: function gameAtIndex(uint256 _index) view returns(uint32 gameType_, uint64 timestamp_, address proxy_) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) GameAtIndex(_index *big.Int) (struct { + GameType uint32 + Timestamp uint64 + Proxy common.Address +}, error) { + return _DisputeGameProxy.Contract.GameAtIndex(&_DisputeGameProxy.CallOpts, _index) +} + +// GameCount is a free data retrieval call binding the contract method 0x4d1975b4. +// +// Solidity: function gameCount() view returns(uint256 gameCount_) +func (_DisputeGameProxy *DisputeGameProxyCaller) GameCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _DisputeGameProxy.contract.Call(opts, &out, "gameCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GameCount is a free data retrieval call binding the contract method 0x4d1975b4. +// +// Solidity: function gameCount() view returns(uint256 gameCount_) +func (_DisputeGameProxy *DisputeGameProxySession) GameCount() (*big.Int, error) { + return _DisputeGameProxy.Contract.GameCount(&_DisputeGameProxy.CallOpts) +} + +// GameCount is a free data retrieval call binding the contract method 0x4d1975b4. +// +// Solidity: function gameCount() view returns(uint256 gameCount_) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) GameCount() (*big.Int, error) { + return _DisputeGameProxy.Contract.GameCount(&_DisputeGameProxy.CallOpts) +} + +// GameImpls is a free data retrieval call binding the contract method 0x1b685b9e. +// +// Solidity: function gameImpls(uint32 ) view returns(address) +func (_DisputeGameProxy *DisputeGameProxyCaller) GameImpls(opts *bind.CallOpts, arg0 uint32) (common.Address, error) { + var out []interface{} + err := _DisputeGameProxy.contract.Call(opts, &out, "gameImpls", arg0) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GameImpls is a free data retrieval call binding the contract method 0x1b685b9e. +// +// Solidity: function gameImpls(uint32 ) view returns(address) +func (_DisputeGameProxy *DisputeGameProxySession) GameImpls(arg0 uint32) (common.Address, error) { + return _DisputeGameProxy.Contract.GameImpls(&_DisputeGameProxy.CallOpts, arg0) +} + +// GameImpls is a free data retrieval call binding the contract method 0x1b685b9e. +// +// Solidity: function gameImpls(uint32 ) view returns(address) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) GameImpls(arg0 uint32) (common.Address, error) { + return _DisputeGameProxy.Contract.GameImpls(&_DisputeGameProxy.CallOpts, arg0) +} + +// Games is a free data retrieval call binding the contract method 0x5f0150cb. +// +// Solidity: function games(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) view returns(address proxy_, uint64 timestamp_) +func (_DisputeGameProxy *DisputeGameProxyCaller) Games(opts *bind.CallOpts, _gameType uint32, _rootClaim [32]byte, _extraData []byte) (struct { + Proxy common.Address + Timestamp uint64 +}, error) { + var out []interface{} + err := _DisputeGameProxy.contract.Call(opts, &out, "games", _gameType, _rootClaim, _extraData) + + outstruct := new(struct { + Proxy common.Address + Timestamp uint64 + }) + if err != nil { + return *outstruct, err + } + + outstruct.Proxy = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.Timestamp = *abi.ConvertType(out[1], new(uint64)).(*uint64) + + return *outstruct, err + +} + +// Games is a free data retrieval call binding the contract method 0x5f0150cb. +// +// Solidity: function games(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) view returns(address proxy_, uint64 timestamp_) +func (_DisputeGameProxy *DisputeGameProxySession) Games(_gameType uint32, _rootClaim [32]byte, _extraData []byte) (struct { + Proxy common.Address + Timestamp uint64 +}, error) { + return _DisputeGameProxy.Contract.Games(&_DisputeGameProxy.CallOpts, _gameType, _rootClaim, _extraData) +} + +// Games is a free data retrieval call binding the contract method 0x5f0150cb. +// +// Solidity: function games(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) view returns(address proxy_, uint64 timestamp_) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) Games(_gameType uint32, _rootClaim [32]byte, _extraData []byte) (struct { + Proxy common.Address + Timestamp uint64 +}, error) { + return _DisputeGameProxy.Contract.Games(&_DisputeGameProxy.CallOpts, _gameType, _rootClaim, _extraData) +} + +// GetGameUUID is a free data retrieval call binding the contract method 0x96cd9720. +// +// Solidity: function getGameUUID(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) pure returns(bytes32 uuid_) +func (_DisputeGameProxy *DisputeGameProxyCaller) GetGameUUID(opts *bind.CallOpts, _gameType uint32, _rootClaim [32]byte, _extraData []byte) ([32]byte, error) { + var out []interface{} + err := _DisputeGameProxy.contract.Call(opts, &out, "getGameUUID", _gameType, _rootClaim, _extraData) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetGameUUID is a free data retrieval call binding the contract method 0x96cd9720. +// +// Solidity: function getGameUUID(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) pure returns(bytes32 uuid_) +func (_DisputeGameProxy *DisputeGameProxySession) GetGameUUID(_gameType uint32, _rootClaim [32]byte, _extraData []byte) ([32]byte, error) { + return _DisputeGameProxy.Contract.GetGameUUID(&_DisputeGameProxy.CallOpts, _gameType, _rootClaim, _extraData) +} + +// GetGameUUID is a free data retrieval call binding the contract method 0x96cd9720. +// +// Solidity: function getGameUUID(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) pure returns(bytes32 uuid_) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) GetGameUUID(_gameType uint32, _rootClaim [32]byte, _extraData []byte) ([32]byte, error) { + return _DisputeGameProxy.Contract.GetGameUUID(&_DisputeGameProxy.CallOpts, _gameType, _rootClaim, _extraData) +} + +// InitBonds is a free data retrieval call binding the contract method 0x6593dc6e. +// +// Solidity: function initBonds(uint32 ) view returns(uint256) +func (_DisputeGameProxy *DisputeGameProxyCaller) InitBonds(opts *bind.CallOpts, arg0 uint32) (*big.Int, error) { + var out []interface{} + err := _DisputeGameProxy.contract.Call(opts, &out, "initBonds", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// InitBonds is a free data retrieval call binding the contract method 0x6593dc6e. +// +// Solidity: function initBonds(uint32 ) view returns(uint256) +func (_DisputeGameProxy *DisputeGameProxySession) InitBonds(arg0 uint32) (*big.Int, error) { + return _DisputeGameProxy.Contract.InitBonds(&_DisputeGameProxy.CallOpts, arg0) +} + +// InitBonds is a free data retrieval call binding the contract method 0x6593dc6e. +// +// Solidity: function initBonds(uint32 ) view returns(uint256) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) InitBonds(arg0 uint32) (*big.Int, error) { + return _DisputeGameProxy.Contract.InitBonds(&_DisputeGameProxy.CallOpts, arg0) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_DisputeGameProxy *DisputeGameProxyCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _DisputeGameProxy.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 (_DisputeGameProxy *DisputeGameProxySession) Owner() (common.Address, error) { + return _DisputeGameProxy.Contract.Owner(&_DisputeGameProxy.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) Owner() (common.Address, error) { + return _DisputeGameProxy.Contract.Owner(&_DisputeGameProxy.CallOpts) +} + +// Version is a free data retrieval call binding the contract method 0x54fd4d50. +// +// Solidity: function version() view returns(string) +func (_DisputeGameProxy *DisputeGameProxyCaller) Version(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _DisputeGameProxy.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 0x54fd4d50. +// +// Solidity: function version() view returns(string) +func (_DisputeGameProxy *DisputeGameProxySession) Version() (string, error) { + return _DisputeGameProxy.Contract.Version(&_DisputeGameProxy.CallOpts) +} + +// Version is a free data retrieval call binding the contract method 0x54fd4d50. +// +// Solidity: function version() view returns(string) +func (_DisputeGameProxy *DisputeGameProxyCallerSession) Version() (string, error) { + return _DisputeGameProxy.Contract.Version(&_DisputeGameProxy.CallOpts) +} + +// Create is a paid mutator transaction binding the contract method 0x82ecf2f6. +// +// Solidity: function create(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) payable returns(address proxy_) +func (_DisputeGameProxy *DisputeGameProxyTransactor) Create(opts *bind.TransactOpts, _gameType uint32, _rootClaim [32]byte, _extraData []byte) (*types.Transaction, error) { + return _DisputeGameProxy.contract.Transact(opts, "create", _gameType, _rootClaim, _extraData) +} + +// Create is a paid mutator transaction binding the contract method 0x82ecf2f6. +// +// Solidity: function create(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) payable returns(address proxy_) +func (_DisputeGameProxy *DisputeGameProxySession) Create(_gameType uint32, _rootClaim [32]byte, _extraData []byte) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.Create(&_DisputeGameProxy.TransactOpts, _gameType, _rootClaim, _extraData) +} + +// Create is a paid mutator transaction binding the contract method 0x82ecf2f6. +// +// Solidity: function create(uint32 _gameType, bytes32 _rootClaim, bytes _extraData) payable returns(address proxy_) +func (_DisputeGameProxy *DisputeGameProxyTransactorSession) Create(_gameType uint32, _rootClaim [32]byte, _extraData []byte) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.Create(&_DisputeGameProxy.TransactOpts, _gameType, _rootClaim, _extraData) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _owner) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactor) Initialize(opts *bind.TransactOpts, _owner common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.contract.Transact(opts, "initialize", _owner) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _owner) returns() +func (_DisputeGameProxy *DisputeGameProxySession) Initialize(_owner common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.Initialize(&_DisputeGameProxy.TransactOpts, _owner) +} + +// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8. +// +// Solidity: function initialize(address _owner) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactorSession) Initialize(_owner common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.Initialize(&_DisputeGameProxy.TransactOpts, _owner) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_DisputeGameProxy *DisputeGameProxyTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _DisputeGameProxy.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_DisputeGameProxy *DisputeGameProxySession) RenounceOwnership() (*types.Transaction, error) { + return _DisputeGameProxy.Contract.RenounceOwnership(&_DisputeGameProxy.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_DisputeGameProxy *DisputeGameProxyTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _DisputeGameProxy.Contract.RenounceOwnership(&_DisputeGameProxy.TransactOpts) +} + +// SetImplementation is a paid mutator transaction binding the contract method 0x14f6b1a3. +// +// Solidity: function setImplementation(uint32 _gameType, address _impl) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactor) SetImplementation(opts *bind.TransactOpts, _gameType uint32, _impl common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.contract.Transact(opts, "setImplementation", _gameType, _impl) +} + +// SetImplementation is a paid mutator transaction binding the contract method 0x14f6b1a3. +// +// Solidity: function setImplementation(uint32 _gameType, address _impl) returns() +func (_DisputeGameProxy *DisputeGameProxySession) SetImplementation(_gameType uint32, _impl common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.SetImplementation(&_DisputeGameProxy.TransactOpts, _gameType, _impl) +} + +// SetImplementation is a paid mutator transaction binding the contract method 0x14f6b1a3. +// +// Solidity: function setImplementation(uint32 _gameType, address _impl) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactorSession) SetImplementation(_gameType uint32, _impl common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.SetImplementation(&_DisputeGameProxy.TransactOpts, _gameType, _impl) +} + +// SetInitBond is a paid mutator transaction binding the contract method 0x1e334240. +// +// Solidity: function setInitBond(uint32 _gameType, uint256 _initBond) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactor) SetInitBond(opts *bind.TransactOpts, _gameType uint32, _initBond *big.Int) (*types.Transaction, error) { + return _DisputeGameProxy.contract.Transact(opts, "setInitBond", _gameType, _initBond) +} + +// SetInitBond is a paid mutator transaction binding the contract method 0x1e334240. +// +// Solidity: function setInitBond(uint32 _gameType, uint256 _initBond) returns() +func (_DisputeGameProxy *DisputeGameProxySession) SetInitBond(_gameType uint32, _initBond *big.Int) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.SetInitBond(&_DisputeGameProxy.TransactOpts, _gameType, _initBond) +} + +// SetInitBond is a paid mutator transaction binding the contract method 0x1e334240. +// +// Solidity: function setInitBond(uint32 _gameType, uint256 _initBond) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactorSession) SetInitBond(_gameType uint32, _initBond *big.Int) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.SetInitBond(&_DisputeGameProxy.TransactOpts, _gameType, _initBond) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_DisputeGameProxy *DisputeGameProxySession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.TransferOwnership(&_DisputeGameProxy.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_DisputeGameProxy *DisputeGameProxyTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _DisputeGameProxy.Contract.TransferOwnership(&_DisputeGameProxy.TransactOpts, newOwner) +} + +// DisputeGameProxyDisputeGameCreatedIterator is returned from FilterDisputeGameCreated and is used to iterate over the raw logs and unpacked data for DisputeGameCreated events raised by the DisputeGameProxy contract. +type DisputeGameProxyDisputeGameCreatedIterator struct { + Event *DisputeGameProxyDisputeGameCreated // 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 *DisputeGameProxyDisputeGameCreatedIterator) 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(DisputeGameProxyDisputeGameCreated) + 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(DisputeGameProxyDisputeGameCreated) + 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 *DisputeGameProxyDisputeGameCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DisputeGameProxyDisputeGameCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DisputeGameProxyDisputeGameCreated represents a DisputeGameCreated event raised by the DisputeGameProxy contract. +type DisputeGameProxyDisputeGameCreated struct { + DisputeProxy common.Address + GameType uint32 + RootClaim [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDisputeGameCreated is a free log retrieval operation binding the contract event 0x5b565efe82411da98814f356d0e7bcb8f0219b8d970307c5afb4a6903a8b2e35. +// +// Solidity: event DisputeGameCreated(address indexed disputeProxy, uint32 indexed gameType, bytes32 indexed rootClaim) +func (_DisputeGameProxy *DisputeGameProxyFilterer) FilterDisputeGameCreated(opts *bind.FilterOpts, disputeProxy []common.Address, gameType []uint32, rootClaim [][32]byte) (*DisputeGameProxyDisputeGameCreatedIterator, error) { + + var disputeProxyRule []interface{} + for _, disputeProxyItem := range disputeProxy { + disputeProxyRule = append(disputeProxyRule, disputeProxyItem) + } + var gameTypeRule []interface{} + for _, gameTypeItem := range gameType { + gameTypeRule = append(gameTypeRule, gameTypeItem) + } + var rootClaimRule []interface{} + for _, rootClaimItem := range rootClaim { + rootClaimRule = append(rootClaimRule, rootClaimItem) + } + + logs, sub, err := _DisputeGameProxy.contract.FilterLogs(opts, "DisputeGameCreated", disputeProxyRule, gameTypeRule, rootClaimRule) + if err != nil { + return nil, err + } + return &DisputeGameProxyDisputeGameCreatedIterator{contract: _DisputeGameProxy.contract, event: "DisputeGameCreated", logs: logs, sub: sub}, nil +} + +// WatchDisputeGameCreated is a free log subscription operation binding the contract event 0x5b565efe82411da98814f356d0e7bcb8f0219b8d970307c5afb4a6903a8b2e35. +// +// Solidity: event DisputeGameCreated(address indexed disputeProxy, uint32 indexed gameType, bytes32 indexed rootClaim) +func (_DisputeGameProxy *DisputeGameProxyFilterer) WatchDisputeGameCreated(opts *bind.WatchOpts, sink chan<- *DisputeGameProxyDisputeGameCreated, disputeProxy []common.Address, gameType []uint32, rootClaim [][32]byte) (event.Subscription, error) { + + var disputeProxyRule []interface{} + for _, disputeProxyItem := range disputeProxy { + disputeProxyRule = append(disputeProxyRule, disputeProxyItem) + } + var gameTypeRule []interface{} + for _, gameTypeItem := range gameType { + gameTypeRule = append(gameTypeRule, gameTypeItem) + } + var rootClaimRule []interface{} + for _, rootClaimItem := range rootClaim { + rootClaimRule = append(rootClaimRule, rootClaimItem) + } + + logs, sub, err := _DisputeGameProxy.contract.WatchLogs(opts, "DisputeGameCreated", disputeProxyRule, gameTypeRule, rootClaimRule) + 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(DisputeGameProxyDisputeGameCreated) + if err := _DisputeGameProxy.contract.UnpackLog(event, "DisputeGameCreated", 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 +} + +// ParseDisputeGameCreated is a log parse operation binding the contract event 0x5b565efe82411da98814f356d0e7bcb8f0219b8d970307c5afb4a6903a8b2e35. +// +// Solidity: event DisputeGameCreated(address indexed disputeProxy, uint32 indexed gameType, bytes32 indexed rootClaim) +func (_DisputeGameProxy *DisputeGameProxyFilterer) ParseDisputeGameCreated(log types.Log) (*DisputeGameProxyDisputeGameCreated, error) { + event := new(DisputeGameProxyDisputeGameCreated) + if err := _DisputeGameProxy.contract.UnpackLog(event, "DisputeGameCreated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// DisputeGameProxyImplementationSetIterator is returned from FilterImplementationSet and is used to iterate over the raw logs and unpacked data for ImplementationSet events raised by the DisputeGameProxy contract. +type DisputeGameProxyImplementationSetIterator struct { + Event *DisputeGameProxyImplementationSet // 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 *DisputeGameProxyImplementationSetIterator) 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(DisputeGameProxyImplementationSet) + 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(DisputeGameProxyImplementationSet) + 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 *DisputeGameProxyImplementationSetIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DisputeGameProxyImplementationSetIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DisputeGameProxyImplementationSet represents a ImplementationSet event raised by the DisputeGameProxy contract. +type DisputeGameProxyImplementationSet struct { + Impl common.Address + GameType uint32 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterImplementationSet is a free log retrieval operation binding the contract event 0xff513d80e2c7fa487608f70a618dfbc0cf415699dc69588c747e8c71566c88de. +// +// Solidity: event ImplementationSet(address indexed impl, uint32 indexed gameType) +func (_DisputeGameProxy *DisputeGameProxyFilterer) FilterImplementationSet(opts *bind.FilterOpts, impl []common.Address, gameType []uint32) (*DisputeGameProxyImplementationSetIterator, error) { + + var implRule []interface{} + for _, implItem := range impl { + implRule = append(implRule, implItem) + } + var gameTypeRule []interface{} + for _, gameTypeItem := range gameType { + gameTypeRule = append(gameTypeRule, gameTypeItem) + } + + logs, sub, err := _DisputeGameProxy.contract.FilterLogs(opts, "ImplementationSet", implRule, gameTypeRule) + if err != nil { + return nil, err + } + return &DisputeGameProxyImplementationSetIterator{contract: _DisputeGameProxy.contract, event: "ImplementationSet", logs: logs, sub: sub}, nil +} + +// WatchImplementationSet is a free log subscription operation binding the contract event 0xff513d80e2c7fa487608f70a618dfbc0cf415699dc69588c747e8c71566c88de. +// +// Solidity: event ImplementationSet(address indexed impl, uint32 indexed gameType) +func (_DisputeGameProxy *DisputeGameProxyFilterer) WatchImplementationSet(opts *bind.WatchOpts, sink chan<- *DisputeGameProxyImplementationSet, impl []common.Address, gameType []uint32) (event.Subscription, error) { + + var implRule []interface{} + for _, implItem := range impl { + implRule = append(implRule, implItem) + } + var gameTypeRule []interface{} + for _, gameTypeItem := range gameType { + gameTypeRule = append(gameTypeRule, gameTypeItem) + } + + logs, sub, err := _DisputeGameProxy.contract.WatchLogs(opts, "ImplementationSet", implRule, gameTypeRule) + 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(DisputeGameProxyImplementationSet) + if err := _DisputeGameProxy.contract.UnpackLog(event, "ImplementationSet", 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 +} + +// ParseImplementationSet is a log parse operation binding the contract event 0xff513d80e2c7fa487608f70a618dfbc0cf415699dc69588c747e8c71566c88de. +// +// Solidity: event ImplementationSet(address indexed impl, uint32 indexed gameType) +func (_DisputeGameProxy *DisputeGameProxyFilterer) ParseImplementationSet(log types.Log) (*DisputeGameProxyImplementationSet, error) { + event := new(DisputeGameProxyImplementationSet) + if err := _DisputeGameProxy.contract.UnpackLog(event, "ImplementationSet", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// DisputeGameProxyInitBondUpdatedIterator is returned from FilterInitBondUpdated and is used to iterate over the raw logs and unpacked data for InitBondUpdated events raised by the DisputeGameProxy contract. +type DisputeGameProxyInitBondUpdatedIterator struct { + Event *DisputeGameProxyInitBondUpdated // 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 *DisputeGameProxyInitBondUpdatedIterator) 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(DisputeGameProxyInitBondUpdated) + 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(DisputeGameProxyInitBondUpdated) + 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 *DisputeGameProxyInitBondUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DisputeGameProxyInitBondUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DisputeGameProxyInitBondUpdated represents a InitBondUpdated event raised by the DisputeGameProxy contract. +type DisputeGameProxyInitBondUpdated struct { + GameType uint32 + NewBond *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitBondUpdated is a free log retrieval operation binding the contract event 0x74d6665c4b26d5596a5aa13d3014e0c06af4d322075a797f87b03cd4c5bc91ca. +// +// Solidity: event InitBondUpdated(uint32 indexed gameType, uint256 indexed newBond) +func (_DisputeGameProxy *DisputeGameProxyFilterer) FilterInitBondUpdated(opts *bind.FilterOpts, gameType []uint32, newBond []*big.Int) (*DisputeGameProxyInitBondUpdatedIterator, error) { + + var gameTypeRule []interface{} + for _, gameTypeItem := range gameType { + gameTypeRule = append(gameTypeRule, gameTypeItem) + } + var newBondRule []interface{} + for _, newBondItem := range newBond { + newBondRule = append(newBondRule, newBondItem) + } + + logs, sub, err := _DisputeGameProxy.contract.FilterLogs(opts, "InitBondUpdated", gameTypeRule, newBondRule) + if err != nil { + return nil, err + } + return &DisputeGameProxyInitBondUpdatedIterator{contract: _DisputeGameProxy.contract, event: "InitBondUpdated", logs: logs, sub: sub}, nil +} + +// WatchInitBondUpdated is a free log subscription operation binding the contract event 0x74d6665c4b26d5596a5aa13d3014e0c06af4d322075a797f87b03cd4c5bc91ca. +// +// Solidity: event InitBondUpdated(uint32 indexed gameType, uint256 indexed newBond) +func (_DisputeGameProxy *DisputeGameProxyFilterer) WatchInitBondUpdated(opts *bind.WatchOpts, sink chan<- *DisputeGameProxyInitBondUpdated, gameType []uint32, newBond []*big.Int) (event.Subscription, error) { + + var gameTypeRule []interface{} + for _, gameTypeItem := range gameType { + gameTypeRule = append(gameTypeRule, gameTypeItem) + } + var newBondRule []interface{} + for _, newBondItem := range newBond { + newBondRule = append(newBondRule, newBondItem) + } + + logs, sub, err := _DisputeGameProxy.contract.WatchLogs(opts, "InitBondUpdated", gameTypeRule, newBondRule) + 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(DisputeGameProxyInitBondUpdated) + if err := _DisputeGameProxy.contract.UnpackLog(event, "InitBondUpdated", 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 +} + +// ParseInitBondUpdated is a log parse operation binding the contract event 0x74d6665c4b26d5596a5aa13d3014e0c06af4d322075a797f87b03cd4c5bc91ca. +// +// Solidity: event InitBondUpdated(uint32 indexed gameType, uint256 indexed newBond) +func (_DisputeGameProxy *DisputeGameProxyFilterer) ParseInitBondUpdated(log types.Log) (*DisputeGameProxyInitBondUpdated, error) { + event := new(DisputeGameProxyInitBondUpdated) + if err := _DisputeGameProxy.contract.UnpackLog(event, "InitBondUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// DisputeGameProxyInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the DisputeGameProxy contract. +type DisputeGameProxyInitializedIterator struct { + Event *DisputeGameProxyInitialized // 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 *DisputeGameProxyInitializedIterator) 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(DisputeGameProxyInitialized) + 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(DisputeGameProxyInitialized) + 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 *DisputeGameProxyInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DisputeGameProxyInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DisputeGameProxyInitialized represents a Initialized event raised by the DisputeGameProxy contract. +type DisputeGameProxyInitialized 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 (_DisputeGameProxy *DisputeGameProxyFilterer) FilterInitialized(opts *bind.FilterOpts) (*DisputeGameProxyInitializedIterator, error) { + + logs, sub, err := _DisputeGameProxy.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &DisputeGameProxyInitializedIterator{contract: _DisputeGameProxy.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 (_DisputeGameProxy *DisputeGameProxyFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *DisputeGameProxyInitialized) (event.Subscription, error) { + + logs, sub, err := _DisputeGameProxy.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(DisputeGameProxyInitialized) + if err := _DisputeGameProxy.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 (_DisputeGameProxy *DisputeGameProxyFilterer) ParseInitialized(log types.Log) (*DisputeGameProxyInitialized, error) { + event := new(DisputeGameProxyInitialized) + if err := _DisputeGameProxy.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// DisputeGameProxyOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the DisputeGameProxy contract. +type DisputeGameProxyOwnershipTransferredIterator struct { + Event *DisputeGameProxyOwnershipTransferred // 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 *DisputeGameProxyOwnershipTransferredIterator) 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(DisputeGameProxyOwnershipTransferred) + 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(DisputeGameProxyOwnershipTransferred) + 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 *DisputeGameProxyOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *DisputeGameProxyOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// DisputeGameProxyOwnershipTransferred represents a OwnershipTransferred event raised by the DisputeGameProxy contract. +type DisputeGameProxyOwnershipTransferred 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 (_DisputeGameProxy *DisputeGameProxyFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*DisputeGameProxyOwnershipTransferredIterator, 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 := _DisputeGameProxy.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &DisputeGameProxyOwnershipTransferredIterator{contract: _DisputeGameProxy.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 (_DisputeGameProxy *DisputeGameProxyFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *DisputeGameProxyOwnershipTransferred, 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 := _DisputeGameProxy.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(DisputeGameProxyOwnershipTransferred) + if err := _DisputeGameProxy.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 (_DisputeGameProxy *DisputeGameProxyFilterer) ParseOwnershipTransferred(log types.Log) (*DisputeGameProxyOwnershipTransferred, error) { + event := new(DisputeGameProxyOwnershipTransferred) + if err := _DisputeGameProxy.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/contract/disputeGame_test.go b/pkg/contract/disputeGame_test.go new file mode 100644 index 0000000..931e0bb --- /dev/null +++ b/pkg/contract/disputeGame_test.go @@ -0,0 +1,21 @@ +package contract + +import ( + "fmt" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/stretchr/testify/require" + "testing" +) + +func TestContract(t *testing.T) { + l1rpc, err := ethclient.Dial("https://quaint-white-season.ethereum-sepolia.quiknode.pro/b5c30cbb548d8743f08dd175fe50e3e923259d30") + require.NoError(t, err) + disputeGame, err := NewDisputeGame(common.HexToAddress("0x8304B519e45133A11E07b356443dC39bEf881D83"), l1rpc) + require.NoError(t, err) + count, err := disputeGame.ClaimDataLen(&bind.CallOpts{}) + require.NoError(t, err) + fmt.Println(count) + +} diff --git a/pkg/event/DisputeGameMove.go b/pkg/event/DisputeGameMove.go new file mode 100644 index 0000000..15d22d2 --- /dev/null +++ b/pkg/event/DisputeGameMove.go @@ -0,0 +1,51 @@ +package event + +import ( + "encoding/json" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" +) + +var ( + DisputeGameMoveName = "Move" + + DisputeGameMovedHash = crypto.Keccak256([]byte("Move(uint256,bytes32,address)")) +) + +type DisputeGameMove struct { + ParentIndex *big.Int `json:"parentIndex"` + Claim string `json:"claim"` + Claimant string `json:"claimant"` +} + +func (*DisputeGameMove) Name() string { + return DisputeGameMoveName +} + +func (*DisputeGameMove) EventHash() common.Hash { + return common.BytesToHash(DisputeGameMovedHash) +} + +func (t *DisputeGameMove) ToObj(data string) error { + err := json.Unmarshal([]byte(data), &t) + if err != nil { + return err + } + return nil +} + +func (*DisputeGameMove) Data(log types.Log) (string, error) { + transfer := &DisputeGameMove{ + ParentIndex: big.NewInt(TopicToInt64(log, 1)), + Claim: TopicToHash(log, 2).Hex(), + Claimant: TopicToAddress(log, 3).Hex(), + } + data, err := ToJSON(transfer) + if err != nil { + return "", err + } + return data, nil +} diff --git a/pkg/event/DisputeGameProxy.go b/pkg/event/DisputeGameProxy.go new file mode 100644 index 0000000..1d3ddca --- /dev/null +++ b/pkg/event/DisputeGameProxy.go @@ -0,0 +1,50 @@ +package event + +import ( + "encoding/json" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" +) + +var ( + DisputeGameCreatedName = "DisputeGameCreated" + + DisputeGameCreatedHash = crypto.Keccak256([]byte("DisputeGameCreated(address,uint32,bytes32)")) +) + +type DisputeGameCreated struct { + DisputeProxy string `json:"disputeProxy"` + GameType uint32 `json:"gameType"` + RootClaim string `json:"rootClaim"` +} + +func (*DisputeGameCreated) Name() string { + return DisputeGameCreatedName +} + +func (*DisputeGameCreated) EventHash() common.Hash { + return common.BytesToHash(DisputeGameCreatedHash) +} + +func (t *DisputeGameCreated) ToObj(data string) error { + err := json.Unmarshal([]byte(data), &t) + if err != nil { + return err + } + return nil +} + +func (*DisputeGameCreated) Data(log types.Log) (string, error) { + transfer := &DisputeGameCreated{ + DisputeProxy: TopicToAddress(log, 1).Hex(), + GameType: uint32(TopicToInt64(log, 2)), + RootClaim: TopicToHash(log, 3).Hex(), + } + data, err := ToJSON(transfer) + if err != nil { + return "", err + } + return data, nil +} diff --git a/pkg/event/DisputeGameResolved.go b/pkg/event/DisputeGameResolved.go new file mode 100644 index 0000000..a43ffd6 --- /dev/null +++ b/pkg/event/DisputeGameResolved.go @@ -0,0 +1,46 @@ +package event + +import ( + "encoding/json" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" +) + +var ( + DisputeGameResolvedName = "Resolved" + + DisputeGameResolvedHash = crypto.Keccak256([]byte("Resolved(uint8)")) +) + +type DisputeGameResolved struct { + Status uint8 `json:"status"` +} + +func (*DisputeGameResolved) Name() string { + return DisputeGameResolvedName +} + +func (*DisputeGameResolved) EventHash() common.Hash { + return common.BytesToHash(DisputeGameResolvedHash) +} + +func (t *DisputeGameResolved) ToObj(data string) error { + err := json.Unmarshal([]byte(data), &t) + if err != nil { + return err + } + return nil +} + +func (*DisputeGameResolved) Data(log types.Log) (string, error) { + transfer := &DisputeGameResolved{ + Status: uint8(TopicToInt64(log, 1)), + } + data, err := ToJSON(transfer) + if err != nil { + return "", err + } + return data, nil +} diff --git a/pkg/event/vlog.go b/pkg/event/vlog.go new file mode 100644 index 0000000..223c481 --- /dev/null +++ b/pkg/event/vlog.go @@ -0,0 +1,167 @@ +package event + +import ( + "context" + "encoding/json" + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" +) + +func DataToAddress(vLog types.Log, index int64) common.Address { + start := 32 * index + return common.BytesToAddress(vLog.Data[start : start+32]) +} + +func DataToInt64(vLog types.Log, index int64) int64 { + start := 32 * index + return big.NewInt(0).SetBytes(vLog.Data[start : start+32]).Int64() +} + +func DataToBool(vLog types.Log, index int64) bool { + start := 32 * index + return big.NewInt(0).SetBytes(vLog.Data[start:start+32]).Int64() == 1 +} + +func DataToHash(vLog types.Log, index int64) common.Hash { + start := 32 * index + return common.BytesToHash(vLog.Data[start : start+32]) +} + +func DataToAddressArray(vLog types.Log, index int64) []string { + offset := big.NewInt(0).SetBytes(vLog.Data[32*index : 32*(index+1)]).Int64() + length := big.NewInt(0).SetBytes(vLog.Data[offset : offset+32]).Int64() + array := make([]string, 0) + var i int64 + for i = 0; i < length; i++ { + start := offset + 32*(i+1) + one := common.BytesToAddress(vLog.Data[start : start+32]) + array = append(array, one.Hex()) + } + return array +} + +func DataToHashArray(vLog types.Log, index int64) []string { + offset := big.NewInt(0).SetBytes(vLog.Data[32*index : 32*(index+1)]).Int64() + length := big.NewInt(0).SetBytes(vLog.Data[offset : offset+32]).Int64() + array := make([]string, 0) + var i int64 + for i = 0; i < length; i++ { + start := offset + 32*(i+1) + one := common.BytesToHash(vLog.Data[start : start+32]) + array = append(array, one.Hex()) + } + return array +} + +func DataToInt64Array(vLog types.Log, index int64) []int64 { + offset := big.NewInt(0).SetBytes(vLog.Data[32*index : 32*(index+1)]).Int64() + length := big.NewInt(0).SetBytes(vLog.Data[offset : offset+32]).Int64() + array := make([]int64, 0) + var i int64 + for i = 0; i < length; i++ { + start := offset + 32*(i+1) + one := big.NewInt(0).SetBytes(vLog.Data[start : start+32]).Int64() + array = append(array, one) + } + return array +} + +func TopicToAddress(vLog types.Log, index int64) common.Address { + return common.BytesToAddress(vLog.Topics[index].Bytes()) +} + +func TopicToInt64(vLog types.Log, index int64) int64 { + return big.NewInt(0).SetBytes(vLog.Topics[index].Bytes()).Int64() +} + +func TopicToBool(vLog types.Log, index int64) bool { + return big.NewInt(0).SetBytes(vLog.Topics[index].Bytes()).Int64() == 1 +} + +func DataToArrayOffsetAndLength(vLog types.Log, index int64) (int64, int64) { + offset := big.NewInt(0).SetBytes(vLog.Data[32*index : 32*(index+1)]).Int64() + length := big.NewInt(0).SetBytes(vLog.Data[offset : offset+32]).Int64() + return offset, length +} + +func TopicToHash(vLog types.Log, index int64) common.Hash { + return common.BytesToHash(vLog.Topics[index].Bytes()) +} + +func TopicToInt64Array(vLog types.Log, index int64) []int64 { + offset := big.NewInt(0).SetBytes(vLog.Topics[index].Bytes()).Int64() + length := big.NewInt(0).SetBytes(vLog.Data[offset : offset+32]).Int64() + array := make([]int64, 0) + var i int64 + for i = 0; i < length; i++ { + start := offset + 32*(i+1) + one := big.NewInt(0).SetBytes(vLog.Data[start : start+32]).Int64() + array = append(array, one) + } + return array +} + +func TopicToArrayOffsetAndLength(vLog types.Log, index int64) (int64, int64) { + offset := big.NewInt(0).SetBytes(vLog.Topics[index].Bytes()).Int64() + length := big.NewInt(0).SetBytes(vLog.Data[offset : offset+32]).Int64() + return offset, length +} + +func StartAndEndTokenIDToString(startTokenID, endTokenID int64) (string, int64) { + str := "" + var count int64 + for startTokenID <= endTokenID { + if str == "" { + str = fmt.Sprintf("%s%d", str, 0) + } else { + str = fmt.Sprintf("%s,%d", str, 0) + } + count++ + startTokenID++ + } + return str, count +} + +func TokenIDsToString(tokenIDs []int64) string { + str := "" + for _, tokenID := range tokenIDs { + if str == "" { + str = fmt.Sprintf("%s%d", str, tokenID) + } else { + str = fmt.Sprintf("%s,%d", str, tokenID) + } + } + return str +} + +func DataToString(vLog types.Log, index int64) string { + start := 32 * index + offset := big.NewInt(0).SetBytes(vLog.Data[start : start+32]).Int64() + length := big.NewInt(0).SetBytes(vLog.Data[offset : offset+32]).Int64() + return string(vLog.Data[offset+32 : offset+32+length]) +} + +func GetSender(rpc *ethclient.Client, blockHash, txHash common.Hash, txIndex uint) (*common.Address, error) { + ctx := context.Background() + tx, _, err := rpc.TransactionByHash(ctx, txHash) + if err != nil { + return nil, err + } + sender, err := rpc.TransactionSender(ctx, tx, blockHash, txIndex) + if err != nil { + return nil, err + } + return &sender, nil +} + +func ToJSON(obj interface{}) (string, error) { + jsonValue, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonValue), nil +} diff --git a/pkg/log/encoder.go b/pkg/log/encoder.go new file mode 100644 index 0000000..9c7a11d --- /dev/null +++ b/pkg/log/encoder.go @@ -0,0 +1,15 @@ +package log + +import ( + "time" + + "go.uber.org/zap/zapcore" +) + +func timeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) { + enc.AppendString(t.Format(time.RFC1123)) +} + +func milliSecondsDurationEncoder(d time.Duration, enc zapcore.PrimitiveArrayEncoder) { + enc.AppendFloat64(float64(d) / float64(time.Millisecond)) +} diff --git a/pkg/log/log.go b/pkg/log/log.go new file mode 100644 index 0000000..f617598 --- /dev/null +++ b/pkg/log/log.go @@ -0,0 +1,376 @@ +package log + +import ( + "fmt" + "sync" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// Logger represents the ability to log messages, both errcode and not. +type Logger interface { + // info level + Info(msg string, fields ...Field) + Infof(format string, v ...interface{}) + Infow(msg string, keysAndValues ...interface{}) + // debug level + Debug(msg string, fields ...Field) + Debugf(format string, v ...interface{}) + Debugw(msg string, keysAndValues ...interface{}) + // warn level + Warn(msg string, fields ...Field) + Warnf(format string, v ...interface{}) + Warnw(msg string, keysAndValues ...interface{}) + // error level + Error(msg string, fields ...Field) + Errorf(format string, v ...interface{}) + Errorw(msg string, keysAndValues ...interface{}) + ErrorR(format string, v ...interface{}) error + // panic level + Panic(msg string, fields ...Field) + Panicf(format string, v ...interface{}) + Panicw(msg string, keysAndValues ...interface{}) + // fatal level + Fatal(msg string, fields ...Field) + Fatalf(format string, v ...interface{}) + Fatalw(msg string, keysAndValues ...interface{}) + + // WithValues adds some key-value pairs of context to a logger. + WithValues(keysAndValues ...interface{}) Logger + + // WithName adds a new element to the logger's name. + // Successive calls with WithName continue to append + // suffixes to the logger's name. It's strongly recommended + // that name segments contain only letters, digits, and hyphens + // (see the package documentation for more information). + WithName(name string) Logger + + // Flush calls the underlying Core's Sync method, flushing any buffered + // log entries. Applications should take care to call Sync before exiting. + Flush() +} + +type zapLogger struct { + zapLogger *zap.Logger + level zapcore.Level +} + +// wrap interface value with zap.Any for performance +func handleFields(l *zap.Logger, args []interface{}, additional ...zap.Field) []zap.Field { + if len(args) == 0 { + return additional + } + + fields := make([]zap.Field, 0, len(args)/2+len(additional)) + for i := 0; i < len(args); { + if _, ok := args[i].(zap.Field); ok { + l.DPanic("strongly-typed Zap Field passed to log", zap.Any("zap field", args[i])) + break + } + + key, val := args[i], args[i+1] + keyStr, isString := key.(string) + if !isString { + l.DPanic( + "non-string key argument passed to logging, ignoring all later arguments", + zap.Any("invalid key", key), + ) + + break + } + fields = append(fields, zap.Any(keyStr, val)) + i += 2 + } + return append(fields, additional...) +} + +var ( + std = New(NewOptions()) + mu sync.Mutex +) + +// init logger. level should be oneof "debug", "info", "warn", "error", "panic", "fatal", format should be oneof "console","json" +func Init(level, format string) { + mu.Lock() + defer mu.Unlock() + options := NewOptions() + options.Level = level + options.Format = format + err := options.Validate() + if err != nil { + panic(err) + } + std = New(options) +} + +// New create logger by opts which can custmoized by command arguments. +// +//nolint:revive +func New(opts *Options) *zapLogger { + if opts == nil { + opts = NewOptions() + } + + var zapLevel zapcore.Level + if err := zapLevel.UnmarshalText([]byte(opts.Level)); err != nil { + zapLevel = zapcore.InfoLevel + } + encodeLevel := zapcore.CapitalLevelEncoder + // when output to local path, with color is forbidden + if opts.Format == consoleFormat && opts.EnableColor { + encodeLevel = zapcore.CapitalColorLevelEncoder + } + + encoderConfig := zapcore.EncoderConfig{ + MessageKey: "message", + LevelKey: "level", + TimeKey: "timestamp", + NameKey: "logger", + CallerKey: "caller", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: encodeLevel, + EncodeTime: timeEncoder, + EncodeDuration: milliSecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + } + + loggerConfig := &zap.Config{ + Level: zap.NewAtomicLevelAt(zapLevel), + Development: opts.Development, + DisableCaller: opts.DisableCaller, + DisableStacktrace: opts.DisableStacktrace, + Sampling: &zap.SamplingConfig{ + Initial: 100, + Thereafter: 100, + }, + Encoding: opts.Format, + EncoderConfig: encoderConfig, + OutputPaths: opts.OutputPaths, + ErrorOutputPaths: opts.ErrorOutputPaths, + } + + var err error + l, err := loggerConfig.Build(zap.AddStacktrace(zapcore.PanicLevel), zap.AddCallerSkip(1)) + if err != nil { + panic(err) + } + logger := &zapLogger{ + zapLogger: l.Named(opts.Name), + level: loggerConfig.Level.Level(), + } + + return logger +} + +// WithValues creates a child logger and adds adds Zap fields to it. +func WithValues(keysAndValues ...interface{}) Logger { return std.WithValues(keysAndValues...) } + +func (l *zapLogger) WithValues(keysAndValues ...interface{}) Logger { + newLogger := l.zapLogger.With(handleFields(l.zapLogger, keysAndValues)...) + + return &zapLogger{ + zapLogger: newLogger, + } +} + +// WithName adds a new path segment to the logger's name. Segments are joined by +// periods. By default, Loggers are unnamed. +func WithName(s string) Logger { return std.WithName(s) } + +func (l *zapLogger) WithName(name string) Logger { + newLogger := l.zapLogger.Named(name) + + return &zapLogger{ + zapLogger: newLogger, + } +} + +// Flush calls the underlying Core's Sync method, flushing any buffered +// log entries. Applications should take care to call Sync before exiting. +func Flush() { std.Flush() } + +func (l *zapLogger) Flush() { + _ = l.zapLogger.Sync() +} + +// Debug method output debug level log. +func Debug(msg string, fields ...Field) { + std.zapLogger.Debug(msg, fields...) +} + +func (l *zapLogger) Debug(msg string, fields ...Field) { + l.zapLogger.Debug(msg, fields...) +} + +// Debugf method output debug level log. +func Debugf(format string, v ...interface{}) { + std.zapLogger.Sugar().Debugf(format, v...) +} + +func (l *zapLogger) Debugf(format string, v ...interface{}) { + l.zapLogger.Sugar().Debugf(format, v...) +} + +// Debugw method output debug level log. +func Debugw(msg string, keysAndValues ...interface{}) { + std.zapLogger.Sugar().Debugw(msg, keysAndValues...) +} + +func (l *zapLogger) Debugw(msg string, keysAndValues ...interface{}) { + l.zapLogger.Sugar().Debugw(msg, keysAndValues...) +} + +// Info method output info level log. +func Info(msg string, fields ...Field) { + std.zapLogger.Info(msg, fields...) +} + +func (l *zapLogger) Info(msg string, fields ...Field) { + l.zapLogger.Info(msg, fields...) +} + +// Infof method output info level log. +func Infof(format string, v ...interface{}) { + std.zapLogger.Sugar().Infof(format, v...) +} + +func (l *zapLogger) Infof(format string, v ...interface{}) { + l.zapLogger.Sugar().Infof(format, v...) +} + +// Infow method output info level log. +func Infow(msg string, keysAndValues ...interface{}) { + std.zapLogger.Sugar().Infow(msg, keysAndValues...) +} + +func (l *zapLogger) Infow(msg string, keysAndValues ...interface{}) { + l.zapLogger.Sugar().Infow(msg, keysAndValues...) +} + +// Warn method output warning level log. +func Warn(msg string, fields ...Field) { + std.zapLogger.Warn(msg, fields...) +} + +func (l *zapLogger) Warn(msg string, fields ...Field) { + l.zapLogger.Warn(msg, fields...) +} + +// Warnf method output warning level log. +func Warnf(format string, v ...interface{}) { + std.zapLogger.Sugar().Warnf(format, v...) +} + +func (l *zapLogger) Warnf(format string, v ...interface{}) { + l.zapLogger.Sugar().Warnf(format, v...) +} + +// Warnw method output warning level log. +func Warnw(msg string, keysAndValues ...interface{}) { + std.zapLogger.Sugar().Warnw(msg, keysAndValues...) +} + +func (l *zapLogger) Warnw(msg string, keysAndValues ...interface{}) { + l.zapLogger.Sugar().Warnw(msg, keysAndValues...) +} + +// Error method output error level log. +func Error(msg string, fields ...Field) { + std.zapLogger.Error(msg, fields...) +} + +func (l *zapLogger) Error(msg string, fields ...Field) { + l.zapLogger.Error(msg, fields...) +} + +// Errorf method output error level log. +func Errorf(format string, v ...interface{}) { + std.zapLogger.Sugar().Errorf(format, v...) +} + +func (l *zapLogger) Errorf(format string, v ...interface{}) { + l.zapLogger.Sugar().Errorf(format, v...) +} + +//nolint:govet +func ErrorR(format string, v ...interface{}) error { + std.zapLogger.Sugar().Errorf(format, v...) + return fmt.Errorf(format, v) +} + +//nolint:govet +func (l *zapLogger) ErrorR(format string, v ...interface{}) error { + l.zapLogger.Sugar().Errorf(format, v...) + return fmt.Errorf(format, v) +} + +// Errorw method output error level log. +func Errorw(msg string, keysAndValues ...interface{}) { + std.zapLogger.Sugar().Errorw(msg, keysAndValues...) +} + +func (l *zapLogger) Errorw(msg string, keysAndValues ...interface{}) { + l.zapLogger.Sugar().Errorw(msg, keysAndValues...) +} + +// Panic method output panic level log and shutdown application. +func Panic(msg string, fields ...Field) { + std.zapLogger.Panic(msg, fields...) +} + +func (l *zapLogger) Panic(msg string, fields ...Field) { + l.zapLogger.Panic(msg, fields...) +} + +// Panicf method output panic level log and shutdown application. +func Panicf(format string, v ...interface{}) { + std.zapLogger.Sugar().Panicf(format, v...) +} + +func (l *zapLogger) Panicf(format string, v ...interface{}) { + l.zapLogger.Sugar().Panicf(format, v...) +} + +// Panicw method output panic level log. +func Panicw(msg string, keysAndValues ...interface{}) { + std.zapLogger.Sugar().Panicw(msg, keysAndValues...) +} + +func (l *zapLogger) Panicw(msg string, keysAndValues ...interface{}) { + l.zapLogger.Sugar().Panicw(msg, keysAndValues...) +} + +// Fatal method output fatal level log. +func Fatal(msg string, fields ...Field) { + std.zapLogger.Fatal(msg, fields...) +} + +func (l *zapLogger) Fatal(msg string, fields ...Field) { + l.zapLogger.Fatal(msg, fields...) +} + +// Fatalf method output fatal level log. +func Fatalf(format string, v ...interface{}) { + std.zapLogger.Sugar().Fatalf(format, v...) +} + +func (l *zapLogger) Fatalf(format string, v ...interface{}) { + l.zapLogger.Sugar().Fatalf(format, v...) +} + +// Fatalw method output Fatalw level log. +func Fatalw(msg string, keysAndValues ...interface{}) { + std.zapLogger.Sugar().Fatalw(msg, keysAndValues...) +} + +func (l *zapLogger) Fatalw(msg string, keysAndValues ...interface{}) { + l.zapLogger.Sugar().Fatalw(msg, keysAndValues...) +} + +//nolint:unused +func (l *zapLogger) clone() *zapLogger { + syslog := *l + return &syslog +} diff --git a/pkg/log/options.go b/pkg/log/options.go new file mode 100644 index 0000000..662ecab --- /dev/null +++ b/pkg/log/options.go @@ -0,0 +1,69 @@ +package log + +import ( + "errors" + "fmt" + "strings" + + "go.uber.org/zap/zapcore" +) + +const ( + consoleFormat = "console" + jsonFormat = "json" +) + +var validLevels = []string{"debug", "info", "warn", "error", "panic", "fatal"} + +// options for create log +type Options struct { + // destination of log + OutputPaths []string `json:"output-paths"` + // the error log of zap + ErrorOutputPaths []string `json:"error-output-paths"` + // log level "info debug warn error panic fatal" + Level string `json:"level"` + // json or console + Format string `json:"format"` + // show file, function, line number in log + DisableCaller bool `json:"disable-caller"` + DisableStacktrace bool `json:"disable-stacktrace"` + // console format can enable color + EnableColor bool `json:"enable-color"` + Development bool `json:"development"` + Name string `json:"name"` +} + +func NewOptions() *Options { + return &Options{ + Level: zapcore.InfoLevel.String(), + DisableCaller: false, + DisableStacktrace: false, + Format: consoleFormat, + EnableColor: false, + Development: false, + OutputPaths: []string{"stdout"}, + ErrorOutputPaths: []string{"stderr"}, + } +} + +func (opt *Options) Validate() error { + errorMsg := make([]string, 0) + if opt.Format != consoleFormat && opt.Format != jsonFormat { + errorMsg = append(errorMsg, fmt.Sprintf("Invalid format, should be: %v or %v", consoleFormat, jsonFormat)) + } + valid := false + for _, val := range validLevels { + if val == opt.Level { + valid = true + break + } + } + if !valid { + errorMsg = append(errorMsg, fmt.Sprintf("Invalid level, should be oneof %v", strings.Join(validLevels, ","))) + } + if len(errorMsg) != 0 { + return errors.New(strings.Join(validLevels, ";")) + } + return nil +} diff --git a/pkg/log/types.go b/pkg/log/types.go new file mode 100644 index 0000000..c69cca4 --- /dev/null +++ b/pkg/log/types.go @@ -0,0 +1,73 @@ +package log + +import ( + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +type Field = zapcore.Field + +type Level = zapcore.Level + +var ( + DebugLevel = zapcore.DebugLevel + InfoLevel = zapcore.InfoLevel + WarnLevel = zapcore.WarnLevel + ErrorLevel = zapcore.ErrorLevel + PanicLevel = zapcore.PanicLevel + FatalLevel = zapcore.FatalLevel +) + +// Alias for zap type functions. +var ( + Any = zap.Any + Array = zap.Array + Object = zap.Object + Binary = zap.Binary + Bool = zap.Bool + Bools = zap.Bools + ByteString = zap.ByteString + ByteStrings = zap.ByteStrings + Complex64 = zap.Complex64 + Complex64s = zap.Complex64s + Complex128 = zap.Complex128 + Complex128s = zap.Complex128s + Duration = zap.Duration + Durations = zap.Durations + Err = zap.Error + Errors = zap.Errors + Float32 = zap.Float32 + Float32s = zap.Float32s + Float64 = zap.Float64 + Float64s = zap.Float64s + Int = zap.Int + Ints = zap.Ints + Int8 = zap.Int8 + Int8s = zap.Int8s + Int16 = zap.Int16 + Int16s = zap.Int16s + Int32 = zap.Int32 + Int32s = zap.Int32s + Int64 = zap.Int64 + Int64s = zap.Int64s + Namespace = zap.Namespace + Reflect = zap.Reflect + Stack = zap.Stack + String = zap.String + Stringer = zap.Stringer + Strings = zap.Strings + Time = zap.Time + Times = zap.Times + Uint = zap.Uint + Uints = zap.Uints + Uint8 = zap.Uint8 + Uint8s = zap.Uint8s + Uint16 = zap.Uint16 + Uint16s = zap.Uint16s + Uint32 = zap.Uint32 + Uint32s = zap.Uint32s + Uint64 = zap.Uint64 + Uint64s = zap.Uint64s + Uintptr = zap.Uintptr + Uintptrs = zap.Uintptrs +) diff --git a/pkg/rpc/http.go b/pkg/rpc/http.go new file mode 100644 index 0000000..e7614dc --- /dev/null +++ b/pkg/rpc/http.go @@ -0,0 +1,42 @@ +package rpc + +import ( + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" +) + +func HTTPPostJSON(proxyURL, httpURL, bodyJSON string) ([]byte, error) { + httpClient := &http.Client{ + Timeout: time.Second * 10, + } + if proxyURL != "" { + proxy, err := url.Parse(proxyURL) + if err != nil { + return nil, err + } + netTransport := &http.Transport{ + Proxy: http.ProxyURL(proxy), + MaxIdleConnsPerHost: 10, + ResponseHeaderTimeout: time.Second * time.Duration(10), + } + httpClient.Transport = netTransport + } + b := strings.NewReader(bodyJSON) + res, err := httpClient.Post(httpURL, "application/json", b) + if err != nil { + return nil, err + } + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + return nil, fmt.Errorf("StatusCode: %d", res.StatusCode) + } + body, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + return body, nil +} diff --git a/pkg/rpc/http_test.go b/pkg/rpc/http_test.go new file mode 100644 index 0000000..90e4f53 --- /dev/null +++ b/pkg/rpc/http_test.go @@ -0,0 +1,17 @@ +package rpc + +import ( + "fmt" + "testing" +) + +func TestEthGetBlockByNumber(t *testing.T) { + json, err := HTTPPostJSON("", "http://35.165.132.220:8545", "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"48203\", true],\"id\":1}") + if err != nil { + return + } + block := ParseJSONBlock(string(json)) + fmt.Println(block.Timestamp()) + fmt.Println(block.Number()) + fmt.Println(block.Hash()) +} diff --git a/pkg/rpc/struct.go b/pkg/rpc/struct.go new file mode 100644 index 0000000..4fcbb90 --- /dev/null +++ b/pkg/rpc/struct.go @@ -0,0 +1,72 @@ +package rpc + +import ( + "encoding/json" + "fmt" + "strconv" + "strings" +) + +type Block struct { + ID int64 `json:"id"` + Jsonrpc string `json:"jsonrpc"` + Result struct { + Difficulty string `json:"difficulty"` + ExtraData string `json:"extraData"` + GasLimit string `json:"gasLimit"` + GasUsed string `json:"gasUsed"` + Hash string `json:"hash"` + LogsBloom string `json:"logsBloom"` + Miner string `json:"miner"` + MixHash string `json:"mixHash"` + Nonce string `json:"nonce"` + Number string `json:"number"` + ParentHash string `json:"parentHash"` + ReceiptsRoot string `json:"receiptsRoot"` + Sha3Uncles string `json:"sha3Uncles"` + Size string `json:"size"` + StateRoot string `json:"stateRoot"` + Timestamp string `json:"timestamp"` + TotalDifficulty string `json:"totalDifficulty"` + Transactions []interface{} `json:"transactions"` + TransactionsRoot string `json:"transactionsRoot"` + Uncles []interface{} `json:"uncles"` + } `json:"result"` +} + +func (b Block) ParentHash() string { + return b.Result.ParentHash +} + +func (b Block) Hash() string { + return b.Result.Hash +} + +func (b Block) Miner() string { + return b.Result.Miner +} + +func (b Block) Number() int64 { + value, err := strconv.ParseInt(strings.ReplaceAll(b.Result.Number, "0x", ""), 16, 64) + if err != nil { + return 0 + } + return value +} + +func (b Block) Timestamp() int64 { + value, err := strconv.ParseInt(strings.ReplaceAll(b.Result.Timestamp, "0x", ""), 16, 64) + if err != nil { + return 0 + } + return value +} + +func ParseJSONBlock(data string) Block { + var c Block + if err := json.Unmarshal([]byte(data), &c); err != nil { + fmt.Println("Error =", err) + return c + } + return c +}