Skip to content

Commit

Permalink
fixed writer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afkbyte committed Dec 24, 2024
1 parent b5267b4 commit 2e5ef1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 12 additions & 0 deletions chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ func (w *ChainWriter) UpdateOperatorDetails(
return nil, errors.New("DelegationManager contract not provided")
}

if w.allocationManager == nil {
return nil, errors.New("AlocationManager contract not provided")
}

w.logger.Infof("updating operator details of operator %s to EigenLayer", operator.Address)

noSendTxOpts, err := w.txMgr.GetNoSendTxOpts()
Expand All @@ -208,14 +212,22 @@ func (w *ChainWriter) UpdateOperatorDetails(
operatorAddress := gethcommon.HexToAddress(operator.Address)
delegationApprover := gethcommon.HexToAddress(operator.DelegationApproverAddress)

println(operator.Address)
println(operator.DelegationApproverAddress)

tx, err := w.delegationManager.ModifyOperatorDetails(noSendTxOpts, operatorAddress, delegationApprover)
if err != nil {
return nil, err
}

println("HERE")
receipt, err := w.txMgr.Send(ctx, tx, waitForReceipt)
if err != nil {
return nil, errors.New("failed to send tx with err: " + err.Error())
}

println("HERE")

w.logger.Info(
"successfully updated operator details",
"txHash",
Expand Down
6 changes: 2 additions & 4 deletions chainio/clients/elcontracts/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestChainWriter(t *testing.T) {
walletModifiedAddress := crypto.PubkeyToAddress(walletModified.PublicKey)

operatorModified := types.Operator{
Address: walletModifiedAddress.Hex(),
Address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
DelegationApproverAddress: walletModifiedAddress.Hex(),
AllocationDelay: 101,
MetadataUrl: "eigensdk-go",
Expand All @@ -132,14 +132,12 @@ func TestChainWriter(t *testing.T) {
walletModified, err := crypto.HexToECDSA("2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6")
assert.NoError(t, err)
walletModifiedAddress := crypto.PubkeyToAddress(walletModified.PublicKey)

operator := types.Operator{
Address: walletModifiedAddress.Hex(),
Address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
DelegationApproverAddress: walletModifiedAddress.Hex(),
AllocationDelay: 101,
MetadataUrl: "eigensdk-go",
}

receipt, err := clients.ElChainWriter.UpdateMetadataURI(context.Background(), operator, "https://0.0.0.0", true)
assert.NoError(t, err)
assert.True(t, receipt.Status == 1)
Expand Down

0 comments on commit 2e5ef1f

Please sign in to comment.