The StableSwap Factory utilizes the create_forwarder_to function 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 three different implementations:
metapool_implementations, containing multiple contracts that are used to deploy metapools.
plain_implementations, containing multiple contracts that are used to deploy plain pools.
gauge_implementation, containing a contract which is used when deploying liquidity gauges for pools.
base_pool_data:HashMap[address,BasePoolArray]@view@externaldefmetapool_implementations(_base_pool:address)->address[10]:""" @notice Get a list of implementation contracts for metapools targetting the given base pool @dev A base pool is the pool for the LP token contained within the metapool @param _base_pool Address of the base pool @return List of implementation contract addresses """returnself.base_pool_data[_base_pool].implementations
Getter for the plain implementations index arg1 for a plain pool with a number of arg0 coins.
Returns: Plain implementation (address).
Input
Type
Description
arg0
uint256
Number of coins in pool
arg1
uint256
Index of implementation
Source code
# number of coins -> implementation addresses# for "plain pools" (as opposed to metapools), implementation contracts# are organized according to the number of coins in the poolplain_implementations:public(HashMap[uint256,address[10]])
Getter for the address of the implementation contract used for a factory pool.
Returns: Implementation (address).
Input
Type
Description
_pool
address
Factory pool address
Source code
@view@externaldefget_implementation_address(_pool:address)->address:""" @notice Get the address of the implementation contract used for a factory pool @param _pool Pool address @return Implementation contract address """returnself.pool_data[_pool].implementation
This function is only callable by the admin of the contract.
Function to set new metapool implementations.
Input
Type
Description
_base_pool
address
Base pool to add implementations for
_implementations
address[10]
New metapool implementations
Source code
base_pool_data:HashMap[address,BasePoolArray]@externaldefset_metapool_implementations(_base_pool:address,_implementations:address[10],):""" @notice Set implementation contracts for a metapool @dev Only callable by admin @param _base_pool Pool address to add @param _implementations Implementation address to use when deploying metapools """assertmsg.sender==self.admin# dev: admin-only functionassertself.base_pool_data[_base_pool].coins[0]!=ZERO_ADDRESS# dev: base pool does not existforiinrange(10):new_imp:address=_implementations[i]current_imp:address=self.base_pool_data[_base_pool].implementations[i]ifnew_imp==current_imp:ifnew_imp==ZERO_ADDRESS:breakelse:self.base_pool_data[_base_pool].implementations[i]=new_imp
This function is only callable by the admin of the contract.
Function to set new plain pool implementations.
Input
Type
Description
_n_coins
uint256
Number of coins in pool to set implementations for
_pool_implementation
address
New plain pool implementations
Source code
# number of coins -> implementation addresses# for "plain pools" (as opposed to metapools), implementation contracts# are organized according to the number of coins in the poolplain_implementations:public(HashMap[uint256,address[10]])@externaldefset_plain_implementations(_n_coins:uint256,_implementations:address[10],):assertmsg.sender==self.admin# dev: admin-only functionforiinrange(10):new_imp:address=_implementations[i]current_imp:address=self.plain_implementations[_n_coins][i]ifnew_imp==current_imp:ifnew_imp==ZERO_ADDRESS:breakelse:self.plain_implementations[_n_coins][i]=new_imp