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
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
Request
This struct stores information for redemptions requests.
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
canPush() - Permission for owner to call
pushToLocker()
. See ZivoeLocker.solcanPull() - Permission for owner to call
pullFromLocker()
. See ZivoeLocker.solcanPullPartial() - Permission for owner to call
pullFromLockerPartial()
. See ZivoeLocker.sol
pushToLocker() - This pulls capital from the DAO.
pullFromLocker() - Migrates entire ERC20 balance from locker to
owner()
.pullFromLockerPartial() - Migrates specific amount of ERC20 from locker to
owner()
.createRequest() - Creates a redemptions request.
destroyRequest() - Destroys a redemption request.
processRequest() - Processes a redemption request.
tickEpoch() - This function will start a new epoch.
updateRedemptionsFeeBIPS() - Updates the state variable "redemptionFeeBips".
Read Functions
canPush()
canPush()
Permission for owner to call pushToLocker()
. See ZivoeLocker.sol
function canPush() public override pure returns (bool) { return true; }
canPull()
canPull()
Permission for owner to call pullFromLocker()
. See ZivoeLocker.sol
function canPull() public override pure returns (bool) { return true; }
canPullPartial()
canPullPartial()
Permission for owner to call pullFromLockerPartial()
. See ZivoeLocker.sol
function canPullPartial() public override pure returns (bool) { return true; }
Write Functions
pushToLocker()
pushToLocker()
This pulls capital from the DAO.
function pushToLocker(
address asset,
uint256 amount,
bytes calldata data
) external override _tickEpoch onlyOwner nonReentrant;
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()
pullFromLocker()
Migrates entire ERC20 balance from locker to owner()
.
function pullFromLocker(address asset, bytes calldata data) external;
address
asset
The asset to migrate.
bytes
data
Accompanying transaction data.
pullFromLockerPartial()
pullFromLockerPartial()
Migrates specific amount of ERC20 from locker to owner()
.
function pullFromLockerPartial(
address asset,
uint256 amount,
bytes calldata data
) external;
address
asset
The asset to migrate.
uint256
amount
The amount of "asset" to migrate.
bytes
data
Accompanying transaction data.
createRequest()
createRequest()
Creates a redemptions request.
function createRequest(
uint256 amount,
bool seniorElseJunior
) external _tickEpoch nonReentrant;
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()
destroyRequest()
Destroys a redemption request.
function destroyRequest(uint256 id) external _tickEpoch nonReentrant;
uint256
id
The ID of the request to destroy.
Emits the RequestDestroyed() event
processRequest()
processRequest()
Processes a redemption request.
function processRequest(uint256 id) external _tickEpoch nonReentrant;
uint256
id
The ID of the request to process.
Emits the RequestProcessed() event
tickEpoch()
tickEpoch()
This function will start a new epoch.
function tickEpoch() public;
Emits the EpochTicked() event
updateRedemptionsFeeBIPS()
updateRedemptionsFeeBIPS()
Updates the state variable "redemptionFeeBips".
function updateRedemptionsFeeBIPS(
uint256 _redemptionsFeeBIPS
) external _tickEpoch;
uint256
_redemptionsFee
The new value for redemptionsFeeBIPS (in BIPS).
Emits the UpdatedRedemptionsFeeBIPS() event
Events
EpochTicked()
EpochTicked()
Emitted during tickEpoch()
event EpochTicked(
uint256 epoch,
uint256 redemptionsAllowedJunior,
uint256 redemptionsAllowedSenior,
uint256 epochDiscountJunior,
uint256 epochDiscountSenior
);
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()
RequestCreated()
Emitted during createRequest()
event RequestCreated(
uint256 indexed id,
address indexed account,
uint256 amount,
bool indexed seniorElseJunior
);
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()
RequestDestroyed()
Emitted during destroyRequest()
event RequestDestroyed(
uint256 indexed id,
address indexed account,
uint256 amount,
bool indexed seniorElseJunior
);
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()
RequestProcessed()
Emitted during processRequest()
event RequestProcessed(
uint256 indexed id,
address indexed account,
uint256 burnAmount,
uint256 redeemAmount,
bool indexed seniorElseJunior
);
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()
UpdatedRedemptionsFeeBIPS()
Emitted during OCR_Modular.sol
event UpdatedOCTYDL(address indexed newOCT, address indexed oldOCT);
address
True
newOCT
The new OCT_YDL contract.
address
True
oldOCT
The old OCT_YDL contract.
Last updated