Documentation
¶
Index ¶
- Variables
- func WithDefaultSafelContractCallerCreator(creator SafeContractCallerCreator) optionFunc
- type DelivererByEthClientOption
- type PrivateKeySigner
- type SafeContract
- type SafeContractCaller
- type SafeContractCallerCreator
- type SafeContractVersion1_3_0
- func (contract *SafeContractVersion1_3_0) EncodeExecTransactionData(signatures []byte, txParams SafeTxParam) ([]byte, error)
- func (contract *SafeContractVersion1_3_0) EncodeTransactionData(nonce uint64, txParams SafeTxParam) ([]byte, error)
- func (contract *SafeContractVersion1_3_0) GetAddress() common.Address
- func (contract *SafeContractVersion1_3_0) GetNonce() (uint64, error)
- func (contract *SafeContractVersion1_3_0) GetOwners() ([]common.Address, error)
- func (contract *SafeContractVersion1_3_0) GetThreshold() (uint64, error)
- func (contract *SafeContractVersion1_3_0) GetTransactionHash(nonce uint64, txParams SafeTxParam) ([]byte, error)
- func (contract *SafeContractVersion1_3_0) GetVersion() (string, error)
- type SafeSignFn
- type SafeTxBuilder
- type SafeTxBuilderByContract
- func (builder *SafeTxBuilderByContract) Build(safeTxParams SafeTxParam) ([]byte, []byte, uint64, error)
- func (builder *SafeTxBuilderByContract) BuildCustomNonce(safeTxParams SafeTxParam, safeNonce uint64) (callData []byte, signatures []byte, err error)
- func (builder *SafeTxBuilderByContract) GetContractAddress() (common.Address, error)
- type SafeTxDeliverer
- type SafeTxDelivererByEthClient
- type SafeTxParam
- type SafeTxParamV1_3
- type Signer
Constants ¶
This section is empty.
Variables ¶
var ErrSafeParamVersionNotMatch = errors.New("safe param version mismatch")
Functions ¶
func WithDefaultSafelContractCallerCreator ¶
func WithDefaultSafelContractCallerCreator(creator SafeContractCallerCreator) optionFunc
Types ¶
type DelivererByEthClientOption ¶
type DelivererByEthClientOption interface {
// contains filtered or unexported methods
}
type PrivateKeySigner ¶
func NewPrivateKeySigner ¶
func NewPrivateKeySigner(key *ecdsa.PrivateKey) *PrivateKeySigner
func (*PrivateKeySigner) GetSignerFn ¶
func (signer *PrivateKeySigner) GetSignerFn() SafeSignFn
func (*PrivateKeySigner) RegisterSignerFn ¶
func (signer *PrivateKeySigner) RegisterSignerFn(signerFn SafeSignFn)
type SafeContract ¶
type SafeContract interface {
SafeContractCaller
// EncodeExecTransactionData generates calldata for Safe's execTransaction call.
EncodeExecTransactionData(signatures []byte, txParams SafeTxParam) ([]byte, error)
}
SafeContract is an abstraction of Safe implementations. Different versions can have different implementations.
func NewSafeContractVersion1_3_0 ¶
func NewSafeContractVersion1_3_0(contractAdress common.Address, backend bind.ContractBackend) (SafeContract, error)
type SafeContractCaller ¶
type SafeContractCaller interface {
GetNonce() (uint64, error)
GetThreshold() (uint64, error)
GetAddress() common.Address
GetOwners() ([]common.Address, error)
GetVersion() (string, error)
GetTransactionHash(nonce uint64, txParams SafeTxParam) ([]byte, error)
EncodeTransactionData(nonce uint64, txParams SafeTxParam) ([]byte, error)
}
SafeContractCaller read-only operations for Safe contracts.
func NewDefaultSafelContractCallerCreator ¶
func NewDefaultSafelContractCallerCreator(address common.Address, backend bind.ContractBackend) (SafeContractCaller, error)
type SafeContractCallerCreator ¶
type SafeContractCallerCreator func(address common.Address, backend bind.ContractBackend) (SafeContractCaller, error)
SafeContractCallerCreator generates a SafeContractCaller instance based on the provided contract address and backend service.
type SafeContractVersion1_3_0 ¶
type SafeContractVersion1_3_0 struct {
Address common.Address
// contains filtered or unexported fields
}
func (*SafeContractVersion1_3_0) EncodeExecTransactionData ¶
func (contract *SafeContractVersion1_3_0) EncodeExecTransactionData(signatures []byte, txParams SafeTxParam) ([]byte, error)
func (*SafeContractVersion1_3_0) EncodeTransactionData ¶
func (contract *SafeContractVersion1_3_0) EncodeTransactionData(nonce uint64, txParams SafeTxParam) ([]byte, error)
func (*SafeContractVersion1_3_0) GetAddress ¶
func (contract *SafeContractVersion1_3_0) GetAddress() common.Address
func (*SafeContractVersion1_3_0) GetNonce ¶
func (contract *SafeContractVersion1_3_0) GetNonce() (uint64, error)
func (*SafeContractVersion1_3_0) GetOwners ¶
func (contract *SafeContractVersion1_3_0) GetOwners() ([]common.Address, error)
func (*SafeContractVersion1_3_0) GetThreshold ¶
func (contract *SafeContractVersion1_3_0) GetThreshold() (uint64, error)
func (*SafeContractVersion1_3_0) GetTransactionHash ¶
func (contract *SafeContractVersion1_3_0) GetTransactionHash(nonce uint64, txParams SafeTxParam) ([]byte, error)
func (*SafeContractVersion1_3_0) GetVersion ¶
func (contract *SafeContractVersion1_3_0) GetVersion() (string, error)
type SafeSignFn ¶
SafeSignFn verifies the provided address and signs the given hash.
type SafeTxBuilder ¶
type SafeTxBuilder interface {
// Build return transaction calldata, verifiable signatures, and safe nonce.
Build(safeTxParams SafeTxParam) (callData []byte, signatures []byte, nonce uint64, err error)
BuildCustomNonce(safeTxParams SafeTxParam, nonce uint64) (callData []byte, signatures []byte, err error)
GetContractAddress() (common.Address, error)
}
SafeTxBuilder builds transaction calldata and maintains Safe nonce sequence.
type SafeTxBuilderByContract ¶
type SafeTxBuilderByContract struct {
// contains filtered or unexported fields
}
func NewSafeTxBuilderByContract ¶
func NewSafeTxBuilderByContract(safe SafeContract, signers map[common.Address]Signer, nonceStorage nonce.Storage) (*SafeTxBuilderByContract, error)
func (*SafeTxBuilderByContract) Build ¶
func (builder *SafeTxBuilderByContract) Build(safeTxParams SafeTxParam) ([]byte, []byte, uint64, error)
func (*SafeTxBuilderByContract) BuildCustomNonce ¶
func (builder *SafeTxBuilderByContract) BuildCustomNonce(safeTxParams SafeTxParam, safeNonce uint64) (callData []byte, signatures []byte, err error)
func (*SafeTxBuilderByContract) GetContractAddress ¶
func (builder *SafeTxBuilderByContract) GetContractAddress() (common.Address, error)
type SafeTxDeliverer ¶
SafeTxDeliverer dispatches requests to the underlying layer, where each request wraps a call to Safe's execTransaction. TODO: Deliverer should validate the request's gas to ensure it meets the minimum requirement for successful Safe contract execution (avoiding reverts).
func NewSafeTxDelivererByEthClient ¶
func NewSafeTxDelivererByEthClient(ethClient *ethclient.Client, clientSendTxAddr common.Address, options ...DelivererByEthClientOption) SafeTxDeliverer
type SafeTxDelivererByEthClient ¶
type SafeTxDelivererByEthClient struct {
// contains filtered or unexported fields
}
type SafeTxParam ¶
type SafeTxParam interface {
Version() string
}
SafeTxParam contains parameters for a specific Safe contract call. TODO: Add IsValid() method for integrity checks.
type SafeTxParamV1_3 ¶
type SafeTxParamV1_3 struct {
To common.Address
Value *big.Int
Calldata []byte
Operation uint8
SafeTxGas *big.Int
BaseGas *big.Int
GasPrice *big.Int
GasToken common.Address
RefundReceiver common.Address
}
func (*SafeTxParamV1_3) Version ¶
func (param *SafeTxParamV1_3) Version() string
type Signer ¶
type Signer interface {
GetSignerFn() SafeSignFn
RegisterSignerFn(signerFn SafeSignFn)
}
Signer defines methods for registration and retrieving the SafeSignFn.