USYC subscriptions and redemptions are handled through an audited smart contract, callable from Solidity, TypeScript, or directly using the Etherscan interface.
import "../IERC20.sol";
interface ITeller {
function buy(uint256 _amount) external returns (uint256);
function sell(uint256 _amount) external returns (uint256);
}
ITeller teller = ITeller(0x0a5ea26fdd38cf2acb06dc64198374c337879dab);
// Subscribe to USYC
IERC20 pyusd = IERC20(0x6c3ea9036406852006290770BEdFcAbA0e23A0e8);
uint256 paying = 100 * 1e6; // 100.000000 PYUSD
pyusd.approve(address(teller), paying);
uint256 usycPurchased = teller.buy(paying);
// Redeem USYC
IERC20 usyc = IERC20(0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b);
uint256 selling = 100 * 1e6; // 100.000000 USYC
usyc.approve(address(teller), selling);
uint256 usdcPayout = teller.sell(selling);
import { Address, erc20ABI, writeContract } from '@wagmi/core'
const USYC_TELLER_ABI = [
{
inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }],
name: 'sell',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }],
name: 'buy',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'nonpayable',
type: 'function',
},
] as const
// Ethereum mainnet addresses
const USYC_TELLER_ADDRESS: Address =
'0xAAF405C48e8c73aECedA3E40fE34e5C0ff8f5DE5'
const USDC_ADDRESS: Address = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
const USYC_ADDRESS: Address = '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b'
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: 1,
address: USDC_ADDRESS,
abi: erc20ABI,
functionName: 'approve',
args: [USYC_TELLER_ADDRESS, ONE_HUNDRED_USDC],
})
export const buyUSYC = () =>
writeContract({
address: USYC_TELLER_ADDRESS,
chainId: 1,
abi: USYC_TELLER_ABI,
functionName: 'buy',
args: [ONE_HUNDRED_USDC],
})
// Redeem USYC
export const approveUSYCTellerToSpendUSYC = () =>
writeContract({
chainId: 1,
address: USYC_ADDRESS,
abi: erc20ABI,
functionName: 'approve',
args: [USYC_TELLER_ADDRESS, ONE_HUNDRED_USYC],
})
export const sellUSYC = () =>
writeContract({
address: USYC_TELLER_ADDRESS,
chainId: 1,
abi: USYC_TELLER_ABI,
functionName: 'sell',
args: [ONE_HUNDRED_USYC],
})
You can use the Etherscan interface to subscribe to and redeem USYC.
Before subscribing to USYC, you must approve the Teller contract to spend your USDC.
approve
function.spender
field, enter 0x5C73E1cfdD85b7f1d608F7F7736fC8C653513B7A
(the Teller address).amount
field, enter the amount of USDC to spend.After setting the allowance, you can subscribe to USYC:
buy
function.Before redeeming USYC, you must approve the Teller contract to spend your USYC.
approve
function.spender
field, enter 0x5C73E1cfdD85b7f1d608F7F7736fC8C653513B7A
(the Teller address).amount
field, enter the amount of USYC to redeem.After setting the allowance, you can redeem USYC:
sell
function.