River
Satoshi Protocol V1
Satoshi Protocol V1
  • Intro
    • πŸ”οΈIntroduction
    • πŸ§‘β€πŸš€Mission
    • ❔FAQs
  • Mechanism
    • πŸ—ΊοΈOverview
    • 🏦Minting
    • πŸ›‘οΈStability Pool and Liquidations
    • βš–οΈRedemption & Price Stability
    • 🏧Nexus Yield Module (NYM)
    • ♻️Swap
    • 🌎MultiChain
    • 🌑️Recovery Mode
    • πŸ’°Revenue Structure
    • ⚑Risk Management
  • outro
    • πŸ”—Official Links
    • βš–οΈOracle
    • πŸ“”Deployed Contracts
    • πŸ”Audit Reports
  • How to use
    • πŸ—οΈCreate Position
    • πŸͺ£Deposit into Stability Pool
  • SDK
    • Introduction
    • Get Started
    • Position
      • Operation - OpenTrove
      • Operation - Deposit
      • Operation - Mint
      • Operation - Withdraw
      • Operation - Repay
      • Operation - Redemption
    • Stability Pool
      • Operation - Deposit
      • Operation - Withdraw
      • Operation - Claim rewards
    • Nexus Yield Module
      • Operation - Swap In
      • Operation - Swap Out
      • Operation - Withdraw
Powered by GitBook
On this page
  • Key Steps:
  • Example
  1. SDK
  2. Stability Pool

Operation - Withdraw

The Stability Pool in the Satoshi Protocol SDK offers critical functions for managing liquidity and stability within the decentralized finance environment. It allows users to deposit and withdraw satUSD stablecoins, contributing to the pool's ability to offset bad debts and providing a mechanism for earning rewards.

Key Steps:

  1. Convert Withdrawal Amount:

    • Similar to deposit, use parseUnits to specify the amount to withdraw in the proper unit.

  2. Execute Withdrawal Transaction:

    • Use the doWithdraw method to retrieve satUSD stablecoins from the Stability Pool. This updates the user's contribution and the overall balance of the pool.

Example

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

async function withdrawFromStabilityPool() {
  // Step 1: Define the withdrawal amount in SAT stablecoins
  const withdrawAmt = parseUnits('2', DEBT_TOKEN_DECIMALS);  // Withdrawing 2 SAT

  // Step 2: Execute the withdrawal transaction
  const receipt = await satoshiClient.StabilityPool.doWithdraw(withdrawAmt);

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

withdrawFromStabilityPool();
PreviousOperation - DepositNextOperation - Claim rewards

Last updated 9 months ago