- Deposit: Convert underlying assets (USDC) into USYC shares
- Redeem: Convert USYC shares back into underlying assets
The code snippets in this quickstart use Solana devnet addresses. For mainnet
addresses, see Smart Contract Addresses.
Prerequisites
Before you begin, ensure that you’ve:Step 1: Set up the project
This step shows you how to install dependencies and generate the client code you need to interact with the Yieldcoin Manager program.1.1. Install dependencies
Install the Solana Kit library and token program packages:Shell
1.2. Generate client code
Generate client code from the Yieldcoin Manager IDL using your preferred code generator, such as Codama or other Solana IDL tools. The generated code provides instruction builders similar to the following:TypeScript
Step 2: Set up the script
This step shows you how to configure imports, constants, and helper functions for interacting with the Yieldcoin Manager program.2.1. Define imports and constants
Create a new TypeScript file and add the following imports and constants:TypeScript
2.2. Define helper functions
Add the following helper functions to derive PDAs, fetch teller data, and send transactions:TypeScript
Step 3: Subscribe and redeem
This step shows you how to subscribe to USYC (deposit USDC) and redeem USYC (withdraw USDC) using the generated contract functions.3.1. Subscribe to USYC (deposit)
The deposit operation converts USDC into USYC shares. Add the following code to create a deposit instruction and execute it:TypeScript
3.2. Redeem USYC
The redeem operation converts USYC shares back into USDC. Add the following code to create a redeem instruction and execute it:TypeScript