From 74706bdca9c65ba7166eb70b4de7b8a5459d9080 Mon Sep 17 00:00:00 2001 From: anomit ghosh Date: Wed, 4 Sep 2024 20:07:24 +0530 Subject: [PATCH] first commit --- .gitignore | 2 + Dockerfile | 23 + README.md | 0 build-docker.sh | 1 + build.sh | 2 + cmd/main.go | 23 + config/settings.example.json | 11 + config/settings.go | 54 + go.mod | 68 + go.sum | 206 ++ init_processes.sh | 7 + pkgs/contract/contract/abi.json | 1081 +++++++++++ pkgs/contract/contract/contract.go | 2874 ++++++++++++++++++++++++++++ pkgs/helpers/chain.go | 258 +++ pkgs/helpers/constants.go | 4 + pkgs/helpers/contract.go | 44 + pkgs/helpers/database.go | 93 + pkgs/helpers/errors.go | 28 + pkgs/helpers/ipfs.go | 56 + pkgs/helpers/logger.go | 48 + pkgs/helpers/merkle.go | 20 + pkgs/helpers/validation.go | 1 + pm2.config.js | 22 + validator_autofill.sh | 54 + 24 files changed, 4980 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 build-docker.sh create mode 100755 build.sh create mode 100644 cmd/main.go create mode 100644 config/settings.example.json create mode 100644 config/settings.go create mode 100644 go.mod create mode 100644 go.sum create mode 100755 init_processes.sh create mode 100644 pkgs/contract/contract/abi.json create mode 100644 pkgs/contract/contract/contract.go create mode 100644 pkgs/helpers/chain.go create mode 100644 pkgs/helpers/constants.go create mode 100644 pkgs/helpers/contract.go create mode 100644 pkgs/helpers/database.go create mode 100644 pkgs/helpers/errors.go create mode 100644 pkgs/helpers/ipfs.go create mode 100644 pkgs/helpers/logger.go create mode 100644 pkgs/helpers/merkle.go create mode 100644 pkgs/helpers/validation.go create mode 100644 pm2.config.js create mode 100755 validator_autofill.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d6dd1e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +*/settings.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3db8d1f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:alpine3.17 + +ENV GO111MODULE=on + +RUN rm -rf /var/cache/apk/* && \ + rm -rf /tmp/* + +RUN apk update && apk add --no-cache ethtool nodejs npm bash gcc musl-dev libc-dev curl libffi-dev vim nano ca-certificates protoc + +RUN npm install pm2 -g +RUN pm2 install pm2-logrotate && pm2 set pm2-logrotate:compress true && pm2 set pm2-logrotate:retain 7 + +WORKDIR /src +COPY go.mod go.sum ./ +RUN go mod download + +# EXPOSE 9000 + +COPY . . +RUN chmod +x build.sh +RUN ./build.sh + +RUN chmod +x init_processes.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/build-docker.sh b/build-docker.sh new file mode 100755 index 0000000..a20e173 --- /dev/null +++ b/build-docker.sh @@ -0,0 +1 @@ +docker build -t powerloom-submission-validator . \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..bb81ab8 --- /dev/null +++ b/build.sh @@ -0,0 +1,2 @@ +cd cmd +go build . \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 0000000..21bb9cd --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "sync" + "validator/config" + "validator/pkgs/helpers" +) + +func main() { + var wg sync.WaitGroup + + helpers.InitLogger() + config.LoadConfig() + helpers.ConfigureClient() + helpers.ConfigureContractInstance() + helpers.RedisClient = helpers.NewRedisClient() + helpers.ConnectIPFSNode() + helpers.PopulateStateVars() + + wg.Add(1) + go helpers.StartFetchingBlocks() + wg.Wait() +} diff --git a/config/settings.example.json b/config/settings.example.json new file mode 100644 index 0000000..bc42e7a --- /dev/null +++ b/config/settings.example.json @@ -0,0 +1,11 @@ +{ + "ClientUrl": "PROST_RPC_URL", + "ContractAddress": "PROTOCOL_STATE_CONTRACT", + "RedisHost": "REDIS_HOST", + "RedisPort": "REDIS_PORT", + "IPFSUrl": "IPFS_URL", + "SignerAccountAddress": "SIGNER_ACCOUNT_ADDRESS", + "PrivateKey": "SIGNER_ACCOUNT_PRIVATE_KEY", + "ChainID": "PROST_CHAIN_ID", + "BatchSubmissionLimit": "BATCH_SUBMISSION_LIMIT" +} \ No newline at end of file diff --git a/config/settings.go b/config/settings.go new file mode 100644 index 0000000..7fcf869 --- /dev/null +++ b/config/settings.go @@ -0,0 +1,54 @@ +package config + +import ( + "crypto/ecdsa" + "encoding/json" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + log "github.com/sirupsen/logrus" + "os" + "strings" +) + +var SettingsObj *Settings + +type Settings struct { + ClientUrl string `json:"ClientUrl"` + ContractAddress string `json:"ContractAddress"` + RedisHost string `json:"RedisHost"` + RedisPort string `json:"RedisPort"` + IPFSUrl string `json:"IPFSUrl"` + SignerAccountAddressStr string `json:"SignerAccountAddress"` + SignerAccountAddress common.Address + PrivateKeyStr string `json:"PrivateKey"` + PrivateKey *ecdsa.PrivateKey + ChainID int `json:"ChainID"` + BlockTime int `json:"BlockTime"` + BatchSubmissionLimit int `json:"BatchSubmissionLimit"` +} + +func LoadConfig() { + //file, err := os.Open("/Users/mukundrawat/power2/validator-alpha/config/settings.json") + file, err := os.Open(strings.TrimSuffix(os.Getenv("CONFIG_PATH"), "/") + "/config/settings.json") + if err != nil { + log.Fatalf("Failed to open config file: %v", err) + } + defer func(file *os.File) { + err = file.Close() + if err != nil { + log.Errorf("Unable to close file: %s", err.Error()) + } + }(file) + + decoder := json.NewDecoder(file) + config := Settings{} + err = decoder.Decode(&config) + if err != nil { + log.Fatalf("Failed to decode config file: %v", err) + } + + config.SignerAccountAddress = common.HexToAddress(config.SignerAccountAddressStr) + config.PrivateKey, _ = crypto.HexToECDSA(config.PrivateKeyStr) + + SettingsObj = &config +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..386ef3f --- /dev/null +++ b/go.mod @@ -0,0 +1,68 @@ +module validator + +go 1.20 + +require ( + github.com/ethereum/go-ethereum v1.13.12 + github.com/go-redis/redis/v8 v8.11.5 + github.com/ipfs/go-ipfs-api v0.7.0 + github.com/sergerad/incremental-merkle-tree v0.0.0-20230715063941-db79af0c6c68 + github.com/sirupsen/logrus v1.9.3 +) + +require ( + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/StackExchange/wmi v1.2.1 // indirect + github.com/benbjohnson/clock v1.3.0 // indirect + github.com/bits-and-blooms/bitset v1.10.0 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect + github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect + github.com/deckarep/golang-set/v2 v2.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/ethereum/c-kzg-4844 v0.4.0 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/holiman/uint256 v1.2.4 // indirect + github.com/ipfs/boxo v0.12.0 // indirect + github.com/ipfs/go-cid v0.4.1 // indirect + github.com/klauspost/cpuid/v2 v2.2.3 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/libp2p/go-flow-metrics v0.1.0 // indirect + github.com/libp2p/go-libp2p v0.26.3 // indirect + github.com/minio/sha256-simd v1.0.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect + github.com/multiformats/go-multiaddr v0.8.0 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multicodec v0.9.0 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-multistream v0.4.1 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/spaolacci/murmur3 v1.1.0 // 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 + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/tools v0.15.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect + lukechampine.com/blake3 v1.1.7 // indirect + rsc.io/tmplfunc v0.0.3 // indirect +) + +replace github.com/ethereum/go-ethereum v1.13.12 => github.com/muku314115/go-ethereum v1.13.12 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..61fc82f --- /dev/null +++ b/go.sum @@ -0,0 +1,206 @@ +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +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/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +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/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= +github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= +github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 h1:aPEJyR4rPBvDmeyi+l/FS/VtA00IWvjeFvjen1m1l1A= +github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +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/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= +github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= +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/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/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/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= +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-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= +github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +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/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +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/ipfs/boxo v0.12.0 h1:AXHg/1ONZdRQHQLgG5JHsSC3XoE4DjCAMgK+asZvUcQ= +github.com/ipfs/boxo v0.12.0/go.mod h1:xAnfiU6PtxWCnRqu7dcXQ10bB5/kvI1kXRotuGqGBhg= +github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= +github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= +github.com/ipfs/go-ipfs-api v0.7.0 h1:CMBNCUl0b45coC+lQCXEVpMhwoqjiaCwUIrM+coYW2Q= +github.com/ipfs/go-ipfs-api v0.7.0/go.mod h1:AIxsTNB0+ZhkqIfTZpdZ0VR/cpX5zrXjATa3prSay3g= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU= +github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= +github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= +github.com/libp2p/go-libp2p v0.26.3 h1:6g/psubqwdaBqNNoidbRKSTBEYgaOuKBhHl8Q5tO+PM= +github.com/libp2p/go-libp2p v0.26.3/go.mod h1:x75BN32YbwuY0Awm2Uix4d4KOz+/4piInkp4Wr3yOo8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +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/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/muku314115/go-ethereum v1.13.12 h1:Nkt0EYaNd9K5AcOvXqWU6Pi+bjvV0HdNqn8BaXjGeI4= +github.com/muku314115/go-ethereum v1.13.12/go.mod h1:gFtlVORuUcT+UUIcJ/veCNjkuOSujCi338uSHJrYAew= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multiaddr v0.8.0 h1:aqjksEcqK+iD/Foe1RRFsGZh8+XFiGo7FgUCZlpv3LU= +github.com/multiformats/go-multiaddr v0.8.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= +github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= +github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +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.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/sergerad/incremental-merkle-tree v0.0.0-20230715063941-db79af0c6c68 h1:rWmg+/vRrWRWVsuG0BeTLX7QqBdjR2erY9X6g/L/aKE= +github.com/sergerad/incremental-merkle-tree v0.0.0-20230715063941-db79af0c6c68/go.mod h1:PtQNNXYnJzHvVGY+VALmPmGh/DpO/YAb0vLxPCuifY4= +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/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +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/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/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +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.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +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-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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.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/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +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= +lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= +lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/init_processes.sh b/init_processes.sh new file mode 100755 index 0000000..53d0f35 --- /dev/null +++ b/init_processes.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo 'starting pm2...'; + +pm2 start pm2.config.js + +pm2 logs --lines 1000 diff --git a/pkgs/contract/contract/abi.json b/pkgs/contract/contract/abi.json new file mode 100644 index 0000000..14ebae3 --- /dev/null +++ b/pkgs/contract/contract/abi.json @@ -0,0 +1,1081 @@ +[ + { + "inputs": [ + { + "internalType": "uint8", + "name": "epochSize", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "sourceChainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sourceChainBlockTime", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "useBlockNumberAsEpochId", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "snapshotterAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "snapshotCid", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "projectId", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "DelayedSnapshotSubmitted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "begin", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "end", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "EpochReleased", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "projectId", + "type": "string" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "enableEpochId", + "type": "uint256" + } + ], + "name": "ProjectsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "SnapshotBatchFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "batchCid", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "SnapshotBatchSubmitted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "validatorAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "ValidatorsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "snapshotterAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "allSnapshottersUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "snapshotterAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "masterSnapshottersUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "projectId", + "type": "string" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "enableEpochId", + "type": "uint256" + } + ], + "name": "pretestProjectsUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "DeploymentBlockNumber", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EPOCH_SIZE", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SOURCE_CHAIN_BLOCK_TIME", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SOURCE_CHAIN_ID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "USE_BLOCK_NUMBER_AS_EPOCH_ID", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allSnapshotters", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "projectId", + "type": "string" + } + ], + "name": "attestationFinalizedStatus", + "outputs": [ + { + "internalType": "bool", + "name": "finalized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorAddr", + "type": "address" + } + ], + "name": "attestationsReceived", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "rootHash", + "type": "bytes32" + } + ], + "name": "attestationsReceivedCount", + "outputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + } + ], + "name": "batchIdAttestationStatus", + "outputs": [ + { + "internalType": "bool", + "name": "status", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batchIdToProjects", + "outputs": [ + { + "internalType": "string", + "name": "projectids", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "begin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "epochInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blocknumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEnd", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "begin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "forceSkipEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getMasterSnapshotters", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSnapshotters", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalMasterSnapshotterCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalSnapshotterCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalValidatorsCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "projectId", + "type": "string" + } + ], + "name": "lastFinalizedSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "masterSnapshotters", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + } + ], + "name": "maxAttestationFinalizedRootHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "rootHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + } + ], + "name": "maxAttestationsCount", + "outputs": [ + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "maxSnapshotsCid", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minSubmissionsForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "projectId", + "type": "string" + } + ], + "name": "projectFirstEpochId", + "outputs": [ + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "messageHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "recoverAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "begin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "releaseEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "snapshotStatus", + "outputs": [ + { + "internalType": "enum PowerloomProtocolState.SnapshotStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "string", + "name": "snapshotCid", + "type": "string" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "snapshotSubmissionWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "finalizedCidsRootHash", + "type": "bytes32" + } + ], + "name": "submitBatchAttestation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "batchCid", + "type": "string" + }, + { + "internalType": "uint256", + "name": "batchId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "projectIds", + "type": "string[]" + }, + { + "internalType": "string[]", + "name": "snapshotCids", + "type": "string[]" + } + ], + "name": "submitSubmissionBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_snapshotters", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "_status", + "type": "bool[]" + } + ], + "name": "updateAllSnapshotters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_snapshotters", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "_status", + "type": "bool[]" + } + ], + "name": "updateMasterSnapshotters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minSubmissionsForConsensus", + "type": "uint256" + } + ], + "name": "updateMinSnapshottersForConsensus", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newsnapshotSubmissionWindow", + "type": "uint256" + } + ], + "name": "updateSnapshotSubmissionWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_validators", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "_status", + "type": "bool[]" + } + ], + "name": "updateValidators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "snapshotCid", + "type": "string" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "projectId", + "type": "string" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "string", + "name": "snapshotCid", + "type": "string" + }, + { + "internalType": "uint256", + "name": "epochId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "projectId", + "type": "string" + } + ], + "internalType": "struct PowerloomProtocolState.Request", + "name": "request", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "address", + "name": "signer", + "type": "address" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/pkgs/contract/contract/contract.go b/pkgs/contract/contract/contract.go new file mode 100644 index 0000000..01f4e1b --- /dev/null +++ b/pkgs/contract/contract/contract.go @@ -0,0 +1,2874 @@ +// 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 +) + +// PowerloomProtocolStateRequest is an auto generated low-level Go binding around an user-defined struct. +type PowerloomProtocolStateRequest struct { + Deadline *big.Int + SnapshotCid string + EpochId *big.Int + ProjectId string +} + +// ContractMetaData contains all meta data concerning the Contract contract. +var ContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"epochSize\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"sourceChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"sourceChainBlockTime\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"useBlockNumberAsEpochId\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"snapshotterAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"snapshotCid\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"DelayedSnapshotSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"begin\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"EpochReleased\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"enableEpochId\",\"type\":\"uint256\"}],\"name\":\"ProjectsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"SnapshotBatchFinalized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"batchCid\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"SnapshotBatchSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validatorAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"}],\"name\":\"ValidatorsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"snapshotterAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"}],\"name\":\"allSnapshottersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"snapshotterAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"}],\"name\":\"masterSnapshottersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"allowed\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"enableEpochId\",\"type\":\"uint256\"}],\"name\":\"pretestProjectsUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DeploymentBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EPOCH_SIZE\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SOURCE_CHAIN_BLOCK_TIME\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SOURCE_CHAIN_ID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USE_BLOCK_NUMBER_AS_EPOCH_ID\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allSnapshotters\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"}],\"name\":\"attestationFinalizedStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"finalized\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"validatorAddr\",\"type\":\"address\"}],\"name\":\"attestationsReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"rootHash\",\"type\":\"bytes32\"}],\"name\":\"attestationsReceivedCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"}],\"name\":\"batchIdAttestationStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"batchIdToProjects\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"projectids\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"begin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"epochInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blocknumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochEnd\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"begin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"forceSkipEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMasterSnapshotters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSnapshotters\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalMasterSnapshotterCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalSnapshotterCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalValidatorsCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"}],\"name\":\"lastFinalizedSnapshot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"masterSnapshotters\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"}],\"name\":\"maxAttestationFinalizedRootHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"rootHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"}],\"name\":\"maxAttestationsCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"maxSnapshotsCid\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minSubmissionsForConsensus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"}],\"name\":\"projectFirstEpochId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"recoverAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"begin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"name\":\"releaseEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"snapshotStatus\",\"outputs\":[{\"internalType\":\"enumPowerloomProtocolState.SnapshotStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"snapshotCid\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snapshotSubmissionWindow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"finalizedCidsRootHash\",\"type\":\"bytes32\"}],\"name\":\"submitBatchAttestation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"batchCid\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"batchId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"string[]\",\"name\":\"projectIds\",\"type\":\"string[]\"},{\"internalType\":\"string[]\",\"name\":\"snapshotCids\",\"type\":\"string[]\"}],\"name\":\"submitSubmissionBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_snapshotters\",\"type\":\"address[]\"},{\"internalType\":\"bool[]\",\"name\":\"_status\",\"type\":\"bool[]\"}],\"name\":\"updateAllSnapshotters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_snapshotters\",\"type\":\"address[]\"},{\"internalType\":\"bool[]\",\"name\":\"_status\",\"type\":\"bool[]\"}],\"name\":\"updateMasterSnapshotters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minSubmissionsForConsensus\",\"type\":\"uint256\"}],\"name\":\"updateMinSnapshottersForConsensus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newsnapshotSubmissionWindow\",\"type\":\"uint256\"}],\"name\":\"updateSnapshotSubmissionWindow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"},{\"internalType\":\"bool[]\",\"name\":\"_status\",\"type\":\"bool[]\"}],\"name\":\"updateValidators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"snapshotCid\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"snapshotCid\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"epochId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"projectId\",\"type\":\"string\"}],\"internalType\":\"structPowerloomProtocolState.Request\",\"name\":\"request\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// ContractABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractMetaData.ABI instead. +var ContractABI = ContractMetaData.ABI + +// Contract is an auto generated Go binding around an Ethereum contract. +type Contract struct { + ContractCaller // Read-only binding to the contract + ContractTransactor // Write-only binding to the contract + ContractFilterer // Log filterer for contract events +} + +// ContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type ContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractSession struct { + Contract *Contract // 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 +} + +// ContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractCallerSession struct { + Contract *ContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractTransactorSession struct { + Contract *ContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type ContractRaw struct { + Contract *Contract // Generic contract binding to access the raw methods on +} + +// ContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractCallerRaw struct { + Contract *ContractCaller // Generic read-only contract binding to access the raw methods on +} + +// ContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractTransactorRaw struct { + Contract *ContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewContract creates a new instance of Contract, bound to a specific deployed contract. +func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) { + contract, err := bindContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Contract{ContractCaller: ContractCaller{contract: contract}, ContractTransactor: ContractTransactor{contract: contract}, ContractFilterer: ContractFilterer{contract: contract}}, nil +} + +// NewContractCaller creates a new read-only instance of Contract, bound to a specific deployed contract. +func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) { + contract, err := bindContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractCaller{contract: contract}, nil +} + +// NewContractTransactor creates a new write-only instance of Contract, bound to a specific deployed contract. +func NewContractTransactor(address common.Address, transactor bind.ContractTransactor) (*ContractTransactor, error) { + contract, err := bindContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractTransactor{contract: contract}, nil +} + +// NewContractFilterer creates a new log filterer instance of Contract, bound to a specific deployed contract. +func NewContractFilterer(address common.Address, filterer bind.ContractFilterer) (*ContractFilterer, error) { + contract, err := bindContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractFilterer{contract: contract}, nil +} + +// bindContract binds a generic wrapper to an already deployed contract. +func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractMetaData.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 (_Contract *ContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.Contract.ContractCaller.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 (_Contract *ContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.ContractTransactor.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 (_Contract *ContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Contract.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 (_Contract *ContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Contract *ContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Contract.Contract.contract.Transact(opts, method, params...) +} + +// DeploymentBlockNumber is a free data retrieval call binding the contract method 0xb1288f71. +// +// Solidity: function DeploymentBlockNumber() view returns(uint256) +func (_Contract *ContractCaller) DeploymentBlockNumber(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "DeploymentBlockNumber") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// DeploymentBlockNumber is a free data retrieval call binding the contract method 0xb1288f71. +// +// Solidity: function DeploymentBlockNumber() view returns(uint256) +func (_Contract *ContractSession) DeploymentBlockNumber() (*big.Int, error) { + return _Contract.Contract.DeploymentBlockNumber(&_Contract.CallOpts) +} + +// DeploymentBlockNumber is a free data retrieval call binding the contract method 0xb1288f71. +// +// Solidity: function DeploymentBlockNumber() view returns(uint256) +func (_Contract *ContractCallerSession) DeploymentBlockNumber() (*big.Int, error) { + return _Contract.Contract.DeploymentBlockNumber(&_Contract.CallOpts) +} + +// EPOCHSIZE is a free data retrieval call binding the contract method 0x62656003. +// +// Solidity: function EPOCH_SIZE() view returns(uint8) +func (_Contract *ContractCaller) EPOCHSIZE(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "EPOCH_SIZE") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// EPOCHSIZE is a free data retrieval call binding the contract method 0x62656003. +// +// Solidity: function EPOCH_SIZE() view returns(uint8) +func (_Contract *ContractSession) EPOCHSIZE() (uint8, error) { + return _Contract.Contract.EPOCHSIZE(&_Contract.CallOpts) +} + +// EPOCHSIZE is a free data retrieval call binding the contract method 0x62656003. +// +// Solidity: function EPOCH_SIZE() view returns(uint8) +func (_Contract *ContractCallerSession) EPOCHSIZE() (uint8, error) { + return _Contract.Contract.EPOCHSIZE(&_Contract.CallOpts) +} + +// SOURCECHAINBLOCKTIME is a free data retrieval call binding the contract method 0x351b6155. +// +// Solidity: function SOURCE_CHAIN_BLOCK_TIME() view returns(uint256) +func (_Contract *ContractCaller) SOURCECHAINBLOCKTIME(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "SOURCE_CHAIN_BLOCK_TIME") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SOURCECHAINBLOCKTIME is a free data retrieval call binding the contract method 0x351b6155. +// +// Solidity: function SOURCE_CHAIN_BLOCK_TIME() view returns(uint256) +func (_Contract *ContractSession) SOURCECHAINBLOCKTIME() (*big.Int, error) { + return _Contract.Contract.SOURCECHAINBLOCKTIME(&_Contract.CallOpts) +} + +// SOURCECHAINBLOCKTIME is a free data retrieval call binding the contract method 0x351b6155. +// +// Solidity: function SOURCE_CHAIN_BLOCK_TIME() view returns(uint256) +func (_Contract *ContractCallerSession) SOURCECHAINBLOCKTIME() (*big.Int, error) { + return _Contract.Contract.SOURCECHAINBLOCKTIME(&_Contract.CallOpts) +} + +// SOURCECHAINID is a free data retrieval call binding the contract method 0x74be2150. +// +// Solidity: function SOURCE_CHAIN_ID() view returns(uint256) +func (_Contract *ContractCaller) SOURCECHAINID(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "SOURCE_CHAIN_ID") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SOURCECHAINID is a free data retrieval call binding the contract method 0x74be2150. +// +// Solidity: function SOURCE_CHAIN_ID() view returns(uint256) +func (_Contract *ContractSession) SOURCECHAINID() (*big.Int, error) { + return _Contract.Contract.SOURCECHAINID(&_Contract.CallOpts) +} + +// SOURCECHAINID is a free data retrieval call binding the contract method 0x74be2150. +// +// Solidity: function SOURCE_CHAIN_ID() view returns(uint256) +func (_Contract *ContractCallerSession) SOURCECHAINID() (*big.Int, error) { + return _Contract.Contract.SOURCECHAINID(&_Contract.CallOpts) +} + +// USEBLOCKNUMBERASEPOCHID is a free data retrieval call binding the contract method 0x2d46247b. +// +// Solidity: function USE_BLOCK_NUMBER_AS_EPOCH_ID() view returns(bool) +func (_Contract *ContractCaller) USEBLOCKNUMBERASEPOCHID(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "USE_BLOCK_NUMBER_AS_EPOCH_ID") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// USEBLOCKNUMBERASEPOCHID is a free data retrieval call binding the contract method 0x2d46247b. +// +// Solidity: function USE_BLOCK_NUMBER_AS_EPOCH_ID() view returns(bool) +func (_Contract *ContractSession) USEBLOCKNUMBERASEPOCHID() (bool, error) { + return _Contract.Contract.USEBLOCKNUMBERASEPOCHID(&_Contract.CallOpts) +} + +// USEBLOCKNUMBERASEPOCHID is a free data retrieval call binding the contract method 0x2d46247b. +// +// Solidity: function USE_BLOCK_NUMBER_AS_EPOCH_ID() view returns(bool) +func (_Contract *ContractCallerSession) USEBLOCKNUMBERASEPOCHID() (bool, error) { + return _Contract.Contract.USEBLOCKNUMBERASEPOCHID(&_Contract.CallOpts) +} + +// AllSnapshotters is a free data retrieval call binding the contract method 0x3d15d0f4. +// +// Solidity: function allSnapshotters(address ) view returns(bool) +func (_Contract *ContractCaller) AllSnapshotters(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "allSnapshotters", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// AllSnapshotters is a free data retrieval call binding the contract method 0x3d15d0f4. +// +// Solidity: function allSnapshotters(address ) view returns(bool) +func (_Contract *ContractSession) AllSnapshotters(arg0 common.Address) (bool, error) { + return _Contract.Contract.AllSnapshotters(&_Contract.CallOpts, arg0) +} + +// AllSnapshotters is a free data retrieval call binding the contract method 0x3d15d0f4. +// +// Solidity: function allSnapshotters(address ) view returns(bool) +func (_Contract *ContractCallerSession) AllSnapshotters(arg0 common.Address) (bool, error) { + return _Contract.Contract.AllSnapshotters(&_Contract.CallOpts, arg0) +} + +// AttestationFinalizedStatus is a free data retrieval call binding the contract method 0xbfefe303. +// +// Solidity: function attestationFinalizedStatus(uint256 epochId, string projectId) view returns(bool finalized) +func (_Contract *ContractCaller) AttestationFinalizedStatus(opts *bind.CallOpts, epochId *big.Int, projectId string) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "attestationFinalizedStatus", epochId, projectId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// AttestationFinalizedStatus is a free data retrieval call binding the contract method 0xbfefe303. +// +// Solidity: function attestationFinalizedStatus(uint256 epochId, string projectId) view returns(bool finalized) +func (_Contract *ContractSession) AttestationFinalizedStatus(epochId *big.Int, projectId string) (bool, error) { + return _Contract.Contract.AttestationFinalizedStatus(&_Contract.CallOpts, epochId, projectId) +} + +// AttestationFinalizedStatus is a free data retrieval call binding the contract method 0xbfefe303. +// +// Solidity: function attestationFinalizedStatus(uint256 epochId, string projectId) view returns(bool finalized) +func (_Contract *ContractCallerSession) AttestationFinalizedStatus(epochId *big.Int, projectId string) (bool, error) { + return _Contract.Contract.AttestationFinalizedStatus(&_Contract.CallOpts, epochId, projectId) +} + +// AttestationsReceived is a free data retrieval call binding the contract method 0x33420a0c. +// +// Solidity: function attestationsReceived(uint256 batchId, address validatorAddr) view returns(bool) +func (_Contract *ContractCaller) AttestationsReceived(opts *bind.CallOpts, batchId *big.Int, validatorAddr common.Address) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "attestationsReceived", batchId, validatorAddr) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// AttestationsReceived is a free data retrieval call binding the contract method 0x33420a0c. +// +// Solidity: function attestationsReceived(uint256 batchId, address validatorAddr) view returns(bool) +func (_Contract *ContractSession) AttestationsReceived(batchId *big.Int, validatorAddr common.Address) (bool, error) { + return _Contract.Contract.AttestationsReceived(&_Contract.CallOpts, batchId, validatorAddr) +} + +// AttestationsReceived is a free data retrieval call binding the contract method 0x33420a0c. +// +// Solidity: function attestationsReceived(uint256 batchId, address validatorAddr) view returns(bool) +func (_Contract *ContractCallerSession) AttestationsReceived(batchId *big.Int, validatorAddr common.Address) (bool, error) { + return _Contract.Contract.AttestationsReceived(&_Contract.CallOpts, batchId, validatorAddr) +} + +// AttestationsReceivedCount is a free data retrieval call binding the contract method 0x66f94346. +// +// Solidity: function attestationsReceivedCount(uint256 batchId, bytes32 rootHash) view returns(uint256 count) +func (_Contract *ContractCaller) AttestationsReceivedCount(opts *bind.CallOpts, batchId *big.Int, rootHash [32]byte) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "attestationsReceivedCount", batchId, rootHash) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AttestationsReceivedCount is a free data retrieval call binding the contract method 0x66f94346. +// +// Solidity: function attestationsReceivedCount(uint256 batchId, bytes32 rootHash) view returns(uint256 count) +func (_Contract *ContractSession) AttestationsReceivedCount(batchId *big.Int, rootHash [32]byte) (*big.Int, error) { + return _Contract.Contract.AttestationsReceivedCount(&_Contract.CallOpts, batchId, rootHash) +} + +// AttestationsReceivedCount is a free data retrieval call binding the contract method 0x66f94346. +// +// Solidity: function attestationsReceivedCount(uint256 batchId, bytes32 rootHash) view returns(uint256 count) +func (_Contract *ContractCallerSession) AttestationsReceivedCount(batchId *big.Int, rootHash [32]byte) (*big.Int, error) { + return _Contract.Contract.AttestationsReceivedCount(&_Contract.CallOpts, batchId, rootHash) +} + +// BatchIdAttestationStatus is a free data retrieval call binding the contract method 0xa047977d. +// +// Solidity: function batchIdAttestationStatus(uint256 batchId) view returns(bool status) +func (_Contract *ContractCaller) BatchIdAttestationStatus(opts *bind.CallOpts, batchId *big.Int) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "batchIdAttestationStatus", batchId) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// BatchIdAttestationStatus is a free data retrieval call binding the contract method 0xa047977d. +// +// Solidity: function batchIdAttestationStatus(uint256 batchId) view returns(bool status) +func (_Contract *ContractSession) BatchIdAttestationStatus(batchId *big.Int) (bool, error) { + return _Contract.Contract.BatchIdAttestationStatus(&_Contract.CallOpts, batchId) +} + +// BatchIdAttestationStatus is a free data retrieval call binding the contract method 0xa047977d. +// +// Solidity: function batchIdAttestationStatus(uint256 batchId) view returns(bool status) +func (_Contract *ContractCallerSession) BatchIdAttestationStatus(batchId *big.Int) (bool, error) { + return _Contract.Contract.BatchIdAttestationStatus(&_Contract.CallOpts, batchId) +} + +// BatchIdToProjects is a free data retrieval call binding the contract method 0x510c9f4c. +// +// Solidity: function batchIdToProjects(uint256 batchId, uint256 ) view returns(string projectids) +func (_Contract *ContractCaller) BatchIdToProjects(opts *bind.CallOpts, batchId *big.Int, arg1 *big.Int) (string, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "batchIdToProjects", batchId, arg1) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// BatchIdToProjects is a free data retrieval call binding the contract method 0x510c9f4c. +// +// Solidity: function batchIdToProjects(uint256 batchId, uint256 ) view returns(string projectids) +func (_Contract *ContractSession) BatchIdToProjects(batchId *big.Int, arg1 *big.Int) (string, error) { + return _Contract.Contract.BatchIdToProjects(&_Contract.CallOpts, batchId, arg1) +} + +// BatchIdToProjects is a free data retrieval call binding the contract method 0x510c9f4c. +// +// Solidity: function batchIdToProjects(uint256 batchId, uint256 ) view returns(string projectids) +func (_Contract *ContractCallerSession) BatchIdToProjects(batchId *big.Int, arg1 *big.Int) (string, error) { + return _Contract.Contract.BatchIdToProjects(&_Contract.CallOpts, batchId, arg1) +} + +// CurrentEpoch is a free data retrieval call binding the contract method 0x76671808. +// +// Solidity: function currentEpoch() view returns(uint256 begin, uint256 end, uint256 epochId) +func (_Contract *ContractCaller) CurrentEpoch(opts *bind.CallOpts) (struct { + Begin *big.Int + End *big.Int + EpochId *big.Int +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "currentEpoch") + + outstruct := new(struct { + Begin *big.Int + End *big.Int + EpochId *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Begin = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.End = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.EpochId = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// CurrentEpoch is a free data retrieval call binding the contract method 0x76671808. +// +// Solidity: function currentEpoch() view returns(uint256 begin, uint256 end, uint256 epochId) +func (_Contract *ContractSession) CurrentEpoch() (struct { + Begin *big.Int + End *big.Int + EpochId *big.Int +}, error) { + return _Contract.Contract.CurrentEpoch(&_Contract.CallOpts) +} + +// CurrentEpoch is a free data retrieval call binding the contract method 0x76671808. +// +// Solidity: function currentEpoch() view returns(uint256 begin, uint256 end, uint256 epochId) +func (_Contract *ContractCallerSession) CurrentEpoch() (struct { + Begin *big.Int + End *big.Int + EpochId *big.Int +}, error) { + return _Contract.Contract.CurrentEpoch(&_Contract.CallOpts) +} + +// EpochInfo is a free data retrieval call binding the contract method 0x3894228e. +// +// Solidity: function epochInfo(uint256 ) view returns(uint256 timestamp, uint256 blocknumber, uint256 epochEnd) +func (_Contract *ContractCaller) EpochInfo(opts *bind.CallOpts, arg0 *big.Int) (struct { + Timestamp *big.Int + Blocknumber *big.Int + EpochEnd *big.Int +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "epochInfo", arg0) + + outstruct := new(struct { + Timestamp *big.Int + Blocknumber *big.Int + EpochEnd *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Timestamp = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Blocknumber = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.EpochEnd = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// EpochInfo is a free data retrieval call binding the contract method 0x3894228e. +// +// Solidity: function epochInfo(uint256 ) view returns(uint256 timestamp, uint256 blocknumber, uint256 epochEnd) +func (_Contract *ContractSession) EpochInfo(arg0 *big.Int) (struct { + Timestamp *big.Int + Blocknumber *big.Int + EpochEnd *big.Int +}, error) { + return _Contract.Contract.EpochInfo(&_Contract.CallOpts, arg0) +} + +// EpochInfo is a free data retrieval call binding the contract method 0x3894228e. +// +// Solidity: function epochInfo(uint256 ) view returns(uint256 timestamp, uint256 blocknumber, uint256 epochEnd) +func (_Contract *ContractCallerSession) EpochInfo(arg0 *big.Int) (struct { + Timestamp *big.Int + Blocknumber *big.Int + EpochEnd *big.Int +}, error) { + return _Contract.Contract.EpochInfo(&_Contract.CallOpts, arg0) +} + +// GetMasterSnapshotters is a free data retrieval call binding the contract method 0x90110313. +// +// Solidity: function getMasterSnapshotters() view returns(address[]) +func (_Contract *ContractCaller) GetMasterSnapshotters(opts *bind.CallOpts) ([]common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getMasterSnapshotters") + + if err != nil { + return *new([]common.Address), err + } + + out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) + + return out0, err + +} + +// GetMasterSnapshotters is a free data retrieval call binding the contract method 0x90110313. +// +// Solidity: function getMasterSnapshotters() view returns(address[]) +func (_Contract *ContractSession) GetMasterSnapshotters() ([]common.Address, error) { + return _Contract.Contract.GetMasterSnapshotters(&_Contract.CallOpts) +} + +// GetMasterSnapshotters is a free data retrieval call binding the contract method 0x90110313. +// +// Solidity: function getMasterSnapshotters() view returns(address[]) +func (_Contract *ContractCallerSession) GetMasterSnapshotters() ([]common.Address, error) { + return _Contract.Contract.GetMasterSnapshotters(&_Contract.CallOpts) +} + +// GetSnapshotters is a free data retrieval call binding the contract method 0x8deed336. +// +// Solidity: function getSnapshotters() view returns(address[]) +func (_Contract *ContractCaller) GetSnapshotters(opts *bind.CallOpts) ([]common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getSnapshotters") + + if err != nil { + return *new([]common.Address), err + } + + out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) + + return out0, err + +} + +// GetSnapshotters is a free data retrieval call binding the contract method 0x8deed336. +// +// Solidity: function getSnapshotters() view returns(address[]) +func (_Contract *ContractSession) GetSnapshotters() ([]common.Address, error) { + return _Contract.Contract.GetSnapshotters(&_Contract.CallOpts) +} + +// GetSnapshotters is a free data retrieval call binding the contract method 0x8deed336. +// +// Solidity: function getSnapshotters() view returns(address[]) +func (_Contract *ContractCallerSession) GetSnapshotters() ([]common.Address, error) { + return _Contract.Contract.GetSnapshotters(&_Contract.CallOpts) +} + +// GetTotalMasterSnapshotterCount is a free data retrieval call binding the contract method 0xd551672b. +// +// Solidity: function getTotalMasterSnapshotterCount() view returns(uint256) +func (_Contract *ContractCaller) GetTotalMasterSnapshotterCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getTotalMasterSnapshotterCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetTotalMasterSnapshotterCount is a free data retrieval call binding the contract method 0xd551672b. +// +// Solidity: function getTotalMasterSnapshotterCount() view returns(uint256) +func (_Contract *ContractSession) GetTotalMasterSnapshotterCount() (*big.Int, error) { + return _Contract.Contract.GetTotalMasterSnapshotterCount(&_Contract.CallOpts) +} + +// GetTotalMasterSnapshotterCount is a free data retrieval call binding the contract method 0xd551672b. +// +// Solidity: function getTotalMasterSnapshotterCount() view returns(uint256) +func (_Contract *ContractCallerSession) GetTotalMasterSnapshotterCount() (*big.Int, error) { + return _Contract.Contract.GetTotalMasterSnapshotterCount(&_Contract.CallOpts) +} + +// GetTotalSnapshotterCount is a free data retrieval call binding the contract method 0x92ae6f66. +// +// Solidity: function getTotalSnapshotterCount() view returns(uint256) +func (_Contract *ContractCaller) GetTotalSnapshotterCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getTotalSnapshotterCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetTotalSnapshotterCount is a free data retrieval call binding the contract method 0x92ae6f66. +// +// Solidity: function getTotalSnapshotterCount() view returns(uint256) +func (_Contract *ContractSession) GetTotalSnapshotterCount() (*big.Int, error) { + return _Contract.Contract.GetTotalSnapshotterCount(&_Contract.CallOpts) +} + +// GetTotalSnapshotterCount is a free data retrieval call binding the contract method 0x92ae6f66. +// +// Solidity: function getTotalSnapshotterCount() view returns(uint256) +func (_Contract *ContractCallerSession) GetTotalSnapshotterCount() (*big.Int, error) { + return _Contract.Contract.GetTotalSnapshotterCount(&_Contract.CallOpts) +} + +// GetTotalValidatorsCount is a free data retrieval call binding the contract method 0x983d52e7. +// +// Solidity: function getTotalValidatorsCount() view returns(uint256) +func (_Contract *ContractCaller) GetTotalValidatorsCount(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getTotalValidatorsCount") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetTotalValidatorsCount is a free data retrieval call binding the contract method 0x983d52e7. +// +// Solidity: function getTotalValidatorsCount() view returns(uint256) +func (_Contract *ContractSession) GetTotalValidatorsCount() (*big.Int, error) { + return _Contract.Contract.GetTotalValidatorsCount(&_Contract.CallOpts) +} + +// GetTotalValidatorsCount is a free data retrieval call binding the contract method 0x983d52e7. +// +// Solidity: function getTotalValidatorsCount() view returns(uint256) +func (_Contract *ContractCallerSession) GetTotalValidatorsCount() (*big.Int, error) { + return _Contract.Contract.GetTotalValidatorsCount(&_Contract.CallOpts) +} + +// GetValidators is a free data retrieval call binding the contract method 0xb7ab4db5. +// +// Solidity: function getValidators() view returns(address[]) +func (_Contract *ContractCaller) GetValidators(opts *bind.CallOpts) ([]common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "getValidators") + + if err != nil { + return *new([]common.Address), err + } + + out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) + + return out0, err + +} + +// GetValidators is a free data retrieval call binding the contract method 0xb7ab4db5. +// +// Solidity: function getValidators() view returns(address[]) +func (_Contract *ContractSession) GetValidators() ([]common.Address, error) { + return _Contract.Contract.GetValidators(&_Contract.CallOpts) +} + +// GetValidators is a free data retrieval call binding the contract method 0xb7ab4db5. +// +// Solidity: function getValidators() view returns(address[]) +func (_Contract *ContractCallerSession) GetValidators() ([]common.Address, error) { + return _Contract.Contract.GetValidators(&_Contract.CallOpts) +} + +// LastFinalizedSnapshot is a free data retrieval call binding the contract method 0x4ea16b0a. +// +// Solidity: function lastFinalizedSnapshot(string projectId) view returns(uint256 epochId) +func (_Contract *ContractCaller) LastFinalizedSnapshot(opts *bind.CallOpts, projectId string) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "lastFinalizedSnapshot", projectId) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// LastFinalizedSnapshot is a free data retrieval call binding the contract method 0x4ea16b0a. +// +// Solidity: function lastFinalizedSnapshot(string projectId) view returns(uint256 epochId) +func (_Contract *ContractSession) LastFinalizedSnapshot(projectId string) (*big.Int, error) { + return _Contract.Contract.LastFinalizedSnapshot(&_Contract.CallOpts, projectId) +} + +// LastFinalizedSnapshot is a free data retrieval call binding the contract method 0x4ea16b0a. +// +// Solidity: function lastFinalizedSnapshot(string projectId) view returns(uint256 epochId) +func (_Contract *ContractCallerSession) LastFinalizedSnapshot(projectId string) (*big.Int, error) { + return _Contract.Contract.LastFinalizedSnapshot(&_Contract.CallOpts, projectId) +} + +// MasterSnapshotters is a free data retrieval call binding the contract method 0x34b739d9. +// +// Solidity: function masterSnapshotters(address ) view returns(bool) +func (_Contract *ContractCaller) MasterSnapshotters(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "masterSnapshotters", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// MasterSnapshotters is a free data retrieval call binding the contract method 0x34b739d9. +// +// Solidity: function masterSnapshotters(address ) view returns(bool) +func (_Contract *ContractSession) MasterSnapshotters(arg0 common.Address) (bool, error) { + return _Contract.Contract.MasterSnapshotters(&_Contract.CallOpts, arg0) +} + +// MasterSnapshotters is a free data retrieval call binding the contract method 0x34b739d9. +// +// Solidity: function masterSnapshotters(address ) view returns(bool) +func (_Contract *ContractCallerSession) MasterSnapshotters(arg0 common.Address) (bool, error) { + return _Contract.Contract.MasterSnapshotters(&_Contract.CallOpts, arg0) +} + +// MaxAttestationFinalizedRootHash is a free data retrieval call binding the contract method 0xcc542228. +// +// Solidity: function maxAttestationFinalizedRootHash(uint256 batchId) view returns(bytes32 rootHash) +func (_Contract *ContractCaller) MaxAttestationFinalizedRootHash(opts *bind.CallOpts, batchId *big.Int) ([32]byte, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "maxAttestationFinalizedRootHash", batchId) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// MaxAttestationFinalizedRootHash is a free data retrieval call binding the contract method 0xcc542228. +// +// Solidity: function maxAttestationFinalizedRootHash(uint256 batchId) view returns(bytes32 rootHash) +func (_Contract *ContractSession) MaxAttestationFinalizedRootHash(batchId *big.Int) ([32]byte, error) { + return _Contract.Contract.MaxAttestationFinalizedRootHash(&_Contract.CallOpts, batchId) +} + +// MaxAttestationFinalizedRootHash is a free data retrieval call binding the contract method 0xcc542228. +// +// Solidity: function maxAttestationFinalizedRootHash(uint256 batchId) view returns(bytes32 rootHash) +func (_Contract *ContractCallerSession) MaxAttestationFinalizedRootHash(batchId *big.Int) ([32]byte, error) { + return _Contract.Contract.MaxAttestationFinalizedRootHash(&_Contract.CallOpts, batchId) +} + +// MaxAttestationsCount is a free data retrieval call binding the contract method 0x30c8ecb2. +// +// Solidity: function maxAttestationsCount(uint256 batchId) view returns(uint256 count) +func (_Contract *ContractCaller) MaxAttestationsCount(opts *bind.CallOpts, batchId *big.Int) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "maxAttestationsCount", batchId) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxAttestationsCount is a free data retrieval call binding the contract method 0x30c8ecb2. +// +// Solidity: function maxAttestationsCount(uint256 batchId) view returns(uint256 count) +func (_Contract *ContractSession) MaxAttestationsCount(batchId *big.Int) (*big.Int, error) { + return _Contract.Contract.MaxAttestationsCount(&_Contract.CallOpts, batchId) +} + +// MaxAttestationsCount is a free data retrieval call binding the contract method 0x30c8ecb2. +// +// Solidity: function maxAttestationsCount(uint256 batchId) view returns(uint256 count) +func (_Contract *ContractCallerSession) MaxAttestationsCount(batchId *big.Int) (*big.Int, error) { + return _Contract.Contract.MaxAttestationsCount(&_Contract.CallOpts, batchId) +} + +// MaxSnapshotsCid is a free data retrieval call binding the contract method 0xc2b97d4c. +// +// Solidity: function maxSnapshotsCid(string , uint256 ) view returns(string) +func (_Contract *ContractCaller) MaxSnapshotsCid(opts *bind.CallOpts, arg0 string, arg1 *big.Int) (string, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "maxSnapshotsCid", arg0, arg1) + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// MaxSnapshotsCid is a free data retrieval call binding the contract method 0xc2b97d4c. +// +// Solidity: function maxSnapshotsCid(string , uint256 ) view returns(string) +func (_Contract *ContractSession) MaxSnapshotsCid(arg0 string, arg1 *big.Int) (string, error) { + return _Contract.Contract.MaxSnapshotsCid(&_Contract.CallOpts, arg0, arg1) +} + +// MaxSnapshotsCid is a free data retrieval call binding the contract method 0xc2b97d4c. +// +// Solidity: function maxSnapshotsCid(string , uint256 ) view returns(string) +func (_Contract *ContractCallerSession) MaxSnapshotsCid(arg0 string, arg1 *big.Int) (string, error) { + return _Contract.Contract.MaxSnapshotsCid(&_Contract.CallOpts, arg0, arg1) +} + +// MinSubmissionsForConsensus is a free data retrieval call binding the contract method 0x66752e1e. +// +// Solidity: function minSubmissionsForConsensus() view returns(uint256) +func (_Contract *ContractCaller) MinSubmissionsForConsensus(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "minSubmissionsForConsensus") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinSubmissionsForConsensus is a free data retrieval call binding the contract method 0x66752e1e. +// +// Solidity: function minSubmissionsForConsensus() view returns(uint256) +func (_Contract *ContractSession) MinSubmissionsForConsensus() (*big.Int, error) { + return _Contract.Contract.MinSubmissionsForConsensus(&_Contract.CallOpts) +} + +// MinSubmissionsForConsensus is a free data retrieval call binding the contract method 0x66752e1e. +// +// Solidity: function minSubmissionsForConsensus() view returns(uint256) +func (_Contract *ContractCallerSession) MinSubmissionsForConsensus() (*big.Int, error) { + return _Contract.Contract.MinSubmissionsForConsensus(&_Contract.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Contract.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 (_Contract *ContractSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Contract *ContractCallerSession) Owner() (common.Address, error) { + return _Contract.Contract.Owner(&_Contract.CallOpts) +} + +// ProjectFirstEpochId is a free data retrieval call binding the contract method 0xfa30dbe0. +// +// Solidity: function projectFirstEpochId(string projectId) view returns(uint256 epochId) +func (_Contract *ContractCaller) ProjectFirstEpochId(opts *bind.CallOpts, projectId string) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "projectFirstEpochId", projectId) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ProjectFirstEpochId is a free data retrieval call binding the contract method 0xfa30dbe0. +// +// Solidity: function projectFirstEpochId(string projectId) view returns(uint256 epochId) +func (_Contract *ContractSession) ProjectFirstEpochId(projectId string) (*big.Int, error) { + return _Contract.Contract.ProjectFirstEpochId(&_Contract.CallOpts, projectId) +} + +// ProjectFirstEpochId is a free data retrieval call binding the contract method 0xfa30dbe0. +// +// Solidity: function projectFirstEpochId(string projectId) view returns(uint256 epochId) +func (_Contract *ContractCallerSession) ProjectFirstEpochId(projectId string) (*big.Int, error) { + return _Contract.Contract.ProjectFirstEpochId(&_Contract.CallOpts, projectId) +} + +// RecoverAddress is a free data retrieval call binding the contract method 0xc655d7aa. +// +// Solidity: function recoverAddress(bytes32 messageHash, bytes signature) pure returns(address) +func (_Contract *ContractCaller) RecoverAddress(opts *bind.CallOpts, messageHash [32]byte, signature []byte) (common.Address, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "recoverAddress", messageHash, signature) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// RecoverAddress is a free data retrieval call binding the contract method 0xc655d7aa. +// +// Solidity: function recoverAddress(bytes32 messageHash, bytes signature) pure returns(address) +func (_Contract *ContractSession) RecoverAddress(messageHash [32]byte, signature []byte) (common.Address, error) { + return _Contract.Contract.RecoverAddress(&_Contract.CallOpts, messageHash, signature) +} + +// RecoverAddress is a free data retrieval call binding the contract method 0xc655d7aa. +// +// Solidity: function recoverAddress(bytes32 messageHash, bytes signature) pure returns(address) +func (_Contract *ContractCallerSession) RecoverAddress(messageHash [32]byte, signature []byte) (common.Address, error) { + return _Contract.Contract.RecoverAddress(&_Contract.CallOpts, messageHash, signature) +} + +// SnapshotStatus is a free data retrieval call binding the contract method 0x3aaf384d. +// +// Solidity: function snapshotStatus(string , uint256 ) view returns(uint8 status, string snapshotCid, uint256 timestamp) +func (_Contract *ContractCaller) SnapshotStatus(opts *bind.CallOpts, arg0 string, arg1 *big.Int) (struct { + Status uint8 + SnapshotCid string + Timestamp *big.Int +}, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "snapshotStatus", arg0, arg1) + + outstruct := new(struct { + Status uint8 + SnapshotCid string + Timestamp *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Status = *abi.ConvertType(out[0], new(uint8)).(*uint8) + outstruct.SnapshotCid = *abi.ConvertType(out[1], new(string)).(*string) + outstruct.Timestamp = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// SnapshotStatus is a free data retrieval call binding the contract method 0x3aaf384d. +// +// Solidity: function snapshotStatus(string , uint256 ) view returns(uint8 status, string snapshotCid, uint256 timestamp) +func (_Contract *ContractSession) SnapshotStatus(arg0 string, arg1 *big.Int) (struct { + Status uint8 + SnapshotCid string + Timestamp *big.Int +}, error) { + return _Contract.Contract.SnapshotStatus(&_Contract.CallOpts, arg0, arg1) +} + +// SnapshotStatus is a free data retrieval call binding the contract method 0x3aaf384d. +// +// Solidity: function snapshotStatus(string , uint256 ) view returns(uint8 status, string snapshotCid, uint256 timestamp) +func (_Contract *ContractCallerSession) SnapshotStatus(arg0 string, arg1 *big.Int) (struct { + Status uint8 + SnapshotCid string + Timestamp *big.Int +}, error) { + return _Contract.Contract.SnapshotStatus(&_Contract.CallOpts, arg0, arg1) +} + +// SnapshotSubmissionWindow is a free data retrieval call binding the contract method 0x059080f6. +// +// Solidity: function snapshotSubmissionWindow() view returns(uint256) +func (_Contract *ContractCaller) SnapshotSubmissionWindow(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "snapshotSubmissionWindow") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// SnapshotSubmissionWindow is a free data retrieval call binding the contract method 0x059080f6. +// +// Solidity: function snapshotSubmissionWindow() view returns(uint256) +func (_Contract *ContractSession) SnapshotSubmissionWindow() (*big.Int, error) { + return _Contract.Contract.SnapshotSubmissionWindow(&_Contract.CallOpts) +} + +// SnapshotSubmissionWindow is a free data retrieval call binding the contract method 0x059080f6. +// +// Solidity: function snapshotSubmissionWindow() view returns(uint256) +func (_Contract *ContractCallerSession) SnapshotSubmissionWindow() (*big.Int, error) { + return _Contract.Contract.SnapshotSubmissionWindow(&_Contract.CallOpts) +} + +// Verify is a free data retrieval call binding the contract method 0xc22e1a53. +// +// Solidity: function verify(string snapshotCid, uint256 epochId, string projectId, (uint256,string,uint256,string) request, bytes signature, address signer) view returns(bool) +func (_Contract *ContractCaller) Verify(opts *bind.CallOpts, snapshotCid string, epochId *big.Int, projectId string, request PowerloomProtocolStateRequest, signature []byte, signer common.Address) (bool, error) { + var out []interface{} + err := _Contract.contract.Call(opts, &out, "verify", snapshotCid, epochId, projectId, request, signature, signer) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// Verify is a free data retrieval call binding the contract method 0xc22e1a53. +// +// Solidity: function verify(string snapshotCid, uint256 epochId, string projectId, (uint256,string,uint256,string) request, bytes signature, address signer) view returns(bool) +func (_Contract *ContractSession) Verify(snapshotCid string, epochId *big.Int, projectId string, request PowerloomProtocolStateRequest, signature []byte, signer common.Address) (bool, error) { + return _Contract.Contract.Verify(&_Contract.CallOpts, snapshotCid, epochId, projectId, request, signature, signer) +} + +// Verify is a free data retrieval call binding the contract method 0xc22e1a53. +// +// Solidity: function verify(string snapshotCid, uint256 epochId, string projectId, (uint256,string,uint256,string) request, bytes signature, address signer) view returns(bool) +func (_Contract *ContractCallerSession) Verify(snapshotCid string, epochId *big.Int, projectId string, request PowerloomProtocolStateRequest, signature []byte, signer common.Address) (bool, error) { + return _Contract.Contract.Verify(&_Contract.CallOpts, snapshotCid, epochId, projectId, request, signature, signer) +} + +// ForceSkipEpoch is a paid mutator transaction binding the contract method 0xf537a3e2. +// +// Solidity: function forceSkipEpoch(uint256 begin, uint256 end) returns() +func (_Contract *ContractTransactor) ForceSkipEpoch(opts *bind.TransactOpts, begin *big.Int, end *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "forceSkipEpoch", begin, end) +} + +// ForceSkipEpoch is a paid mutator transaction binding the contract method 0xf537a3e2. +// +// Solidity: function forceSkipEpoch(uint256 begin, uint256 end) returns() +func (_Contract *ContractSession) ForceSkipEpoch(begin *big.Int, end *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ForceSkipEpoch(&_Contract.TransactOpts, begin, end) +} + +// ForceSkipEpoch is a paid mutator transaction binding the contract method 0xf537a3e2. +// +// Solidity: function forceSkipEpoch(uint256 begin, uint256 end) returns() +func (_Contract *ContractTransactorSession) ForceSkipEpoch(begin *big.Int, end *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ForceSkipEpoch(&_Contract.TransactOpts, begin, end) +} + +// ReleaseEpoch is a paid mutator transaction binding the contract method 0x132c290f. +// +// Solidity: function releaseEpoch(uint256 begin, uint256 end) returns() +func (_Contract *ContractTransactor) ReleaseEpoch(opts *bind.TransactOpts, begin *big.Int, end *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "releaseEpoch", begin, end) +} + +// ReleaseEpoch is a paid mutator transaction binding the contract method 0x132c290f. +// +// Solidity: function releaseEpoch(uint256 begin, uint256 end) returns() +func (_Contract *ContractSession) ReleaseEpoch(begin *big.Int, end *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ReleaseEpoch(&_Contract.TransactOpts, begin, end) +} + +// ReleaseEpoch is a paid mutator transaction binding the contract method 0x132c290f. +// +// Solidity: function releaseEpoch(uint256 begin, uint256 end) returns() +func (_Contract *ContractTransactorSession) ReleaseEpoch(begin *big.Int, end *big.Int) (*types.Transaction, error) { + return _Contract.Contract.ReleaseEpoch(&_Contract.TransactOpts, begin, end) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Contract *ContractTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Contract.Contract.RenounceOwnership(&_Contract.TransactOpts) +} + +// SubmitBatchAttestation is a paid mutator transaction binding the contract method 0x70dfe736. +// +// Solidity: function submitBatchAttestation(uint256 batchId, uint256 epochId, bytes32 finalizedCidsRootHash) returns() +func (_Contract *ContractTransactor) SubmitBatchAttestation(opts *bind.TransactOpts, batchId *big.Int, epochId *big.Int, finalizedCidsRootHash [32]byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "submitBatchAttestation", batchId, epochId, finalizedCidsRootHash) +} + +// SubmitBatchAttestation is a paid mutator transaction binding the contract method 0x70dfe736. +// +// Solidity: function submitBatchAttestation(uint256 batchId, uint256 epochId, bytes32 finalizedCidsRootHash) returns() +func (_Contract *ContractSession) SubmitBatchAttestation(batchId *big.Int, epochId *big.Int, finalizedCidsRootHash [32]byte) (*types.Transaction, error) { + return _Contract.Contract.SubmitBatchAttestation(&_Contract.TransactOpts, batchId, epochId, finalizedCidsRootHash) +} + +// SubmitBatchAttestation is a paid mutator transaction binding the contract method 0x70dfe736. +// +// Solidity: function submitBatchAttestation(uint256 batchId, uint256 epochId, bytes32 finalizedCidsRootHash) returns() +func (_Contract *ContractTransactorSession) SubmitBatchAttestation(batchId *big.Int, epochId *big.Int, finalizedCidsRootHash [32]byte) (*types.Transaction, error) { + return _Contract.Contract.SubmitBatchAttestation(&_Contract.TransactOpts, batchId, epochId, finalizedCidsRootHash) +} + +// SubmitSubmissionBatch is a paid mutator transaction binding the contract method 0xca467e62. +// +// Solidity: function submitSubmissionBatch(string batchCid, uint256 batchId, uint256 epochId, string[] projectIds, string[] snapshotCids) returns() +func (_Contract *ContractTransactor) SubmitSubmissionBatch(opts *bind.TransactOpts, batchCid string, batchId *big.Int, epochId *big.Int, projectIds []string, snapshotCids []string) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "submitSubmissionBatch", batchCid, batchId, epochId, projectIds, snapshotCids) +} + +// SubmitSubmissionBatch is a paid mutator transaction binding the contract method 0xca467e62. +// +// Solidity: function submitSubmissionBatch(string batchCid, uint256 batchId, uint256 epochId, string[] projectIds, string[] snapshotCids) returns() +func (_Contract *ContractSession) SubmitSubmissionBatch(batchCid string, batchId *big.Int, epochId *big.Int, projectIds []string, snapshotCids []string) (*types.Transaction, error) { + return _Contract.Contract.SubmitSubmissionBatch(&_Contract.TransactOpts, batchCid, batchId, epochId, projectIds, snapshotCids) +} + +// SubmitSubmissionBatch is a paid mutator transaction binding the contract method 0xca467e62. +// +// Solidity: function submitSubmissionBatch(string batchCid, uint256 batchId, uint256 epochId, string[] projectIds, string[] snapshotCids) returns() +func (_Contract *ContractTransactorSession) SubmitSubmissionBatch(batchCid string, batchId *big.Int, epochId *big.Int, projectIds []string, snapshotCids []string) (*types.Transaction, error) { + return _Contract.Contract.SubmitSubmissionBatch(&_Contract.TransactOpts, batchCid, batchId, epochId, projectIds, snapshotCids) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Contract *ContractTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Contract.Contract.TransferOwnership(&_Contract.TransactOpts, newOwner) +} + +// UpdateAllSnapshotters is a paid mutator transaction binding the contract method 0xa88d5a46. +// +// Solidity: function updateAllSnapshotters(address[] _snapshotters, bool[] _status) returns() +func (_Contract *ContractTransactor) UpdateAllSnapshotters(opts *bind.TransactOpts, _snapshotters []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "updateAllSnapshotters", _snapshotters, _status) +} + +// UpdateAllSnapshotters is a paid mutator transaction binding the contract method 0xa88d5a46. +// +// Solidity: function updateAllSnapshotters(address[] _snapshotters, bool[] _status) returns() +func (_Contract *ContractSession) UpdateAllSnapshotters(_snapshotters []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.Contract.UpdateAllSnapshotters(&_Contract.TransactOpts, _snapshotters, _status) +} + +// UpdateAllSnapshotters is a paid mutator transaction binding the contract method 0xa88d5a46. +// +// Solidity: function updateAllSnapshotters(address[] _snapshotters, bool[] _status) returns() +func (_Contract *ContractTransactorSession) UpdateAllSnapshotters(_snapshotters []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.Contract.UpdateAllSnapshotters(&_Contract.TransactOpts, _snapshotters, _status) +} + +// UpdateMasterSnapshotters is a paid mutator transaction binding the contract method 0x8f9eacf3. +// +// Solidity: function updateMasterSnapshotters(address[] _snapshotters, bool[] _status) returns() +func (_Contract *ContractTransactor) UpdateMasterSnapshotters(opts *bind.TransactOpts, _snapshotters []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "updateMasterSnapshotters", _snapshotters, _status) +} + +// UpdateMasterSnapshotters is a paid mutator transaction binding the contract method 0x8f9eacf3. +// +// Solidity: function updateMasterSnapshotters(address[] _snapshotters, bool[] _status) returns() +func (_Contract *ContractSession) UpdateMasterSnapshotters(_snapshotters []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.Contract.UpdateMasterSnapshotters(&_Contract.TransactOpts, _snapshotters, _status) +} + +// UpdateMasterSnapshotters is a paid mutator transaction binding the contract method 0x8f9eacf3. +// +// Solidity: function updateMasterSnapshotters(address[] _snapshotters, bool[] _status) returns() +func (_Contract *ContractTransactorSession) UpdateMasterSnapshotters(_snapshotters []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.Contract.UpdateMasterSnapshotters(&_Contract.TransactOpts, _snapshotters, _status) +} + +// UpdateMinSnapshottersForConsensus is a paid mutator transaction binding the contract method 0x38deacd3. +// +// Solidity: function updateMinSnapshottersForConsensus(uint256 _minSubmissionsForConsensus) returns() +func (_Contract *ContractTransactor) UpdateMinSnapshottersForConsensus(opts *bind.TransactOpts, _minSubmissionsForConsensus *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "updateMinSnapshottersForConsensus", _minSubmissionsForConsensus) +} + +// UpdateMinSnapshottersForConsensus is a paid mutator transaction binding the contract method 0x38deacd3. +// +// Solidity: function updateMinSnapshottersForConsensus(uint256 _minSubmissionsForConsensus) returns() +func (_Contract *ContractSession) UpdateMinSnapshottersForConsensus(_minSubmissionsForConsensus *big.Int) (*types.Transaction, error) { + return _Contract.Contract.UpdateMinSnapshottersForConsensus(&_Contract.TransactOpts, _minSubmissionsForConsensus) +} + +// UpdateMinSnapshottersForConsensus is a paid mutator transaction binding the contract method 0x38deacd3. +// +// Solidity: function updateMinSnapshottersForConsensus(uint256 _minSubmissionsForConsensus) returns() +func (_Contract *ContractTransactorSession) UpdateMinSnapshottersForConsensus(_minSubmissionsForConsensus *big.Int) (*types.Transaction, error) { + return _Contract.Contract.UpdateMinSnapshottersForConsensus(&_Contract.TransactOpts, _minSubmissionsForConsensus) +} + +// UpdateSnapshotSubmissionWindow is a paid mutator transaction binding the contract method 0x9b2f89ce. +// +// Solidity: function updateSnapshotSubmissionWindow(uint256 newsnapshotSubmissionWindow) returns() +func (_Contract *ContractTransactor) UpdateSnapshotSubmissionWindow(opts *bind.TransactOpts, newsnapshotSubmissionWindow *big.Int) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "updateSnapshotSubmissionWindow", newsnapshotSubmissionWindow) +} + +// UpdateSnapshotSubmissionWindow is a paid mutator transaction binding the contract method 0x9b2f89ce. +// +// Solidity: function updateSnapshotSubmissionWindow(uint256 newsnapshotSubmissionWindow) returns() +func (_Contract *ContractSession) UpdateSnapshotSubmissionWindow(newsnapshotSubmissionWindow *big.Int) (*types.Transaction, error) { + return _Contract.Contract.UpdateSnapshotSubmissionWindow(&_Contract.TransactOpts, newsnapshotSubmissionWindow) +} + +// UpdateSnapshotSubmissionWindow is a paid mutator transaction binding the contract method 0x9b2f89ce. +// +// Solidity: function updateSnapshotSubmissionWindow(uint256 newsnapshotSubmissionWindow) returns() +func (_Contract *ContractTransactorSession) UpdateSnapshotSubmissionWindow(newsnapshotSubmissionWindow *big.Int) (*types.Transaction, error) { + return _Contract.Contract.UpdateSnapshotSubmissionWindow(&_Contract.TransactOpts, newsnapshotSubmissionWindow) +} + +// UpdateValidators is a paid mutator transaction binding the contract method 0x1b0b3ae3. +// +// Solidity: function updateValidators(address[] _validators, bool[] _status) returns() +func (_Contract *ContractTransactor) UpdateValidators(opts *bind.TransactOpts, _validators []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "updateValidators", _validators, _status) +} + +// UpdateValidators is a paid mutator transaction binding the contract method 0x1b0b3ae3. +// +// Solidity: function updateValidators(address[] _validators, bool[] _status) returns() +func (_Contract *ContractSession) UpdateValidators(_validators []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.Contract.UpdateValidators(&_Contract.TransactOpts, _validators, _status) +} + +// UpdateValidators is a paid mutator transaction binding the contract method 0x1b0b3ae3. +// +// Solidity: function updateValidators(address[] _validators, bool[] _status) returns() +func (_Contract *ContractTransactorSession) UpdateValidators(_validators []common.Address, _status []bool) (*types.Transaction, error) { + return _Contract.Contract.UpdateValidators(&_Contract.TransactOpts, _validators, _status) +} + +// ContractDelayedSnapshotSubmittedIterator is returned from FilterDelayedSnapshotSubmitted and is used to iterate over the raw logs and unpacked data for DelayedSnapshotSubmitted events raised by the Contract contract. +type ContractDelayedSnapshotSubmittedIterator struct { + Event *ContractDelayedSnapshotSubmitted // 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 *ContractDelayedSnapshotSubmittedIterator) 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(ContractDelayedSnapshotSubmitted) + 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(ContractDelayedSnapshotSubmitted) + 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 *ContractDelayedSnapshotSubmittedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractDelayedSnapshotSubmittedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractDelayedSnapshotSubmitted represents a DelayedSnapshotSubmitted event raised by the Contract contract. +type ContractDelayedSnapshotSubmitted struct { + SnapshotterAddr common.Address + SnapshotCid string + EpochId *big.Int + ProjectId string + Timestamp *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelayedSnapshotSubmitted is a free log retrieval operation binding the contract event 0xa4b1762053ee970f50692b6936d4e58a9a01291449e4da16bdf758891c8de752. +// +// Solidity: event DelayedSnapshotSubmitted(address indexed snapshotterAddr, string snapshotCid, uint256 indexed epochId, string projectId, uint256 timestamp) +func (_Contract *ContractFilterer) FilterDelayedSnapshotSubmitted(opts *bind.FilterOpts, snapshotterAddr []common.Address, epochId []*big.Int) (*ContractDelayedSnapshotSubmittedIterator, error) { + + var snapshotterAddrRule []interface{} + for _, snapshotterAddrItem := range snapshotterAddr { + snapshotterAddrRule = append(snapshotterAddrRule, snapshotterAddrItem) + } + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "DelayedSnapshotSubmitted", snapshotterAddrRule, epochIdRule) + if err != nil { + return nil, err + } + return &ContractDelayedSnapshotSubmittedIterator{contract: _Contract.contract, event: "DelayedSnapshotSubmitted", logs: logs, sub: sub}, nil +} + +// WatchDelayedSnapshotSubmitted is a free log subscription operation binding the contract event 0xa4b1762053ee970f50692b6936d4e58a9a01291449e4da16bdf758891c8de752. +// +// Solidity: event DelayedSnapshotSubmitted(address indexed snapshotterAddr, string snapshotCid, uint256 indexed epochId, string projectId, uint256 timestamp) +func (_Contract *ContractFilterer) WatchDelayedSnapshotSubmitted(opts *bind.WatchOpts, sink chan<- *ContractDelayedSnapshotSubmitted, snapshotterAddr []common.Address, epochId []*big.Int) (event.Subscription, error) { + + var snapshotterAddrRule []interface{} + for _, snapshotterAddrItem := range snapshotterAddr { + snapshotterAddrRule = append(snapshotterAddrRule, snapshotterAddrItem) + } + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "DelayedSnapshotSubmitted", snapshotterAddrRule, epochIdRule) + 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(ContractDelayedSnapshotSubmitted) + if err := _Contract.contract.UnpackLog(event, "DelayedSnapshotSubmitted", 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 +} + +// ParseDelayedSnapshotSubmitted is a log parse operation binding the contract event 0xa4b1762053ee970f50692b6936d4e58a9a01291449e4da16bdf758891c8de752. +// +// Solidity: event DelayedSnapshotSubmitted(address indexed snapshotterAddr, string snapshotCid, uint256 indexed epochId, string projectId, uint256 timestamp) +func (_Contract *ContractFilterer) ParseDelayedSnapshotSubmitted(log types.Log) (*ContractDelayedSnapshotSubmitted, error) { + event := new(ContractDelayedSnapshotSubmitted) + if err := _Contract.contract.UnpackLog(event, "DelayedSnapshotSubmitted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractEpochReleasedIterator is returned from FilterEpochReleased and is used to iterate over the raw logs and unpacked data for EpochReleased events raised by the Contract contract. +type ContractEpochReleasedIterator struct { + Event *ContractEpochReleased // 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 *ContractEpochReleasedIterator) 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(ContractEpochReleased) + 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(ContractEpochReleased) + 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 *ContractEpochReleasedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractEpochReleasedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractEpochReleased represents a EpochReleased event raised by the Contract contract. +type ContractEpochReleased struct { + EpochId *big.Int + Begin *big.Int + End *big.Int + Timestamp *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEpochReleased is a free log retrieval operation binding the contract event 0x108f87075a74f81fa2271fdf9fc0883a1811431182601fc65d24513970336640. +// +// Solidity: event EpochReleased(uint256 indexed epochId, uint256 begin, uint256 end, uint256 timestamp) +func (_Contract *ContractFilterer) FilterEpochReleased(opts *bind.FilterOpts, epochId []*big.Int) (*ContractEpochReleasedIterator, error) { + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "EpochReleased", epochIdRule) + if err != nil { + return nil, err + } + return &ContractEpochReleasedIterator{contract: _Contract.contract, event: "EpochReleased", logs: logs, sub: sub}, nil +} + +// WatchEpochReleased is a free log subscription operation binding the contract event 0x108f87075a74f81fa2271fdf9fc0883a1811431182601fc65d24513970336640. +// +// Solidity: event EpochReleased(uint256 indexed epochId, uint256 begin, uint256 end, uint256 timestamp) +func (_Contract *ContractFilterer) WatchEpochReleased(opts *bind.WatchOpts, sink chan<- *ContractEpochReleased, epochId []*big.Int) (event.Subscription, error) { + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "EpochReleased", epochIdRule) + 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(ContractEpochReleased) + if err := _Contract.contract.UnpackLog(event, "EpochReleased", 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 +} + +// ParseEpochReleased is a log parse operation binding the contract event 0x108f87075a74f81fa2271fdf9fc0883a1811431182601fc65d24513970336640. +// +// Solidity: event EpochReleased(uint256 indexed epochId, uint256 begin, uint256 end, uint256 timestamp) +func (_Contract *ContractFilterer) ParseEpochReleased(log types.Log) (*ContractEpochReleased, error) { + event := new(ContractEpochReleased) + if err := _Contract.contract.UnpackLog(event, "EpochReleased", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Contract contract. +type ContractOwnershipTransferredIterator struct { + Event *ContractOwnershipTransferred // 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 *ContractOwnershipTransferredIterator) 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(ContractOwnershipTransferred) + 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(ContractOwnershipTransferred) + 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 *ContractOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractOwnershipTransferred represents a OwnershipTransferred event raised by the Contract contract. +type ContractOwnershipTransferred 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 (_Contract *ContractFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ContractOwnershipTransferredIterator, 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 := _Contract.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ContractOwnershipTransferredIterator{contract: _Contract.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 (_Contract *ContractFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ContractOwnershipTransferred, 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 := _Contract.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(ContractOwnershipTransferred) + if err := _Contract.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 (_Contract *ContractFilterer) ParseOwnershipTransferred(log types.Log) (*ContractOwnershipTransferred, error) { + event := new(ContractOwnershipTransferred) + if err := _Contract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractProjectsUpdatedIterator is returned from FilterProjectsUpdated and is used to iterate over the raw logs and unpacked data for ProjectsUpdated events raised by the Contract contract. +type ContractProjectsUpdatedIterator struct { + Event *ContractProjectsUpdated // 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 *ContractProjectsUpdatedIterator) 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(ContractProjectsUpdated) + 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(ContractProjectsUpdated) + 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 *ContractProjectsUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractProjectsUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractProjectsUpdated represents a ProjectsUpdated event raised by the Contract contract. +type ContractProjectsUpdated struct { + ProjectId string + Allowed bool + EnableEpochId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterProjectsUpdated is a free log retrieval operation binding the contract event 0x96103183e0788ea5e37ef5b430d1e822a85c862531186baeea043a82dcbcb924. +// +// Solidity: event ProjectsUpdated(string projectId, bool allowed, uint256 enableEpochId) +func (_Contract *ContractFilterer) FilterProjectsUpdated(opts *bind.FilterOpts) (*ContractProjectsUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "ProjectsUpdated") + if err != nil { + return nil, err + } + return &ContractProjectsUpdatedIterator{contract: _Contract.contract, event: "ProjectsUpdated", logs: logs, sub: sub}, nil +} + +// WatchProjectsUpdated is a free log subscription operation binding the contract event 0x96103183e0788ea5e37ef5b430d1e822a85c862531186baeea043a82dcbcb924. +// +// Solidity: event ProjectsUpdated(string projectId, bool allowed, uint256 enableEpochId) +func (_Contract *ContractFilterer) WatchProjectsUpdated(opts *bind.WatchOpts, sink chan<- *ContractProjectsUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "ProjectsUpdated") + 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(ContractProjectsUpdated) + if err := _Contract.contract.UnpackLog(event, "ProjectsUpdated", 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 +} + +// ParseProjectsUpdated is a log parse operation binding the contract event 0x96103183e0788ea5e37ef5b430d1e822a85c862531186baeea043a82dcbcb924. +// +// Solidity: event ProjectsUpdated(string projectId, bool allowed, uint256 enableEpochId) +func (_Contract *ContractFilterer) ParseProjectsUpdated(log types.Log) (*ContractProjectsUpdated, error) { + event := new(ContractProjectsUpdated) + if err := _Contract.contract.UnpackLog(event, "ProjectsUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractSnapshotBatchFinalizedIterator is returned from FilterSnapshotBatchFinalized and is used to iterate over the raw logs and unpacked data for SnapshotBatchFinalized events raised by the Contract contract. +type ContractSnapshotBatchFinalizedIterator struct { + Event *ContractSnapshotBatchFinalized // 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 *ContractSnapshotBatchFinalizedIterator) 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(ContractSnapshotBatchFinalized) + 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(ContractSnapshotBatchFinalized) + 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 *ContractSnapshotBatchFinalizedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractSnapshotBatchFinalizedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractSnapshotBatchFinalized represents a SnapshotBatchFinalized event raised by the Contract contract. +type ContractSnapshotBatchFinalized struct { + EpochId *big.Int + BatchId *big.Int + Timestamp *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSnapshotBatchFinalized is a free log retrieval operation binding the contract event 0x5234f54aa94bd8e44799076dbbe59404d669eb94833cfbff03360715b9820e40. +// +// Solidity: event SnapshotBatchFinalized(uint256 indexed epochId, uint256 indexed batchId, uint256 timestamp) +func (_Contract *ContractFilterer) FilterSnapshotBatchFinalized(opts *bind.FilterOpts, epochId []*big.Int, batchId []*big.Int) (*ContractSnapshotBatchFinalizedIterator, error) { + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + var batchIdRule []interface{} + for _, batchIdItem := range batchId { + batchIdRule = append(batchIdRule, batchIdItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "SnapshotBatchFinalized", epochIdRule, batchIdRule) + if err != nil { + return nil, err + } + return &ContractSnapshotBatchFinalizedIterator{contract: _Contract.contract, event: "SnapshotBatchFinalized", logs: logs, sub: sub}, nil +} + +// WatchSnapshotBatchFinalized is a free log subscription operation binding the contract event 0x5234f54aa94bd8e44799076dbbe59404d669eb94833cfbff03360715b9820e40. +// +// Solidity: event SnapshotBatchFinalized(uint256 indexed epochId, uint256 indexed batchId, uint256 timestamp) +func (_Contract *ContractFilterer) WatchSnapshotBatchFinalized(opts *bind.WatchOpts, sink chan<- *ContractSnapshotBatchFinalized, epochId []*big.Int, batchId []*big.Int) (event.Subscription, error) { + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + var batchIdRule []interface{} + for _, batchIdItem := range batchId { + batchIdRule = append(batchIdRule, batchIdItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "SnapshotBatchFinalized", epochIdRule, batchIdRule) + 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(ContractSnapshotBatchFinalized) + if err := _Contract.contract.UnpackLog(event, "SnapshotBatchFinalized", 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 +} + +// ParseSnapshotBatchFinalized is a log parse operation binding the contract event 0x5234f54aa94bd8e44799076dbbe59404d669eb94833cfbff03360715b9820e40. +// +// Solidity: event SnapshotBatchFinalized(uint256 indexed epochId, uint256 indexed batchId, uint256 timestamp) +func (_Contract *ContractFilterer) ParseSnapshotBatchFinalized(log types.Log) (*ContractSnapshotBatchFinalized, error) { + event := new(ContractSnapshotBatchFinalized) + if err := _Contract.contract.UnpackLog(event, "SnapshotBatchFinalized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractSnapshotBatchSubmittedIterator is returned from FilterSnapshotBatchSubmitted and is used to iterate over the raw logs and unpacked data for SnapshotBatchSubmitted events raised by the Contract contract. +type ContractSnapshotBatchSubmittedIterator struct { + Event *ContractSnapshotBatchSubmitted // 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 *ContractSnapshotBatchSubmittedIterator) 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(ContractSnapshotBatchSubmitted) + 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(ContractSnapshotBatchSubmitted) + 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 *ContractSnapshotBatchSubmittedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractSnapshotBatchSubmittedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractSnapshotBatchSubmitted represents a SnapshotBatchSubmitted event raised by the Contract contract. +type ContractSnapshotBatchSubmitted struct { + BatchId *big.Int + BatchCid string + EpochId *big.Int + Timestamp *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSnapshotBatchSubmitted is a free log retrieval operation binding the contract event 0x71f7e37d775c89547d94f23aae240bec29afd96657dc34975abbdd326e8e6d5d. +// +// Solidity: event SnapshotBatchSubmitted(uint256 batchId, string batchCid, uint256 indexed epochId, uint256 timestamp) +func (_Contract *ContractFilterer) FilterSnapshotBatchSubmitted(opts *bind.FilterOpts, epochId []*big.Int) (*ContractSnapshotBatchSubmittedIterator, error) { + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "SnapshotBatchSubmitted", epochIdRule) + if err != nil { + return nil, err + } + return &ContractSnapshotBatchSubmittedIterator{contract: _Contract.contract, event: "SnapshotBatchSubmitted", logs: logs, sub: sub}, nil +} + +// WatchSnapshotBatchSubmitted is a free log subscription operation binding the contract event 0x71f7e37d775c89547d94f23aae240bec29afd96657dc34975abbdd326e8e6d5d. +// +// Solidity: event SnapshotBatchSubmitted(uint256 batchId, string batchCid, uint256 indexed epochId, uint256 timestamp) +func (_Contract *ContractFilterer) WatchSnapshotBatchSubmitted(opts *bind.WatchOpts, sink chan<- *ContractSnapshotBatchSubmitted, epochId []*big.Int) (event.Subscription, error) { + + var epochIdRule []interface{} + for _, epochIdItem := range epochId { + epochIdRule = append(epochIdRule, epochIdItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "SnapshotBatchSubmitted", epochIdRule) + 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(ContractSnapshotBatchSubmitted) + if err := _Contract.contract.UnpackLog(event, "SnapshotBatchSubmitted", 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 +} + +// ParseSnapshotBatchSubmitted is a log parse operation binding the contract event 0x71f7e37d775c89547d94f23aae240bec29afd96657dc34975abbdd326e8e6d5d. +// +// Solidity: event SnapshotBatchSubmitted(uint256 batchId, string batchCid, uint256 indexed epochId, uint256 timestamp) +func (_Contract *ContractFilterer) ParseSnapshotBatchSubmitted(log types.Log) (*ContractSnapshotBatchSubmitted, error) { + event := new(ContractSnapshotBatchSubmitted) + if err := _Contract.contract.UnpackLog(event, "SnapshotBatchSubmitted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractValidatorsUpdatedIterator is returned from FilterValidatorsUpdated and is used to iterate over the raw logs and unpacked data for ValidatorsUpdated events raised by the Contract contract. +type ContractValidatorsUpdatedIterator struct { + Event *ContractValidatorsUpdated // 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 *ContractValidatorsUpdatedIterator) 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(ContractValidatorsUpdated) + 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(ContractValidatorsUpdated) + 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 *ContractValidatorsUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractValidatorsUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractValidatorsUpdated represents a ValidatorsUpdated event raised by the Contract contract. +type ContractValidatorsUpdated struct { + ValidatorAddress common.Address + Allowed bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidatorsUpdated is a free log retrieval operation binding the contract event 0x7f3079c058f3e3dee87048158309898b46e9741ff53b6c7a3afac7c370649afc. +// +// Solidity: event ValidatorsUpdated(address validatorAddress, bool allowed) +func (_Contract *ContractFilterer) FilterValidatorsUpdated(opts *bind.FilterOpts) (*ContractValidatorsUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "ValidatorsUpdated") + if err != nil { + return nil, err + } + return &ContractValidatorsUpdatedIterator{contract: _Contract.contract, event: "ValidatorsUpdated", logs: logs, sub: sub}, nil +} + +// WatchValidatorsUpdated is a free log subscription operation binding the contract event 0x7f3079c058f3e3dee87048158309898b46e9741ff53b6c7a3afac7c370649afc. +// +// Solidity: event ValidatorsUpdated(address validatorAddress, bool allowed) +func (_Contract *ContractFilterer) WatchValidatorsUpdated(opts *bind.WatchOpts, sink chan<- *ContractValidatorsUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "ValidatorsUpdated") + 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(ContractValidatorsUpdated) + if err := _Contract.contract.UnpackLog(event, "ValidatorsUpdated", 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 +} + +// ParseValidatorsUpdated is a log parse operation binding the contract event 0x7f3079c058f3e3dee87048158309898b46e9741ff53b6c7a3afac7c370649afc. +// +// Solidity: event ValidatorsUpdated(address validatorAddress, bool allowed) +func (_Contract *ContractFilterer) ParseValidatorsUpdated(log types.Log) (*ContractValidatorsUpdated, error) { + event := new(ContractValidatorsUpdated) + if err := _Contract.contract.UnpackLog(event, "ValidatorsUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractAllSnapshottersUpdatedIterator is returned from FilterAllSnapshottersUpdated and is used to iterate over the raw logs and unpacked data for AllSnapshottersUpdated events raised by the Contract contract. +type ContractAllSnapshottersUpdatedIterator struct { + Event *ContractAllSnapshottersUpdated // 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 *ContractAllSnapshottersUpdatedIterator) 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(ContractAllSnapshottersUpdated) + 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(ContractAllSnapshottersUpdated) + 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 *ContractAllSnapshottersUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractAllSnapshottersUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractAllSnapshottersUpdated represents a AllSnapshottersUpdated event raised by the Contract contract. +type ContractAllSnapshottersUpdated struct { + SnapshotterAddress common.Address + Allowed bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAllSnapshottersUpdated is a free log retrieval operation binding the contract event 0x743e47fbcd2e3a64a2ab8f5dcdeb4c17f892c17c9f6ab58d3a5c235953d60058. +// +// Solidity: event allSnapshottersUpdated(address snapshotterAddress, bool allowed) +func (_Contract *ContractFilterer) FilterAllSnapshottersUpdated(opts *bind.FilterOpts) (*ContractAllSnapshottersUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "allSnapshottersUpdated") + if err != nil { + return nil, err + } + return &ContractAllSnapshottersUpdatedIterator{contract: _Contract.contract, event: "allSnapshottersUpdated", logs: logs, sub: sub}, nil +} + +// WatchAllSnapshottersUpdated is a free log subscription operation binding the contract event 0x743e47fbcd2e3a64a2ab8f5dcdeb4c17f892c17c9f6ab58d3a5c235953d60058. +// +// Solidity: event allSnapshottersUpdated(address snapshotterAddress, bool allowed) +func (_Contract *ContractFilterer) WatchAllSnapshottersUpdated(opts *bind.WatchOpts, sink chan<- *ContractAllSnapshottersUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "allSnapshottersUpdated") + 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(ContractAllSnapshottersUpdated) + if err := _Contract.contract.UnpackLog(event, "allSnapshottersUpdated", 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 +} + +// ParseAllSnapshottersUpdated is a log parse operation binding the contract event 0x743e47fbcd2e3a64a2ab8f5dcdeb4c17f892c17c9f6ab58d3a5c235953d60058. +// +// Solidity: event allSnapshottersUpdated(address snapshotterAddress, bool allowed) +func (_Contract *ContractFilterer) ParseAllSnapshottersUpdated(log types.Log) (*ContractAllSnapshottersUpdated, error) { + event := new(ContractAllSnapshottersUpdated) + if err := _Contract.contract.UnpackLog(event, "allSnapshottersUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractMasterSnapshottersUpdatedIterator is returned from FilterMasterSnapshottersUpdated and is used to iterate over the raw logs and unpacked data for MasterSnapshottersUpdated events raised by the Contract contract. +type ContractMasterSnapshottersUpdatedIterator struct { + Event *ContractMasterSnapshottersUpdated // 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 *ContractMasterSnapshottersUpdatedIterator) 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(ContractMasterSnapshottersUpdated) + 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(ContractMasterSnapshottersUpdated) + 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 *ContractMasterSnapshottersUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractMasterSnapshottersUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractMasterSnapshottersUpdated represents a MasterSnapshottersUpdated event raised by the Contract contract. +type ContractMasterSnapshottersUpdated struct { + SnapshotterAddress common.Address + Allowed bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMasterSnapshottersUpdated is a free log retrieval operation binding the contract event 0x9c2d4c2b4cf1ca90e31b1448712dae908d3568785b68a411f6617479c2b9913b. +// +// Solidity: event masterSnapshottersUpdated(address snapshotterAddress, bool allowed) +func (_Contract *ContractFilterer) FilterMasterSnapshottersUpdated(opts *bind.FilterOpts) (*ContractMasterSnapshottersUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "masterSnapshottersUpdated") + if err != nil { + return nil, err + } + return &ContractMasterSnapshottersUpdatedIterator{contract: _Contract.contract, event: "masterSnapshottersUpdated", logs: logs, sub: sub}, nil +} + +// WatchMasterSnapshottersUpdated is a free log subscription operation binding the contract event 0x9c2d4c2b4cf1ca90e31b1448712dae908d3568785b68a411f6617479c2b9913b. +// +// Solidity: event masterSnapshottersUpdated(address snapshotterAddress, bool allowed) +func (_Contract *ContractFilterer) WatchMasterSnapshottersUpdated(opts *bind.WatchOpts, sink chan<- *ContractMasterSnapshottersUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "masterSnapshottersUpdated") + 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(ContractMasterSnapshottersUpdated) + if err := _Contract.contract.UnpackLog(event, "masterSnapshottersUpdated", 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 +} + +// ParseMasterSnapshottersUpdated is a log parse operation binding the contract event 0x9c2d4c2b4cf1ca90e31b1448712dae908d3568785b68a411f6617479c2b9913b. +// +// Solidity: event masterSnapshottersUpdated(address snapshotterAddress, bool allowed) +func (_Contract *ContractFilterer) ParseMasterSnapshottersUpdated(log types.Log) (*ContractMasterSnapshottersUpdated, error) { + event := new(ContractMasterSnapshottersUpdated) + if err := _Contract.contract.UnpackLog(event, "masterSnapshottersUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractPretestProjectsUpdatedIterator is returned from FilterPretestProjectsUpdated and is used to iterate over the raw logs and unpacked data for PretestProjectsUpdated events raised by the Contract contract. +type ContractPretestProjectsUpdatedIterator struct { + Event *ContractPretestProjectsUpdated // 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 *ContractPretestProjectsUpdatedIterator) 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(ContractPretestProjectsUpdated) + 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(ContractPretestProjectsUpdated) + 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 *ContractPretestProjectsUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractPretestProjectsUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractPretestProjectsUpdated represents a PretestProjectsUpdated event raised by the Contract contract. +type ContractPretestProjectsUpdated struct { + ProjectId string + Allowed bool + EnableEpochId *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPretestProjectsUpdated is a free log retrieval operation binding the contract event 0x9a3ed6f278d4fc2537eb88005da8f892d6a8838b3cda9d15d2d30f5639d8d861. +// +// Solidity: event pretestProjectsUpdated(string projectId, bool allowed, uint256 enableEpochId) +func (_Contract *ContractFilterer) FilterPretestProjectsUpdated(opts *bind.FilterOpts) (*ContractPretestProjectsUpdatedIterator, error) { + + logs, sub, err := _Contract.contract.FilterLogs(opts, "pretestProjectsUpdated") + if err != nil { + return nil, err + } + return &ContractPretestProjectsUpdatedIterator{contract: _Contract.contract, event: "pretestProjectsUpdated", logs: logs, sub: sub}, nil +} + +// WatchPretestProjectsUpdated is a free log subscription operation binding the contract event 0x9a3ed6f278d4fc2537eb88005da8f892d6a8838b3cda9d15d2d30f5639d8d861. +// +// Solidity: event pretestProjectsUpdated(string projectId, bool allowed, uint256 enableEpochId) +func (_Contract *ContractFilterer) WatchPretestProjectsUpdated(opts *bind.WatchOpts, sink chan<- *ContractPretestProjectsUpdated) (event.Subscription, error) { + + logs, sub, err := _Contract.contract.WatchLogs(opts, "pretestProjectsUpdated") + 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(ContractPretestProjectsUpdated) + if err := _Contract.contract.UnpackLog(event, "pretestProjectsUpdated", 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 +} + +// ParsePretestProjectsUpdated is a log parse operation binding the contract event 0x9a3ed6f278d4fc2537eb88005da8f892d6a8838b3cda9d15d2d30f5639d8d861. +// +// Solidity: event pretestProjectsUpdated(string projectId, bool allowed, uint256 enableEpochId) +func (_Contract *ContractFilterer) ParsePretestProjectsUpdated(log types.Log) (*ContractPretestProjectsUpdated, error) { + event := new(ContractPretestProjectsUpdated) + if err := _Contract.contract.UnpackLog(event, "pretestProjectsUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkgs/helpers/chain.go b/pkgs/helpers/chain.go new file mode 100644 index 0000000..8a50843 --- /dev/null +++ b/pkgs/helpers/chain.go @@ -0,0 +1,258 @@ +package helpers + +import ( + "context" + "encoding/json" + "fmt" + "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/ethclient" + "github.com/sergerad/incremental-merkle-tree/imt" + log "github.com/sirupsen/logrus" + "math/big" + "sort" + "strconv" + "strings" + "time" + "validator/config" + "validator/pkgs/contract/contract" +) + +var ( + Client *ethclient.Client + CurrentBlockNumber = new(big.Int) + CurrentEpochID = new(big.Int) +) + +func ConfigureClient() { + var err error + Client, err = ethclient.Dial(config.SettingsObj.ClientUrl) + if err != nil { + log.Fatal(err) + } +} + +func SetupAuth() { + nonce, err := Client.PendingNonceAt(context.Background(), config.SettingsObj.SignerAccountAddress) + if err != nil { + log.Fatalf("Failed to get nonce: %v", err) + } + + Auth, err = bind.NewKeyedTransactorWithChainID(config.SettingsObj.PrivateKey, big.NewInt(int64(config.SettingsObj.ChainID))) + if err != nil { + log.Fatalf("Failed to create authorized transactor: %v", err) + } + + Auth.Nonce = big.NewInt(int64(nonce)) + Auth.Value = big.NewInt(0) // in wei + Auth.GasLimit = uint64(3000000) // in units + Auth.From = config.SettingsObj.SignerAccountAddress +} + +func UpdateGasPrice(multiplier int) { + gasPrice, err := Client.SuggestGasPrice(context.Background()) + if err != nil { + log.Errorf("Failed to get gas price: %v", err) + } + Auth.GasPrice = gasPrice.Mul(gasPrice, big.NewInt(int64(multiplier))) +} + +func UpdateAuth(num int64) { + Auth.Nonce = new(big.Int).Add(Auth.Nonce, big.NewInt(num)) + UpdateGasPrice(1) +} + +func StartFetchingBlocks() { + contractABI, err := abi.JSON(strings.NewReader(contract.ContractMetaData.ABI)) // Replace with your contract ABI + + if err != nil { + log.Fatal(err) + } + + for { + var block *types.Block + block, err = Client.BlockByNumber(context.Background(), nil) + if err != nil || block == nil { + log.Errorf("Failed to fetch latest block: %s", err.Error()) + continue + } + + if CurrentBlockNumber.Cmp(block.Header().Number) < 0 { + CurrentBlockNumber.Set(block.Header().Number) + log.Debugln("Current block: ", CurrentBlockNumber.String()) + + // iterate all transactions in parallel and search for events + go func() { + for _, tx := range block.Transactions() { + receipt, err := Client.TransactionReceipt(context.Background(), tx.Hash()) + if err != nil { + log.Errorln(err.Error()) + continue + } + for _, vLog := range receipt.Logs { + if vLog.Address.Hex() != config.SettingsObj.ContractAddress { + continue + } + switch vLog.Topics[0].Hex() { + case contractABI.Events["SnapshotBatchSubmitted"].ID.Hex(): + event, err := Instance.ParseSnapshotBatchSubmitted(*vLog) + if err != nil { + log.Debugln("Error unpacking SnapshotBatchSubmitted event:", err) + continue + } + // begin building merkle tree + go storeBatchSubmission(event) + case contractABI.Events["EpochReleased"].ID.Hex(): + event, err := Instance.ParseEpochReleased(*vLog) + if err != nil { + log.Debugln("Error unpacking epochReleased event:", err) + continue + } + event.EpochId = new(big.Int).SetBytes(vLog.Topics[1][:]) + if CurrentEpochID.Cmp(event.EpochId) < 0 { + CurrentEpochID.Set(event.EpochId) + go triggerValidationFlow(new(big.Int).Set(CurrentEpochID)) + log.Debugln("Epoch Released: ", event.EpochId.String()) + } + } + } + } + }() + time.Sleep(time.Duration(config.SettingsObj.BlockTime*500) * time.Millisecond) + } else { + time.Sleep(100 * time.Millisecond) + continue + } + } +} + +func PopulateStateVars() { + for { + if num, err := Client.BlockNumber(context.Background()); err == nil { + CurrentBlockNumber.SetUint64(num) + break + } else { + log.Debugln("Encountered error while fetching current block: ", err.Error()) + } + } + CurrentEpochID.Set(big.NewInt(0)) +} + +func storeBatchSubmission(event *contract.ContractSnapshotBatchSubmitted) { + batch := FetchSubmission(IPFSCon, event.BatchCid) + log.Debugf("Fetched batch %s for epoch %s with roothash %s from IPFS: ", batch.ID.String(), event.EpochId, batch.RootHash) + //submissions, err := json.Marshal(batch.Submissions) + //if err != nil { + // log.Errorf("Unable to unmarshal submissions for batch %d epochId %s: %s\n", batch.ID, event.EpochId.String(), err.Error()) + //} + submissionIds, err := json.Marshal(batch.SubmissionIds) + if err != nil { + log.Errorf("Unable to unmarshal submissionIds for batch %d epochId %s: %s\n", batch.ID, event.EpochId.String(), err.Error()) + } + err = Set(context.Background(), RedisClient, fmt.Sprintf("%s.%s.%s", ValidatorKey, event.EpochId.String(), batch.ID.String()), string(submissionIds), time.Hour) + if err != nil { + log.Errorf("Unable to store submissions for batch %d epochId %s: %s\n", batch.ID, event.EpochId.String(), err.Error()) + } +} + +func triggerValidationFlow(epochId *big.Int) { + batchSubmissionLimit := new(big.Int).Add(CurrentBlockNumber, big.NewInt(int64(config.SettingsObj.BatchSubmissionLimit))) + + for CurrentBlockNumber.Cmp(batchSubmissionLimit) < 0 { + time.Sleep(time.Duration(config.SettingsObj.BlockTime) * time.Second) + } + + pattern := fmt.Sprintf("%s.%s.*", ValidatorKey, epochId) + keys, err := FetchKeysForPattern(context.Background(), RedisClient, pattern) + + if err != nil { + log.Errorf("Unable to fetch keys for pattern %s: %s\n", pattern, err.Error()) + } + + sort.Slice(keys, func(i, j int) bool { + numI, _ := strconv.Atoi(strings.Split(keys[i], ".")[2]) + numJ, _ := strconv.Atoi(strings.Split(keys[j], ".")[2]) + return numI < numJ + }) + + tree, _ := imt.New() + + SetupAuth() + for _, key := range keys { + value, err := Get(context.Background(), RedisClient, key) + if err != nil { + log.Errorln("Error fetching data from redis: ", err.Error()) + } + log.Debugf("Fetched submissions for key %s\n", key) + var batchSubmissionIds []string + err = json.Unmarshal([]byte(value), &batchSubmissionIds) + if err != nil { + log.Errorf("Unable to unmarshal batch submissionIds for key: %s\n", key) + } + _, err = UpdateMerkleTree(batchSubmissionIds, tree) + if err != nil { + log.Errorf("Unable to build Merkel tree: %s\n", err.Error()) + } + SubmitAttestation(key, tree.RootDigest()) + } + + ResetValidatorDBSubmissions(context.Background(), RedisClient, epochId) + + time.Sleep(time.Second * time.Duration(config.SettingsObj.BlockTime)) + + EnsureTxSuccess(epochId) +} + +func EnsureTxSuccess(epochID *big.Int) { + for { + keys, err := FetchKeysForPattern(context.Background(), RedisClient, fmt.Sprintf("%s.%s.*", TxsKey, epochID.String())) + SetupAuth() + if err != nil { + log.Debugf("Could not fetch submitted transactions: %s\n", err.Error()) + return + } else { + if keys == nil { + log.Debugln("No unsuccessful transactions remaining for epochId: ", epochID.String()) + return + } + log.Debugf("Fetched %d transactions for epoch %d", len(keys), epochID) + for _, key := range keys { + if value, err := Get(context.Background(), RedisClient, key); err != nil { + log.Errorf("Unable to fetch value for key: %s\n", key) + } else { + log.Debugf("Fetched value %s for key %s\n", value, key) + vals := strings.Split(value, ".") + + tx := vals[0] + cid := vals[3] + batchID := new(big.Int) + _, ok := batchID.SetString(vals[2], 10) + if !ok { + log.Errorf("Unable to convert bigInt string to bigInt: %s\n", vals[2]) + } + + nonce := strings.Split(key, ".")[3] + multiplier := 1 + if _, err := Client.TransactionReceipt(context.Background(), common.HexToHash(tx)); err != nil { + log.Errorf("Found unsuccessful transaction: %s, batchID: %d, nonce: %s", tx, batchID, nonce) + updatedNonce := Auth.Nonce.String() + UpdateGasPrice(1) + var reTx *types.Transaction + for reTx, err = Instance.SubmitBatchAttestation(Auth, batchID, epochID, [32]byte(common.Hex2Bytes(cid))); err != nil; { + updatedNonce = Auth.Nonce.String() + multiplier = HandleAttestationSubmissionError(err, multiplier, batchID.String()) + } + UpdateAuth(1) + RedisClient.Set(context.Background(), fmt.Sprintf("%s.%s.%d.%s", TxsKey, epochID.String(), batchID, updatedNonce), fmt.Sprintf("%s.%s.%s.%s", reTx.Hash().Hex(), epochID.String(), batchID.String(), cid), time.Hour) + } + if _, err := RedisClient.Del(context.Background(), fmt.Sprintf("%s.%s.%s.%s", TxsKey, epochID.String(), batchID.String(), nonce)).Result(); err != nil { + log.Errorf("Unable to delete transaction from redis: %s\n", err.Error()) + } + } + } + } + time.Sleep(time.Second * time.Duration(config.SettingsObj.BlockTime)) + } +} diff --git a/pkgs/helpers/constants.go b/pkgs/helpers/constants.go new file mode 100644 index 0000000..0567a5c --- /dev/null +++ b/pkgs/helpers/constants.go @@ -0,0 +1,4 @@ +package helpers + +const ValidatorKey = "SnapshotSubmissionValidator" +const TxsKey = "AttestationTransactions" diff --git a/pkgs/helpers/contract.go b/pkgs/helpers/contract.go new file mode 100644 index 0000000..e86b9d7 --- /dev/null +++ b/pkgs/helpers/contract.go @@ -0,0 +1,44 @@ +package helpers + +import ( + "context" + "fmt" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + log "github.com/sirupsen/logrus" + "math/big" + "strings" + "time" + "validator/config" + "validator/pkgs/contract/contract" +) + +var ( + Auth *bind.TransactOpts + Instance *contract.Contract +) + +func ConfigureContractInstance() { + Instance, _ = contract.NewContract(common.HexToAddress(config.SettingsObj.ContractAddress), Client) +} + +func SubmitAttestation(key string, cid []byte) { + vals := strings.Split(key, ".") + epochId, _ := new(big.Int).SetString(vals[1], 10) + batchId, _ := new(big.Int).SetString(vals[2], 10) + + multiplier := 1 + UpdateGasPrice(multiplier) + var tx *types.Transaction + var err error + nonce := Auth.Nonce.String() + for tx, err = Instance.SubmitBatchAttestation(Auth, batchId, epochId, [32]byte(cid)); err != nil; { + time.Sleep(time.Duration(config.SettingsObj.BlockTime) * time.Second) + nonce = Auth.Nonce.String() + multiplier = HandleAttestationSubmissionError(err, multiplier, batchId.String()) + } + RedisClient.Set(context.Background(), fmt.Sprintf("%s.%s.%s.%s", TxsKey, epochId.String(), batchId.String(), nonce), fmt.Sprintf("%s.%s.%s.%s", tx.Hash().Hex(), epochId.String(), batchId.String(), common.Bytes2Hex(cid)), time.Hour) + log.Debugf("Successfully submitted attestation for batch %s with roothash %s and nonce %s\n ", batchId.String(), common.Bytes2Hex(cid), nonce) + UpdateAuth(1) +} diff --git a/pkgs/helpers/database.go b/pkgs/helpers/database.go new file mode 100644 index 0000000..ef3f5e2 --- /dev/null +++ b/pkgs/helpers/database.go @@ -0,0 +1,93 @@ +package helpers + +import ( + "context" + "errors" + "fmt" + "github.com/go-redis/redis/v8" + log "github.com/sirupsen/logrus" + "math/big" + "time" + "validator/config" +) + +var RedisClient *redis.Client + +func NewRedisClient() *redis.Client { + return redis.NewClient(&redis.Options{ + Addr: fmt.Sprintf("%s:%s", config.SettingsObj.RedisHost, config.SettingsObj.RedisPort), // Redis server address + Password: "", // no password set + DB: 0, // use default DB + }) +} + +func Set(ctx context.Context, client *redis.Client, key string, value string, expiration time.Duration) error { + if _, err := Get(ctx, client, key); err != nil && !errors.Is(err, redis.Nil) { + return err + } + if err := client.Set(ctx, key, value, expiration).Err(); err != nil { + return err + } + return nil +} + +func Get(ctx context.Context, client *redis.Client, key string) (string, error) { + val, err := client.Get(ctx, key).Result() + if err != nil && !errors.Is(err, redis.Nil) { + return "", err + } + return val, nil +} + +func FetchKeysForPattern(ctx context.Context, client *redis.Client, pattern string) ([]string, error) { + var allKeys []string + var cursor uint64 + + for { + keys, newCursor, err := client.Scan(ctx, cursor, pattern, 100).Result() + if err != nil { + return nil, errors.New(fmt.Sprintf("Error scanning keys for pattern %s: %v", pattern, err)) + } + allKeys = append(allKeys, keys...) + + cursor = newCursor + if cursor == 0 { + break + } + } + return allKeys, nil +} + +func ResetValidatorDBSubmissions(ctx context.Context, client *redis.Client, epochID *big.Int) { + pattern := fmt.Sprintf("%s.%d.*", ValidatorKey, epochID) + + // Use Scan to find keys matching the pattern. + var cursor uint64 + var n int + var keysToDelete []string + for { + var keys []string + var err error + keys, cursor, err = client.Scan(ctx, cursor, pattern, 100).Result() + if err != nil { + log.Errorf("Error scanning keys: %v", err) + } + keysToDelete = append(keysToDelete, keys...) + n += len(keys) + + if cursor == 0 { // No more keys + break + } + } + + // Delete the keys. + if len(keysToDelete) > 0 { + _, err := client.Del(ctx, keysToDelete...).Result() + if err != nil { + log.Errorf("Error deleting keys: %v", err) + } + log.Debugf("Deleted %d keys.\n", n) + } else { + log.Debugln("No keys found to delete.") + } +} diff --git a/pkgs/helpers/errors.go b/pkgs/helpers/errors.go new file mode 100644 index 0000000..51dcfb9 --- /dev/null +++ b/pkgs/helpers/errors.go @@ -0,0 +1,28 @@ +package helpers + +import ( + log "github.com/sirupsen/logrus" + "strings" +) + +func HandleAttestationSubmissionError(err error, multiplier int, id string) int { + log.Debugf("Found error: %s proceeding with adjustments for attestation submission\n", err.Error()) + if strings.Contains(err.Error(), "transaction underpriced") { + log.Errorf("Could not submit batch: %s error: %s\n", id, err.Error()) + multiplier++ + UpdateGasPrice(multiplier) + log.Debugln("Retrying with gas price: ", Auth.GasPrice.String()) + } else if strings.Contains(err.Error(), "nonce too low") { + log.Errorf("Nonce too low for batch: %s error: %s\n", id, err.Error()) + UpdateAuth(1) + log.Debugln("Retrying with nonce: ", Auth.Nonce.String()) + } else if strings.Contains(err.Error(), "nonce too high") { + log.Errorf("Nonce too low for batch: %s error: %s\n", id, err.Error()) + UpdateAuth(-1) + log.Debugln("Retrying with nonce: ", Auth.Nonce.String()) + } else { + // Handle other errors + log.Errorf("Unexpected error: %v", err) + } + return multiplier +} diff --git a/pkgs/helpers/ipfs.go b/pkgs/helpers/ipfs.go new file mode 100644 index 0000000..2c72fac --- /dev/null +++ b/pkgs/helpers/ipfs.go @@ -0,0 +1,56 @@ +package helpers + +import ( + "bytes" + "encoding/json" + shell "github.com/ipfs/go-ipfs-api" + log "github.com/sirupsen/logrus" + "math/big" + "validator/config" +) + +var IPFSCon *shell.Shell + +// Batch represents your data structure +type Batch struct { + ID *big.Int `json:"id"` + SubmissionIds []string `json:"submissionIds"` + Submissions []string `json:"submissions"` + RootHash string `json:"roothash"` +} + +// Connect to the local IPFS node +func ConnectIPFSNode() { + log.Debugf("Connecting to IPFS host: %s", config.SettingsObj.IPFSUrl) + IPFSCon = shell.NewShell(config.SettingsObj.IPFSUrl) +} + +func StoreOnIPFS(sh *shell.Shell, data *Batch) (string, error) { + jsonData, err := json.Marshal(data) + cid, err := sh.Add(bytes.NewReader(jsonData)) + if err != nil { + return "", err + } + return cid, nil +} + +func FetchSubmission(sh *shell.Shell, cid string) *Batch { + data, err := sh.Cat(cid) + if err != nil { + return nil + } + + buf := new(bytes.Buffer) + _, err = buf.ReadFrom(data) + if err != nil { + return nil + } + + batch := &Batch{} + err = json.Unmarshal(buf.Bytes(), batch) // Unmarshal takes a byte slice directly + if err != nil { + return nil + } + + return batch +} diff --git a/pkgs/helpers/logger.go b/pkgs/helpers/logger.go new file mode 100644 index 0000000..16b7f7a --- /dev/null +++ b/pkgs/helpers/logger.go @@ -0,0 +1,48 @@ +package helpers + +import ( + "fmt" + log "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus/hooks/writer" + "io" + "os" + "strconv" +) + +func InitLogger() { + log.SetOutput(io.Discard) // Send all logs to nowhere by default + + log.SetReportCaller(true) + + log.AddHook(&writer.Hook{ // Send logs with level higher than warning to stderr + Writer: os.Stderr, + LogLevels: []log.Level{ + log.PanicLevel, + log.FatalLevel, + log.ErrorLevel, + log.WarnLevel, + }, + }) + log.AddHook(&writer.Hook{ // Send info and debug logs to stdout + Writer: os.Stdout, + LogLevels: []log.Level{ + log.TraceLevel, + log.InfoLevel, + log.DebugLevel, + }, + }) + if len(os.Args) < 2 { + fmt.Println("Pass loglevel as an argument if you don't want default(INFO) to be set.") + fmt.Println("Values to be passed for logLevel: ERROR(2),INFO(4),DEBUG(5)") + log.SetLevel(log.DebugLevel) + } else { + logLevel, err := strconv.ParseUint(os.Args[1], 10, 32) + if err != nil || logLevel > 6 { + log.SetLevel(log.DebugLevel) //TODO: Change default level to error + } else { + //TODO: Need to come up with approach to dynamically update logLevel. + log.SetLevel(log.Level(logLevel)) + } + } + log.SetFormatter(&log.TextFormatter{FullTimestamp: true}) +} diff --git a/pkgs/helpers/merkle.go b/pkgs/helpers/merkle.go new file mode 100644 index 0000000..6004bec --- /dev/null +++ b/pkgs/helpers/merkle.go @@ -0,0 +1,20 @@ +package helpers + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/sergerad/incremental-merkle-tree/imt" + log "github.com/sirupsen/logrus" +) + +func UpdateMerkleTree(sortedData []string, tree *imt.IncrementalMerkleTree) (*imt.IncrementalMerkleTree, error) { + log.Debugln("current hash: ", common.Bytes2Hex(tree.RootDigest())) + for _, value := range sortedData { + err := tree.AddLeaf([]byte(value)) + if err != nil { + log.Errorf("Error adding merkle tree leaf: %s\n", err.Error()) + return nil, err + } + } + + return tree, nil +} diff --git a/pkgs/helpers/validation.go b/pkgs/helpers/validation.go new file mode 100644 index 0000000..345b806 --- /dev/null +++ b/pkgs/helpers/validation.go @@ -0,0 +1 @@ +package helpers diff --git a/pm2.config.js b/pm2.config.js new file mode 100644 index 0000000..807c108 --- /dev/null +++ b/pm2.config.js @@ -0,0 +1,22 @@ +// this means if app restart {MAX_RESTART} times in 1 min then it stops +// const MAX_RESTART = 10; +// const MIN_UPTIME = 60000; +const NODE_ENV = process.env.NODE_ENV || 'development'; + +module.exports = { + apps : [ + { + name : "validator", + script : "./cmd/cmd", + cwd : `${__dirname}/cmd`, + // max_restarts: MAX_RESTART, + // min_uptime: MIN_UPTIME, + // kill_timeout : 3000, + env: { + NODE_ENV: NODE_ENV, + CONFIG_PATH:`${__dirname}` + }, + args: "5" //Log level set to debug, for production change to 4 (INFO) or 2(ERROR) + } + ] +} \ No newline at end of file diff --git a/validator_autofill.sh b/validator_autofill.sh new file mode 100755 index 0000000..69e6e66 --- /dev/null +++ b/validator_autofill.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e + +echo 'populating validator settings from environment values...'; + +if [ -z "$SIGNER_ACCOUNT_ADDRESS" ]; then + echo "SIGNER_ACCOUNT_ADDRESS not found, please set this in your .env!"; + exit 1; +fi + +if [ -z "$SIGNER_ACCOUNT_PRIVATE_KEY" ]; then + echo "SIGNER_ACCOUNT_PRIVATE_KEY not found, please set this in your .env!"; + exit 1; +fi + + +if [ -z "$PROST_RPC_URL" ]; then + echo "$PROST_RPC_URL not found, please set this in your .env!"; + exit 1; +fi +if [ -z "$PROTOCOL_STATE_CONTRACT" ]; then + echo "PROTOCOL_STATE_CONTRACT not found, please set this in your .env!"; + exit 1; +fi + +# Assuming default values for each variable if not provided +export REDIS_HOST="${REDIS_HOST:-redis}" +export REDIS_PORT="${REDIS_PORT:-6379}" +export IPFS_URL="${IPFS_URL:-/dns/ipfs/tcp/5001}" +export IPFS_API_KEY="${IPFS_API_KEY:-}" +export IPFS_API_SECRET="${IPFS_API_SECRET:-}" +export BATCH_SUBMISSION_LIMIT="${BATCH_SUBMISSION_LIMIT:-60}" +export BLOCK_TIME="${BLOCK_TIME:-1}" + +cd config + +# Template to actual settings.json manipulation +cp settings.example.json settings.json + +# Replace placeholders in settings.json with actual values from environment variables +sed -i'.backup' -e "s#PROST_RPC_URL#$PROST_RPC_URL#" \ + -e "s#PROTOCOL_STATE_CONTRACT#$PROTOCOL_STATE_CONTRACT#" \ + -e "s#REDIS_HOST#$REDIS_HOST#" \ + -e "s#REDIS_PORT#$REDIS_PORT#" \ + -e "s#IPFS_URL#$IPFS_URL#" \ + -e "s#SIGNER_ACCOUNT_ADDRESS#$SIGNER_ACCOUNT_ADDRESS#" \ + -e "s#SIGNER_ACCOUNT_PRIVATE_KEY#$SIGNER_ACCOUNT_PRIVATE_KEY#" \ + -e "s#PROST_CHAIN_ID#$PROST_CHAIN_ID#" settings.json \ + -e "s#BLOCK_TIME#$BLOCK_TIME#" \ + -e "s#BATCH_SUBMISSION_LIMIT#$BATCH_SUBMISSION_LIMIT#" settings.json + +# Cleanup backup file +rm settings.json.backup