LogoLogo
User DocsDeveloper DocsHow-To Guides
  • ➡️Start Here
  • 🚧Disclaimer
  • User Docs
    • Introduction
    • Fund Overview
    • zVLT
    • Tranches
    • ZVE Token
  • How-To Guides
    • Complete KYC/KYB
    • Mint Tranche Tokens
    • Stake Tranche Tokens
  • Developer Docs
    • Contract Addresses
    • Core Contracts
      • ZivoeDAO.sol
      • ZivoeGlobals.sol
      • ZivoeGovernorV2.sol
      • ZivoeITO.sol
      • ZivoeLocker.sol
      • ZivoeMath.sol
      • ZivoeRewards.sol
      • ZivoeRewardsVesting.sol
      • ZivoeToken.sol
      • ZivoeTranches.sol
      • ZivoeTrancheToken.sol
      • ZivoeYDL.sol
      • ZivoeVault.sol
      • ZivoeRouter.sol
    • Lockers
      • OCC_Modular.sol
      • OCE_ZVE.sol
      • OCL_ZVE.sol
      • OCR_Modular.sol
      • OCT_DAO.sol
      • OCT_Convert.sol
      • OCT_YDL.sol
      • OCT_ZVL.sol
      • OCY_Convex_A.sol
      • OCY_Convex_B.sol
      • OCY_Convex_C.sol
      • OCY_OUSD.sol
      • ZivoeSwapper.sol
  • Official Links
    • Audits
    • Website
    • Twitter
    • Telegram
    • Blog
  • Terms
    • Terms Of Use / Privacy Policy
    • Reg S Compliance
Powered by GitBook

Zivoe Finance - Official Documentation

On this page
  • Introduction
  • Sections
  • Read Functions
  • Write Functions
  • Events
  1. Developer Docs
  2. Lockers

OCE_ZVE.sol

OCE -> On-Chain Emissions ($ZVE, Exponential Decay)

PreviousOCC_Modular.solNextOCL_ZVE.sol

Last updated 11 months ago

Introduction

This contract facilitates an exponential decay emissions schedule for $ZVE.

This contract has the following responsibilities:

  • Handles accounting (with governable variables) to support emissions schedule.

  • Forwards $ZVE to all ZivoeRewards contracts at will (stZVE, stSTT, stJTT).

State Variables

Type
Name
Description

address

GBL

The ZivoeGlobals contract.

uint256

exponentialDecayPerSecond

The rate of decay per second.

uint256

lastDistribution

The block.timestamp value of last distribution.

uint256[3]

distributionRatioBIPS

Determines distribution between rewards contract, in BIPS. distributionRatioBIPS[0] => stZVE distributionRatioBIPS[1] => stSTT distributionRatioBIPS[2] => stJTT

uint256

BIPS

Private constant, 10000

uint256

RAY

Private constant, 10**27

Sections

Read Functions

  • canPush() - Permission for owner to call pushToLocker(). See ZivoeLocker.sol

  • canPull() - Permission for owner to call pullFromLocker(). See ZivoeLocker.sol

  • canPullPartial() - Permission for owner to call pullFromLockerPartial(). See ZivoeLocker.sol

  • decay() - Returns the amount remaining after a decay.

  • rmul() - Multiplies two variables and returns value, truncated by RAY precision.

  • rpow() - rpow(uint256 x, uint256 n, uint256 b), used for exponentiation in drip

Write Functions

  • pushToLocker() - Allocates ZVE from the DAO to this locker for emissions.

  • forwardEmissions() - Forwards $ZVE available for distribution.

  • updateDistributionRatioBIPS() - Updates the distribution between rewards contract, in BIPS.

  • updateExponentialDecayPerSecond() - Updates the exponentialDecayPerSecond variable with provided input.

Events

  • UpdatedDistributionRatioBIPS()

  • EmissionsForwarded()

  • UpdatedExponentialDecayPerSecond()

Read Functions

canPush()

Permission for owner to call pushToLocker(). See ZivoeLocker.sol

 function canPush() public override pure returns (bool) { return true; }

canPull()

Permission for owner to call pullFromLocker(). See ZivoeLocker.sol

function canPull() public override pure returns (bool) { return true; }

canPullPartial()

Permission for owner to call pullFromLockerPartial(). See ZivoeLocker.sol

function canPullPartial() public override pure returns (bool) { return true; }

