Skip to main content

Pool Factory: Overview

The Tricrypto-NG Factory allows the permissionless deployment of two-coin volatile asset pools, as well as gauges. **The liquidity pool and LP token share the same contract.**Additionally, the Factory contract is the direct admin and fee receiver of all pools. In turn, the Factory is controlled by the CurveDAO.

Contract Source & Deployment

Source code for this contract is available on Github.
A list of all deployed contracts can be found here.


ImplementationsThe Tricrypto-NG Factory makes use of blueprint contracts to deploy its contracts from the implementations.:::warning

**Implementation contracts are upgradable.**They can either be replaced, or additional implementation contracts can be added. Therefore, please always make sure to check the most recent ones.

:::

It utilizes four different implementations:

  • pool_implementations, containing multiple blueprint contracts that are used to deploy the pools.
  • gauge_implementation, containing a blueprint contract that is used when deploying gauges for pools.
  • views_implementation, containing a view methods contract relevant for integrators and users looking to interact with the AMMs.
  • math_implementation, containing math functions used in the AMM.

More on the Math Implementation and Views Implementation.

Query Implementations

pool_implementation

Factory.pool_implementations(arg0: uint256) -> address: view

Getter for the current pool implementation contract. This accounts for variations such as two-coin and three-pool pools.

Returns: Pool blueprint contract (address).

InputTypeDescription
arg0uint256Index
<>Source code
pool_implementations: public(HashMap[uint256, address])
Example
>>> Factory.pool_implementation(0)
'0x66442B0C5260B92cAa9c234ECf2408CBf6b19a6f'

gauge_implementation

Factory.gauge_implementation() -> address: view

Getter for the current gauge implementation contract.

Returns: Gauge blueprint contract (address).

<>Source code
gauge_implementation: public(address)
Example
>>> Factory.gauge_implementation()
'0x5fC124a161d888893529f67580ef94C2784e9233'

views_implementation

Factory.views_implementation() -> address: view

Getter for the current views implementation contract.

Returns: Views blueprint contract (address).

<>Source code
views_implementation: public(address)
Example
>>> Factory.views_implementation()
'0x064253915b8449fdEFac2c4A74aA9fdF56691a31'

math_implementation

Factory.math_implementation() -> address: view

Getter for the current pool implementation contract.

Returns: Math blueprint contract (address).

<>Source code
math_implementation: public(address)
Example
>>> Factory.math_implementation()
'0xcBFf3004a20dBfE2731543AA38599A526e0fD6eE'

Set New ImplementationsNew implementations can be set via these admin-only functions:

set_pool_implementation

Factory.set_pool_implementation(_pool_implementation: address, _implementation_index: uint256):
Guarded Method

This function is only callable by the admin of the contract.

Function to set a _pool_implementation for _implementation_index.

Emits event: UpdatePoolImplementation

InputTypeDescription
_pool_implementationaddressNew pool implementation
_implementation_indexuint256Index
<>Source code
event UpdatePoolImplementation:
_implemention_id: uint256
_old_pool_implementation: address
_new_pool_implementation: address

pool_implementations: public(HashMap[uint256, address])

@external
def set_pool_implementation(
_pool_implementation: address, _implementation_index: uint256
):
"""
@notice Set pool implementation
@dev Set to empty(address) to prevent deployment of new pools
@param _pool_implementation Address of the new pool implementation
@param _implementation_index Index of the pool implementation
"""
assert msg.sender == self.admin, "dev: admin only"

log UpdatePoolImplementation(
_implementation_index,
self.pool_implementations[_implementation_index],
_pool_implementation
)

self.pool_implementations[_implementation_index] = _pool_implementation
Example
>>> Factory.set_pool_implementation("todo")
'todo'

set_gauge_implementation

Factory.set_gauge_implementation(_gauge_implementation: address):
Guarded Method

This function is only callable by the admin of the contract.

Function to set a new _gauge_implementation.

Emits event: UpdateGaugeImplementation

InputTypeDescription
_gauge_implementationaddressGauge blueprint contract
<>Source code
event UpdateGaugeImplementation:
_old_gauge_implementation: address
_new_gauge_implementation: address

gauge_implementation: public(address)

@external
def set_gauge_implementation(_gauge_implementation: address):
"""
@notice Set gauge implementation
@dev Set to empty(address) to prevent deployment of new gauges
@param _gauge_implementation Address of the new token implementation
"""
assert msg.sender == self.admin, "dev: admin only"

log UpdateGaugeImplementation(self.gauge_implementation, _gauge_implementation)
self.gauge_implementation = _gauge_implementation
Example
>>> Factory.set_gauge_implementation("todo")
'todo'

set_views_implementation

Factory.set_views_implementation(_views_implementation: address):
Guarded Method

This function is only callable by the admin of the contract.

Function to set a new _views_implementation.

Emits event: UpdateViewsImplementation

InputTypeDescription
_views_implementationaddressViews blueprint contract
<>Source code
event UpdateViewsImplementation:
_old_views_implementation: address
_new_views_implementation: address

views_implementation: public(address)

@external
def set_views_implementation(_views_implementation: address):
"""
@notice Set views contract implementation
@param _views_implementation Address of the new views contract
"""
assert msg.sender == self.admin, "dev: admin only"

log UpdateViewsImplementation(self.views_implementation, _views_implementation)
self.views_implementation = _views_implementation
Example
>>> Factory.set_views_implementation("todo")
'todo'

set_math_implementation

Factory.set_math_implementation(_math_implementation: address):
Guarded Method

This function is only callable by the admin of the contract.

Function to set a new _math_implementation.

Emits event: UpdateMathImplementation

InputTypeDescription
_math_implementationaddressMath blueprint contract
<>Source code
event UpdateMathImplementation:
_old_math_implementation: address
_new_math_implementation: address

math_implementation: public(address)

@external
def set_math_implementation(_math_implementation: address):
"""
@notice Set math implementation
@param _math_implementation Address of the new math contract
"""
assert msg.sender == self.admin, "dev: admin only"

log UpdateMathImplementation(self.math_implementation, _math_implementation)
self.math_implementation = _math_implementation
Example
>>> Factory.set_math_implementation("todo")
'todo'

Fee Receiver

fee_receiver

Factory.fee_receiver() -> address: view

Getter for the fee receiver.

Returns: fee receiver (address).

<>Source code
fee_receiver: public(address)
Example
>>> Factory.fee_receiver()
'0xeCb456EA5365865EbAb8a2661B0c503410e9B347'

set_fee_receiver

Factory.set_fee_receiver(_fee_receiver: address):
Guarded Method

This function is only callable by the admin of the contract.

Function to set a new fee_receiver address.

Emits event: UpdateFeeReceiver

InputTypeDescription
_fee_receiveraddressnew fee receiver address
<>Source code
event UpdateFeeReceiver:
_old_fee_receiver: address
_new_fee_receiver: address

admin: public(address)
fee_receiver: public(address)

@external
def set_fee_receiver(_fee_receiver: address):
"""
@notice Set fee receiver
@param _fee_receiver Address that fees are sent to
"""
assert msg.sender == self.admin, "dev: admin only"

log UpdateFeeReceiver(self.fee_receiver, _fee_receiver)
self.fee_receiver = _fee_receiver
Example
>>> Factory.set_fee_receiver("todo")
'todo'