Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur committed Jun 26, 2024
1 parent 984c63d commit b9ba1be
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
13 changes: 7 additions & 6 deletions chainio/clients/elcontracts/bindings.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// bindings.go contains functions that create contract bindings for the Eigenlayer and AVS contracts.
// Package elcontracts bindings.go contains functions that create contract bindings for the Eigenlayer Core contracts
// These functions are meant to be used by constructors of the chainio package.
package elcontracts

import (
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/types"
"github.com/Layr-Labs/eigensdk-go/utils"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
gethcommon "github.com/ethereum/go-ethereum/common"

Expand All @@ -14,9 +11,13 @@ import (
delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager"
slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher"
strategymanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/StrategyManager"
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/utils"
)

// ContractBindings Unclear to me why geth bindings don't store and expose the contract address...
// ContractBindings contains the contract bindings for the EigenLayer Core contracts
//
// Unclear why geth bindings don't store and expose the contract address,
// so we also store them here in case the different constructors that use this struct need them
type ContractBindings struct {
SlasherAddr gethcommon.Address
Expand All @@ -30,7 +31,7 @@ type ContractBindings struct {
}

func NewBindingsFromConfig(
cfg types.ElChainReaderConfig,
cfg ElChainReaderConfig,
client eth.Client,
logger logging.Logger,
) (*ContractBindings, error) {
Expand Down
12 changes: 9 additions & 3 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ type ELReader interface {
) ([32]byte, error)
}

type ElChainReaderConfig struct {
DelegationManagerAddress common.Address
AvsDirectoryAddress common.Address
}

type ELChainReader struct {
logger logging.Logger
slasher slasher.ContractISlasherCalls
Expand All @@ -73,7 +78,6 @@ type ELChainReader struct {
// forces EthReader to implement the chainio.Reader interface
var _ ELReader = (*ELChainReader)(nil)

// TODO(madhur): make this private. All clients should use build functions
func NewELChainReader(
slasher slasher.ContractISlasherCalls,
delegationManager delegationmanager.ContractDelegationManagerCalls,
Expand All @@ -82,6 +86,8 @@ func NewELChainReader(
logger logging.Logger,
ethClient eth.Client,
) *ELChainReader {
logger = logger.With("module", "elcontracts/reader")

return &ELChainReader{
slasher: slasher,
delegationManager: delegationManager,
Expand Down Expand Up @@ -119,8 +125,8 @@ func BuildELChainReader(
), nil
}

func BuildFromConfig(
cfg types.ElChainReaderConfig,
func NewReaderFromConfig(
cfg ElChainReaderConfig,
ethClient eth.Client,
logger logging.Logger,
) (*ELChainReader, error) {
Expand Down
7 changes: 0 additions & 7 deletions types/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
package types

import "github.com/ethereum/go-ethereum/common"

type ElChainReaderConfig struct {
DelegationManagerAddress common.Address
AvsDirectoryAddress common.Address
}

0 comments on commit b9ba1be

Please sign in to comment.