Quantillon Protocol

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

AdminFunctionsLibrary

Git Source

Author: Quantillon Labs - Nicolas Bellengé - @chewbaccoin

Library for rarely used admin functions to reduce contract size

Main characteristics:

  • Consolidates admin functions like recoverETH and recoverToken
  • Reduces contract size by moving rarely used functions to library
  • Maintains same API and behavior
  • Uses custom errors for gas efficiency

Note: security-contact: team@quantillon.money

Functions

recoverETH

Recover ETH to treasury address

Emergency function to recover ETH sent to the contract

Notes:

  • security: Requires admin role

  • validation: None required

  • state-changes: Transfers ETH from contract to treasury

  • events: Emits ETHRecovered event

  • errors: Throws NotAuthorized if caller lacks admin role

  • reentrancy: Not protected - no external calls

  • access: Restricted to admin role

  • oracle: Not applicable

function recoverETH(address contractInstance, address treasury, bytes32 adminRole) external;

Parameters

NameTypeDescription
contractInstanceaddressThe contract instance calling this function
treasuryaddressThe treasury address to send ETH to
adminRolebytes32The admin role required for this operation

recoverToken

Recover tokens to treasury address

Emergency function to recover ERC20 tokens sent to the contract

Notes:

  • security: Requires admin role

  • validation: None required

  • state-changes: Transfers tokens from contract to treasury

  • events: Emits TokenRecovered event

  • errors: Throws NotAuthorized if caller lacks admin role

  • reentrancy: Not protected - library handles reentrancy

  • access: Restricted to admin role

  • oracle: Not applicable

function recoverToken(address contractInstance, address token, uint256 amount, address treasury, bytes32 adminRole)
    external;

Parameters

NameTypeDescription
contractInstanceaddressThe contract instance calling this function
tokenaddressAddress of the token to recover
amountuint256Amount of tokens to recover
treasuryaddressThe treasury address to send tokens to
adminRolebytes32The admin role required for this operation

Events

ETHRecovered

Event emitted when ETH is recovered

event ETHRecovered(address indexed treasury, uint256 amount);

Parameters

NameTypeDescription
treasuryaddressThe treasury address that received the ETH
amountuint256The amount of ETH recovered