Supply/Withdraw Asset
When users supply assets into Scallop lending pools, they receive sCoins — tokens that represent their lending positions. For example, depositing SUI yields sSUI, and depositing USDC yields sUSDC.
sCoins accrue value over time based on lending yields and can be redeemed to withdraw the underlying assets.
Supply Asset
There are several methods to supply assets into lending pools. Users will receive sCoin as proof of their lending positions.
Using ScallopClient
import { ScallopClient } from '@scallop-io/sui-scallop-sdk';
const scallopClient = new ScallopClient({
addressId: '695fcdc084f790c04eb068dc',
fullnodeUrl: 'https://fullnode.mainnet.sui.io:443',
secretKey: '...', // or mnemonics: '...'
});
await scallopClient.init();
const poolName = 'sca'; // Use lowercase for pool names ('usdc', 'wal', 'sui', 'deep', etc.)
const amount = 1 * 1e9; // 1 SCA
const { effects, digest } = await scallopClient.supply(poolName, amount);
console.log(`${effects?.status.status}: ${digest}`);Using ScallopBuilder
Quick Method for Automatic Coin Selection
Normal Method for More Composability
Withdraw Asset
There are several methods to withdraw supplied assets from lending pools. Note that withdrawal will burn user's existing sCoins.
Using ScallopClient
Using ScallopBuilder
Quick Method for Automatic Coin Selection
withdrawQuick uses the user's sCoins first, and falls back to the old market coins when the sCoins are not enough.
Normal Method for More Composability
Last updated
Was this helpful?