OCR_Modular.sol

OCR -> On-Chain Redemption

Introduction

OCR stands for "On-Chain Redemption".

This locker is responsible for handling redemptions of tranche tokens to stablecoins.

State Variables

TypeNameDescription

address

GBL

The ZivoeGlobals contract.

address

stablecoin

The stablecoin redeemable in this contract.

uint256

epoch

The timestamp of current epoch.

uint256

epochDiscountJunior

Redemption discount for $zJTT (junior tranche).

uint256

epochDiscountSenior

Redemption discount for $zSTT (senior tranche).

uint256

redemptionsAllowedJunior

Redemptions allowed for $zJTT (junior tranche).

uint256

redemptionsAllowedSenior

Redemptions allowed for $zSTT (senior tranche).

uint256

redemptionsFeeBIPS

Fee for redemptions (in BIPS).

uint256

redemptionsQueuedJunior

Redemptions queued for $zJTT (junior tranche).

uint256

redemptionsQueuedSenior

Redemptions queued for $zSTT (senior tranche).

uint256

requestCounter

Increments with new requests.

uint256

BIPS

Private constant, 10000

uint256

RAY

Private constant, 10**27

requests

Mapping of all requests.

Request

This struct stores information for redemptions requests.

TypeVariableDescription

address

account

The account making the request

uint256

amount

The amount of the request ($zSTT and $zJTT)

uint256

unlocks

The timestamp after which this request may be processed

bool

seniorElseJunior

The tranche this request is for (true = Senior, false = Junior)

Sections

Read Functions

Write Functions

Events

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; }

Write Functions

pushToLocker()

This pulls capital from the DAO.

function pushToLocker(
    address asset, 
    uint256 amount, 
    bytes calldata data
) external override _tickEpoch onlyOwner nonReentrant;
TypeNameDescription

address

asset

The asset to pull from the DAO.

uint256

amount

The amount of asset to pull from the DAO.

bytes

data

Accompanying transaction data.

pullFromLocker()

Migrates entire ERC20 balance from locker to owner().

function pullFromLocker(address asset, bytes calldata data) external;
TypeNameDescription

address

asset

The asset to migrate.

bytes

data

Accompanying transaction data.

pullFromLockerPartial()

Migrates specific amount of ERC20 from locker to owner().

function pullFromLockerPartial(
    address asset, 
    uint256 amount, 
    bytes calldata data
) external;
TypeNameDescription

address

asset

The asset to migrate.

uint256

amount

The amount of "asset" to migrate.

bytes

data

Accompanying transaction data.

createRequest()

Creates a redemptions request.

function createRequest(
    uint256 amount, 
    bool seniorElseJunior
) external _tickEpoch nonReentrant;
TypeNameDescription

uint256

amount

The amount to deposit for the request.

uint256

seniorElseJunior

he tranche to deposit for (true = Senior, false = Junior).

Emits the RequestCreated() event

destroyRequest()

Destroys a redemption request.

function destroyRequest(uint256 id) external _tickEpoch nonReentrant;
TypeNameDescription

uint256

id

The ID of the request to destroy.

Emits the RequestDestroyed() event

processRequest()

Processes a redemption request.

function processRequest(uint256 id) external _tickEpoch nonReentrant;
TypeNameDescription

uint256

id

The ID of the request to process.

Emits the RequestProcessed() event

tickEpoch()

This function will start a new epoch.

function tickEpoch() public;

Emits the EpochTicked() event

updateRedemptionsFeeBIPS()

Updates the state variable "redemptionFeeBips".

function updateRedemptionsFeeBIPS(
    uint256 _redemptionsFeeBIPS
) external _tickEpoch;
TypeNameDescription

uint256

_redemptionsFee

The new value for redemptionsFeeBIPS (in BIPS).

Emits the UpdatedRedemptionsFeeBIPS() event

Events

EpochTicked()

Emitted during tickEpoch()

event EpochTicked(
    uint256 epoch, 
    uint256 redemptionsAllowedJunior, 
    uint256 redemptionsAllowedSenior,
    uint256 epochDiscountJunior, 
    uint256 epochDiscountSenior
);
TypeIndexedNameDescription

uint256

False

epoch

The timestamp of the start of this epoch.

uint256

False

redemptionsAllowedJunior

Redemptions allowed for $zJTT (junior tranche) for this epoch.

uint256

False

redemptionsAllowedSenior

Redemptions allowed for $zSTT (senior tranche) for this epoch.

uint256

False

epochDiscountJunior

Redemption discount for $zJTT (junior tranche) for this epoch.

uint256

False

epochDiscountSenior

Redemption discount for $zSTT (senior tranche) for this epoch.

RequestCreated()

Emitted during createRequest()

event RequestCreated(
    uint256 indexed id, 
    address indexed account, 
    uint256 amount, 
    bool indexed seniorElseJunior
);
TypeIndexedNameDescription

uint256

True

id

The ID of the request created.

address

True

account

The account creating a request.

uint256

False

amount

The amount deposited for the request ($zJTT or $zSTT).

bool

True

seniorElseJunior

The tranche deposited for (true = Senior, false = Junior).

RequestDestroyed()

Emitted during destroyRequest()

event RequestDestroyed(
    uint256 indexed id, 
    address indexed account, 
    uint256 amount, 
    bool indexed seniorElseJunior
);
TypeIndexedNameDescription

uint256

True

id

The ID of the request destroyed.

address

True

account

The account destroying the request.

uint256

False

amount

The amount returned from the request ($zJTT or $zSTT).

bool

True

seniorElseJunior

The tranche deposited for (true = Senior, false = Junior).

RequestProcessed()

Emitted during processRequest()

event RequestProcessed(
    uint256 indexed id, 
    address indexed account, 
    uint256 burnAmount, 
    uint256 redeemAmount, 
    bool indexed seniorElseJunior
);
TypeIndexedNameDescription

uint256

True

id

The ID of the request processed.

address

True

account

The account receiving the redeemed tokens.

uint256

False

burnAmount

The amount of tranche tokens ($zJTT or $zSTT) burned from the request.

uint256

False

redeemAmount

The amount reddeemed from the processed request.

bool

True

seniorElseJunior

The tranche deposited for (true = Senior, false = Junior).

UpdatedRedemptionsFeeBIPS()

Emitted during #updateredemptionsfee

event UpdatedOCTYDL(address indexed newOCT, address indexed oldOCT);
TypeIndexedNameDescription

address

True

newOCT

The new OCT_YDL contract.

address

True

oldOCT

The old OCT_YDL contract.

Last updated

Zivoe Finance - Official Documentation