| hide_table_of_contents | true |
|---|
This document is being iterated on rapidly due to incoming questions from partner protocols.
Unlike standard AMMs, Pendle's AMM only allows swapping exact PT in/out. Therefore, functions like swapExactSyForPt and swapPtForExactSy should generally be avoided. If necessary, use PendleRouter's swapExactSyForPt with approx parameters. Refer to the PendleRouter documentation for details.
There are two methods:
- Call
redeemRewards(user)and retrieve the output. This method has the side effect of redeeming the user's rewards, so it might not be ideal. - Call
IERC20(market).transfer(user,0)followed byaccruedRewards. The transfer triggers an update of the user's rewards.
Yes, the output can change if the underlying protocol adds new reward tokens. However, no reward tokens will ever be removed.
On-Chain Method:
To read for SY, please execute an eth_call (callStatic in ethersjs) to the following function of SY:
function claimRewards(address user) external returns (uint256[] memory rewardAmounts);For YT, execute the following function:
function redeemDueInterestAndRewards(
address user,
bool redeemInterest,
bool redeemRewards
) external returns (uint256 interestOut, uint256[] memory rewardsOut);For Market, execute the following function:
function redeemRewards(address user) external returns (uint256[] memory);These calls can be batched through Multicall if necessary.