Skip to content

AvoForwarder ​

AvoForwarder_V1 ​

Handles executing authorized actions (through signatures) at Avocados, triggered by allow-listed broadcasters.

Only compatible with forwarding cast calls to Avocado smart wallet contracts. This is not a generic forwarder. This is NOT a "TrustedForwarder" as proposed in EIP-2770, see info in Avocado smart wallet contracts.

Does not validate the EIP712 signature (instead this is done in the smart wallet itself).

Upgradeable through AvoForwarderProxy

AvoForwarderConstants ​

avoFactory ​

solidity
contract IAvoFactory avoFactory

AvoFactory (proxy) used to deploy new Avocado smart wallets.

avocadoBytecode ​

solidity
bytes32 avocadoBytecode

cached Avocado Bytecode to directly compute address in this contract to optimize gas usage.

AvoForwarderVariables ​

AvoForwarderErrors ​

AvoForwarder__InvalidParams ​

solidity
error AvoForwarder__InvalidParams()

thrown when a method is called with invalid params (e.g. zero address)

AvoForwarder__Unauthorized ​

solidity
error AvoForwarder__Unauthorized()

thrown when a caller is not authorized to execute a certain action

AvoForwarder__LegacyVersionNotDeployed ​

solidity
error AvoForwarder__LegacyVersionNotDeployed()

thrown when trying to execute legacy methods for a not yet deployed Avocado smart wallet

AvoForwarder__Unsupported ​

solidity
error AvoForwarder__Unsupported()

thrown when an unsupported method is called (e.g. renounceOwnership)

AvoForwarderStructs ​

AddressBool ​

solidity
struct AddressBool {
  address addr;
  bool value;
}

ExecuteBatchParams ​

solidity
struct ExecuteBatchParams {
  address from;
  uint32 index;
  struct AvocadoMultisigStructs.CastChainAgnosticParams params;
  struct AvocadoMultisigStructs.SignatureParams[] signaturesParams;
  struct AvocadoMultisigStructs.ChainAgnosticHash[] chainAgnosticHashes;
}

SimulateBatchResult ​

solidity
struct SimulateBatchResult {
  uint256 castGasUsed;
  bool success;
  string revertReason;
}

AvoForwarderEvents ​

Executed ​

solidity
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 ​

solidity
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

BroadcasterUpdated ​

solidity
event BroadcasterUpdated(address broadcaster, bool status)

emitted if a broadcaster's allowed status is updated

AuthUpdated ​

solidity
event AuthUpdated(address auth, bool status)

emitted if an auth's allowed status is updated

AvoForwarderCore ​

AvoForwarderViews ​

isBroadcaster ​

solidity
function isBroadcaster(address broadcaster_) external view returns (bool)

checks if a broadcaster_ address is an allowed broadcaster

isAuth ​

solidity
function isAuth(address auth_) external view returns (bool)

checks if an auth_ address is an allowed auth

AvoForwarderViewsAvocado ​

avoNonce ​

solidity
function avoNonce(address owner_, uint32 index_) external view returns (uint256)

Retrieves the current avoNonce of AvocadoMultisig for owner_ address. Needed for building signatures.

Parameters ​

NameTypeDescription
owner_addressAvocado owner to retrieve the nonce for.
index_uint32index number of Avocado for owner_ EOA

Return Values ​

NameTypeDescription
[0]uint256returns the avoNonce for the owner_ necessary to sign a meta transaction

avocadoVersionName ​

solidity
function avocadoVersionName(address owner_, uint32 index_) external view returns (string)

Retrieves the current AvocadoMultisig implementation name for owner_ address. Needed for building signatures.

Parameters ​

NameTypeDescription
owner_addressAvocado owner to retrieve the name for.
index_uint32index number of Avocado for owner_ EOA

Return Values ​

NameTypeDescription
[0]stringreturns the domain separator name for the owner_ necessary to sign a meta transaction

avocadoVersion ​

solidity
function avocadoVersion(address owner_, uint32 index_) external view returns (string)

Retrieves the current AvocadoMultisig implementation version for owner_ address. Needed for building signatures.

Parameters ​

