USYC Docs
Search
K

Solidity

Describes how to use code to enter and exit SDYC
import "../IERC20.sol";
interface ITeller {
function buy(uint256 _amount) external returns (uint256);
function sell(uint256 _amount) external returns (uint256);
}
ITeller teller = ITeller(0xAAF405C48e8c73aECedA3E40fE34e5C0ff8f5DE5);
// Buying USYC
IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
uint256 paying = 100 * 1e6; // 100.000000 USDC
usdc.approve(address(teller), paying); // approving teller to spend 100 USDC
uint256 sdycPurchased = teller.buy(paying);
// Selling USYC
IERC20 usyc = IERC20(0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b);
uint256 selling = 100 * 1e6; // 100.000000 USYC
usyc.approve(address(teller), selling); // approving teller to spend 100 USYC
uint256 usdcPayout = teller.sell(selling)