Skip to main content
This contract is owned and managed by the product’s team. It allows developers to deploy and set up their own pools. The following are the main technical aspects of this contract: See FactoryBase.sol.

Deployers Allow List

In order for a developer to be able to use the factory, they must first be added to the allow list in the Factory contract. Currently, only the product team can add or remove a deployer to the allow list. If you are interested in using our product and being added to the allow list, reach out at liquidity@thrackle.io .

Pool Configurations

For the pool to be properly setup, it is important to understand the parameters that it requires:

Pairs

A pool serves as a trading means for a pair of ERC20 tokens. This pair is composed of one ERC20 that we will call the x-token and another ERC20 that we will call the y-token aka collateral token.

Available y Tokens

This token can be chosen from a predetermined list which is maintained by the product’s team. Currently available y-tokens are:
Ethereum Network:
Token NameToken SymbolToken AddressNetworkChain ID
Circle USDUSDC0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48Ethereum1
TetherUSDT0xdAC17F958D2ee523a2206206994597C13D831ec7Ethereum1
Wrapped EtherwETH0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2Ethereum1
Polygon Network:
Token NameToken SymbolToken AddressNetworkChain ID
Circle USDUSDC0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359Polygon137
TetherUSDT0xc2132D05D31c914a87C6611C10748AEb04B58e8FPolygon137
Wrapped MaticwMATIC0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619Polygon137
Note: The pool’s default for decimals is 18. Upon creation of a pool an offset will be set for Collateral tokens with less than 18 decimals. The offset will be applied during swaps to make sure the difference in decimals is accounted for.

x Token

This can actually be any ERC20 token, even y tokens, as long as it complies with the supply requirements:
  • Max Supply For x-tokens: The total supply of an x-token is set at construction, immutable, and must not be more than 100 billion tokens (assuming it has 18 decimals) to be part of a pool.
  • Token uses 18 decimals: It is an expectation for the x-token to use 18 decimals.
Visit the Unsupported Tokens page for a more explicit list of unsupported tokens.

LP Fees

Pools have an LP-fee feature which initial value must be set through the factory. Take into account that this fee value can also be updated at any time in the pool contract itself after deployed. The LP fee is the percentage of the swaps that the pool will set aside as a liquidity-provider fee. The fee will be collected and accumulated in y-tokens. This is a percentage expected to be in basis points (100 -> 1%).

Curve Parameters

  • b: The slope of the tbc function. Related to the price impact of trades, if the slope is higher, a certain trade will move the price more.
  • c: The y-intercept of the tbc function. This is the price of the x-token when the pool is empty.
  • C: The concentration parameter of the tbc function.
  • lowerPrice: The initial lower price for an x-token. This is basically the initial price, in WAD, of the x-token to be bought from the pool. This value is expected in WAD (1 -> 1 * 1e18).
  • xMin: The minimum value of variable x.
  • xMax: The highest price for an x-token.
  • V: Vector field parameter.
  • Zn: A balancing quantity that needs to be added to L for fair LP fee accounting.
  • winactive: The amount of liquidity that is inactive. It cannot extract revenue, cannot further add liquidity and removal of liquidity is on a modified flow.

Protocol Fees

Protocol fees are a portion of each swap that will go towards the protocol as a compensation for its service provided. The management of the protocol fee is under complete control of the protocol, and the factory plays a central role in this management. The following are the properties of the factory’s protocol fees:
  • Protocol fees can be updated at any time only by the owner of the factory.
  • Protocol fees can be 0.
  • Protocol fees are expressed in basis points.
  • Protocol fees can be as high as 0.20%.

Factory’s protocol fee value

The factory is in charge of setting the initial value of the protocol fees of the pools at deployment time. Only the owner of the factory can set this value. The following functions are available to manage the protocol fee:
/**
 * @dev fee percentage for swaps for the protocol
 * @return the percentage for swaps in basis points that will go towards the protocol
 */
function protocolFee() external returns (uint16);

/**
 * @dev This is the function to update the protocol fees per trading.
 * @param _protocolFee percentage of the transaction that will get collected as fees (in percentage basis points:
 * 10000 -> 100.00%; 500 -> 5.00%; 1 -> 0.01%)
 */
function setProtocolFee(uint16 _protocolFee) external;

Factory’s protocol fee collector

The factory is also in charge of setting the initial address of the protocol fee collector of the pools at deployment time. Only the owner of the factory can set this value. The following functions are available to manage this address:
/**
 * @dev protocol-fee collector address
 * @return the current protocolFeeCollector address
 */
function protocolFeeCollector() external returns (address);

/**
 * @dev proposed protocol-fee collector address
 * @return the current proposedProtocolFeeCollector address
 */
function proposedProtocolFeeCollector() external returns (address);

/**
 * @dev function to propose a new protocol fee collector
 * @param _protocolFeeCollector the new fee collector
 * @notice that only the current fee collector address can call this function
 */
function proposeProtocolFeeCollector(address _protocolFeeCollector) external;

/**
 * @dev function to confirm a new protocol fee collector
 * @notice that only the already proposed fee collector can call this function
 */
function confirmProtocolFeeCollector() external;
Notice that the process of assigning a new protocol fee collector is a 2-step process in order to prevent human errors from setting the wrong address:
  1. The owner of the factory proposes a new protocol fee collector address through the function proposeProtocolFeeCollector.
  2. The proposed protocol fee collector account then needs to call the confirmProtocolFeeCollector function to accept/confirm this role.

Usage

Deploy A New ALTBC Pool

To deploy a new ALTBC pool, call the following function on the ALTBCFactory contract:
/**
 * @dev deploys an ALTBC pool
 * @param _xToken address of the X token (x axis)
 * @param _yToken address of the Y token (y axis)
 * @param _lpFee percentage of the fees in percentage basis points
 * @param _tbcInput input data for the pool
 * @param _xAdd the initial liquidity of xTokens that will be transferred to the pool
 * @param _name the name of the pool
 * @param _symbol the symbol of the pool
 * @return deployedPool the address of the deployed pool
 * @notice Only allowed deployers can deploy pools and only allowed yTokens are allowed
 */
function createPool(
    address _xToken,
    address _yToken,
    uint16 _lpFee,
    ALTBCInput memory _tbcInput,
    uint256 _xAdd,
    string memory _name,
    string memory _symbol
) external onlyAllowedDeployers onlyAllowedYTokens(_yToken) returns (address deployedPool)
This function returns the address of the new pool. See Pool documentation for more details.

Manage Deployer’s Allow List

To manage the deployer allow list, there are 2 functions available, one of them being accessable only to the contract owner, and 1 read function available for everybody to use:
/**
 * @dev sets the deployer allow list
 * @param _address of the allow list contract
 * @notice Only the owner can set the deployer allow list
 */
function setDeployerAllowList(address _address) external onlyOwner;

/**
 * @dev gets the deployer allow list
 * @return _address of the current allow list contract
 */
function getDeployerAllowList() external view returns (address);

Manage Collateral Token’s Allow List

In a similar fashion, to manage the y-token’s allow list, there are 2 functions available, one of them being accessable only to the contract owner, and 1 read function available for everybody to use:
/**
 * @dev sets the y token allow list
 * @param _address of the allow list contract
 */
function setYTokenAllowList(address _address) external onlyOwner;

/**
 * @dev gets the y token allow list
 * @return _address of the current allow list contract
 */
function getYTokenAllowList() external view returns (address);
Visit next page for Pool documentation.