Skip to content

AvoRegistry

AvoRegistry_V1

Registry for various config data and general actions for Avocado contracts:

  • holds lists of valid versions for Avocado & AvoForwarder
  • handles fees for castAuthorized() calls

Upgradeable through AvoRegistryProxy

AvoRegistryConstants

avoFactory

solidity
contract IAvoFactory avoFactory

AvoFactory where new versions get registered automatically as default version on registerAvoVersion()

AvoRegistryVariables

feeConfig

solidity
struct IAvoFeeCollector.FeeConfig feeConfig

fee config for calcFee(). Configurable by owner.

avoVersions

solidity
mapping(address => bool) avoVersions

mapping to store allowed Avocado versions. Modifiable by owner.

avoForwarderVersions

solidity
mapping(address => bool) avoForwarderVersions

mapping to store allowed AvoForwarder versions. Modifiable by owner.

AvoRegistryErrors

AvoRegistry__InvalidVersion

solidity
error AvoRegistry__InvalidVersion()

thrown for requireVersion() methods

AvoRegistry__FeeModeNotImplemented

solidity
error AvoRegistry__FeeModeNotImplemented(uint8 mode)

thrown when a requested fee mode is not implemented

AvoRegistry__InvalidParams

solidity
error AvoRegistry__InvalidParams()

thrown when a method is called with invalid params, e.g. the zero address

AvoRegistry__Unsupported

solidity
error AvoRegistry__Unsupported()

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

AvoRegistryEvents

SetAvoVersion

solidity
event SetAvoVersion(address avoVersion, bool allowed, bool setDefault)

emitted when the status for a certain AvoMultsig version is updated

SetAvoForwarderVersion

solidity
event SetAvoForwarderVersion(address avoForwarderVersion, bool allowed)

emitted when the status for a certain AvoForwarder version is updated

FeeConfigUpdated

solidity
event FeeConfigUpdated(address feeCollector, uint8 mode, uint88 fee)

emitted when the fee config is updated

AvoRegistryCore

AvoFeeCollector

calcFee

solidity
function calcFee(uint256 gasUsed_) public view returns (uint256 feeAmount_, address payable feeCollector_)

calculates the feeAmount_ for an Avocado (msg.sender) transaction gasUsed_ based on fee configuration present on the contract

Parameters

NameTypeDescription
gasUsed_uint256amount of gas used, required if mode is percentage. not used if mode is static fee.

Return Values

NameTypeDescription
feeAmount_uint256calculated fee amount to be paid
feeCollector_address payableaddress to send the fee to

updateFeeConfig

solidity
function updateFeeConfig(struct IAvoFeeCollector.FeeConfig feeConfig_) external

sets feeConfig_ as the new fee config in storage. Only callable by owner.

AvoRegistry

constructor

solidity
constructor(contract IAvoFactory avoFactory_) public

initialize

solidity
function initialize(address owner_) public

initializes the contract with owner_ as owner

requireValidAvoVersion

solidity
function requireValidAvoVersion(address avoVersion_) external view

checks if an address is listed as allowed Avocado version, reverts if not.

Parameters

NameTypeDescription
avoVersion_addressaddress of the Avocado logic contract to check

requireValidAvoForwarderVersion

solidity
function requireValidAvoForwarderVersion(address avoForwarderVersion_) external view

checks if an address is listed as allowed AvoForwarder version, reverts if not.

Parameters

NameTypeDescription
avoForwarderVersion_addressaddress of the AvoForwarder logic contract to check

setAvoForwarderVersion

solidity
function setAvoForwarderVersion(address avoForwarder_, bool allowed_) external

sets the status for a certain address as allowed AvoForwarder version. Only callable by owner.

Parameters

NameTypeDescription
avoForwarder_addressthe address of the contract to treat as AvoForwarder version
allowed_boolflag to set this address as valid version (true) or not (false)

setAvoVersion

solidity
function setAvoVersion(address avoVersion_, bool allowed_, bool setDefault_) external

sets the status for a certain address as allowed / default Avocado version. Only callable by owner.

Parameters

NameTypeDescription
avoVersion_addressthe address of the contract to treat as Avocado version
allowed_boolflag to set this address as valid version (true) or not (false)
setDefault_boolflag to indicate whether this version should automatically be set as new default version for new deployments at the linked avoFactory

renounceOwnership

solidity
function renounceOwnership() public view

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