Implementations
The 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
).
Input | Type | Description |
---|---|---|
arg0 | uint256 | Index |
gauge_implementation
¶
Factory.gauge_implementation() -> address: view
Getter for the current gauge implementation contract.
Returns: Gauge blueprint contract (address
).
views_implementation
¶
Factory.views_implementation() -> address: view
Getter for the current views implementation contract.
Returns: Views blueprint contract (address
).
math_implementation
¶
Factory.math_implementation() -> address: view
Getter for the current pool implementation contract.
Returns: Math blueprint contract (address
).
Set New Implementations¶
New 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
Input | Type | Description |
---|---|---|
_pool_implementation | address | New pool implementation |
_implementation_index | uint256 | Index |
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
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
Input | Type | Description |
---|---|---|
_gauge_implementation | address | Gauge 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
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
Input | Type | Description |
---|---|---|
_views_implementation | address | Views 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
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
Input | Type | Description |
---|---|---|
_math_implementation | address | Math 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