Documentation
¶
Index ¶
- Constants
- Variables
- func EstimateSafeTransactionGasLimit(ctx context.Context, client EstimateSafeTransactionClient, ...) (uint64, error)
- type Clients
- type EstimateSafeTransactionClient
- type EstimateSafeTransactionGasRequest
- type Estimation
- func (g *Estimation) EstimateSafeGas(ctx context.Context, safeTxn *types.SafeTx) (uint64, error)
- func (g *Estimation) EstimateSafeGasv1_3_0(ctx context.Context, safeTxn *types.SafeTx) (uint64, error)
- func (g *Estimation) EstimateSafeGasv1_4_0(_ context.Context, safeTxn *types.SafeTx) (uint64, error)
Constants ¶
const ( DefaultMaxGasLimit = uint64(6400000) MaxBinarySearchDepth = 10000 )
const ( SafeBufferLimit = 0.1 SimulateTxnAccessor = "SimulateTxnAccessor" )
Variables ¶
var (
ErrEstimateTransactionLimitFailed = errors.New("failed to estimate safe transaction gas")
)
var (
ErrInvalidChainID = errors.New("invalid chainID")
)
Functions ¶
func EstimateSafeTransactionGasLimit ¶
func EstimateSafeTransactionGasLimit( ctx context.Context, client EstimateSafeTransactionClient, request EstimateSafeTransactionGasRequest, ) (uint64, error)
EstimateSafeTransactionGasLimit estimates the gas limit for a safe transaction. It uses a binary search algorithm to find the optimal gas limit for the transaction. And finds the optimal gas at which the transaction succeeds by checking the return of the eth_call if encoded callData is execTransactionFromModule or execTransaction and call is successful safe returns (true) boolean as return https://github.com/safe-global/safe-contracts/blob/1cfa95710057e33832600e6b9ad5ececca8f7839/contracts/SafeL2.sol#L12-L13
Types ¶
type Estimation ¶
type Estimation struct {
// contains filtered or unexported fields
}
func NewGasEstimation ¶
func (*Estimation) EstimateSafeGas ¶
EstimateSafeGas this estimates the max gas limit that should be given in form of safeTxGas it selects the appropriate function according to the safe version
func (*Estimation) EstimateSafeGasv1_3_0 ¶
func (g *Estimation) EstimateSafeGasv1_3_0(ctx context.Context, safeTxn *types.SafeTx) (uint64, error)
EstimateSafeGasv1_3_0 this estimates the max gas limit that should be given in form of safeTxGas and is compatible with safe version 1.3.0 see https://github.com/safe-global/safe-core-sdk/blob/7959821ab08c96cf3babb9ed906c01d644ac49f4/packages/protocol-kit/src/utils/transactions/gas.ts#L17
func (*Estimation) EstimateSafeGasv1_4_0 ¶
func (g *Estimation) EstimateSafeGasv1_4_0(_ context.Context, safeTxn *types.SafeTx) (uint64, error)
EstimateSafeGasv1_4_0 this estimates the max gas limit that should be given in form of safeTxGas and is compatible with safe version 1.4.0