Skip to main content

Burner

Git Source

Inherits: Policy, RolesConsumer

Olympus Burner Policy Contract

This policy is to enable burning of OHM by the DAO MS to support test runs of new products which have not been automated yet. This policy will be removed once the protocol completes feature development and the DAO no longer needs to test products. This policy requires categories to be created to designate the purpose for burned OHM, which can be tracked externally from automated systems.

State Variables

TRSRY

TRSRYv1 internal TRSRY;

MINTR

MINTRv1 internal MINTR;

ohm

OHM token

ERC20 public immutable ohm;

categories

List of approved categories for logging OHM burns

bytes32[] public categories;

categoryApproved

Whether a category is approved for logging

This is used to prevent logging of burn events that are not consistent with standardized names

mapping(bytes32 => bool) public categoryApproved;

Functions

constructor

constructor(Kernel kernel_, ERC20 ohm_) Policy(kernel_);

configureDependencies

Define module dependencies for this policy.

function configureDependencies() external override returns (Keycode[] memory dependencies);

Returns

NameTypeDescription
dependenciesKeycode[]- Keycode array of module dependencies.

requestPermissions

Function called by kernel to set module function permissions.

function requestPermissions() external view override returns (Permissions[] memory requests);

Returns

NameTypeDescription
requestsPermissions[]- Array of keycodes and function selectors for requested permissions.

onlyApproved

modifier onlyApproved(bytes32 category_);

burnFromTreasury

Burn OHM from the treasury

function burnFromTreasury(uint256 amount_, bytes32 category_)
external
onlyRole("burner_admin")
onlyApproved(category_);

Parameters

NameTypeDescription
amount_uint256Amount of OHM to burn
category_bytes32

burnFrom

Burn OHM from an address

Burning OHM from an address requires it to have approved the MINTR for their OHM. Here, we transfer from the user and burn from this address to avoid approving a a different contract.

function burnFrom(address from_, uint256 amount_, bytes32 category_)
external
onlyRole("burner_admin")
onlyApproved(category_);

Parameters

NameTypeDescription
from_addressAddress to burn OHM from
amount_uint256Amount of OHM to burn
category_bytes32

burn

Burn OHM in this contract

function burn(uint256 amount_, bytes32 category_) external onlyRole("burner_admin") onlyApproved(category_);

Parameters

NameTypeDescription
amount_uint256Amount of OHM to burn
category_bytes32

addCategory

Add a category to the list of approved burn categories

function addCategory(bytes32 category_) external onlyRole("burner_admin");

Parameters

NameTypeDescription
category_bytes32Category to add

removeCategory

Remove a category from the list of approved burn categories

function removeCategory(bytes32 category_) external onlyRole("burner_admin");

Parameters

NameTypeDescription
category_bytes32Category to remove

getCategories

Get the list of approved burn categories

function getCategories() external view returns (bytes32[] memory);

Events

Burn

event Burn(address indexed from, bytes32 indexed category, uint256 amount);

CategoryAdded

event CategoryAdded(bytes32 category);

CategoryRemoved

event CategoryRemoved(bytes32 category);

Errors

Burner_CategoryNotApproved

error Burner_CategoryNotApproved();

Burner_CategoryApproved

error Burner_CategoryApproved();