NameTypeDescription
owner_addressAvocado owner to retrieve the version for.
index_uint32index number of Avocado for owner_ EOA

Return Values ​

NameTypeDescription
[0]stringreturns the domain separator version for the owner_ necessary to sign a meta transaction

computeAvocado ​

solidity
function computeAvocado(address owner_, uint32 index_) external view returns (address)

Computes the deterministic Avocado address for owner_ and index_

getAvocadoChainAgnosticHashes ​

solidity
function getAvocadoChainAgnosticHashes(address from_, uint32 index_, struct AvocadoMultisigStructs.CastChainAgnosticParams[] params_) external returns (struct AvocadoMultisigStructs.ChainAgnosticHash[] chainAgnosticHashes_)

returns the hashes struct for each CastChainAgnosticParams element of params_. The returned array must be passed into castChainAgnostic() as the param chainAgnosticHashes_ there (order must be the same). The returned hash for each element is the EIP712 type hash for CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH, as used when the signature digest is built.

Deploys the Avocado if necessary. Expected to be called with callStatic.

AvoForwarderV1 ​

executeV1 ​

solidity
function executeV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastParams params_, struct AvocadoMultisigStructs.CastForwardParams forwardParams_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_) external payable

Deploys Avocado for owner if necessary and calls cast() on it. For Avocado v1. Only callable by allowed broadcasters.

Parameters ​

NameTypeDescription
from_addressAvocado owner
index_uint32index number of Avocado for owner_ EOA
params_struct AvocadoMultisigStructs.CastParamsCast params such as id, avoNonce and actions to execute
forwardParams_struct AvocadoMultisigStructs.CastForwardParamsCast 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

verifyV1 ​

solidity
function verifyV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastParams params_, struct AvocadoMultisigStructs.CastForwardParams forwardParams_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_) external returns (bool)

Verify the transaction is valid and can be executed. IMPORTANT: Expected to be called via callStatic.

                     Returns true if valid, reverts otherwise:
                     e.g. if input params, signature or avoNonce etc. are invalid.

Parameters ​

NameTypeDescription
from_addressAvocado owner
index_uint32index number of Avocado for owner_ EOA
params_struct AvocadoMultisigStructs.CastParamsCast params such as id, avoNonce and actions to execute
forwardParams_struct AvocadoMultisigStructs.CastForwardParamsCast 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 ​

NameTypeDescription
[0]boolreturns true if everything is valid, otherwise reverts.

AvoForwarderChainAgnosticV1 ​

executeChainAgnosticV1 ​

solidity
function executeChainAgnosticV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastChainAgnosticParams params_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_, struct AvocadoMultisigStructs.ChainAgnosticHash[] chainAgnosticHashes_) external payable

Deploys Avocado for owner if necessary and calls castChainAgnostic() on it. For Avocado v1. Only callable by allowed broadcasters.

Parameters ​

NameTypeDescription
from_addressAvocado owner
index_uint32index number of Avocado for owner_ EOA
params_struct AvocadoMultisigStructs.CastChainAgnosticParamsChain agnostic params containing CastParams, ForwardParams and chain id. Note chain id must match block.chainid.
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
chainAgnosticHashes_struct AvocadoMultisigStructs.ChainAgnosticHash[]hashes struct for each original CastChainAgnosticParams struct as used when signing the txs to be executed. Result of .getChainAgnosticHashes().

verifyChainAgnosticV1 ​

solidity
function verifyChainAgnosticV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastChainAgnosticParams params_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_, struct AvocadoMultisigStructs.ChainAgnosticHash[] chainAgnosticHashes_) external returns (bool)

Verify the transaction is a valid chain agnostic tx and can be executed. IMPORTANT: Expected to be called via callStatic.

                        Returns true if valid, reverts otherwise:
                        e.g. if input params, signature or avoNonce etc. are invalid.

Parameters ​

NameTypeDescription
from_addressAvocado owner
index_uint32index number of Avocado for owner_ EOA
params_struct AvocadoMultisigStructs.CastChainAgnosticParamsChain agnostic params containing CastParams, ForwardParams and chain id. Note chain id must match block.chainid.
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
chainAgnosticHashes_struct AvocadoMultisigStructs.ChainAgnosticHash[]hashes struct for each original CastChainAgnosticParams struct as used when signing the txs to be executed. Result of .getChainAgnosticHashes().

