diff --git a/pkg/internal/common/eth.go b/pkg/internal/common/eth.go index c78e2cc..8467573 100644 --- a/pkg/internal/common/eth.go +++ b/pkg/internal/common/eth.go @@ -24,11 +24,11 @@ type TxFeeDetails struct { } func (t *TxFeeDetails) Print() { - message := strings.Repeat("-", 25) + " Gas Fee Details " + strings.Repeat("-", 25) + message := strings.Repeat("-", 30) + " Gas Fee Details " + strings.Repeat("-", 30) fmt.Println(message) fmt.Printf("Gas Tip Cap: %0.9f Gwei\n", t.GasTipCapGwei) fmt.Printf("Gas Fee Cap: %0.9f Gwei\n", t.GasFeeCapGwei) - fmt.Printf("Gas Limit: %d\n", t.GasLimit) + fmt.Printf("Gas Limit: %d (If claimer is a smart contract, this value is hardcoded)\n", t.GasLimit) fmt.Printf("Approximate Max Cost of transaction: %0.12f ETH\n", t.CostInEth) fmt.Println(strings.Repeat("-", len(message))) } diff --git a/pkg/rewards/claim.go b/pkg/rewards/claim.go index 9ac2233..8b929b5 100644 --- a/pkg/rewards/claim.go +++ b/pkg/rewards/claim.go @@ -204,10 +204,24 @@ func Claim(cCtx *cli.Context, p utils.Prompter) error { return err } + // If claimer is a smart contract, we can't estimate gas using geth + // since balance of contract can be 0, as it can be called by an EOA + // to claim. So we hardcode the gas limit to 150_000 so that we can + // create unsigned tx without gas limit estimation from contract bindings + code, err := ethClient.CodeAt(ctx, config.ClaimerAddress, nil) + if err != nil { + return eigenSdkUtils.WrapError("failed to get code at address", err) + } + if len(code) > 0 { + // Claimer is a smart contract + noSendTxOpts.GasLimit = 150_000 + } + unsignedTx, err := contractBindings.RewardsCoordinator.ProcessClaim(noSendTxOpts, elClaim, config.RecipientAddress) if err != nil { return eigenSdkUtils.WrapError("failed to create unsigned tx", err) } + if config.OutputType == string(common.OutputType_Calldata) { calldataHex := gethcommon.Bytes2Hex(unsignedTx.Data())