Skip to main content

LegacyBurner

Git Source

Inherits: Policy

Title: Olympus Legacy Burner Policy

Constants​

ohm​

OlympusERC20Token public immutable ohm;

DENOMINATOR​

uint256 internal constant DENOMINATOR = 100_000_000;

State Variables​

MINTR​

MINTRv1 internal MINTR;

bondManager​

address public bondManager;

inverseBondDepo​

address public inverseBondDepo;

reward​

uint256 public reward;

rewardClaimed​

bool public rewardClaimed;

Functions​

constructor​

constructor(
Kernel kernel_,
address ohm_,
address bondManager_,
address inverseBondDepo_,
uint256 reward_ // in OHM, 9 decimals
) Policy(kernel_);

Parameters

NameTypeDescription
kernel_Kernel
ohm_address
bondManager_address
inverseBondDepo_address
reward_uint256

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.

burn​

Burn OHM from desired sources, send rewards to the caller

Calculates linearly increasing reward (up to cap) for the amount of OHM burned, burns OHM from BondManager and InverseBondDepo, and mints rewards to the caller. We use this approach of burning everything and then reminting the rewards because the InverseBondDepo does not allow partial burns or the transfer of OHM to another address. We have to burn the entire amount of OHM in the contract. So we burn everything, then mint the rewards to the caller.

function burn() external;

_burnBondManagerOhm​

Burns OHM from the bond manager

An infinite approval (via Policy MS) for this contract to spend OHM from the bond manager is required

function _burnBondManagerOhm(uint256 amount_) internal;

Parameters

NameTypeDescription
amount_uint256

_burnInverseBondDepoOhm​

Burns OHM from the legacy inverse bond depository

The only way to burn is to burn the entire amount of OHM in the contract, cannot transfer here first. The burn function requires the caller to be specified as the policy address on an OlympusAuthority contract. So in order for this to work we have to also deploy a mock OlympusAuthority contract that specifies this contract as the policy address and then update the authority address on the inverse bond depository contract.

function _burnInverseBondDepoOhm() internal;

Events​

Burn​

event Burn(uint256 amount, uint256 reward);

Parameters

NameTypeDescription
amountuint256
rewarduint256

Errors​

LegacyBurner_RewardAlreadyClaimed​

error LegacyBurner_RewardAlreadyClaimed();