The StableSwap-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 five different implementations:
pool_implementations, containing multiple blueprint contracts that are used to deploy plain pools.
metapool_implementations, containing multiple blueprint contracts that are used to deploy metapools.
math_implementation, containing math functions used in the AMM.
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.
This function is only callable by the admin of the contract.
Function to set/add a new pool implementation.
Input
Type
Description
_implementation_index
uint256
index value of implementation
_implementation
address
implementation contract address
Source code
# index -> implementation addresspool_implementations:public(HashMap[uint256,address])metapool_implementations:public(HashMap[uint256,address])math_implementation:public(address)gauge_implementation:public(address)views_implementation:public(address)@externaldefset_pool_implementations(_implementation_index:uint256,_implementation:address,):""" @notice Set implementation contracts for pools @dev Only callable by admin @param _implementation_index Implementation index where implementation is stored @param _implementation Implementation address to use when deploying plain pools """assertmsg.sender==self.admin# dev: admin-only functionself.pool_implementations[_implementation_index]=_implementation
This function is only callable by the admin of the contract.
Function to set/add a new metapool implementation.
Input
Type
Description
_implementation_index
uint256
index value of implementation
_implementation
address
implementation contract address
Source code
# index -> implementation addresspool_implementations:public(HashMap[uint256,address])metapool_implementations:public(HashMap[uint256,address])math_implementation:public(address)gauge_implementation:public(address)views_implementation:public(address)@externaldefset_metapool_implementations(_implementation_index:uint256,_implementation:address,):""" @notice Set implementation contracts for metapools @dev Only callable by admin @param _implementation_index Implementation index where implementation is stored @param _implementation Implementation address to use when deploying meta pools """assertmsg.sender==self.admin# dev: admin-only functionself.metapool_implementations[_implementation_index]=_implementation
This function is only callable by the admin of the contract.
Function to set a new math implementation. There can only be one math implementation.
Input
Type
Description
_math_implementation
address
new math implementation contract
Source code
# index -> implementation addresspool_implementations:public(HashMap[uint256,address])metapool_implementations:public(HashMap[uint256,address])math_implementation:public(address)gauge_implementation:public(address)views_implementation:public(address)@externaldefset_math_implementation(_math_implementation:address):""" @notice Set implementation contracts for StableSwap Math @dev Only callable by admin @param _math_implementation Address of the math implementation contract """assertmsg.sender==self.admin# dev: admin-only functionself.math_implementation=_math_implementation
This function is only callable by the admin of the contract. There can only be one gauge implementation.
Function to set a new gauge implementation.
Input
Type
Description
_gauge_implementation
address
new gauge implementation contract
Source code
# index -> implementation addresspool_implementations:public(HashMap[uint256,address])metapool_implementations:public(HashMap[uint256,address])math_implementation:public(address)gauge_implementation:public(address)views_implementation:public(address)@externaldefset_gauge_implementation(_gauge_implementation:address):""" @notice Set implementation contracts for liquidity gauge @dev Only callable by admin @param _gauge_implementation Address of the gauge blueprint implementation contract """assertmsg.sender==self.admin# dev: admin-only functionself.gauge_implementation=_gauge_implementation
This function is only callable by the admin of the contract. There can only be one views implementation.
Function to set a new views implementation.
Input
Type
Description
_views_implementation
address
new views implementation contract
Source code
# index -> implementation addresspool_implementations:public(HashMap[uint256,address])metapool_implementations:public(HashMap[uint256,address])math_implementation:public(address)gauge_implementation:public(address)views_implementation:public(address)@externaldefset_views_implementation(_views_implementation:address):""" @notice Set implementation contracts for Views methods @dev Only callable by admin @param _views_implementation Implementation address of views contract """assertmsg.sender==self.admin# dev: admin-only functionself.views_implementation=_views_implementation