Skip to main content

Simple Functions

This document lists simplified versions of Pendle Router functions that use on-chain approximation algorithms instead of requiring complex parameters. These functions are automatically used by the main router when conditions allow for simplified execution.

Overview

The Pendle Router includes simplified versions of complex functions that:

  • Use on-chain approximation algorithms (no ApproxParams needed)
  • Skip limit order functionality (no LimitOrderData needed)
  • Provide streamlined interfaces for common operations
  • Are automatically selected when no off-chain guess is provided and limit order data is empty

Important Notes

⚠️ Limited Flexibility: Simple functions don't support limit orders or custom approximation parameters.

⚠️ Market Dependent: Effectiveness depends on current market conditions and may not always be available.

The simple functions provide a streamlined interface for common operations while maintaining the full functionality of the Pendle trading system through automated approximation algorithms.

PT Trading Functions

swapExactTokenForPtSimple

Simplified version of swapExactTokenForPt using on-chain approximation.

function swapExactTokenForPtSimple(
address receiver,
address market,
uint256 minPtOut,
TokenInput calldata input
) external payable returns (uint256 netPtOut, uint256 netSyFee, uint256 netSyInterm)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive PT tokens
marketaddressPendle market address
minPtOutuint256Minimum PT tokens to receive
inputTokenInputToken input configuration

Return Values

NameTypeDescription
netPtOutuint256PT tokens received
netSyFeeuint256Trading fees paid in SY
netSyIntermuint256SY tokens generated from input token

swapExactSyForPtSimple

Simplified version of swapExactSyForPt using on-chain approximation.

function swapExactSyForPtSimple(
address receiver,
address market,
uint256 exactSyIn,
uint256 minPtOut
) external returns (uint256 netPtOut, uint256 netSyFee)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive PT tokens
marketaddressPendle market address
exactSyInuint256Exact amount of SY tokens to swap
minPtOutuint256Minimum PT tokens to receive

Return Values

NameTypeDescription
netPtOutuint256PT tokens received
netSyFeeuint256Trading fees paid in SY

YT Trading Functions

swapExactTokenForYtSimple

Simplified version of swapExactTokenForYt using on-chain approximation.

function swapExactTokenForYtSimple(
address receiver,
address market,
uint256 minYtOut,
TokenInput calldata input
) external payable returns (uint256 netYtOut, uint256 netSyFee, uint256 netSyInterm)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive YT tokens
marketaddressPendle market address
minYtOutuint256Minimum YT tokens to receive
inputTokenInputToken input configuration

Return Values

NameTypeDescription
netYtOutuint256YT tokens received
netSyFeeuint256Trading fees paid in SY
netSyIntermuint256SY tokens generated from input token

swapExactSyForYtSimple

Simplified version of swapExactSyForYt using on-chain approximation.

function swapExactSyForYtSimple(
address receiver,
address market,
uint256 exactSyIn,
uint256 minYtOut
) external returns (uint256 netYtOut, uint256 netSyFee)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive YT tokens
marketaddressPendle market address
exactSyInuint256Exact amount of SY tokens to swap
minYtOutuint256Minimum YT tokens to receive

Return Values

NameTypeDescription
netYtOutuint256YT tokens received
netSyFeeuint256Trading fees paid in SY

Liquidity Management Functions

addLiquiditySingleTokenSimple

Simplified version of addLiquiditySingleToken using on-chain approximation.

function addLiquiditySingleTokenSimple(
address receiver,
address market,
uint256 minLpOut,
TokenInput calldata input
) external payable returns (uint256 netLpOut, uint256 netSyFee, uint256 netSyInterm)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive LP tokens
marketaddressPendle market address
minLpOutuint256Minimum LP tokens to receive
inputTokenInputToken input configuration

Return Values

NameTypeDescription
netLpOutuint256LP tokens received
netSyFeeuint256Trading fees paid in SY
netSyIntermuint256SY tokens generated from input token

addLiquiditySingleSySimple

Simplified version of addLiquiditySingleSy using on-chain approximation.

function addLiquiditySingleSySimple(
address receiver,
address market,
uint256 netSyIn,
uint256 minLpOut
) external returns (uint256 netLpOut, uint256 netSyFee)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive LP tokens
marketaddressPendle market address
netSyInuint256Amount of SY tokens to use
minLpOutuint256Minimum LP tokens to receive

Return Values

NameTypeDescription
netLpOutuint256LP tokens received
netSyFeeuint256Trading fees paid in SY

addLiquiditySinglePtSimple

Simplified version of addLiquiditySinglePt using on-chain approximation.

function addLiquiditySinglePtSimple(
address receiver,
address market,
uint256 netPtIn,
uint256 minLpOut
) external returns (uint256 netLpOut, uint256 netSyFee)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive LP tokens
marketaddressPendle market address
netPtInuint256Amount of PT tokens to use
minLpOutuint256Minimum LP tokens to receive

Return Values

NameTypeDescription
netLpOutuint256LP tokens received
netSyFeeuint256Trading fees paid in SY

removeLiquiditySinglePtSimple

Simplified version of removeLiquiditySinglePt using on-chain approximation.

function removeLiquiditySinglePtSimple(
address receiver,
address market,
uint256 netLpToRemove,
uint256 minPtOut
) external returns (uint256 netPtOut, uint256 netSyFee)

Input Parameters

NameTypeDescription
receiveraddressAddress to receive PT tokens
marketaddressPendle market address
netLpToRemoveuint256Amount of LP tokens to burn
minPtOutuint256Minimum PT tokens to receive

Return Values

NameTypeDescription
netPtOutuint256PT tokens received
netSyFeeuint256Trading fees paid in SY

When Simple Functions Are Used

The Pendle Router automatically determines when to use simplified functions. Simple functions are used when:

  1. No limit orders: LimitOrderData is empty
  2. No off-chain guess: ApproxParams doesn't include off-chain calculated estimates
  3. Default parameters: Standard approximation parameters are used

Advantages of Simple Functions

Ease of Use: Require fewer parameters and no complex configuration.

Reliability: Built-in approximation algorithms are optimized for common trading scenarios.

Automatic Selection: The main router functions automatically delegate to simple versions when no off-chain guess is provided and limit order data is empty.

Integration Approach

Recommended Pattern: Always use the main router functions (e.g., swapExactTokenForPt) with default parameters. The router will automatically use simple versions when optimal.

// This may automatically use the simple version
router.swapExactTokenForPt(
receiver,
market,
minPtOut,
createDefaultApproxParams(),
createTokenInputSimple(tokenIn, amountIn),
createEmptyLimitOrderData()
);

Direct Usage: Only call simple functions directly if you're building custom routing logic and want to force the use of on-chain approximation.