How to Participate in Redemption
How to Redeem USH?
The redemption process is straightforward and consists of two main steps:
Step 1: Opening a Depeg Window
Before initiating a redemption, the redeemer must open a Depeg Window in the Depeg Strategy. This is done by calling the openDepegWindow
function:
{
"docs": [
"Tries to open a Depeg Window. This method is used by redeemers to start the redemption process."
],
"name": "openDepegWindow",
"mutability": "mutable",
"inputs": [],
"outputs": [
{
"type": "DepegWindow"
}
]
}
Once the Depeg Window is successfully opened, the user must wait 5 minutes before proceeding. The redemption window remains open for 10 minutes, during which the redeem action must be executed.
Step 2: Executing the Redemption
To redeem, the user must call the Redeem endpoint in the Isolated Lending Protocol. This function is payable in EGLD and is used to repay USH borrows in exchange for collateral.
{
"docs": [
"Redeems USH borrows when there is a depeg. The redemption mechanism is a public process that allows anyone to repay",
"the riskiest USH borrows in exchange for collateral. This process can be profitable for the redeemer given that USH is",
"trading on the open market below the pegged price while the protocol assumes a pegged price. The redeemer provides",
"funding in the form of EGLD, which is swapped for USH through the respective pool, helping restore the USH peg to the",
"dollar in the pool."
],
"name": "redeem",
"mutability": "mutable",
"payableInTokens": ["EGLD"],
"inputs": [
{
"name": "opt_min_amount_out",
"type": "Option<BigUint>"
},
{
"name": "opt_gas_deletion",
"type": "Option<u64>"
},
{
"name": "opt_gas_insertion",
"type": "Option<u64>"
}
],
"outputs": [
{
"type": "EsdtTokenPayment"
},
{
"type": "EgldOrEsdtTokenPayment"
},
{
"type": "EgldOrEsdtTokenPayment"
},
{
"type": "EsdtTokenPayment"
}
]
}
This mechanism allows anyone to repay the riskiest USH borrows in exchange for their collateral. Since USH is trading below the peg in the open market while the protocol assumes a pegged price, this process can be profitable for the redeemer. The provided EGLD is swapped for USH through the liquidity pool, helping to restore the peg.
It’s important to note that not all of the transferred EGLD may be used, as the redemption depends on the riskiest accounts in the protocol.
Other Useful Functions
1. Checking If A Depeg Window Can Be Opened
Before attempting to open a redemption window, you can check if the conditions allow it by calling the canOpenDepegWindow
function:
{
"docs": [
"Checks whether the Depeg Strategy can open a Depeg Window based on the current state of the smart contract, the",
"existence of a depeg, and the status of the Depeg Window. This method is used by redeemers to identify when they can",
"start the redemption process."
],
"name": "canOpenDepegWindow",
"mutability": "mutable",
"inputs": [],
"outputs": [
{
"type": "bool"
}
]
}
If the function returns true
, a Depeg Window can be opened.
2. Determining The Optimal EGLD Amount For Maximum Profit
To estimate the ideal amount of EGLD to use in the Redeem function for the highest possible profit, you can call getEgldAmountMaxProfit
:
{
"docs": [
"Returns the EGLD amount at which a redemption generates the maximum profit."
],
"name": "getEgldAmountMaxProfit",
"mutability": "readonly",
"inputs": [],
"outputs": [
{
"type": "BigUint"
}
]
}
This function provides the optimal amount of EGLD to use, ensuring the best possible arbitrage opportunities during the redemption process.
ABI Files
Last updated
Was this helpful?