Add support to sepolia chains (#1001)

Co-authored-by: walker-16 <agpazos85@gmail.com>
This commit is contained in:
ftocal 2024-01-22 11:01:18 -03:00 committed by GitHub
parent 00d88a38dc
commit d3c1c52b79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 376 additions and 148 deletions

View File

@ -13,7 +13,7 @@ require (
github.com/joho/godotenv v1.5.1
github.com/mr-tron/base58 v1.2.0
github.com/prometheus/client_golang v1.16.0
github.com/sethvargo/go-envconfig v0.9.0
github.com/sethvargo/go-envconfig v1.0.0
github.com/shopspring/decimal v1.3.1
github.com/spf13/cobra v1.7.0
github.com/wormhole-foundation/wormhole-explorer/common v0.0.0-00010101000000-000000000000

View File

@ -189,7 +189,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@ -328,8 +328,8 @@ github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
github.com/sethvargo/go-envconfig v0.9.0 h1:Q6FQ6hVEeTECULvkJZakq3dZMeBQ3JUpcKMfPQbKMDE=
github.com/sethvargo/go-envconfig v0.9.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
github.com/sethvargo/go-envconfig v1.0.0 h1:1C66wzy4QrROf5ew4KdVw942CQDa55qmlYmw9FZxZdU=
github.com/sethvargo/go-envconfig v1.0.0/go.mod h1:Lzc75ghUn5ucmcRGIdGQ33DKJrcjk4kihFYgSTBmjIc=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
@ -365,8 +365,6 @@ github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVS
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e h1:1Y+QtZiWzpOQiIV0YihRK44LE064qMREnsSijzmNZEw=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=

View File

@ -55,8 +55,6 @@ github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
@ -92,7 +90,6 @@ github.com/aws/aws-sdk-go v1.22.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@ -131,8 +128,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
@ -155,7 +150,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
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/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
@ -354,7 +348,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 h1:ajue7SzQMywqRjg2fK7dcpc0QhFGpTR2plWfV4EZWR4=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0/go.mod h1:r1hZAcvfFXuYmcKyCJI9wlyOPIZUJl6FCB8Cpca/NLE=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
@ -494,7 +487,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
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/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
@ -757,8 +749,6 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20230426150516-e695fad0bed8 h1:rrOyHd+H9a6Op1iUyZNCaI5v9D1syq8jDAYyX/2Q4L8=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20230426150516-e695fad0bed8/go.mod h1:dE12DOucCq23gjGGGhtbyx41FBxuHxjpPvG+ArO+8t0=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=

View File

@ -0,0 +1,34 @@
package configuration
import (
"context"
"fmt"
"strings"
"github.com/wormhole-foundation/wormhole-explorer/common/domain"
"github.com/joho/godotenv"
"github.com/sethvargo/go-envconfig"
)
func LoadFromEnv[T any](ctx context.Context) (*T, error) {
_ = godotenv.Load()
var settings T
err := envconfig.Process(ctx, &settings)
if err != nil {
return nil, fmt.Errorf("failed to read config from environment: %w", err)
}
return &settings, nil
}
func IsMainnet(s string) bool {
return strings.ToLower(s) == domain.P2pMainNet
}
func IsTestnet(s string) bool {
return strings.ToLower(s) == domain.P2pTestNet
}

View File

@ -12,9 +12,11 @@ require (
github.com/go-redis/redis/v8 v8.11.5
github.com/gofiber/fiber/v2 v2.47.0
github.com/influxdata/influxdb-client-go/v2 v2.12.2
github.com/joho/godotenv v1.5.1
github.com/mr-tron/base58 v1.2.0
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.19
github.com/pkg/errors v0.9.1
github.com/sethvargo/go-envconfig v1.0.0
github.com/shopspring/decimal v1.3.1
github.com/stretchr/testify v1.8.0
github.com/test-go/testify v1.1.4

View File

@ -178,8 +178,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@ -237,6 +237,8 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
@ -356,6 +358,8 @@ github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJv
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sethvargo/go-envconfig v1.0.0 h1:1C66wzy4QrROf5ew4KdVw942CQDa55qmlYmw9FZxZdU=
github.com/sethvargo/go-envconfig v1.0.0/go.mod h1:Lzc75ghUn5ucmcRGIdGQ33DKJrcjk4kihFYgSTBmjIc=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
@ -415,8 +419,6 @@ github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVS
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e h1:1Y+QtZiWzpOQiIV0YihRK44LE064qMREnsSijzmNZEw=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=

View File

@ -9,6 +9,7 @@ import (
"time"
"github.com/wormhole-foundation/wormhole-explorer/common/client/alert"
"github.com/wormhole-foundation/wormhole-explorer/common/configuration"
"github.com/wormhole-foundation/wormhole-explorer/common/dbutil"
"github.com/wormhole-foundation/wormhole-explorer/common/domain"
"github.com/wormhole-foundation/wormhole-explorer/common/health"
@ -40,36 +41,40 @@ func handleExit() {
}
type watchersConfig struct {
ankr []config.WatcherBlockchainAddresses
aptos *config.WatcherBlockchain
arbitrum *config.WatcherBlockchainAddresses
avalanche *config.WatcherBlockchainAddresses
base *config.WatcherBlockchainAddresses
ethereum *config.WatcherBlockchainAddresses
celo *config.WatcherBlockchainAddresses
moonbeam *config.WatcherBlockchainAddresses
oasis *config.WatcherBlockchainAddresses
optimism *config.WatcherBlockchainAddresses
polygon *config.WatcherBlockchainAddresses
solana *config.WatcherBlockchain
terra *config.WatcherBlockchain
rateLimit rateLimitConfig
ankr []config.WatcherBlockchainAddresses
aptos *config.WatcherBlockchain
arbitrum *config.WatcherBlockchainAddresses
avalanche *config.WatcherBlockchainAddresses
base *config.WatcherBlockchainAddresses
baseSepolia *config.WatcherBlockchainAddresses
ethereum *config.WatcherBlockchainAddresses
ethereumSepolia *config.WatcherBlockchainAddresses
celo *config.WatcherBlockchainAddresses
moonbeam *config.WatcherBlockchainAddresses
oasis *config.WatcherBlockchainAddresses
optimism *config.WatcherBlockchainAddresses
polygon *config.WatcherBlockchainAddresses
solana *config.WatcherBlockchain
terra *config.WatcherBlockchain
rateLimit rateLimitConfig
}
type rateLimitConfig struct {
ankr int
aptos int
arbitrum int
avalanche int
base int
celo int
ethereum int
moonbeam int
oasis int
optimism int
polygon int
solana int
terra int
ankr int
aptos int
arbitrum int
avalanche int
base int
baseSepolia int
celo int
ethereum int
ethereumSepolia int
moonbeam int
oasis int
optimism int
polygon int
solana int
terra int
}
func Run() {
@ -77,17 +82,25 @@ func Run() {
defer handleExit()
rootCtx, rootCtxCancel := context.WithCancel(context.Background())
config, err := config.New(rootCtx)
cfg, err := configuration.LoadFromEnv[config.ServiceConfiguration](rootCtx)
if err != nil {
log.Fatal("Error creating config", err)
}
logger := logger.New("wormhole-explorer-contract-watcher", logger.WithLevel(config.LogLevel))
var testnetConfig *config.TestnetConfiguration
if configuration.IsTestnet(cfg.P2pNetwork) {
testnetConfig, err = configuration.LoadFromEnv[config.TestnetConfiguration](rootCtx)
if err != nil {
log.Fatal("Error loading testnet rpc config: ", err)
}
}
logger := logger.New("wormhole-explorer-contract-watcher", logger.WithLevel(cfg.LogLevel))
logger.Info("Starting wormhole-explorer-contract-watcher ...")
//setup DB connection
db, err := dbutil.Connect(rootCtx, logger, config.MongoURI, config.MongoDatabase, false)
db, err := dbutil.Connect(rootCtx, logger, cfg.MongoURI, cfg.MongoDatabase, false)
if err != nil {
logger.Fatal("failed to connect MongoDB", zap.Error(err))
}
@ -99,16 +112,16 @@ func Run() {
}
// create metrics client
metrics := metrics.NewPrometheusMetrics(config.Environment)
metrics := metrics.NewPrometheusMetrics(cfg.Environment)
// create alert client
alerts := newAlertClient(config, logger)
alerts := newAlertClient(cfg, logger)
// create repositories
repo := storage.NewRepository(db.Database, metrics, alerts, logger)
// create watchers
watchers := newWatchers(config, repo, metrics, logger)
watchers := newWatchers(cfg, testnetConfig, repo, metrics, logger)
//create processor
processor := processor.NewProcessor(watchers, logger)
@ -116,7 +129,7 @@ func Run() {
// create and start server.
redeemController := redeem.NewController(watchers, logger)
server := infrastructure.NewServer(logger, config.Port, config.PprofEnabled, redeemController, healthChecks...)
server := infrastructure.NewServer(logger, cfg.Port, cfg.PprofEnabled, redeemController, healthChecks...)
server.Start()
logger.Info("Started wormhole-explorer-contract-watcher")
@ -150,13 +163,13 @@ func newHealthChecks(ctx context.Context, db *mongo.Database) ([]health.Check, e
return []health.Check{health.Mongo(db)}, nil
}
func newWatchers(config *config.ServiceConfiguration, repo *storage.Repository, metrics metrics.Metrics, logger *zap.Logger) []watcher.ContractWatcher {
func newWatchers(config *config.ServiceConfiguration, testnetConfig *config.TestnetConfiguration, repo *storage.Repository, metrics metrics.Metrics, logger *zap.Logger) []watcher.ContractWatcher {
var watchers *watchersConfig
switch config.P2pNetwork {
case domain.P2pMainNet:
watchers = newWatchersForMainnet(config)
case domain.P2pTestNet:
watchers = newWatchersForTestnet(config)
watchers = newWatchersForTestnet(config, testnetConfig)
default:
watchers = &watchersConfig{}
}
@ -178,6 +191,12 @@ func newWatchers(config *config.ServiceConfiguration, repo *storage.Repository,
result = append(result, ethereumWatcher)
}
// add ethereum sepolia watcher
if watchers.ethereumSepolia != nil {
ethereumSepoliaWatcher := builder.CreateEvmWatcher(watchers.rateLimit.ethereumSepolia, testnetConfig.EthereumSepoliaBaseUrl, *watchers.ethereumSepolia, logger, repo, metrics)
result = append(result, ethereumSepoliaWatcher)
}
// add solana watcher
if watchers.solana != nil {
solanaWatcher := builder.CreateSolanaWatcher(watchers.rateLimit.solana, config.SolanaUrl, *watchers.solana, logger, repo, metrics)
@ -238,6 +257,12 @@ func newWatchers(config *config.ServiceConfiguration, repo *storage.Repository,
result = append(result, baseWatcher)
}
// add base sepolia watcher
if watchers.baseSepolia != nil {
baseSepoliaWatcher := builder.CreateEvmWatcher(watchers.rateLimit.baseSepolia, testnetConfig.BaseSepoliaBaseUrl, *watchers.baseSepolia, logger, repo, metrics)
result = append(result, baseSepoliaWatcher)
}
// add polygon watcher
if watchers.polygon != nil {
polygonWatcher := builder.CreateEvmWatcher(watchers.rateLimit.polygon, config.PolygonUrl, *watchers.polygon, logger, repo, metrics)
@ -284,37 +309,41 @@ func newWatchersForMainnet(cfg *config.ServiceConfiguration) *watchersConfig {
}
}
func newWatchersForTestnet(cfg *config.ServiceConfiguration) *watchersConfig {
func newWatchersForTestnet(cfg *config.ServiceConfiguration, testnetCfg *config.TestnetConfiguration) *watchersConfig {
return &watchersConfig{
ankr: []config.WatcherBlockchainAddresses{
config.BSC_TESTNET,
config.FANTOM_TESTNET,
},
aptos: &config.APTOS_TESTNET,
arbitrum: &config.ARBITRUM_TESTNET,
avalanche: &config.AVALANCHE_TESTNET,
celo: &config.CELO_TESTNET,
base: &config.BASE_TESTNET,
ethereum: &config.ETHEREUM_TESTNET,
moonbeam: &config.MOONBEAM_TESTNET,
oasis: &config.OASIS_TESTNET,
optimism: &config.OPTIMISM_TESTNET,
polygon: &config.POLYGON_TESTNET,
solana: &config.SOLANA_TESTNET,
aptos: &config.APTOS_TESTNET,
arbitrum: &config.ARBITRUM_TESTNET,
avalanche: &config.AVALANCHE_TESTNET,
celo: &config.CELO_TESTNET,
base: &config.BASE_TESTNET,
baseSepolia: &config.BASE_SEPOLIA_TESTNET,
ethereum: &config.ETHEREUM_TESTNET,
ethereumSepolia: &config.ETHEREUM_SEPOLIA_TESTNET,
moonbeam: &config.MOONBEAM_TESTNET,
oasis: &config.OASIS_TESTNET,
optimism: &config.OPTIMISM_TESTNET,
polygon: &config.POLYGON_TESTNET,
solana: &config.SOLANA_TESTNET,
rateLimit: rateLimitConfig{
ankr: cfg.AnkrRequestsPerSecond,
avalanche: cfg.AvalancheRequestsPerSecond,
aptos: cfg.AptosRequestsPerSecond,
arbitrum: cfg.ArbitrumRequestsPerSecond,
base: cfg.BaseRequestsPerSecond,
celo: cfg.CeloRequestsPerSecond,
ethereum: cfg.EthereumRequestsPerSecond,
moonbeam: cfg.MoonbeamRequestsPerSecond,
oasis: cfg.OasisRequestsPerSecond,
optimism: cfg.OptimismRequestsPerSecond,
polygon: cfg.PolygonRequestsPerSecond,
solana: cfg.SolanaRequestsPerSecond,
terra: cfg.TerraRequestsPerSecond,
ankr: cfg.AnkrRequestsPerSecond,
avalanche: cfg.AvalancheRequestsPerSecond,
aptos: cfg.AptosRequestsPerSecond,
arbitrum: cfg.ArbitrumRequestsPerSecond,
base: cfg.BaseRequestsPerSecond,
baseSepolia: testnetCfg.BaseSepoliaRequestsPerMinute,
celo: cfg.CeloRequestsPerSecond,
ethereum: cfg.EthereumRequestsPerSecond,
ethereumSepolia: testnetCfg.EthereumSepoliaRequestsPerMinute,
moonbeam: cfg.MoonbeamRequestsPerSecond,
oasis: cfg.OasisRequestsPerSecond,
optimism: cfg.OptimismRequestsPerSecond,
polygon: cfg.PolygonRequestsPerSecond,
solana: cfg.SolanaRequestsPerSecond,
terra: cfg.TerraRequestsPerSecond,
},
}
}

View File

@ -1,12 +1,5 @@
package config
import (
"context"
"github.com/joho/godotenv"
"github.com/sethvargo/go-envconfig"
)
// ServiceConfiguration represents the application configuration when running as service with the default values.
type ServiceConfiguration struct {
Environment string `env:"ENVIRONMENT,required"`
@ -47,6 +40,13 @@ type ServiceConfiguration struct {
TerraRequestsPerSecond int `env:"TERRA_REQUESTS_PER_SECOND,required"`
}
type TestnetConfiguration struct {
BaseSepoliaBaseUrl string `env:"BASE_SEPOLIA_URL,required"`
BaseSepoliaRequestsPerMinute int `env:"BASE_SEPOLIA_REQUESTS_PER_SECOND,required"`
EthereumSepoliaBaseUrl string `env:"ETHEREUM_SEPOLIA_URL,required"`
EthereumSepoliaRequestsPerMinute int `env:"ETHEREUM_SEPOLIA_REQUESTS_PER_SECOND,required"`
}
// BackfillerConfiguration represents the application configuration when running as backfiller.
type BackfillerConfiguration struct {
LogLevel string `env:"LOG_LEVEL,default=INFO"`
@ -61,15 +61,3 @@ type BackfillerConfiguration struct {
PageSize uint64 `env:"PAGE_SIZE,default=100"`
PersistBlock bool `env:"PERSIST_BLOCK,default=false"`
}
// New creates a configuration with the values from .env file and environment variables.
func New(ctx context.Context) (*ServiceConfiguration, error) {
_ = godotenv.Load(".env", "../.env")
var configuration ServiceConfiguration
if err := envconfig.Process(ctx, &configuration); err != nil {
return nil, err
}
return &configuration, nil
}

View File

@ -40,6 +40,34 @@ var ETHEREUM_TESTNET = WatcherBlockchainAddresses{
},
}
var ETHEREUM_SEPOLIA_TESTNET = WatcherBlockchainAddresses{
ChainID: vaa.ChainIDSepolia,
Name: "eth_sepolia",
SizeBlocks: 100,
WaitSeconds: 10,
InitialBlock: 3_174_984,
MethodsByAddress: map[string][]BlockchainMethod{
strings.ToLower("0xDB5492265f6038831E89f495670FF909aDe94bd9"): {
{
ID: MethodIDCompleteTransfer,
Name: MethodCompleteTransfer,
},
{
ID: MethodIDCompleteAndUnwrapETH,
Name: MethodCompleteAndUnwrapETH,
},
{
ID: MethodIDCreateWrapped,
Name: MethodCreateWrapped,
},
{
ID: MethodIDUpdateWrapped,
Name: MethodUpdateWrapped,
},
},
},
}
var POLYGON_TESTNET = WatcherBlockchainAddresses{
ChainID: vaa.ChainIDPolygon,
Name: "polygon_mumbai",
@ -359,3 +387,35 @@ var BASE_TESTNET = WatcherBlockchainAddresses{
},
},
}
var BASE_SEPOLIA_TESTNET = WatcherBlockchainAddresses{
ChainID: vaa.ChainIDBaseSepolia,
Name: "base_sepolia",
SizeBlocks: 100,
WaitSeconds: 10,
InitialBlock: 3_415_420,
MethodsByAddress: map[string][]BlockchainMethod{
strings.ToLower("0x86F55A04690fd7815A3D802bD587e83eA888B239"): {
{
ID: MethodIDCompleteTransfer,
Name: MethodCompleteTransfer,
},
{
ID: MethodIDCompleteAndUnwrapETH,
Name: MethodCompleteAndUnwrapETH,
},
{
ID: MethodIDCreateWrapped,
Name: MethodCreateWrapped,
},
{
ID: MethodIDUpdateWrapped,
Name: MethodUpdateWrapped,
},
{
ID: MetehodIDCompleteTransferWithRelay,
Name: MetehodCompleteTransferWithRelay,
},
},
},
}

View File

@ -8,10 +8,8 @@ require (
github.com/gagliardetto/solana-go v1.8.4
github.com/go-resty/resty/v2 v2.7.0
github.com/gofiber/fiber/v2 v2.47.0
github.com/joho/godotenv v1.5.1
github.com/near/borsh-go v0.3.1
github.com/prometheus/client_golang v1.14.0
github.com/sethvargo/go-envconfig v0.9.0
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.8.2
github.com/test-go/testify v1.1.4
@ -62,6 +60,7 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/influxdata/influxdb-client-go/v2 v2.12.2 // indirect
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.3 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
@ -86,6 +85,7 @@ require (
github.com/rivo/uniseg v0.4.4 // indirect
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 // indirect
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect
github.com/sethvargo/go-envconfig v1.0.0 // indirect
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/streamingfast/logging v0.0.0-20220405224725-2755dab2ce75 // indirect

View File

@ -124,7 +124,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
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/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/deepmap/oapi-codegen v1.12.4 h1:pPmn6qI9MuOtCz82WY2Xaw46EQjgvxednXXrP7g5Q2s=
@ -165,7 +164,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
@ -212,7 +210,6 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@ -226,7 +223,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@ -243,7 +240,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
@ -440,8 +436,8 @@ github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJv
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sethvargo/go-envconfig v0.9.0 h1:Q6FQ6hVEeTECULvkJZakq3dZMeBQ3JUpcKMfPQbKMDE=
github.com/sethvargo/go-envconfig v0.9.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
github.com/sethvargo/go-envconfig v1.0.0 h1:1C66wzy4QrROf5ew4KdVw942CQDa55qmlYmw9FZxZdU=
github.com/sethvargo/go-envconfig v1.0.0/go.mod h1:Lzc75ghUn5ucmcRGIdGQ33DKJrcjk4kihFYgSTBmjIc=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
@ -505,8 +501,6 @@ github.com/valyala/fasthttp v1.47.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20230426150516-e695fad0bed8 h1:rrOyHd+H9a6Op1iUyZNCaI5v9D1syq8jDAYyX/2Q4L8=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20230426150516-e695fad0bed8/go.mod h1:dE12DOucCq23gjGGGhtbyx41FBxuHxjpPvG+ArO+8t0=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=

3
deploy/common/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.env
.env.*
bin

View File

@ -22,4 +22,10 @@ data:
solana-url: {{ .SOLANA_URL | b64enc }}
sui-url: {{ .SUI_URL | b64enc }}
terra-url: {{ .TERRA_URL | b64enc }}
{{ if eq .P2P_NETWORK "testnet" }}
arbitrum-sepolia-url: {{ .ARBITRUM_SEPOLIA_URL | b64enc }}
base-sepolia-url: {{ .BASE_SEPOLIA_URL | b64enc }}
ethereum-sepolia-url: {{ .ETHEREUM_SEPOLIA_URL | b64enc }}
optimism-sepolia-url: {{ .OPTIMISM_SEPOLIA_URL | b64enc }}
{{ end }}
type: Opaque

View File

@ -1,5 +1,6 @@
ENVIRONMENT=production
NAMESPACE=wormscan
P2P_NETWORK=mainnet
MONGODB_URI=
MONGODB_DATABASE=
REDIS_URI=

View File

@ -1,5 +1,6 @@
ENVIRONMENT=production
NAMESPACE=wormscan-testnet
P2P_NETWORK=testnet
MONGODB_URI=
MONGODB_DATABASE=wormhole
REDIS_URI=
@ -15,15 +16,19 @@ ALERT_API_KEY=
ANKR_URL=
APTOS_URL=
ARBITRUM_URL=
ARBITRUM_SEPOLIA_URL=
AVALANCHE_URL=
BASE_URL=
BASE_SEPOLIA_URL=
BSC_URL=
CELO_URL=
ETHEREUM_URL=
ETHEREUM_SEPOLIA_URL=
FANTOM_URL=
MOONBEAM_URL=
OASIS_URL=
OPTIMISM_URL=
OPTIMISM_SEPOLIA_URL=
POLYGON_URL=
SEI_URL=
SOLANA_URL=

View File

@ -1,5 +1,6 @@
ENVIRONMENT=staging
NAMESPACE=wormscan
P2P_NETWORK=mainnet
MONGODB_URI=
MONGODB_DATABASE=
REDIS_URI=

View File

@ -1,5 +1,6 @@
ENVIRONMENT=test
NAMESPACE=wormscan-testnet
P2P_NETWORK=testnet
MONGODB_URI=
MONGODB_DATABASE=
REDIS_URI=
@ -15,15 +16,19 @@ ALERT_API_KEY=
ANKR_URL=
APTOS_URL=
ARBITRUM_URL=
ARBITRUM_SEPOLIA_URL=
AVALANCHE_URL=
BASE_URL=
BASE_SEPOLIA_URL=
BSC_URL=
CELO_URL=
ETHEREUM_URL=
ETHEREUM_SEPOLIA_URL=
FANTOM_URL=
MOONBEAM_URL=
OASIS_URL=
OPTIMISM_URL=
OPTIMISM_SEPOLIA_URL=
POLYGON_URL=
SEI_URL=
SOLANA_URL=

View File

@ -151,6 +151,22 @@ spec:
key: polygon-url
- name: POLYGON_REQUESTS_PER_SECOND
value: "{{ .POLYGON_REQUESTS_PER_SECOND }}"
{{ if eq .P2P_NETWORK "testnet" }}
- name: BASE_SEPOLIA_URL
valueFrom:
secretKeyRef:
name: blockchain
key: base-sepolia-url
- name: BASE_SEPOLIA_REQUESTS_PER_SECOND
value: "{{ .BASE_SEPOLIA_REQUESTS_PER_SECOND }}"
- name: ETHEREUM_SEPOLIA_URL
valueFrom:
secretKeyRef:
name: blockchain
key: ethereum-sepolia-url
- name: ETHEREUM_SEPOLIA_REQUESTS_PER_SECOND
value: "{{ .ETHEREUM_SEPOLIA_REQUESTS_PER_SECOND }}"
{{ end }}
- name: ALERT_API_KEY
valueFrom:
secretKeyRef:

View File

@ -14,9 +14,11 @@ APTOS_REQUESTS_PER_SECOND=5
ARBITRUM_REQUESTS_PER_SECOND=3
AVALANCHE_REQUESTS_PER_SECOND=5
BASE_REQUESTS_PER_SECOND=3
BASE_SEPOLIA_REQUESTS_PER_SECOND=3
BSC_REQUESTS_PER_SECOND=3
CELO_REQUESTS_PER_SECOND=20
ETHEREUM_REQUESTS_PER_SECOND=2
ETHEREUM_SEPOLIA_REQUESTS_PER_SECOND=2
FANTOM_REQUESTS_PER_SECOND=5
MOONBEAM_REQUESTS_PER_SECOND=2
OASIS_REQUESTS_PER_SECOND=3

View File

@ -14,9 +14,11 @@ APTOS_REQUESTS_PER_SECOND=1
ARBITRUM_REQUESTS_PER_SECOND=1
AVALANCHE_REQUESTS_PER_SECOND=5
BASE_REQUESTS_PER_SECOND=1
BASE_SEPOLIA_REQUESTS_PER_SECOND=3
BSC_REQUESTS_PER_SECOND=3
CELO_REQUESTS_PER_SECOND=20
ETHEREUM_REQUESTS_PER_SECOND=2
ETHEREUM_SEPOLIA_REQUESTS_PER_SECOND=2
FANTOM_REQUESTS_PER_SECOND=5
MOONBEAM_REQUESTS_PER_SECOND=2
OASIS_REQUESTS_PER_SECOND=1

View File

@ -26,12 +26,18 @@ APTOS_REQUESTS_PER_MINUTE=120
ARBITRUM_BASE_URL=https://goerli-rollup.arbitrum.io/rpc
ARBITRUM_REQUESTS_PER_MINUTE=12
ARBITRUM_SEPOLIA_BASE_URL=https://sepolia-rollup.arbitrum.io/rpc
ARBITRUM_SEPOLIA_REQUESTS_PER_MINUTE=12
AVALANCHE_BASE_URL=https://rpc.ankr.com/avalanche_fuji
AVALANCHE_REQUESTS_PER_MINUTE=120
BASE_BASE_URL=https://base-goerli.public.blastapi.io
BASE_REQUESTS_PER_MINUTE=120
BASE_SEPOLIA_BASE_URL=https://base-sepolia.public.blastapi.io
BASE_SEPOLIA_REQUESTS_PER_MINUTE=120
BSC_BASE_URL=https://data-seed-prebsc-1-s1.binance.org:8545
BSC_REQUESTS_PER_MINUTE=120
@ -41,6 +47,9 @@ CELO_REQUESTS_PER_MINUTE=12
ETHEREUM_BASE_URL=https://rpc.ankr.com/eth_goerli
ETHEREUM_REQUESTS_PER_MINUTE=120
ETHEREUM_SEPOLIA_BASE_URL=https://rpc.ankr.com/eth_sepolia
ETHEREUM_SEPOLIA_REQUESTS_PER_MINUTE=120
EVMOS_BASE_URL=https://evmos-testnet-rpc.polkachu.com
EVMOS_REQUESTS_PER_MINUTE=12
@ -68,6 +77,9 @@ OASIS_REQUESTS_PER_MINUTE=12
OPTIMISM_BASE_URL=https://goerli.optimism.io
OPTIMISM_REQUESTS_PER_MINUTE=120
OPTIMISM_SEPOLIA_BASE_URL=https://rpc.ankr.com/optimism_sepolia
OPTIMISM_SEPOLIA_REQUESTS_PER_MINUTE=120
OSMOSIS_BASE_URL=https://rpc.testnet.osmosis.zone
OSMOSIS_REQUESTS_PER_MINUTE=12

View File

@ -25,12 +25,18 @@ APTOS_REQUESTS_PER_MINUTE=12
ARBITRUM_REQUESTS_PER_MINUTE=12
ARBITRUM_SEPOLIA_BASE_URL=https://sepolia-rollup.arbitrum.io/rpc
ARBITRUM_SEPOLIA_REQUESTS_PER_MINUTE=12
AVALANCHE_BASE_URL=https://rpc.ankr.com/avalanche_fuji
AVALANCHE_REQUESTS_PER_MINUTE=12
BASE_BASE_URL=https://base-goerli.public.blastapi.io
BASE_REQUESTS_PER_MINUTE=12
BASE_SEPOLIA_BASE_URL=https://base-sepolia.public.blastapi.io
BASE_SEPOLIA_REQUESTS_PER_MINUTE=120
BSC_BASE_URL=https://data-seed-prebsc-1-s1.binance.org:8545
BSC_REQUESTS_PER_MINUTE=12
@ -40,6 +46,9 @@ CELO_REQUESTS_PER_MINUTE=12
ETHEREUM_BASE_URL=https://rpc.ankr.com/eth_goerli
ETHEREUM_REQUESTS_PER_MINUTE=12
ETHEREUM_SEPOLIA_BASE_URL=https://rpc.ankr.com/eth_sepolia
ETHEREUM_SEPOLIA_REQUESTS_PER_MINUTE=120
EVMOS_BASE_URL=https://evmos-testnet-rpc.polkachu.com
EVMOS_REQUESTS_PER_MINUTE=12
@ -66,6 +75,9 @@ OASIS_REQUESTS_PER_MINUTE=12
OPTIMISM_REQUESTS_PER_MINUTE=12
OPTIMISM_SEPOLIA_BASE_URL=https://rpc.ankr.com/optimism_sepolia
OPTIMISM_SEPOLIA_REQUESTS_PER_MINUTE=120
OSMOSIS_BASE_URL=https://rpc.testnet.osmosis.zone
OSMOSIS_REQUESTS_PER_MINUTE=12

View File

@ -225,6 +225,36 @@ spec:
value: {{ .XPLA_BASE_URL }}
- name: XPLA_REQUESTS_PER_MINUTE
value: "{{ .XPLA_REQUESTS_PER_MINUTE }}"
{{ if eq .P2P_NETWORK "testnet" }}
- name: ARBITRUM_SEPOLIA_BASE_URL
valueFrom:
secretKeyRef:
name: blockchain
key: arbitrum-sepolia-url
- name: ARBITRUM_SEPOLIA_REQUESTS_PER_MINUTE
value: "{{ .ARBITRUM_SEPOLIA_REQUESTS_PER_MINUTE }}"
- name: BASE_SEPOLIA_BASE_URL
valueFrom:
secretKeyRef:
name: blockchain
key: base-sepolia-url
- name: BASE_SEPOLIA_REQUESTS_PER_MINUTE
value: "{{ .BASE_SEPOLIA_REQUESTS_PER_MINUTE }}"
- name: ETHEREUM_SEPOLIA_BASE_URL
valueFrom:
secretKeyRef:
name: blockchain
key: ethereum-sepolia-url
- name: ETHEREUM_SEPOLIA_REQUESTS_PER_MINUTE
value: "{{ .ETHEREUM_SEPOLIA_REQUESTS_PER_MINUTE }}"
- name: OPTIMISM_SEPOLIA_BASE_URL
valueFrom:
secretKeyRef:
name: blockchain
key: optimism-sepolia-url
- name: OPTIMISM_SEPOLIA_REQUESTS_PER_MINUTE
value: "{{ .OPTIMISM_SEPOLIA_REQUESTS_PER_MINUTE }}"
{{ end }}
resources:
limits:
memory: {{ .RESOURCES_LIMITS_MEMORY }}

View File

@ -4,9 +4,9 @@ go 1.19
require (
github.com/gofiber/fiber/v2 v2.47.0
github.com/joho/godotenv v1.4.0 // Configuration environment
github.com/joho/godotenv v1.5.1 // Configuration environment
github.com/pkg/errors v0.9.1
github.com/sethvargo/go-envconfig v0.6.0 // Configuration environment
github.com/sethvargo/go-envconfig v1.0.0 // Configuration environment
github.com/stretchr/testify v1.8.1 // Testing
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229
go.mongodb.org/mongo-driver v1.11.2

View File

@ -104,7 +104,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
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/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
@ -190,7 +189,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@ -225,8 +224,8 @@ github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 h1:vilfsD
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@ -339,8 +338,8 @@ github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
github.com/sethvargo/go-envconfig v0.6.0 h1:GxxdoeiNpWgGiVEphNFNObgMYRN/ZvI2dN7rBwadyss=
github.com/sethvargo/go-envconfig v0.6.0/go.mod h1:00S1FAhRUuTNJazWBWcJGvEHOM+NO6DhoRMAOX7FY5o=
github.com/sethvargo/go-envconfig v1.0.0 h1:1C66wzy4QrROf5ew4KdVw942CQDa55qmlYmw9FZxZdU=
github.com/sethvargo/go-envconfig v1.0.0/go.mod h1:Lzc75ghUn5ucmcRGIdGQ33DKJrcjk4kihFYgSTBmjIc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
@ -382,8 +381,6 @@ github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVS
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e h1:1Y+QtZiWzpOQiIV0YihRK44LE064qMREnsSijzmNZEw=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=

View File

@ -4,9 +4,9 @@ go 1.19
require (
github.com/gofiber/fiber/v2 v2.47.0
github.com/joho/godotenv v1.4.0 // Configuration environment
github.com/joho/godotenv v1.5.1 // Configuration environment
github.com/pkg/errors v0.9.1
github.com/sethvargo/go-envconfig v0.6.0 // Configuration environment
github.com/sethvargo/go-envconfig v1.0.0 // Configuration environment
go.mongodb.org/mongo-driver v1.11.2
go.uber.org/zap v1.24.0
)

View File

@ -167,7 +167,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@ -195,8 +195,8 @@ github.com/holiman/uint256 v1.2.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@ -292,8 +292,8 @@ github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
github.com/sethvargo/go-envconfig v0.6.0 h1:GxxdoeiNpWgGiVEphNFNObgMYRN/ZvI2dN7rBwadyss=
github.com/sethvargo/go-envconfig v0.6.0/go.mod h1:00S1FAhRUuTNJazWBWcJGvEHOM+NO6DhoRMAOX7FY5o=
github.com/sethvargo/go-envconfig v1.0.0 h1:1C66wzy4QrROf5ew4KdVw942CQDa55qmlYmw9FZxZdU=
github.com/sethvargo/go-envconfig v1.0.0/go.mod h1:Lzc75ghUn5ucmcRGIdGQ33DKJrcjk4kihFYgSTBmjIc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
@ -327,8 +327,6 @@ github.com/valyala/fasthttp v1.47.0 h1:y7moDoxYzMooFpT5aHgNgVOQDrS3qlkfiP9mDtGGK
github.com/valyala/fasthttp v1.47.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20230426150516-e695fad0bed8 h1:rrOyHd+H9a6Op1iUyZNCaI5v9D1syq8jDAYyX/2Q4L8=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20230426150516-e695fad0bed8/go.mod h1:dE12DOucCq23gjGGGhtbyx41FBxuHxjpPvG+ArO+8t0=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=

View File

@ -1,2 +1,3 @@
.env
.env.*
bin

View File

@ -398,7 +398,7 @@ func (a *apiWormchain) fetchWormchainTx(
Attribute: &AttributeTxDetail{
Type: "wormchain-gateway",
Value: &WorchainAttributeTxDetail{
OriginChainID: ChainIDOsmosis,
OriginChainID: sdk.ChainIDOsmosis,
OriginTxHash: osmosisTx.txHash,
OriginAddress: wormchainTx.sender,
},
@ -418,7 +418,7 @@ func (a *apiWormchain) fetchWormchainTx(
Attribute: &AttributeTxDetail{
Type: "wormchain-gateway",
Value: &WorchainAttributeTxDetail{
OriginChainID: ChainIDKujira,
OriginChainID: sdk.ChainIDKujira,
OriginTxHash: kujiraTx.txHash,
OriginAddress: wormchainTx.sender,
},
@ -438,7 +438,7 @@ func (a *apiWormchain) fetchWormchainTx(
Attribute: &AttributeTxDetail{
Type: "wormchain-gateway",
Value: &WorchainAttributeTxDetail{
OriginChainID: ChainIDEvmos,
OriginChainID: sdk.ChainIDEvmos,
OriginTxHash: evmosTx.txHash,
OriginAddress: wormchainTx.sender,
},

View File

@ -23,11 +23,6 @@ var (
baseUrlsByChain map[sdk.ChainID]string
)
// WARNING: The following chain IDs are not supported by the wormhole-sdk:
const ChainIDOsmosis sdk.ChainID = 20
const ChainIDEvmos sdk.ChainID = 4001
const ChainIDKujira sdk.ChainID = 4002
type WormchainTxDetail struct {
}
type TxDetail struct {
@ -44,7 +39,7 @@ type AttributeTxDetail struct {
Value any
}
func Initialize(cfg *config.RpcProviderSettings) {
func Initialize(cfg *config.RpcProviderSettings, testnetConfig *config.TestnetRpcProviderSettings) {
// convertToRateLimiter converts "requests per minute" into the associated *time.Ticker
convertToRateLimiter := func(requestsPerMinute uint16) *time.Ticker {
@ -82,7 +77,7 @@ func Initialize(cfg *config.RpcProviderSettings) {
rateLimitersByChain[sdk.ChainIDSui] = convertToRateLimiter(cfg.SuiRequestsPerMinute)
rateLimitersByChain[sdk.ChainIDXpla] = convertToRateLimiter(cfg.XplaRequestsPerMinute)
rateLimitersByChain[sdk.ChainIDWormchain] = convertToRateLimiter(cfg.WormchainRequestsPerMinute)
rateLimitersByChain[ChainIDOsmosis] = convertToRateLimiter(cfg.OsmosisRequestsPerMinute)
rateLimitersByChain[sdk.ChainIDOsmosis] = convertToRateLimiter(cfg.OsmosisRequestsPerMinute)
rateLimitersByChain[sdk.ChainIDSei] = convertToRateLimiter(cfg.SeiRequestsPerMinute)
// Initialize the RPC base URLs for each chain
@ -111,6 +106,18 @@ func Initialize(cfg *config.RpcProviderSettings) {
baseUrlsByChain[sdk.ChainIDXpla] = cfg.XplaBaseUrl
baseUrlsByChain[sdk.ChainIDWormchain] = cfg.WormchainBaseUrl
baseUrlsByChain[sdk.ChainIDSei] = cfg.SeiBaseUrl
if testnetConfig != nil {
rateLimitersByChain[sdk.ChainIDArbitrumSepolia] = convertToRateLimiter(testnetConfig.ArbitrumSepoliaRequestsPerMinute)
rateLimitersByChain[sdk.ChainIDBaseSepolia] = convertToRateLimiter(testnetConfig.BaseSepoliaRequestsPerMinute)
rateLimitersByChain[sdk.ChainIDSepolia] = convertToRateLimiter(testnetConfig.EthereumSepoliaRequestsPerMinute)
rateLimitersByChain[sdk.ChainIDOptimismSepolia] = convertToRateLimiter(testnetConfig.OptimismSepoliaRequestsPerMinute)
baseUrlsByChain[sdk.ChainIDArbitrumSepolia] = testnetConfig.ArbitrumSepoliaBaseUrl
baseUrlsByChain[sdk.ChainIDBaseSepolia] = testnetConfig.BaseSepoliaBaseUrl
baseUrlsByChain[sdk.ChainIDSepolia] = testnetConfig.EthereumSepoliaBaseUrl
baseUrlsByChain[sdk.ChainIDOptimismSepolia] = testnetConfig.OptimismSepoliaBaseUrl
}
}
func FetchTx(
@ -143,21 +150,25 @@ func FetchTx(
fetchFunc = fetchCosmosTx
case sdk.ChainIDAcala,
sdk.ChainIDArbitrum,
sdk.ChainIDArbitrumSepolia,
sdk.ChainIDAvalanche,
sdk.ChainIDBase,
sdk.ChainIDBaseSepolia,
sdk.ChainIDBSC,
sdk.ChainIDCelo,
sdk.ChainIDEthereum,
sdk.ChainIDSepolia,
sdk.ChainIDFantom,
sdk.ChainIDKarura,
sdk.ChainIDKlaytn,
sdk.ChainIDMoonbeam,
sdk.ChainIDOasis,
sdk.ChainIDOptimism,
sdk.ChainIDOptimismSepolia,
sdk.ChainIDPolygon:
fetchFunc = fetchEthTx
case sdk.ChainIDWormchain:
rateLimiter, ok := rateLimitersByChain[ChainIDOsmosis]
rateLimiter, ok := rateLimitersByChain[sdk.ChainIDOsmosis]
if !ok {
return nil, errors.New("found no rate limiter for chain osmosis")
}

View File

@ -11,6 +11,7 @@ import (
"syscall"
"time"
"github.com/wormhole-foundation/wormhole-explorer/common/configuration"
"github.com/wormhole-foundation/wormhole-explorer/common/dbutil"
"github.com/wormhole-foundation/wormhole-explorer/common/logger"
"github.com/wormhole-foundation/wormhole-explorer/txtracker/chains"
@ -36,13 +37,21 @@ func main() {
rootCtx, rootCtxCancel := context.WithCancel(context.Background())
// Load config
cfg, err := config.LoadFromEnv[config.BackfillerSettings]()
cfg, err := configuration.LoadFromEnv[config.BackfillerSettings](rootCtx)
if err != nil {
log.Fatal("Failed to load config: ", err)
}
var testRpcConfig *config.TestnetRpcProviderSettings
if configuration.IsTestnet(cfg.P2pNetwork) {
testRpcConfig, err = configuration.LoadFromEnv[config.TestnetRpcProviderSettings](rootCtx)
if err != nil {
log.Fatal("Error loading testnet rpc config: ", err)
}
}
// Initialize rate limiters
chains.Initialize(&cfg.RpcProviderSettings)
chains.Initialize(&cfg.RpcProviderSettings, testRpcConfig)
// Initialize logger
rootLogger := logger.New("backfiller", logger.WithLevel(cfg.LogLevel))

View File

@ -38,7 +38,7 @@ func main() {
timestamp := time.Unix(blockTime, 0)
// fetch tx data
chains.Initialize(cfg)
chains.Initialize(cfg, nil)
txDetail, err := chains.FetchTx(context.Background(), cfg, chainId, os.Args[2], &timestamp, os.Args[4])
if err != nil {
log.Fatalf("Failed to get transaction data: %v", err)

View File

@ -14,6 +14,7 @@ import (
"go.mongodb.org/mongo-driver/mongo"
"github.com/wormhole-foundation/wormhole-explorer/common/client/sqs"
"github.com/wormhole-foundation/wormhole-explorer/common/configuration"
"github.com/wormhole-foundation/wormhole-explorer/common/dbutil"
"github.com/wormhole-foundation/wormhole-explorer/common/health"
"github.com/wormhole-foundation/wormhole-explorer/common/logger"
@ -36,6 +37,14 @@ func main() {
log.Fatal("Error loading config: ", err)
}
var testRpcConfig *config.TestnetRpcProviderSettings
if configuration.IsTestnet(cfg.P2pNetwork) {
testRpcConfig, err = config.LoadFromEnv[config.TestnetRpcProviderSettings]()
if err != nil {
log.Fatal("Error loading testnet rpc config: ", err)
}
}
// initialize metrics
metrics := newMetrics(cfg)
@ -45,7 +54,7 @@ func main() {
logger.Info("Starting wormhole-explorer-tx-tracker ...")
// initialize rate limiters
chains.Initialize(&cfg.RpcProviderSettings)
chains.Initialize(&cfg.RpcProviderSettings, testRpcConfig)
// initialize the database client
db, err := dbutil.Connect(rootCtx, logger, cfg.MongodbUri, cfg.MongodbDatabase, false)

View File

@ -119,6 +119,17 @@ type RpcProviderSettings struct {
WormchainRequestsPerMinute uint16 `split_words:"true" required:"true"`
}
type TestnetRpcProviderSettings struct {
ArbitrumSepoliaBaseUrl string `split_words:"true" required:"true"`
ArbitrumSepoliaRequestsPerMinute uint16 `split_words:"true" required:"true"`
BaseSepoliaBaseUrl string `split_words:"true" required:"true"`
BaseSepoliaRequestsPerMinute uint16 `split_words:"true" required:"true"`
EthereumSepoliaBaseUrl string `split_words:"true" required:"true"`
EthereumSepoliaRequestsPerMinute uint16 `split_words:"true" required:"true"`
OptimismSepoliaBaseUrl string `split_words:"true" required:"true"`
OptimismSepoliaRequestsPerMinute uint16 `split_words:"true" required:"true"`
}
func LoadFromEnv[T any]() (*T, error) {
_ = godotenv.Load()

View File

@ -81,6 +81,7 @@ require (
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sethvargo/go-envconfig v1.0.0 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect

View File

@ -149,7 +149,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
@ -265,7 +264,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@ -499,6 +498,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb
github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8=
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sethvargo/go-envconfig v1.0.0 h1:1C66wzy4QrROf5ew4KdVw942CQDa55qmlYmw9FZxZdU=
github.com/sethvargo/go-envconfig v1.0.0/go.mod h1:Lzc75ghUn5ucmcRGIdGQ33DKJrcjk4kihFYgSTBmjIc=
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/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
@ -580,8 +581,6 @@ github.com/wormhole-foundation/wormhole-explorer/api v0.0.0-20230316184234-db3a5
github.com/wormhole-foundation/wormhole-explorer/api v0.0.0-20230316184234-db3a54270a77/go.mod h1:SX//TXHIIc+QMHco3wxphC5Jk6wO/lk3r9J+SZnYip8=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e h1:1Y+QtZiWzpOQiIV0YihRK44LE064qMREnsSijzmNZEw=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240110201643-e70f2153117e/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=