Return Values ​

NameTypeDescription
[0]boolreturns true if everything is valid, otherwise reverts.

AvoForwarderBatchV1 ​

executeBatchV1 ​

solidity
function executeBatchV1(struct AvoForwarderStructs.ExecuteBatchParams[] batches_, bool continueOnRevert_) external payable

Executes multiple txs as batch. For Avocado v1. Only callable by allowed broadcasters.

Parameters ​

NameTypeDescription
batches_struct AvoForwarderStructs.ExecuteBatchParams[]Execute batch txs array, same as inputs for executeChainAgnosticV1() just as struct array. If chainAgnosticHashes is set (length > 0), then executeChainAgnosticV1() is executed, otherwise executeV1() is executed with the given array element.
continueOnRevert_boolflag to signal if one ExecuteBatchParams in batches_ fails, should the rest of them still continue to be executed.

AvoForwarderSimulateV1 ​

SimulationVars ​

solidity
struct SimulationVars {
  contract IAvocadoMultisigV1 avocadoMultisig;
  uint256 initialGas;
}

estimateV1 ​

solidity
function estimateV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastParams params_, struct AvocadoMultisigStructs.CastForwardParams forwardParams_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_) external payable

_see simulateV1(). Reverts on success_= false for accurate .estimateGas() usage. Helpful to estimate gas for an Avocado tx. Note: resulting gas usage will usually be with at least ~10k gas buffer compared to actual execution. 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)._

simulateV1 ​

solidity
function simulateV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastParams params_, struct AvocadoMultisigStructs.CastForwardParams forwardParams_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_) public payable returns (uint256 castGasUsed_, uint256 deploymentGasUsed_, bool isDeployed_, bool success_, string revertReason_)

Simulates a executeV1() tx, callable only by msg.sender = dead address (0x000000000000000000000000000000000000dEaD). Useful to determine success / error and other return values of executeV1() with a .callstatic. For Avocado v1.

_- set signaturesParams_to empty to automatically simulate with required signers length. - ifsignaturesParams*first element signature is not set, or if first signer is set to 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF, then gas usage burn is simulated for verify signature functionality. DO NOT set signature to non-empty for subsequent elements then; set all signatures to empty! - ifsignaturesParams* is set normally, signatures are verified as in actual execute - buffer amounts for mock smart contract signers signature verification must be added off-chain as this varies on a case per case basis._

Parameters ​

NameTypeDescription
from_addressAvocadoMultisig owner
index_uint32index number of Avocado for owner_ EOA
params_struct AvocadoMultisigStructs.CastParamsCast params such as id, avoNonce and actions to execute
forwardParams_struct AvocadoMultisigStructs.CastForwardParamsCast 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 ​

NameTypeDescription
castGasUsed_uint256amount of gas used for executing cast
deploymentGasUsed_uint256amount of gas used for deployment (or for getting the contract if already deployed)
isDeployed_boolboolean flag indicating if Avocado is already deployed
success_boolboolean flag indicating whether executing actions reverts or not
revertReason_stringrevert reason original error in default format "<action_index>_error"

estimateChainAgnosticV1 ​

solidity
function estimateChainAgnosticV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastChainAgnosticParams params_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_, struct AvocadoMultisigStructs.ChainAgnosticHash[] chainAgnosticHashes_) external payable

_see simulateChainAgnosticV1(). Reverts on success_= false for accurate .estimateGas() usage. Helpful to estimate gas for an Avocado tx. Note: resulting gas usage will usually be with at least ~10k gas buffer compared to actual execution. 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)._

simulateChainAgnosticV1 ​

solidity
function simulateChainAgnosticV1(address from_, uint32 index_, struct AvocadoMultisigStructs.CastChainAgnosticParams params_, struct AvocadoMultisigStructs.SignatureParams[] signaturesParams_, struct AvocadoMultisigStructs.ChainAgnosticHash[] chainAgnosticHashes_) public payable returns (uint256 castGasUsed_, uint256 deploymentGasUsed_, bool isDeployed_, bool success_, string revertReason_)

