Sky Savings allows apps to earn the Sky Savings Rate by depositing USDS into the sUSDS vault. The sUSDS vault follows the ERC-4626 standard — your app deposits USDS and receives sUSDS shares that automatically accrue yield.
On Ethereum, your app can convert DAI to USDS at a 1:1 rate through the DaiUsds converter contract. First, approve the converter to spend DAI, then call daiToUsds.
Report incorrect code
Copy
Ask AI
import {encodeFunctionData, maxUint256, erc20Abi, parseUnits} from 'viem';import {useSendTransaction} from '@privy-io/react-auth';const {sendTransaction} = useSendTransaction();const DAI_ADDRESS = '0x6B175474E89094C44Da98b954EedeAC495271d0F';const DAI_USDS_CONVERTER = '0x3225737a9Bbb6473CB4a45b7244ACa2BEFdB276A';const CHAIN_ID = 1; // Ethereum Mainnet// Step 1: Approve the converter to spend DAIconst approveData = encodeFunctionData({ abi: erc20Abi, functionName: 'approve', args: [DAI_USDS_CONVERTER as `0x${string}`, maxUint256]});await sendTransaction({ to: DAI_ADDRESS as `0x${string}`, data: approveData, chainId: CHAIN_ID});// Step 2: Convert DAI to USDSconst converterAbi = [ { type: 'function', name: 'daiToUsds', inputs: [ {name: 'usr', type: 'address'}, {name: 'wad', type: 'uint256'} ], outputs: [], stateMutability: 'nonpayable' }] as const;const amount = parseUnits('100', 18); // 100 DAIconst convertData = encodeFunctionData({ abi: converterAbi, functionName: 'daiToUsds', args: [address, amount]});await sendTransaction({ to: DAI_USDS_CONVERTER as `0x${string}`, data: convertData, chainId: CHAIN_ID});
Privy makes it straightforward to build secure, user-friendly access to Sky Savings. For advanced use cases, refer to the Sky Developer Docs, or reach out in Slack.
Your app is now ready to interact with Sky Savings using Privy embedded wallets!