decay()

Returns the amount remaining after a decay.

function decay(
    uint256 top, 
    uint256 dur
) public view returns (uint256);
Type
Name
Description

uint256

top

The amount decaying.

uint256

dur

The seconds of decay.

Returns

Type
Name
Description

uint256

n/a

The amount remaining after a decay.

rmul()

Multiplies two variables and returns value, truncated by RAY precision.

function rmul(
    uint256 x, 
    uint256 y
) internal pure returns (uint256 z);
Type
Name
Description

uint256

x

First value to multiply.

uint256

y

Second value to multiply.

Returns

Type
Name
Description

uint256

z

Resulting value of x * y, truncated by RAY precision.

rpow()

rpow(uint256 x, uint256 n, uint256 b), used for exponentiation in drip, is a fixed-point arithmetic function that raises x to the power n. It is implemented in Solidity assembly as a repeated squaring algorithm. x and the returned value are to be interpreted as fixed-point integers with scaling factor b. For example, if b == 100, this specifies two decimal digits of precision and the normal decimal value 2.1 would be represented as 210; rpow(210, 2, 100) returns 441 (the two-decimal digit fixed-point representation of 2.1^2 = 4.41). In the current implementation, 10^27 is passed for b, making x and the rpow result both of type RAY in standard MCD fixed-point terminology. rpow's formal invariants include "no overflow" as well as constraints on gas usage.

function rpow(
    uint256 x, 
    uint256 n, 
    uint256 b
) internal pure returns (uint256 z);
Type
Name
Description

uint256

x

The base value.

uint256

n

The power to raise "x" by.

uint256

b

The scaling factor, a.k.a. resulting precision of "z".

Returns

Type
Name
Description

uint256

z

Resulting value of x^n, scaled by factor b.

Write Functions

pushToLocker()

Allocates ZVE from the DAO to this locker for emissions.

function pushToLocker(
    address asset, 
    uint256 amount, 
    bytes calldata data
) external override onlyOwner;
Type
Name
Description

address

asset

The asset to push to this locker (in this case $ZVE).

uint256

amount

The amount of $ZVE to push to this locker.

bytes

data

Accompanying transaction data.

forwardEmissions()

Forwards $ZVE available for distribution.

function forwardEmissions() external nonReentrant;

Emits the EmissionsForwarded() event.

updateDistributionRatioBIPS()

Updates the distribution between rewards contract, in BIPS.

function updateDistributionRatioBIPS(
    uint256[3] calldata _distributionRatioBIPS
) external;
Type
Name
Description

uint256[3]

_distributionRatioBIPS

The updated values for the state variable distributionRatioBIPS.

Emits the UpdatedDistributionRatioBIPS() event.

updateExponentialDecayPerSecond()

Updates the exponentialDecayPerSecond variable with provided input.

function updateExponentialDecayPerSecond(
    uint256 _exponentialDecayPerSecond
) external;
Type
Name
Description

uint256

_exponentialDecayPerSecond

The updated value for exponentialDecayPerSecond state variable.

Emits the UpdatedExponentialDecayPerSecond() event.

Events

UpdatedDistributionRatioBIPS()

Emitted during updateDistributionRatioBIPS()

event UpdatedDistributionRatioBIPS(
    uint256[3] oldRatios, 
    uint256[3] newRatios
);
Type
Indexed
Name
Description

uint256[3]

False

oldRatios

The old distribution ratios.

uint256[3]

False

newRatios

The new distribution ratios.

EmissionsForwarded()

Emitted during forwardEmissions()

event EmissionsForwarded(uint256 stZVE, uint256 stJTT, uint256 stSTT);
Type
Indexed
Name
Description

uint256

False

stZVE

The amount of $ZVE emitted to the $ZVE rewards contract.

uint256

False

stJTT

The amount of $ZVE emitted to the $zJTT rewards contract.

uint256

False

stSTT

The amount of $ZVE emitted to the $zSTT rewards contract.

UpdatedExponentialDecayPerSecond()

Emitted during updateExponentialDecayPerSecond()

event UpdatedExponentialDecayPerSecond(uint256 oldValue, uint256 newValue);
Type
Indexed
Name
Description

uint256

False

oldValue

The old value of exponentialDecayPerSecond.

uint256

False

newValue

The new value of exponentialDecayPerSecond.