AvoGasEstimationsHelper
AvoGasEstimationsHelper_V1
Helps to estimate gas costs for execution of arbitrary actions in an Avocado smart wallet, especially when the smart wallet is not deployed yet.
IAvocadoMultisigWithCallTargets
_callTargets
function _callTargets(struct AvocadoMultisigStructs.Action[] actions_, uint256 id_) external payable
AvoGasEstimationsHelperEvents
Executed
event Executed(address avocadoOwner, uint32 index, address avocadoAddress, address source, bytes metadata)
emitted when all actions for cast()
in an execute()
method are executed successfully
ExecuteFailed
event ExecuteFailed(address avocadoOwner, uint32 index, address avocadoAddress, address source, bytes metadata, string reason)
emitted if one of the actions for cast()
in an execute()
method fails
AvoGasEstimationsHelper
AvoGasEstimationsHelper__InvalidParams
error AvoGasEstimationsHelper__InvalidParams()
AvoGasEstimationsHelper__Unauthorized
error AvoGasEstimationsHelper__Unauthorized()
avoFactory
contract IAvoFactory avoFactory
AvoFactory that this contract uses to find or create Avocado smart wallet deployments
avocadoBytecode
bytes32 avocadoBytecode
cached Avocado Bytecode to directly compute address in this contract to optimize gas usage.
constructor
constructor(contract IAvoFactory avoFactory_) public
constructor sets the immutable avoFactory
address
Parameters
Name | Type | Description |
---|---|---|
avoFactory_ | contract IAvoFactory | address of AvoFactory (proxy) |
SimulateResult
struct SimulateResult {
uint256 totalGasUsed;
uint256 castGasUsed;
uint256 deploymentGasUsed;
bool isDeployed;
bool success;
string revertReason;
}
simulateV1
function simulateV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastParams params_, struct AvocadoMultisigStructs.CastForwardParams forwardParams_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_) external payable returns (struct AvoGasEstimationsHelper.SimulateResult simulateResult_)
Simulates executeV1
, callable only by msg.sender = dead address
(0x000000000000000000000000000000000000dEaD)
Helpful to estimate CastForwardParams.gas
for an Avocado tx.
For Avocado v1.
Deploys the Avocado smart wallet if necessary.
Expected use with .estimateGas()
. User signed CastForwardParams.gas
should be set to the estimated
amount minus gas used in AvoForwarder (until AvocadoMultisig logic where the gas param is validated).
Best to simulate first with a .callstatic
to determine success / error and other return values.
Parameters
Name | Type | Description |
---|---|---|
from_ | address | AvocadoMultisig owner |
index_ | uint32 | index number of Avocado for owner_ EOA |
params_ | struct AvocadoMultisigStructs.CastParams | Cast params such as id, avoNonce and actions to execute |
forwardParams_ | struct AvocadoMultisigStructs.CastForwardParams | Cast params related to validity of forwarding as instructed and signed |
signaturesParams_ | struct AvocadoMultisigStructs.SignatureParams | SignatureParams structs array for signature and signer: - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA. For smart contract signatures it must fulfill the requirements for the relevant smart contract .isValidSignature() EIP1271 logic - signer: address of the signature signer. Must match the actual signature signer or refer to the smart contract that must be an allowed signer and validates signature via EIP1271 |
Return Values
Name | Type | Description |
---|---|---|
simulateResult_ | struct AvoGasEstimationsHelper.SimulateResult | result struct with following values: - total amount of gas used - amount of gas used for executing cast - amount of gas used for deployment (or for getting the contract if already deployed) - boolean flag indicating if Avocado is already deployed - boolean flag indicating whether executing actions reverts or not - revert reason original error in default format "<action_index>_error" |