Simulates a executeChainAgnosticV1() tx, callable only by msg.sender = dead address (0x000000000000000000000000000000000000dEaD). Useful to determine success / error and other return values of executeV1() with a .callstatic. For Avocado v1. Deploys the Avocado smart wallet if necessary.

_- set signaturesParams_to empty to automatically simulate with required signers length. - ifsignaturesParams*first element signature is not set, or if first signer is set to 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF, then gas usage burn is simulated for verify signature functionality. DO NOT set signature to non-empty for subsequent elements then; set all signatures to empty! - ifsignaturesParams* is set normally, signatures are verified as in actual execute - buffer amounts for mock smart contract signers signature verification must be added off-chain as this varies on a case per case basis._

Parameters ​

NameTypeDescription
from_addressAvocado owner
index_uint32index number of Avocado for owner_ EOA
params_struct AvocadoMultisigStructs.CastChainAgnosticParamsChain agnostic params containing CastParams, ForwardParams and chain id. Note chain id must match block.chainid.
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
chainAgnosticHashes_struct AvocadoMultisigStructs.ChainAgnosticHash[]hashes struct for each original CastChainAgnosticParams struct as used when signing the txs to be executed. Result of .getChainAgnosticHashes().

Return Values ​

NameTypeDescription
castGasUsed_uint256amount of gas used for executing cast
deploymentGasUsed_uint256amount of gas used for deployment (or for getting the contract if already deployed)
isDeployed_boolboolean flag indicating if Avocado is already deployed
success_boolboolean flag indicating whether executing actions reverts or not
revertReason_stringrevert reason original error in default format "<action_index>_error"

simulateBatchV1 ​

solidity
function simulateBatchV1(struct AvoForwarderStructs.ExecuteBatchParams[] batches_, bool continueOnRevert_) external payable returns (struct AvoForwarderStructs.SimulateBatchResult[] results_)

Simulates a executeBatchV1() tx, callable only by msg.sender = dead address (0x000000000000000000000000000000000000dEaD) Helpful to estimate gas for an Avocado tx. Note: resulting gas usage will usually be with at least ~10k gas buffer compared to actual execution. For Avocado v1. Deploys the Avocado smart wallet if necessary.

Expected use with .estimateGas(). Best to combine with a .callstatic to determine success / error and other return values of executeV1(). For indidividual measurements of each ExecuteBatchParams execute the respective simulate() single method for it.

Parameters ​

NameTypeDescription
batches_struct AvoForwarderStructs.ExecuteBatchParams[]Execute batch txs array, same as inputs for simulateChainAgnosticV1() just as struct array.
continueOnRevert_boolflag to signal if one ExecuteBatchParams in batches_ fails, should the rest of them still continue to be executed.

AvoForwarderOwnerActions ​

updateBroadcasters ​

solidity
function updateBroadcasters(struct AvoForwarderStructs.AddressBool[] broadcastersStatus_) external

updates allowed status for broadcasters based on broadcastersStatus_ and emits BroadcastersUpdated. Executable by allowed auths or owner only.

updateAuths ​

solidity
function updateAuths(struct AvoForwarderStructs.AddressBool[] authsStatus_) external

updates allowed status for a auths based on authsStatus_ and emits AuthsUpdated. Executable by allowed auths or owner only (auths can only remove themselves).

AvoForwarder ​

constructor ​

solidity
constructor(contract IAvoFactory avoFactory_) public

constructor sets the immutable avoFactory (proxy) address and cached bytecodes derived from it

initialize ​

solidity
function initialize(address owner_, address[] allowedBroadcasters_) public

initializes the contract, setting owner_ and initial allowedBroadcasters_

Parameters ​

NameTypeDescription
owner_addressaddress of owner_ allowed to executed auth limited methods
allowedBroadcasters_address[]initial list of allowed broadcasters to be enabled right away

renounceOwnership ​

solidity
function renounceOwnership() public view

override renounce ownership as it could leave the contract in an unwanted state if called by mistake.