Skip to content

Commit

Permalink
move builders to it's own package
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur committed Jul 2, 2024
1 parent 80be44e commit 626d21c
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions chainio/clients/elcontracts/builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package elcontracts

import (
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr"
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/metrics"
)

func BuildClients(
config Config,
ethHttpClient eth.Client,
txMgr txmgr.TxManager,
logger logging.Logger,
eigenMetrics *metrics.EigenMetrics,
) (*ELChainReader, *ELChainWriter, *ContractBindings, error) {
elContractBindings, err := NewBindingsFromConfig(
config,
ethHttpClient,
logger,
)
if err != nil {
return nil, nil, nil, err
}

elChainReader := NewELChainReader(
elContractBindings.Slasher,
elContractBindings.DelegationManager,
elContractBindings.StrategyManager,
elContractBindings.AvsDirectory,
logger,
ethHttpClient,
)

elChainWriter := NewELChainWriter(
elContractBindings.Slasher,
elContractBindings.DelegationManager,
elContractBindings.StrategyManager,
elContractBindings.RewardsCoordinator,
elContractBindings.StrategyManagerAddr,
elChainReader,
ethHttpClient,
logger,
eigenMetrics,
txMgr,
)

return elChainReader, elChainWriter, elContractBindings, nil
}

0 comments on commit 626d21c

Please sign in to comment.