Skip to content

Commit

Permalink
add erc20 bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasArrachea committed Dec 11, 2024
1 parent 7d1fd72 commit 508cd0d
Show file tree
Hide file tree
Showing 5 changed files with 868 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ core_default := "DelegationManager IRewardsCoordinator ISlasher StrategyManager
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
6 changes: 3 additions & 3 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager"
erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ERC20"
avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAVSDirectory"
erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20"
rewardscoordinator "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IRewardsCoordinator"
slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher"
strategy "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IStrategy"
Expand Down Expand Up @@ -176,7 +176,7 @@ func (r *ChainReader) GetStrategyAndUnderlyingToken(
func (r *ChainReader) GetStrategyAndUnderlyingERC20Token(
ctx context.Context,
strategyAddr gethcommon.Address,
) (*strategy.ContractIStrategy, erc20.ContractIERC20Methods, gethcommon.Address, error) {
) (*strategy.ContractIStrategy, erc20.ContractERC20Methods, gethcommon.Address, error) {
contractStrategy, err := strategy.NewContractIStrategy(strategyAddr, r.ethClient)
if err != nil {
return nil, nil, common.Address{}, utils.WrapError("Failed to fetch strategy contract", err)
Expand All @@ -185,7 +185,7 @@ func (r *ChainReader) GetStrategyAndUnderlyingERC20Token(
if err != nil {
return nil, nil, common.Address{}, utils.WrapError("Failed to fetch token contract", err)
}
contractUnderlyingToken, err := erc20.NewContractIERC20(underlyingTokenAddr, r.ethClient)
contractUnderlyingToken, err := erc20.NewContractERC20(underlyingTokenAddr, r.ethClient)
if err != nil {
return nil, nil, common.Address{}, utils.WrapError("Failed to fetch token contract", err)
}
Expand Down
4 changes: 2 additions & 2 deletions chainio/clients/elcontracts/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/big"
"testing"

erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20"
erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ERC20"
"github.com/Layr-Labs/eigensdk-go/testutils"
"github.com/Layr-Labs/eigensdk-go/testutils/testclients"
"github.com/Layr-Labs/eigensdk-go/types"
Expand Down Expand Up @@ -46,7 +46,7 @@ func TestChainReader(t *testing.T) {
assert.NotNil(t, strategy)
assert.NotEqual(t, common.Address{}, underlyingTokenAddr)

erc20Token, err := erc20.NewContractIERC20(underlyingTokenAddr, clients.EthHttpClient)
erc20Token, err := erc20.NewContractERC20(underlyingTokenAddr, clients.EthHttpClient)
assert.NoError(t, err)

tokenName, err := erc20Token.Name(&bind.CallOpts{})
Expand Down
4 changes: 2 additions & 2 deletions chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr"
delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager"
erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ERC20"
avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAVSDirectory"
erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20"
rewardscoordinator "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IRewardsCoordinator"
slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher"
strategy "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IStrategy"
Expand All @@ -27,7 +27,7 @@ import (
type Reader interface {
GetStrategyAndUnderlyingERC20Token(
ctx context.Context, strategyAddr gethcommon.Address,
) (*strategy.ContractIStrategy, erc20.ContractIERC20Methods, gethcommon.Address, error)
) (*strategy.ContractIStrategy, erc20.ContractERC20Methods, gethcommon.Address, error)
}

type ChainWriter struct {
Expand Down
Loading

0 comments on commit 508cd0d

Please sign in to comment.