This contract allows for easy creation of leverage positions for PT collateralized Ion markets.
State Variables
MARKET
IPMarketV3 public immutable MARKET;
SY
IStandardizedYield public immutable SY;
PT
IERC20 public immutable PT;
YT
IERC20 public immutable YT;
flashswapInitiated
uint256 private flashswapInitiated = 1;
Functions
constructor
Creates a new PtHandler instance
constructor(
IonPool pool,
GemJoin join,
Whitelist whitelist,
IPMarketV3 _market
)
IonHandlerBase(0, pool, join, whitelist);
Parameters
ptLeverage
Allows a borrower to create a leveraged position on Ion Protocol
Transfer PT from user -> Flashswap PT token -> Deposit all PT into IonPool -> Borrow base asset -> Mint SY using base asset -> Repay Flashswap with SY.
On small enough swaps, the SY to send back can be 0. This function can only be called by the market. This function can only be called by market if the swap was initiated by this contract.
function swapCallback(int256 ptToAccount, int256 syToAccount, bytes calldata data) external;