A lightweight example project demonstrating how to integrate with the R2 Protocol smart contracts, including provider setup, ABI usage, and common contract method calls.
- Node.js 18+
- pnpm / yarn / npm
- RPC endpoint (e.g., Infura / Alchemy / local node)
- Your private key without the 0x prefix
Create .env:
RPC_URL=https://your_rpc_here
PRIVATE_KEY=xxxxxxxxxxxxxxxxxxxxxxxx
Send underlying tokens (USDC) and mint sR2USD/sR2USD+:
npm run deposit
Burn sR2USD/sR2USD+ and receive underlying tokens (USDC):
npm run redeem
- Ensure your wallet has enough gas.
- All amounts should follow the token’s decimals.