Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

FeeContract

Git Source

Inherits: Initializable, OwnableUpgradeable, UUPSUpgradeable

State Variables

maxDepositAmount

max amount allowed to be deposited to prevent fat finger errors

uint256 public maxDepositAmount

minDepositAmount

uint256 public minDepositAmount

balances

store user balances in a mapping

mapping(address user => uint256 amount) public balances

Functions

constructor

since the constructor initializes storage on this contract we disable it

storage is on the proxy contract since it calls this contract via delegatecall

Note: oz-upgrades-unsafe-allow: constructor

constructor() ;

initialize

This contract is called by the proxy when you deploy this contract

function initialize(address multisig) public initializer;

fallback

Revert if a method name does not exist

fallback() external payable;

receive

Revert if no method name was called

receive() external payable;

deposit

Allows anyone to deposit an ETH balance for any user

the deposit amount is less than a specified threshold to prevent fat finger errors

function deposit(address user) public payable;

_authorizeUpgrade

only the owner can authorize an upgrade

function _authorizeUpgrade(address newImplementation) internal override onlyOwner;

renounceOwnership

Cannot renounce ownership

Override renounceOwnership() to revert, preventing accidental or malicious ownership renunciation

function renounceOwnership() public virtual override onlyOwner;

getVersion

Use this to get the implementation contract version

function getVersion()
    public
    pure
    returns (uint8 majorVersion, uint8 minorVersion, uint8 patchVersion);

Events

Deposit

Notify a new deposit

event Deposit(address indexed user, uint256 amount);

Log

event Log(string func, uint256 gas);

Upgrade

upgrade event when the proxy updates the implementation it’s pointing to

event Upgrade(address implementation);

Errors

InvalidUserAddress

error types

error InvalidUserAddress();

DepositTooLarge

error DepositTooLarge();

DepositTooSmall

error DepositTooSmall();

FunctionDoesNotExist

error FunctionDoesNotExist();

NoFunctionCalled

error NoFunctionCalled();

OwnershipCannotBeRenounced

error OwnershipCannotBeRenounced();