Liquidity pools are deployed via the Factory. All pools deployed share the same admin defined within the Factory contract. Transfering the ownership of a pool is only possible by changing the ownership of the Factory. Admin is the Curve DAO (OwnershipAdmin).
The same applies to the fee receiver of the pools.
The appropriate value for A and gamma is dependent upon the type of coin being used within the pool, and is subject to optimization and pool-parameter update based on the market history of the trading pair.
It is possible to modify the parameters for a pool after it has been deployed. Again, only the admin of the pool (= Factory admin) can do so.
This function can only be called by the admin of the Factory contract.
Function to linearly ramp the values of A and gamma.
Emits: RampAgamma
Input
Type
Description
future_A
uint256
Future value of A
future_gamma
uint256
Future value of gamma
future_time
uint256
Timestamp at which the ramping will end
Source code
eventRampAgamma:initial_A:uint256future_A:uint256initial_gamma:uint256future_gamma:uint256initial_time:uint256future_time:uint256@externaldeframp_A_gamma(future_A:uint256,future_gamma:uint256,future_time:uint256):""" @notice Initialise Ramping A and gamma parameter values linearly. @dev Only accessible by factory admin, and only @param future_A The future A value. @param future_gamma The future gamma value. @param future_time The timestamp at which the ramping will end. """assertmsg.sender==factory.admin()# dev: only ownerassertblock.timestamp>self.initial_A_gamma_time+(MIN_RAMP_TIME-1)# dev: ramp undergoingassertfuture_time>block.timestamp+MIN_RAMP_TIME-1# dev: insufficient timeA_gamma:uint256[2]=self._A_gamma()initial_A_gamma:uint256=A_gamma[0]<<128initial_A_gamma=initial_A_gamma|A_gamma[1]assertfuture_A>MIN_A-1assertfuture_A<MAX_A+1assertfuture_gamma>MIN_GAMMA-1assertfuture_gamma<MAX_GAMMA+1ratio:uint256=10**18*future_A/A_gamma[0]assertratio<10**18*MAX_A_CHANGE+1assertratio>10**18/MAX_A_CHANGE-1ratio=10**18*future_gamma/A_gamma[1]assertratio<10**18*MAX_A_CHANGE+1assertratio>10**18/MAX_A_CHANGE-1self.initial_A_gamma=initial_A_gammaself.initial_A_gamma_time=block.timestampfuture_A_gamma:uint256=future_A<<128future_A_gamma=future_A_gamma|future_gammaself.future_A_gamma_time=future_timeself.future_A_gamma=future_A_gammalogRampAgamma(A_gamma[0],future_A,A_gamma[1],future_gamma,block.timestamp,future_time,)
This function can only be called by the admin of the Factory contract.
Function to immediately stop the ramping of A and gamma parameters and set them to their current values.
Emits: StopRampA
Source code
eventStopRampA:current_A:uint256current_gamma:uint256time:uint256@externaldefstop_ramp_A_gamma():""" @notice Stop Ramping A and gamma parameters immediately. @dev Only accessible by factory admin. """assertmsg.sender==factory.admin()# dev: only ownerA_gamma:uint256[2]=self._A_gamma()current_A_gamma:uint256=A_gamma[0]<<128current_A_gamma=current_A_gamma|A_gamma[1]self.initial_A_gamma=current_A_gammaself.future_A_gamma=current_A_gammaself.initial_A_gamma_time=block.timestampself.future_A_gamma_time=block.timestamp# ------ Now (block.timestamp < t1) is always False, so we return saved A.logStopRampA(A_gamma[0],A_gamma[1],block.timestamp)
This function can only be called by the admin of the Factory contract.
Function to commit new parameters. The new parameters are applied immediately.
Emits: NewParameters
Input
Type
Description
_new_mid_fee
uint256
New mid_fee value.
_new_out_fee
uint256
New out_fee value.
_new_fee_gamma
uint256
New fee_gamma value.
_new_allowed_extra_profit
uint256
New allowed_extra_profit value.
_new_adjustment_step
uint256
New adjustment_step value.
_new_ma_time
uint256
New ma_time value, which is time_in_seconds/ln(2).
_new_xcp_ma_time
uint256
New ma time for xcp oracles.
Source code
eventNewParameters:mid_fee:uint256out_fee:uint256fee_gamma:uint256allowed_extra_profit:uint256adjustment_step:uint256ma_time:uint256xcp_ma_time:uint256@external@nonreentrant('lock')defapply_new_parameters(_new_mid_fee:uint256,_new_out_fee:uint256,_new_fee_gamma:uint256,_new_allowed_extra_profit:uint256,_new_adjustment_step:uint256,_new_ma_time:uint256,_new_xcp_ma_time:uint256,):""" @notice Commit new parameters. @dev Only accessible by factory admin. @param _new_mid_fee The new mid fee. @param _new_out_fee The new out fee. @param _new_fee_gamma The new fee gamma. @param _new_allowed_extra_profit The new allowed extra profit. @param _new_adjustment_step The new adjustment step. @param _new_ma_time The new ma time. ma_time is time_in_seconds/ln(2). @param _new_xcp_ma_time The new ma time for xcp oracle. """assertmsg.sender==factory.admin()# dev: only owner# ----------------------------- Set fee params ---------------------------new_mid_fee:uint256=_new_mid_feenew_out_fee:uint256=_new_out_feenew_fee_gamma:uint256=_new_fee_gammacurrent_fee_params:uint256[3]=self._unpack_3(self.packed_fee_params)ifnew_out_fee<MAX_FEE+1:assertnew_out_fee>MIN_FEE-1# dev: fee is out of rangeelse:new_out_fee=current_fee_params[1]ifnew_mid_fee>MAX_FEE:new_mid_fee=current_fee_params[0]assertnew_mid_fee<=new_out_fee# dev: mid-fee is too highifnew_fee_gamma<10**18:assertnew_fee_gamma>0# dev: fee_gamma out of range [1 .. 10**18]else:new_fee_gamma=current_fee_params[2]self.packed_fee_params=self._pack_3([new_mid_fee,new_out_fee,new_fee_gamma])# ----------------- Set liquidity rebalancing parameters -----------------new_allowed_extra_profit:uint256=_new_allowed_extra_profitnew_adjustment_step:uint256=_new_adjustment_stepnew_ma_time:uint256=_new_ma_timecurrent_rebalancing_params:uint256[3]=self._unpack_3(self.packed_rebalancing_params)ifnew_allowed_extra_profit>10**18:new_allowed_extra_profit=current_rebalancing_params[0]ifnew_adjustment_step>10**18:new_adjustment_step=current_rebalancing_params[1]ifnew_ma_time<872542:# <----- Calculated as: 7 * 24 * 60 * 60 / ln(2)assertnew_ma_time>86# dev: MA time should be longer than 60/ln(2)else:new_ma_time=current_rebalancing_params[2]self.packed_rebalancing_params=self._pack_3([new_allowed_extra_profit,new_adjustment_step,new_ma_time])# Set xcp oracle moving average window time:new_xcp_ma_time:uint256=_new_xcp_ma_timeifnew_xcp_ma_time<872542:assertnew_xcp_ma_time>86# dev: xcp MA time should be longer than 60/ln(2)else:new_xcp_ma_time=self.xcp_ma_timeself.xcp_ma_time=new_xcp_ma_time# ---------------------------------- LOG ---------------------------------logNewParameters(new_mid_fee,new_out_fee,new_fee_gamma,new_allowed_extra_profit,new_adjustment_step,new_ma_time,_new_xcp_ma_time,)
This value is initially set to 0 (default) when the pool is first deployed. It only gets populated by block.timestamp + future_time in the ramp_A_gamma function when the ramping process is initiated. After ramping is finished (i.e., self.future_A_gamma_time < block.timestamp), the variable is left as is and not set to 0.
Getter for the future A/gamma time. This is the timestamp when the ramping process is finished.
Returns: future A/gamma time (uint256).
Source code
future_A_gamma_time:public(uint256)# <------ Time when ramping is finished.# This value is 0 (default) when pool is first deployed, and only gets# populated by block.timestamp + future_time in `ramp_A_gamma` when the# ramping process is initiated. After ramping is finished# (i.e. self.future_A_gamma_time < block.timestamp), the variable is left# and not set to 0.