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

contract IAvoFactory avoFactory

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

AvoRegistryVariables

feeConfig

struct IAvoFeeCollector.FeeConfig feeConfig

fee config for calcFee(). Configurable by owner.

avoVersions

mapping(address => bool) avoVersions

mapping to store allowed Avocado versions. Modifiable by owner.

avoForwarderVersions

mapping(address => bool) avoForwarderVersions

mapping to store allowed AvoForwarder versions. Modifiable by owner.

AvoRegistryErrors

AvoRegistry__InvalidVersion

error AvoRegistry__InvalidVersion()

thrown for requireVersion() methods

AvoRegistry__FeeModeNotImplemented

error AvoRegistry__FeeModeNotImplemented(uint8 mode)

thrown when a requested fee mode is not implemented

AvoRegistry__InvalidParams

error AvoRegistry__InvalidParams()

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

AvoRegistry__Unsupported

error AvoRegistry__Unsupported()

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

AvoRegistryEvents

SetAvoVersion

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

emitted when the status for a certain AvoMultsig version is updated

SetAvoForwarderVersion

event SetAvoForwarderVersion(address avoForwarderVersion, bool allowed)

emitted when the status for a certain AvoForwarder version is updated

FeeConfigUpdated

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

emitted when the fee config is updated

AvoRegistryCore

AvoFeeCollector

calcFee

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

function updateFeeConfig(struct IAvoFeeCollector.FeeConfig feeConfig_) external

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

AvoRegistry

constructor

constructor(contract IAvoFactory avoFactory_) public

initialize

function initialize(address owner_) public

initializes the contract with owner_ as owner

requireValidAvoVersion

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

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

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

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

function renounceOwnership() public view

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