Skip to main content
USYC subscriptions and redemptions are handled through an audited smart contract implemented with Solidity. You can interact with the contract using Solidity, TypeScript, or any other programming language that supports Ethereum smart contracts.
The code snippets below use Ethereum Sepolia testnet addresses. For mainnet addresses, see Smart Contract Addresses.

Solidity

import "../IERC20.sol";

interface ITeller {
  function deposit(uint256 _assets, address _receiver) external returns (uint256);
  function redeem(uint256 _shares, address _receiver, address _account) external returns (uint256);
}

ITeller teller = ITeller(0x96424C885951ceb4B79fecb934eD857999e6f82B);

// Subscribe to USYC
IERC20 usdc = IERC20(0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238);
uint256 usdcAmount = 100 * 1e6; // 100.000000 USDC
address usycReceiver = address(this); // address that will receive USYC
usdc.approve(address(teller), usdcAmount);
uint256 usycPurchased = teller.deposit(usdcAmount, usycReceiver);

// Redeem USYC
IERC20 usyc = IERC20(0x38D3A3f8717F4DB1CcB4Ad7D8C755919440848A3);
uint256 usycAmount = 100 * 1e6; // 100.000000 USYC
address usdcReceiver = address(this); // address that will receive USDC
address usycAccount = address(this); // address that holds USYC
uint256 usdcPayout = teller.redeem(usycAmount, usdcReceiver, usycAccount);

TypeScript

import { Address, erc20ABI, writeContract, getAccount } from "@wagmi/core";

const USYC_TELLER_ABI = [
  {
    inputs: [
      { internalType: "uint256", name: "_assets", type: "uint256" },
      { internalType: "address", name: "_receiver", type: "address" },
    ],
    name: "deposit",
    outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
    stateMutability: "nonpayable",
    type: "function",
  },
  {
    inputs: [
      { internalType: "uint256", name: "_amount", type: "uint256" },
      { internalType: "address", name: "_receiver", type: "address" },
      { internalType: "address", name: "_account", type: "address" },
    ],
    name: "redeem",
    outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
    stateMutability: "nonpayable",
    type: "function",
  },
] as const;

// Ethereum Sepolia Addresses
const SEPOLIA_CHAIN_ID = 11155111;
const USYC_TELLER_ADDRESS: Address =
  "0x96424C885951ceb4B79fecb934eD857999e6f82B";
const USDC_ADDRESS: Address = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238";
const USYC_ADDRESS: Address = "0x38D3A3f8717F4DB1CcB4Ad7D8C755919440848A3";

const ONE_HUNDRED_USDC = BigInt(100_000000); // USDC uses 6 decimals
const ONE_HUNDRED_USYC = BigInt(100_000000); // USYC uses 6 decimals

// Subscribe to USYC
export const approveUSYCTellerToSpendUSDC = () =>
  writeContract({
    chainId: SEPOLIA_CHAIN_ID,
    address: USDC_ADDRESS,
    abi: erc20ABI,
    functionName: "approve",
    args: [USYC_TELLER_ADDRESS, ONE_HUNDRED_USDC],
  });

const usycReceiverAddress: Address = getAccount(); // address that will receive USYC

export const depositUSYC = () =>
  writeContract({
    chainId: SEPOLIA_CHAIN_ID,
    address: USYC_TELLER_ADDRESS,
    abi: USYC_TELLER_ABI,
    functionName: "deposit",
    args: [ONE_HUNDRED_USDC, usycReceiverAddress],
  });

// Redeem USYC
const usdcReceiverAddress: Address = getAccount(); // address that will receive USDC
const usycAccountAddress: Address = getAccount(); // address that holds USYC

export const redeemUSYC = () =>
  writeContract({
    chainId: SEPOLIA_CHAIN_ID,
    address: USYC_TELLER_ADDRESS,
    abi: USYC_TELLER_ABI,
    functionName: "redeem",
    args: [ONE_HUNDRED_USYC, usdcReceiverAddress, usycAccountAddress],
  });