Operation - Redemption

The Redeem operation within the TroveManager component of the Satoshi Protocol SDK allows users to exchange their SAT stablecoins for an equivalent amount of collateral at the current redemption rate. This function is crucial for users who wish to exit their investment positions by converting their stablecoins back into the original collateral asset, typically during favorable market conditions.

Key Steps

  1. Estimate Redeem Amount:

    • Determine the amount of SAT stablecoins you wish to redeem. This should be specified using the parseUnits function, which converts the human-readable amount into the smallest unit of the debt token based on its decimals.

  2. Execute Redeem Transaction:

    • Call the doRedeem method on the TroveManager with the specified collateral and the amount of SAT stablecoins to be redeemed. This operation interacts with the blockchain to exchange the stablecoins for collateral.

Example

import { parseUnits } from '@ethersproject/units';
import { satoshiClient, collateral, DEBT_TOKEN_DECIMALS } from 'satoshi-sdk';

async function redeemCollateral() {
  // Step 1: Define the amount of SAT stablecoins you want to redeem
  const estimatedRedeemAmt = parseUnits('5', DEBT_TOKEN_DECIMALS);  // Redeeming 5 SAT

  // Step 2: Execute the redeem operation
  const receipt = await satoshiClient.Postition.doRedeem(collateral, estimatedRedeemAmt);

  // Output the transaction receipt
  console.log('Redeem Receipt:', receipt);
}

redeemCollateral();

Last updated