Skip to content

Commit

Permalink
errors about context fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodeymo committed Nov 11, 2024
1 parent 86fdfff commit 5005257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
16 changes: 5 additions & 11 deletions operator/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"

"github.com/Layr-Labs/eigensdk-go/crypto/bls"
eigenSdkTypes "github.com/Layr-Labs/eigensdk-go/types"

regcoord "github.com/Layr-Labs/eigensdk-go/contracts/bindings/RegistryCoordinator"
)

func (o *Operator) registerOperatorOnStartup(
Expand Down Expand Up @@ -63,7 +60,7 @@ func (o *Operator) RegisterOperatorWithEigenlayer() error {
}

func (o *Operator) DepositIntoStrategy(strategyAddr common.Address, amount *big.Int) error {
_, tokenAddr, err := o.eigenlayerReader.GetStrategyAndUnderlyingToken(&bind.CallOpts{}, strategyAddr)
_, tokenAddr, err := o.eigenlayerReader.GetStrategyAndUnderlyingToken(context.Background(), strategyAddr)
if err != nil {
o.logger.Error("Failed to fetch strategy contract", "err", err)
return err
Expand All @@ -74,6 +71,10 @@ func (o *Operator) DepositIntoStrategy(strategyAddr common.Address, amount *big.
return err
}
txOpts, err := o.avsWriter.TxMgr.GetNoSendTxOpts()
if err != nil {
o.logger.Error("Failed to fetch GetNoSendTxOpts", "err", err)
return err
}
tx, err := contractErc20Mock.Mint(txOpts, o.operatorAddr, amount)
if err != nil {
o.logger.Errorf("Error assembling Mint tx")
Expand Down Expand Up @@ -175,10 +176,3 @@ func (o *Operator) PrintOperatorStatus() error {
fmt.Println(string(operatorStatusJson))
return nil
}

func pubKeyG1ToBN254G1Point(p *bls.G1Point) regcoord.BN254G1Point {
return regcoord.BN254G1Point{
X: p.X.BigInt(new(big.Int)),
Y: p.Y.BigInt(new(big.Int)),
}
}
15 changes: 5 additions & 10 deletions plugin/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ import (
sdkclients "github.com/Layr-Labs/eigensdk-go/chainio/clients"
"github.com/Layr-Labs/eigensdk-go/chainio/clients/wallet"
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr"
regcoord "github.com/Layr-Labs/eigensdk-go/contracts/bindings/RegistryCoordinator"
"github.com/Layr-Labs/eigensdk-go/crypto/bls"
sdkecdsa "github.com/Layr-Labs/eigensdk-go/crypto/ecdsa"
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/signerv2"
sdktypes "github.com/Layr-Labs/eigensdk-go/types"
"github.com/Layr-Labs/incredible-squaring-avs/core/chainio"
"github.com/Layr-Labs/incredible-squaring-avs/types"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/urfave/cli"
Expand Down Expand Up @@ -135,6 +133,10 @@ func plugin(ctx *cli.Context) {
return
}
clients, err := sdkclients.BuildAll(buildClientConfig, operatorEcdsaPrivateKey, logger)
if err != nil {
fmt.Println(err)
return
}
avsReader, err := chainio.BuildAvsReader(
common.HexToAddress(avsConfig.AVSRegistryCoordinatorAddress),
common.HexToAddress(avsConfig.OperatorStateRetrieverAddress),
Expand Down Expand Up @@ -202,7 +204,7 @@ func plugin(ctx *cli.Context) {
return
}
strategyAddr := common.HexToAddress(ctx.GlobalString(StrategyAddrFlag.Name))
_, tokenAddr, err := clients.ElChainReader.GetStrategyAndUnderlyingToken(&bind.CallOpts{}, strategyAddr)
_, tokenAddr, err := clients.ElChainReader.GetStrategyAndUnderlyingToken(context.Background(), strategyAddr)
if err != nil {
logger.Error("Failed to fetch strategy contract", "err", err)
return
Expand Down Expand Up @@ -239,10 +241,3 @@ func plugin(ctx *cli.Context) {
fmt.Println("Invalid operation type")
}
}

func pubKeyG1ToBN254G1Point(p *bls.G1Point) regcoord.BN254G1Point {
return regcoord.BN254G1Point{
X: p.X.BigInt(new(big.Int)),
Y: p.Y.BigInt(new(big.Int)),
}
}

0 comments on commit 5005257

Please sign in to comment.