Skip to content

Commit

Permalink
feat: Add Smart Contracts logic for Lido (#386)
Browse files Browse the repository at this point in the history
* feat: add MevBoostRelayAllowedList contract and code

* feat: add StakingRouter contract and code

* feat: add contracts go files to package "lido"

* feat: apply changes to go.sum and go.mod

* feat: adjust packages for contracts

* fix: adjust formatting in MEVBoostRelayAllowedList.go

* fix: update go.mod and go.sum

* test: create MEVBoostrelayAllowedList_test.go

* feat: update go.mod, go.sum

* style: adjust formatting

* feat: move lido package to internal package

* feat: add feeRecipient addresses for each network

* feat: adjust MEVBoostRelayAllowedList_test.go for method GetRelays

* style: add comments to GetRelays method

* feat: separate test and logic methods

* feat: put expectedRelays in .yaml file

* style: rename files, adjust formatting and add comments

* feat: import configs package

* feat: add public rpcs to configs and create method GetPublicRPCs

* style: adjust formatting
  • Loading branch information
khalifaa55 authored Jun 25, 2024
1 parent 1f75887 commit 870874f
Show file tree
Hide file tree
Showing 14 changed files with 6,190 additions and 59 deletions.
8 changes: 8 additions & 0 deletions configs/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ func SupportsMEVBoost(network string) bool {
out, ok := networksConfigs[network]
return ok && out.SupportsMEVBoost
}

func GetPublicRPCs(network string) ([]string, error) {
rpcs, exists := networkRPCs[network]
if !exists {
return nil, fmt.Errorf("invalid network")
}
return rpcs.PublicRPCs, nil
}
29 changes: 29 additions & 0 deletions configs/public_rpcs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package configs

type RPC struct {
NetworkName string
PublicRPCs []string
}

var networkRPCs = map[string]RPC{
NetworkMainnet: {
NetworkName: NetworkMainnet,
PublicRPCs: []string{
"https://eth.llamarpc.com",
"https://eth-pokt.nodies.app",
"https://rpc.mevblocker.io",
"https://ethereum-rpc.publicnode.com",
"https://rpc.flashbots.net",
},
},
NetworkHolesky: {
NetworkName: NetworkHolesky,
PublicRPCs: []string{
"https://1rpc.io/holesky",
"https://holesky.drpc.org",
"https://ethereum-holesky-rpc.publicnode.com",
"https://endpoints.omniatech.io/v1/eth/holesky/public",
"https://ethereum-holesky.blockpi.network/v1/rpc/public",
},
},
}
50 changes: 33 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/NethermindEth/sedge

go 1.19
go 1.21

require (
github.com/AlecAivazis/survey/v2 v2.3.6
Expand All @@ -10,6 +10,7 @@ require (
github.com/compose-spec/compose-go v1.12.0
github.com/distribution/reference v0.5.0
github.com/docker/docker v24.0.7+incompatible
github.com/ethereum/go-ethereum v1.14.5
github.com/golang/mock v1.6.0
github.com/google/go-github/v47 v47.1.0
github.com/google/uuid v1.4.0
Expand All @@ -18,65 +19,80 @@ require (
github.com/opencontainers/image-spec v1.0.2
github.com/otiai10/copy v1.9.0
github.com/protolambda/go-keystorev4 v0.0.0-20211007151826-f20444f6d564
github.com/protolambda/zrnt v0.30.0
github.com/protolambda/zrnt v0.32.2
github.com/protolambda/ztyp v0.2.2
github.com/santhosh-tekuri/jsonschema/v5 v5.2.0
github.com/sirupsen/logrus v1.9.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.9.0
github.com/tyler-smith/go-bip39 v1.1.0
github.com/wealdtech/go-eth2-types/v2 v2.8.0
github.com/wealdtech/go-eth2-util v1.8.0
golang.org/x/sync v0.5.0
golang.org/x/sync v0.7.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.4.0
)

require (
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/creack/pty v1.1.18 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/distribution/distribution/v3 v3.0.0-20230223072852-e5d5810851d1 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ferranbt/fastssz v0.1.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/holiman/uint256 v1.2.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kilic/bls12-381 v0.1.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 // indirect
github.com/protolambda/bls12-381-util v0.1.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/wealdtech/go-bytesutil v1.2.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.6.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading

0 comments on commit 870874f

Please sign in to comment.