# Introduction

### Overview of the SDK

The Satoshi Protocol SDK is a comprehensive toolkit for developers to integrate and interact with the Satoshi Protocol, a DeFi platform on the blockchain. This SDK is structured to facilitate various operations such as minting, earning, staking, and cross-chain functionality. Here’s a brief overview of the main components and their functions:

* Package: <https://www.npmjs.com/package/satoshi-sdk>
* GitHub: <https://github.com/Satoshi-Protocol/satoshi-sdk>

#### Directory Structure:

* **`/src`**: Contains the source code for the SDK.
  * **`abi`**: Holds ABI files necessary for smart contract interactions.
  * **`api`**: Functions for direct API calls to the Satoshi Protocol.
  * **`config`**: Configuration files that specify chain parameters and protocol settings.
  * **`core`**: Core functionalities such as borrow, deposit, repay, and withdraw operations.
  * **`core/utils`**: Utility functions that support various features like calculations, hints, and total debt amounts.
  * **`types`**: TypeScript type definitions for assets and configurations.

### Key Features:

#### **Trove Operations**:

* **OpenTrove**
  * **Purpose**: Mint satUSD stable coins by depositing collateral into a new trove.
  * **Usage**: Used to initiate participation in the lending system, allowing users to lock in collateral in exchange for stable coins.
* **Deposit**
  * **Purpose**: Add additional collateral to an existing trove to increase the collateral ratio.
  * **Usage**: Helps maintain a safe buffer against price fluctuations, potentially allowing for further minting without reducing safety margins.
* **Withdraw**
  * **Purpose**: Remove collateral from a trove while maintaining the required minimum collateral ratio.
  * **Usage**: Permits users to retrieve excess collateral, useful when the collateral's value increases or the debt is partially repaid.
* **Borrow (Mint)**
  * **Purpose**: Mint more satUSD stable coins against the existing collateral in the trove.
  * **Usage**: Enables further leveraging of investments by increasing stable coins minting against secured collateral.
* **Repay**
  * **Purpose**: Pay back minted satUSD stable coins to reduce the trove’s debt.
  * **Usage**: Reduces interest liabilities and risk of liquidation by improving the collateral-to-debt ratio.
* **Close**
  * **Purpose**: Close the trove by repaying all debts and reclaiming all collateral.
  * **Usage**: Ends participation in the minting system and liquidates the position, returning all collateral to the user.
* **Redeem**
  * **Purpose**: Let users redeem satUSD for collateral, ensuring the stability of the peg to the USD.

#### **Stability Pool Operations**:

* **Deposit**
  * **Purpose**: Users deposit satUSD stable coins into the Stability Pool to participate in covering liquidations and earning returns from the pool's operations.
  * **Usage**:
    1. **Enhance Pool Stability**: By contributing to the pool, users help maintain overall system stability.
    2. **Earn Returns**: Participants can earn rewards based on the pool's performance and their contribution.
* **Withdraw**
  * **Purpose**: Allows users to withdraw their deposited satUSD stable coins from the Stability Pool, reducing their involvement but also their potential earnings.
  * **Usage:**
    1. **Retrieve Liquidity**: Users can withdraw their contributions for personal liquidity needs.
    2. **Adjust Investment**: Manage exposure to the Stability Pool based on market conditions or personal strategy changes.
* **Claim**
  * **Purpose**: Allows users to claim accumulated collateral gains from the Stability Pool.
  * **Usage:** This function is crucial for users who have contributed to the pool and have earned returns as the pool liquidates troves that fall below the required collateral-to-debt ratio.

#### Nexus Yield Module (NYM) Operations:

* **Swap In**
  * **Purpose**: Allows users to swap stablecoins or other supported assets into $satUSD, the protocol’s native stablecoin.
* **Swap Out**
  * **Purpose**: Allows users to schedule the conversion of satUSD back into other stablecoins or supported assets, such as USDT or USDC. The Swap-out process includes a pending period before the assets can be withdrawn.
* **Withdraw**
  * **Purpose**: Allows users to withdraw previously scheduled withdrawals of assets, such as USDT, USDC, or other supported tokens.

***

This SDK is built with flexibility in mind, supporting multiple blockchain networks and providing a rich set of features to engage with decentralized finance applications.

{% hint style="info" %}
If you have any problems while developing, please don't hesitate to let us know. Contact us on [Discord](https://discord.gg/CakRgSnPVS) or [Telegram](https://t.me/satoshi_sat).
{% endhint %}
