Skip to main content

Stablecoin

XSDStabilizer

Validate

function validateToken(XToken token)

validates Token is part of the “supplyTokens” list defined by admin.

Mint

function mint(uint256 amount, XToken token)

Mint XSD in given “amount” by supplying “token”.

reverts when

  • token is blacklisted or banned
  • market share of XSD is too high
  • price is too low
  • no allowance is granted for token
  • no allowance is granted for LEXE (to pay fees)

If no reverts are hit, it will mint XSD from the Interface.

function getLexeFeeMint(uint256 amount, uint256 xsdPrice)

Calculates LEXE Fees for given Mint conditions by checking LEXE price.

Burn

function burn(uint256 amount, XToken token)

Burns XSD for given “amount” in exchange of “token”.

reverts when

  • Amount is 0
  • token is invalid
  • token is blacklisted or banned
  • price of XSD too high
  • Supply of token too low

If no reverts are hit, it will burn XSD from the Interface.

function getLexeFeeBurn(uint256 amount, uint256 xsdPrice)

Calculates LEXE Fees for given Burn conditions by checking LEXE price.

Statistics / Admin Functions

function getSupplyValue()

calculates the total Value of XSD in circulation.

function getHypotheticalLendexeShare(uint256 amount)

returns hypothetical XSD supply share percentage of the Lendexe market capital scaled as mantissa for given LEXE amount.

function updateBlacklist(XToken token)

update blacklist for given “token”.

function \_unbanToken(XToken token)

Unbans a previously blacklisted “token”.

UltimateLoan

The loan information is stored in a struct called “loanInfo”.

It holds the owner of the loan, the amount of xsd, the amount of LEXE and the dueBlock of the given loan.

Supply

function calculateAllowedMint(address owner, uint256 nftAmount)

calculates the max mint amount of “owner” for the given “nftAmount”.

iterates through the NFT-Levels and returns the amount accordingly.

function validateLock(address owner)

Validates / calculates the period of lock for the “owner”s LEXE .

Returns dueBlock & lockAmount depending on lockTime.

function supply(uint256 xsdAmount, uint256 nftAmount)

User supplies assets into the market and receives “xsdAmount” in exchange depending on his “nftAmount”.

reverts if

  • UL is not active
  • Account does not hold LEXE
  • No allowance granted for LEXE or insufficient balance

functions called

  • calculateAllowedMint
  • validateLock

If no reverts are hit, XSD is minted via stabilizer and sent to the caller.

Repay

function repay(XToken xSTB)

User repays XSD and receives Stablecoin “xSTB” in exchange.

reverts if

  • UL is not active

If no reverts are hit, XSD is burned and the user receives the stablecoins back.

Liquidate

function liquidate(address owner) liquidates the “owner”.

reverts if

  • Loan is not yet due

if no reverts are hit, burn some LEXE and send the remainder to the vault. The loan is then removed from “loanInfo”.