ZivoeMath.sol

Mathematics for Yield Distributions

Introduction

This contract facilitates mathematics, intended solely for the YDL.

Note: This contract is deployed and tracked via ZivoeYDL, see ZivoeYDL.sol and for further information on the derivation of the equations, see

State Variables

Type
Name
Description

uint256

BIPS

Private constant, 10000

uint256

WAD

Private constant, 10**18

uint256

RAY

Private constant, 10**27

Sections

Read Functions

  • ema() - Calculates the current EMA (exponential moving average).

  • juniorProportion() - Calculates proportion of yield attributable to junior tranche.

  • seniorProportion() - Calculates proportion of yield distributble which is attributable to the senior tranche.

  • seniorProportionBase() - Calculates proportion of yield attributed to senior tranche (no extenuating circumstances).

  • seniorProportionShortfall() - Calculates proportion of yield attributed to senior tranche (shortfall occurence).

  • yieldTarget() - Calculates amount of annual yield required to meet target rate for both tranches.

Read Functions

ema()

Calculates the current EMA (exponential moving average).

Type
Name
Description

uint256

bV

The base value (typically an EMA from prior calculations).

uint256

cV

The current value, which is factored into bV.

uint256

N

Number of steps to average over.

Returns

Type
Name
Description

uint256

eV

EMA-based value given prior and current conditions.

juniorProportion()

Calculates proportion of yield attributable to junior tranche.

Type
Name
Description

uint256

eSTT

ema-based supply of zSTT (units = WEI)

uint256

eJTT

ema-based supply of zJTT (units = WEI)

uint256

sP

Proportion of yield attributable to seniors (units = RAY)

uint256

Q

senior to junior tranche target ratio (units = BIPS)

Returns

Type
Name
Description

uint256

jP

Yield attributable to junior tranche in RAY.

seniorProportion()

Calculates proportion of yield distributable which is attributable to the senior tranche.

Type
Name
Description

uint256

yD

yield distributable (units = WEI)

uint256

yT

ema-based yield target (units = WEI)

uint256

eSTT

ema-based supply of zSTT (units = WEI)

uint256

eJTT

ema-based supply of zJTT (units = WEI)

uint256

Y

target annual yield for senior tranche (units = BIPS)

uint256

Q

multiple of Y (units = BIPS)

uint256

T

# of days between distributions (units = integer)

Returns

Type
Name
Description

uint256

sP

Proportion of yD attributable to senior tranche.

seniorProportionBase()

Calculates proportion of yield attributed to senior tranche (no extenuating circumstances).

Type
Name
Description

uint256

yD

yield distributable (units = WEI)

uint256

eSTT

ema-based supply of zSTT (units = WEI)

uint256

Y

target annual yield for senior tranche (units = BIPS)

uint256

T

# of days between distributions (units = integer)

Returns

Type
Name
Description

uint256

sPB

Proportion of yield attributed to senior tranche in RAY.

seniorProportionShortfall()

Calculates proportion of yield attributed to senior tranche (shortfall occurence).

Type
Name
Description

uint256

eSTT

ema-based supply of zSTT (units = WEI)

uint256

eJTT

ema-based supply of zJTT (units = WEI)

uint256

Q

multiple of Y (units = BIPS)

Returns

Type
Name
Description

uint256

sPS

Proportion of yield attributed to senior tranche in RAY.

yieldTarget()

Calculates amount of annual yield required to meet target rate for both tranches.

Type
Name
Description

uint256

eSTT

ema-based supply of zSTT (units = WEI)

uint256

eJTT

ema-based supply of zJTT (units = WEI)

uint256

Y

target annual yield for senior tranche (units = BIPS)

uint256

Q

multiple of Y (units = BIPS)

uint256

T

# of days between distributions (units = integer)

Returns

Type
Name
Description

uint256

yT

yield target for the senior and junior tranche combined.

Last updated