Skip to main content

TpdaLiquidationPairFactory

Git Source

Author: G9 Software Inc.

Factory contract for deploying TpdaLiquidationPair contracts.

State Variables

allPairs

Tracks an array of all pairs created by this factory

TpdaLiquidationPair[] public allPairs;

deployedPairs

Mapping to verify if a TpdaLiquidationPair has been deployed via this factory.

mapping(address pair => bool wasDeployed) public deployedPairs;

Functions

createPair

Creates a new TpdaLiquidationPair and registers it within the factory

function createPair(
ILiquidationSource _source,
address _tokenIn,
address _tokenOut,
uint64 _targetAuctionPeriod,
uint192 _targetAuctionPrice,
uint256 _smoothingFactor
) external returns (TpdaLiquidationPair);

Parameters

NameTypeDescription
_sourceILiquidationSourceThe liquidation source that the pair will use
_tokenInaddressThe input token for the pair
_tokenOutaddressThe output token for the pair
_targetAuctionPerioduint64The duration of auctions
_targetAuctionPriceuint192The initial auction price
_smoothingFactoruint256The degree of smoothing to apply to the available token balance

Returns

NameTypeDescription
<none>TpdaLiquidationPairThe new liquidation pair

totalPairs

Total number of TpdaLiquidationPair deployed by this factory.

function totalPairs() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Number of TpdaLiquidationPair deployed by this factory.

Events

PairCreated

Emitted when a new TpdaLiquidationPair is created

event PairCreated(
TpdaLiquidationPair indexed pair,
ILiquidationSource source,
address indexed tokenIn,
address indexed tokenOut,
uint64 targetAuctionPeriod,
uint192 targetAuctionPrice,
uint256 smoothingFactor
);

Parameters

NameTypeDescription
pairTpdaLiquidationPairThe address of the new pair
sourceILiquidationSourceThe liquidation source that the pair is using
tokenInaddressThe input token for the pair
tokenOutaddressThe output token for the pair
targetAuctionPerioduint64The duration of auctions
targetAuctionPriceuint192The minimum auction size in output tokens
smoothingFactoruint256The 18 decimal smoothing fraction for the liquid balance