Operation - Mint
Key Steps
Parse Minting Amount:
Convert the desired minting amount into the correct unit using the
parseUnits
function. This function requires specifying the number of decimals to use, which aligns with the debt token's specifications (usually 18 decimals, like Ethereum).
Execute Minting Transaction:
Call the
doBorrow
function with the necessary parameters, including the public and wallet clients, protocol configuration, collateral information, and the parsed minting amount.
Usage
This function is typically used when a user needs to:
Increase Leverage: Mint additional stablecoins to leverage their investment position further without selling existing collateral.
Manage Financial Needs: Access additional funds for other investment opportunities or personal expenditures without liquidating their assets.
Example
import { parseUnits } from 'viem';
import { publicClient, walletClient, protocolConfig, collateral } from 'satoshi-sdk';
const DEBT_TOKEN_DECIMALS = 18; // Standard decimals for Ethereum-based tokens
async function increaseMinting() {
// Step 1: Define the amount to mint
const addMintingAmt = parseUnits('5', DEBT_TOKEN_DECIMALS); // Mint an additional 5 SAT stablecoins
// Step 2: Execute the minting transaction
const receipt = await satoshiClient.Postition.doBorrow({
publicClient,
walletClient,
protocolConfig,
collateral,
addMintingAmt,
});
console.log('Minting additional stablecoins successful:', receipt);
}
increaseMinting();
Last updated