⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
Converts MoC commission from ReserveToken to MoC price
Returns
MoC balance of owner and MoC allowance of spender
Arguments
Name
Type
Description
owner
address
address of token owner
spender
address
address of token spender
calculateCommissionsWithPrices
Calculates commissions in MoC and ReserveToken
Returns
Commissions calculated in MoC price and ReserveToken price; and ReserveToken and MoC prices
Arguments
Name
Type
Description
params
struct MoCExchange.CommissionParamsStruct
Params defined in CommissionParamsStruct
riskProDiscToResToken
Reserve token equivalent for the amount of riskPro given applying the spotDiscountRate
Returns
Reserve token amount
Arguments
Name
Type
Description
riskProAmount
uint256
amount of RiskPro [using mocPrecision]
riskProTecPrice
uint256
price of RiskPro without discounts [using mocPrecision]
riskProDiscountRate
uint256
RiskPro discounts [using mocPrecision]
mintRiskPro
Mint RiskPros and give it to the msg.sender
Arguments
Name
Type
Description
account
address
Address of minter
reserveTokenAmount
uint256
Amount in ReserveToken to mint
vendorAccount
address
Vendor address
redeemRiskPro
Sender burns his RiskProS and redeems the equivalent ReserveTokens
Returns
resTokens to transfer to the redeemer and commission spent, using [using reservePrecision]
Arguments
Name
Type
Description
account
address
Address of the redeeemer
riskProAmount
uint256
Amount of RiskPros to be redeemed
vendorAccount
address
Vendor address
redeemFreeStableToken
Redeems the requested amount for the account, or the max amount of free stableTokens possible.
Returns
resTokens to transfer to the redeemer and commission spent, using [using reservePrecision]
Arguments
Name
Type
Description
account
address
Address of the redeeemer
stableTokenAmount
uint256
Amount of StableTokens to redeem [using mocPrecision]
vendorAccount
address
Vendor address
mintStableToken
Mint Max amount of StableTokens and give it to the msg.sender
Returns
the actual amount of resTokens used and the resTokens commission for them [using rbtPresicion]
Arguments
Name
Type
Description
account
address
minter user address
resTokensToMint
uint256
resTokens amount the user intents to convert to StableToken [using rbtPresicion]
vendorAccount
address
Vendor address
redeemStableTokenWithPrice
User StableTokens get burned and he receives the equivalent ReserveTokens in return
Returns
true and commission spent if resTokens send was completed, false if fails.
Arguments
Name
Type
Description
userAddress
address
Address of the user asking to redeem
amount
uint256
Verified amount of StableTokens to be redeemed [using mocPrecision]
reservePrice
uint256
resToken price [using mocPrecision]
redeemAllStableToken
Allow redeem on liquidation state, user StableTokens get burned and he receives the equivalent ReserveTokens according to liquidationPrice
Returns
The amount of ReserveTokens in sent for the redemption or 0 if send does not succed
Arguments
Name
Type
Description
origin
address
address owner of the StableTokens
destination
address
address to send the ReserveTokens
mintRiskProx
⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
BUCKET RiskProx minting. Mints RiskProx for the specified bucket
Returns
total ReserveTokens Spent (resTokensToMint more interest) and commission spent [using reservePrecision]
Arguments
Name
Type
Description
account
address payable
owner of the new minted RiskProx
bucket
bytes32
bucket name
resTokensToMint
uint256
resToken amount to mint [using reservePrecision]
vendorAccount
address
Vendor address
redeemRiskProx
⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
Sender burns his RiskProx, redeems the equivalent amount of RiskPros, return the "borrowed" StableTokens and recover pending interests
Returns
the actual amount of resTokens to redeem and the resTokens commission for them [using reservePresicion]
Arguments
Name
Type
Description
account
address payable
user address to redeem riskProx from
bucket
bytes32
Bucket where the RiskProxs are hold
riskProxAmount
uint256
Amount of RiskProxs to be redeemed [using reservePrecision]
vendorAccount
address
Vendor address
forceRedeemRiskProx
Burns user RiskProx and sends the equivalent amount of ReserveTokens to the account without caring if transaction succeeds
Returns
result of the ReserveTokens sending transaction
Arguments
Name
Type
Description
bucket
bytes32
Bucket where the RiskProxs are hold
account
address payable
user address to redeem riskProx from
riskProxAmount
uint256
Amount of RiskProx to redeem [using mocPrecision]
riskProxPrice
uint256
Price of one RiskProx in ReserveTokens [using reservePrecision]
burnRiskProxFor
Burns user RiskProx
Returns
ResToken total value of the redemption [using reservePrecision]*
Arguments
Name
Type
Description
bucket
bytes32
Bucket where the RiskProxs are hold
account
address payable
user address to redeem riskProx from
riskProxAmount
uint256
Amount of RiskProx to redeem [using reservePrecision]
riskProxPrice
uint256
Price of one RiskProx in ReserveTokens [using reservePrecision]
redeemRiskProxInternal
⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
Internal function to avoid stack too deep errors
Arguments
Name
Type
Description
account
address
bucket
bytes32
riskProxAmount
uint256
details
struct MoCExchange.RiskProxRedeemStruct
vendorAccount
address
mintRiskProInternal
Internal function to avoid stack too deep errors
Arguments
Name
Type
Description
account
address
reserveTokenAmount
uint256
details
struct MoCExchange.RiskProMintStruct
vendorAccount
address
mintRiskProxInternal
⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
Calculates the amount of ReserveTokens that one bucket should move to another in RiskProx minting/redemption. This extra makes RiskProx more leveraging than RiskPro.
Arguments
Name
Type
Description
bucketFrom
bytes32
Origin bucket from which the ReserveTokens are moving
bucketTo
bytes32
Destination bucket to which the ReserveTokens are moving
totalReserveToken
uint256
Amount of ReserveTokens moving between buckets [using reservePrecision]
lev
uint256
lev of the L bucket [using mocPrecision]
recoverInterests
Returns ReserveTokens for user in concept of interests refund
Returns
Interests [using reservePrecision]
Arguments
Name
Type
Description
bucket
bytes32
Bucket where the RiskProxs are hold
resTokenToRedeem
uint256
Total ReserveTokens value of the redemption [using mocPrecision]
function initialize(address connectorAddress) public nonpayable initializer
function getMoCTokenBalance(address owner, address spender) public view
returns(mocBalance uint256, mocAllowance uint256)
function calculateCommissionsWithPrices(struct MoCExchange.CommissionParamsStruct params) public view
returns(ret struct MoCExchange.CommissionReturnStruct)
function riskProDiscToResToken(uint256 riskProAmount, uint256 riskProTecPrice, uint256 riskProDiscountRate) internal view
returns(uint256)