Teller Smart Contract

USYC subscriptions and redemptions are handled through an audited smart contract implemented with Solidity. If you have been entitled to the contract, 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 Contracts.

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

Last updated