Skip to main content

Sfpy Library

Functions#

poolFor#

function poolFor(
address factory,
address token
) internal returns (address pool)

calculates the CREATE2 address for a pair without making any external calls

Parameters:#

NameTypeDescription
factoryaddresscontract address of the factory
tokenaddresscontract address of the token

getAmountIn#

function getAmountIn(
uint256 amountOut
) internal returns (uint256 amountIn)

calculates the minimum amount needed to be returned back from a flash loan including the 0.1% fee

Parameters:#

NameTypeDescription
amountOutuint256the amount of tokens that were borrowed