MoCSettlement

View Source: contracts/MoCSettlement.sol

↗ Extends: MoCSettlementEvents, MoCBase, PartialExecution, Governed, IMoCSettlement ↘ Derived Contracts: MoCSettlementMock

MoCSettlement - version: 0.1.12

Structs

RedeemRequest

struct RedeemRequest {
 address payable who,
 uint256 amount
}

UserRedeemRequest

struct UserRedeemRequest {
 uint256 index,
 bool activeRedeemer
}

SettlementInfo

struct SettlementInfo {
 uint256 btcPrice,
 uint256 btcxPrice,
 uint256 docRedeemCount,
 uint256 deleveragingCount,
 uint256 bproxAmount,
 uint256 partialCommissionAmount,
 uint256 finalCommissionAmount,
 uint256 leverage,
 uint256 startBlockNumber,
 bool isProtectedMode
}

Contract Members

Constants & Variables

bytes32 public constant DOC_REDEMPTION_TASK;

bytes32 public constant DELEVERAGING_TASK;

bytes32 public constant SETTLEMENT_TASK;

contract IMoCState internal mocState;

contract IMoCExchange internal mocExchange;

contract DocToken internal docToken;

contract MoCBProxManager internal bproxManager;

uint256 internal lastProcessedBlock;

uint256 internal blockSpan;

struct MoCSettlement.SettlementInfo internal settlementInfo;

struct MoCSettlement.RedeemRequest[] private redeemQueue;

uint256 private redeemQueueLength;

mapping(address => struct MoCSettlement.UserRedeemRequest) private redeemMapping;

uint256[50] private upgradeGap;

RedeemRequestAlter

Parameters

RedeemRequestProcessed

Parameters

SettlementRedeemStableToken

Parameters

SettlementDeleveraging

Parameters

SettlementStarted

Parameters

SettlementCompleted

Parameters

Modifiers

withinBoundaries

Verify that the index is smaller than the length of the redeem request queue

modifier withinBoundaries(uint256 _index) internal

Arguments

isTime

modifier isTime() internal

Arguments

Functions

initialize

Initializes the contract

function initialize(address connectorAddress, address _governor, uint256 _blockSpan) public nonpayable initializer 

Arguments

setBlockSpan

⤿ Overridden Implementation(s): MoCSettlementMock.setBlockSpan

Set the blockspan configuration blockspan of settlement

function setBlockSpan(uint256 bSpan) public nonpayable onlyAuthorizedChanger 

Arguments

setSettlementToStall

Set Settlement to be kept in finnished state after all execution is completed.

function setSettlementToStall() public nonpayable onlyAuthorizedChanger 

Arguments

restartSettlementState

Set Settlement state to Ready

function restartSettlementState() public nonpayable onlyAuthorizedChanger 

Arguments

getRedeemRequestAt

⤾ overrides IMoCSettlement.getRedeemRequestAt

Gets the RedeemRequest at the queue index position

function getRedeemRequestAt(uint256 _index) public view withinBoundaries 
returns(address payable, uint256)

Returns

redeemer's address and amount he submitted

Arguments

getBlockSpan

Gets the number of blocks the settlemnet will be allowed to run

function getBlockSpan() public view
returns(uint256)

Arguments

redeemQueueSize

⤾ overrides IMoCSettlement.redeemQueueSize

Returns the current redeem request queue's length

function redeemQueueSize() public view
returns(uint256)

Arguments

isSettlementEnabled

⤾ overrides IMoCSettlement.isSettlementEnabled

Returns true if blockSpan number of blocks has pass since last execution

function isSettlementEnabled() public view
returns(bool)

Arguments

isSettlementRunning

Returns true if the settlment is running

function isSettlementRunning() public view
returns(bool)

Arguments

isSettlementReady

⤾ overrides IMoCSettlement.isSettlementReady

Returns true if the settlment is ready

function isSettlementReady() public view
returns(bool)

Arguments

nextSettlementBlock

⤾ overrides IMoCSettlement.nextSettlementBlock

Returns the next block from which settlement is possible

function nextSettlementBlock() public view
returns(uint256)

Arguments

docAmountToRedeem

⤾ overrides IMoCSettlement.docAmountToRedeem

returns the total amount of Docs in the redeem queue for _who

function docAmountToRedeem(address _who) public view
returns(uint256)

Returns

total amount of Docs in the redeem queue for _who [using mocPrecision]

Arguments

addRedeemRequest

⤾ overrides IMoCSettlement.addRedeemRequest

push a new redeem request to the queue for the sender or updates the amount if the user has a redeem request

function addRedeemRequest(uint256 amount, address payable redeemer) public nonpayable onlyWhitelisted 

Arguments

clear

empty the queue

function clear() public nonpayable onlyWhitelisted 

Arguments

alterRedeemRequestAmount

⤾ overrides IMoCSettlement.alterRedeemRequestAmount

Alters the redeem amount position for the redeemer

function alterRedeemRequestAmount(bool isAddition, uint256 delta, address redeemer) public nonpayable onlyWhitelisted 

Returns

the filled amount [using mocPrecision]

Arguments

runSettlement

⤾ overrides IMoCSettlement.runSettlement

Runs settlement process in steps

function runSettlement(uint256 steps) public nonpayable onlyWhitelisted isTime 
returns(uint256)

Returns

The commissions collected in the executed steps

Arguments

fixTasksPointer

Create Task structures for Settlement execution

function fixTasksPointer() public nonpayable

Arguments

initializeContracts

function initializeContracts() internal nonpayable

Arguments

initializeValues

function initializeValues(address _governor, uint256 _blockSpan) internal nonpayable

Arguments

deleveragingStepCount

Returns the amount of steps for the Deleveraging task which is the amount of active BProx addresses

function deleveragingStepCount() internal view
returns(uint256)

Arguments

docRedemptionStepCount

Returns the amount of steps for the Doc Redemption task which is the amount of redeem requests in the queue

function docRedemptionStepCount() internal view
returns(uint256)

Arguments

initializeSettlement

Freezes state for Settlement execution

function initializeSettlement() internal nonpayable

Arguments

finishSettlement

Execute final step of Settlement task group

function finishSettlement() internal nonpayable

Arguments

finishDeleveraging

Execute final step of Deleveraging task

function finishDeleveraging() internal nonpayable

Arguments

finishDocRedemption

Execute final step of DocRedemption task

function finishDocRedemption() internal nonpayable

Arguments

deleveragingStep

Individual Deleveraging step to be executed in partial execution uint256 parameter needed for PartialExecution

function deleveragingStep(uint256 ) internal nonpayable

Arguments

docRedemptionStep

Individual DocRedemption step to be executed in partial execution

function docRedemptionStep(uint256 index) internal nonpayable

Arguments

initializeTasks

Create Task structures for Settlement execution

function initializeTasks() internal nonpayable

Arguments

Last updated