Getting started with Pi Protocol is simple. Below is a quickstart guide to minting, querying, and redeeming with Pi contracts.
Step 1: Minting USP​
To mint USP, interact with Pi’s minting contract by providing tokenized RWA collateral (e.g., T-Bills or IIAs). The minting process automatically issues:
- USP: The stablecoin pegged to $1.
- USI: The yield-bearing token representing interest accrued from the collateral.
Example Contract Interaction:
mint(uint256 collateralAmount) {
// Provide collateral
// Receive USP and USI tokens
}
The minted USP can be used for transactions, staking in LAMP, or liquidity provision.
Step 2: Querying USI​
You can query USI to track the yield generated by the underlying asset. The contract updates metadata in real-time, reflecting the current accrued interest and maturity schedule.
Example Contract Interaction: solidity
getUSIYield(address user) {
// Query the yield associated with the user's USI token
return userUSI.balanceOf(address);
}
Step 3: Redeeming Collateral​
To redeem the underlying collateral, return both USP and USI tokens to the Pi Protocol. The contract then releases the collateral and burns the tokens.
Example Contract Interaction:
redeem(uint256 usiAmount) {
// Return USP and USI
// Unlock collateral and burn tokens
}
This ensures that the collateral can only be unlocked once both the principal (USP) and yield (USI) components are returned.