Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to mainnet rewards v0.4.3 #407

Merged
merged 8 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "contracts/lib/eigenlayer-middleware"]
path = contracts/lib/eigenlayer-middleware
url = [email protected]:Layr-Labs/eigenlayer-middleware.git
commit = 512ce7326f35e8060b9d46e23f9c159c0000b546
[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
url = [email protected]:foundry-rs/forge-std
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ lint: ## runs all linters

___BINDINGS___: ##

core_default := "DelegationManager IRewardsCoordinator ISlasher StrategyManager EigenPod EigenPodManager IStrategy IAVSDirectory"
core_default := "DelegationManager IRewardsCoordinator ISlasher StrategyManager EigenPod EigenPodManager IStrategy IAVSDirectory IEigenPod IEigenPodManager"
core_location := "./lib/eigenlayer-middleware/lib/eigenlayer-contracts"
core_bindings_location := "../../../../bindings"

middleware_default := "RegistryCoordinator IndexRegistry OperatorStateRetriever StakeRegistry BLSApkRegistry IBLSSignatureChecker ServiceManagerBase IERC20"
middleware_default := "RegistryCoordinator IndexRegistry OperatorStateRetriever StakeRegistry BLSApkRegistry IBLSSignatureChecker ServiceManagerBase IERC20 ERC20"
middleware_location := "./lib/eigenlayer-middleware"
middleware_bindings_location := "../../bindings"

Expand Down Expand Up @@ -107,13 +107,9 @@ else
cd contracts && ./generate-bindings.sh $(sdk_location) $(sdk_default) $(sdk_bindings_location)
endif

.PHONY: eigenpod-bindings
eigenpod-bindings: ## generates contract bindings for eigenpod
cd chainio/clients/eigenpod && ./generate.sh

.PHONY: bindings
bindings: ## generates all contract bindings
rm -rf bindings/* && make core-bindings middleware-bindings sdk-bindings eigenpod-bindings
rm -rf bindings/* && make core-bindings middleware-bindings sdk-bindings


___CONTRACTS___: ##
Expand Down
36 changes: 18 additions & 18 deletions chainio/clients/eigenpod/bindings.go
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
package eigenpod

import (
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eigenpod/bindings"
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"

ieigenpod "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IEigenPod"
ieigenpodmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IEigenPodManager"
"github.com/ethereum/go-ethereum/common"
)

type ContractBindings struct {
Address common.Address
*bindings.IEigenPod
*ieigenpod.ContractIEigenPod
}

type ContractCallerBindings struct {
Address common.Address
*bindings.IEigenPodCaller
*ieigenpod.ContractIEigenPodCaller
}

type ManagerContractBindings struct {
Address common.Address
*bindings.IEigenPodManager
*ieigenpodmanager.ContractIEigenPodManager
}

type ManagerContractCallerBindings struct {
Address common.Address
*bindings.IEigenPodManagerCaller
*ieigenpodmanager.ContractIEigenPodManagerCaller
}

func NewContractBindings(
address common.Address,
ethClient eth.HttpBackend,
) (*ContractBindings, error) {
pod, err := bindings.NewIEigenPod(address, ethClient)
pod, err := ieigenpod.NewContractIEigenPod(address, ethClient)
if err != nil {
return nil, err
}
return &ContractBindings{
Address: address,
IEigenPod: pod,
Address: address,
ContractIEigenPod: pod,
}, nil
}

func NewContractCallerBindings(
address common.Address,
ethClient eth.HttpBackend,
) (*ContractCallerBindings, error) {
pod, err := bindings.NewIEigenPodCaller(address, ethClient)
pod, err := ieigenpod.NewContractIEigenPodCaller(address, ethClient)
if err != nil {
return nil, err
}
return &ContractCallerBindings{
Address: address,
IEigenPodCaller: pod,
Address: address,
ContractIEigenPodCaller: pod,
}, nil
}

func NewManagerContractBindings(
address common.Address,
ethClient eth.HttpBackend,
) (*ManagerContractBindings, error) {
manager, err := bindings.NewIEigenPodManager(address, ethClient)
manager, err := ieigenpodmanager.NewContractIEigenPodManager(address, ethClient)
if err != nil {
return nil, err
}
return &ManagerContractBindings{
Address: address,
IEigenPodManager: manager,
Address: address,
ContractIEigenPodManager: manager,
}, nil
}

func NewManagerContractCallerBindings(
address common.Address,
ethClient eth.HttpBackend,
) (*ManagerContractCallerBindings, error) {
manager, err := bindings.NewIEigenPodManagerCaller(address, ethClient)
manager, err := ieigenpodmanager.NewContractIEigenPodManagerCaller(address, ethClient)
if err != nil {
return nil, err
}
return &ManagerContractCallerBindings{
Address: address,
IEigenPodManagerCaller: manager,
Address: address,
ContractIEigenPodManagerCaller: manager,
}, nil
}
8 changes: 4 additions & 4 deletions chainio/clients/eigenpod/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ func BuildEigenPodClients(
}

eigenPodChainReader := newChainReader(
&eigenPodBindings.IEigenPodCaller,
&eigenPodBindings.ContractIEigenPodCaller,
client,
logger,
)

eigenPodChainWriter := newChainWriter(
eigenPodBindings.IEigenPod,
eigenPodBindings.ContractIEigenPod,
client,
logger,
txMgr,
Expand All @@ -48,13 +48,13 @@ func BuildEigenPodManagerClients(
}

eigenPodManagerChainReader := newManagerChainReader(
&eigenPodManagerBindings.IEigenPodManagerCaller,
&eigenPodManagerBindings.ContractIEigenPodManagerCaller,
client,
logger,
)

eigenPodManagerChainWriter := newManagerChainWriter(
eigenPodManagerBindings.IEigenPodManager,
eigenPodManagerBindings.ContractIEigenPodManager,
client,
logger,
txMgr,
Expand Down
59 changes: 0 additions & 59 deletions chainio/clients/eigenpod/generate.sh

This file was deleted.

27 changes: 14 additions & 13 deletions chainio/clients/eigenpod/reader.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package eigenpod

import (
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eigenpod/bindings"
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
ieigenpod "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IEigenPod"
ieigenpodmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IEigenPodManager"
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/utils"

Expand All @@ -15,7 +16,7 @@ import (
type ChainReader struct {
logger logging.Logger
ethClient eth.HttpBackend
*bindings.IEigenPodCaller
*ieigenpod.ContractIEigenPodCaller
}

// ManagerChainReader is a reader for the EigenPodManager contract.
Expand All @@ -24,34 +25,34 @@ type ChainReader struct {
type ManagerChainReader struct {
logger logging.Logger
ethClient eth.HttpBackend
*bindings.IEigenPodManagerCaller
*ieigenpodmanager.ContractIEigenPodManagerCaller
}

func newChainReader(
eigenPod *bindings.IEigenPodCaller,
eigenPod *ieigenpod.ContractIEigenPodCaller,
ethClient eth.HttpBackend,
logger logging.Logger,
) *ChainReader {
logger = logger.With(logging.ComponentKey, "eigenpod/reader")

return &ChainReader{
logger: logger,
ethClient: ethClient,
IEigenPodCaller: eigenPod,
logger: logger,
ethClient: ethClient,
ContractIEigenPodCaller: eigenPod,
}
}

func newManagerChainReader(
manager *bindings.IEigenPodManagerCaller,
manager *ieigenpodmanager.ContractIEigenPodManagerCaller,
ethClient eth.HttpBackend,
logger logging.Logger,
) *ManagerChainReader {
logger = logger.With(logging.ComponentKey, "eigenpodmanager/reader")

return &ManagerChainReader{
logger: logger,
ethClient: ethClient,
IEigenPodManagerCaller: manager,
logger: logger,
ethClient: ethClient,
ContractIEigenPodManagerCaller: manager,
}
}

Expand All @@ -65,7 +66,7 @@ func NewReader(
return nil, utils.WrapError("Failed to create EigenPod contract", err)
}

return newChainReader(pod.IEigenPodCaller, ethClient, logger), nil
return newChainReader(pod.ContractIEigenPodCaller, ethClient, logger), nil
}

func NewManagerReader(
Expand All @@ -78,5 +79,5 @@ func NewManagerReader(
return nil, utils.WrapError("Failed to create EigenPodManager contract", err)
}

return newManagerChainReader(manager.IEigenPodManagerCaller, ethClient, logger), nil
return newManagerChainReader(manager.ContractIEigenPodManagerCaller, ethClient, logger), nil
}
15 changes: 8 additions & 7 deletions chainio/clients/eigenpod/writer.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package eigenpod

import (
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eigenpod/bindings"
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr"
ieigenpod "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IEigenPod"
ieigenpodmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IEigenPodManager"
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/utils"

Expand All @@ -13,19 +14,19 @@ import (
type ChainWriter struct {
logger logging.Logger
ethClient eth.HttpBackend
eigenPod *bindings.IEigenPod
eigenPod *ieigenpod.ContractIEigenPod
txMgr txmgr.TxManager
}

type ManagerChainWriter struct {
logger logging.Logger
ethClient eth.HttpBackend
manager *bindings.IEigenPodManager
manager *ieigenpodmanager.ContractIEigenPodManager
txMgr txmgr.TxManager
}

func newChainWriter(
eigenPod *bindings.IEigenPod,
eigenPod *ieigenpod.ContractIEigenPod,
ethClient eth.HttpBackend,
logger logging.Logger,
txMgr txmgr.TxManager,
Expand All @@ -41,7 +42,7 @@ func newChainWriter(
}

func newManagerChainWriter(
manager *bindings.IEigenPodManager,
manager *ieigenpodmanager.ContractIEigenPodManager,
ethClient eth.HttpBackend,
logger logging.Logger,
txMgr txmgr.TxManager,
Expand All @@ -62,7 +63,7 @@ func NewWriter(
txMgr txmgr.TxManager,
logger logging.Logger,
) (*ChainWriter, error) {
pod, err := bindings.NewIEigenPod(eigenPodAddress, ethClient)
pod, err := ieigenpod.NewContractIEigenPod(eigenPodAddress, ethClient)
if err != nil {
return nil, utils.WrapError("Failed to create EigenPod contract", err)
}
Expand All @@ -76,7 +77,7 @@ func NewManagerWriter(
txMgr txmgr.TxManager,
logger logging.Logger,
) (*ManagerChainWriter, error) {
manager, err := bindings.NewIEigenPodManager(eigenPodManagerAddress, ethClient)
manager, err := ieigenpodmanager.NewContractIEigenPodManager(eigenPodManagerAddress, ethClient)
if err != nil {
return nil, utils.WrapError("Failed to create EigenPodManager contract", err)
}
Expand Down
Loading
Loading