This repository was archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
177 additions
and
33 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package nodeinterface | ||
|
||
import "github.com/ethereum/go-ethereum/common" | ||
|
||
var ( | ||
ERC4337GasHelperAddress = common.HexToAddress("0x559e3c6A74678FDBE1Fcc54153A8D7Dd7049FBCA") | ||
PrecompileAddress = common.HexToAddress("0x00000000000000000000000000000000000000C8") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package nodeinterface | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/accounts/abi" | ||
"github.com/ethereum/go-ethereum/common/hexutil" | ||
) | ||
|
||
var ( | ||
addressT, _ = abi.NewType("address", "", nil) | ||
boolT, _ = abi.NewType("bool", "", nil) | ||
bytesT, _ = abi.NewType("bytes", "", nil) | ||
uint64T, _ = abi.NewType("uint64", "", nil) | ||
uint256T, _ = abi.NewType("uint256", "", nil) | ||
|
||
GasEstimateL1ComponentMethod = abi.NewMethod( | ||
"gasEstimateL1Component", | ||
"gasEstimateL1Component", | ||
abi.Function, | ||
"", | ||
false, | ||
true, | ||
abi.Arguments{ | ||
{Name: "to", Type: addressT}, | ||
{Name: "contractCreation", Type: boolT}, | ||
{Name: "data", Type: bytesT}, | ||
}, | ||
abi.Arguments{ | ||
{Name: "gasEstimateForL1", Type: uint64T}, | ||
{Name: "baseFee", Type: uint256T}, | ||
{Name: "l1BaseFeeEstimate", Type: uint256T}, | ||
}, | ||
) | ||
) | ||
|
||
type GasEstimateL1ComponentOutput struct { | ||
GasEstimateForL1 uint64 | ||
BaseFee *big.Int | ||
L1BaseFeeEstimate *big.Int | ||
} | ||
|
||
func DecodeGasEstimateL1ComponentOutput(out any) (*GasEstimateL1ComponentOutput, error) { | ||
hex, ok := out.(string) | ||
if !ok { | ||
return nil, errors.New("gasEstimateL1Component: cannot assert type: hex is not of type string") | ||
} | ||
data, err := hexutil.Decode(hex) | ||
if err != nil { | ||
return nil, fmt.Errorf("gasEstimateL1Component: %s", err) | ||
} | ||
|
||
args, err := GasEstimateL1ComponentMethod.Outputs.Unpack(data) | ||
if err != nil { | ||
return nil, fmt.Errorf("gasEstimateL1Component: %s", err) | ||
} | ||
|
||
return &GasEstimateL1ComponentOutput{ | ||
GasEstimateForL1: args[0].(uint64), | ||
BaseFee: args[1].(*big.Int), | ||
L1BaseFeeEstimate: args[2].(*big.Int), | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters