The following are methods that may only be called by the pool admin (owner).
Additionally, some admin methods require a two-phase transaction process, whereby changes are committed in a first transaction and after a forced delay applied via a second transaction. The minimum delay after which a committed action can be applied is given by the constant pool attribute admin_actions_delay, which is set to 3 days.
ADMIN_ACTIONS_DELAY:constant(uint256)=3*86400...@externaldefcommit_transfer_ownership(_owner:address):assertmsg.sender==self.owner# dev: only ownerassertself.transfer_ownership_deadline==0# dev: active transfer_deadline:uint256=block.timestamp+ADMIN_ACTIONS_DELAYself.transfer_ownership_deadline=_deadlineself.future_owner=_ownerlogCommitNewAdmin(_deadline,_owner)
Transfers ownership of the pool from current owner to the owner previously set via commit_transfer_ownership.
Emits: NewAdmin
Source code
@externaldefapply_transfer_ownership():assertmsg.sender==self.owner# dev: only ownerassertblock.timestamp>=self.transfer_ownership_deadline# dev: insufficient timeassertself.transfer_ownership_deadline!=0# dev: no active transferself.transfer_ownership_deadline=0_owner:address=self.future_ownerself.owner=_ownerlogNewAdmin(_owner)
The amplification coefficient A determines a pool’s tolerance for imbalance between the assets within it. A higher value means that trades will incur slippage sooner as the assets within the pool become imbalanced.
Note
Within the pools, A is in fact implemented as 1 / A and therefore a higher value implies that the pool will be more tolerant to slippage when imbalanced.
The appropriate value for A is dependent upon the type of coin being used within the pool, and is subject to optimisation and pool-parameter update based on the market history of the trading pair. It is possible to modify the amplification coefficient for a pool after it has been deployed. However, it requires a vote within the Curve DAO and must reach a 15% quorum.
Stop ramping A up or down and sets A to current A.
Emits: StopRampA
Source code
@externaldefstop_ramp_A():assertmsg.sender==self.owner# dev: only ownercurrent_A:uint256=self._A()self.initial_A=current_Aself.future_A=current_Aself.initial_A_time=block.timestampself.future_A_time=block.timestamp# now (block.timestamp < t1) is always False, so we return saved AlogStopRampA(current_A,block.timestamp)
todo: hyperlink to fee collection and distribution Curve pools charge fees on token swaps, where the fee may differ between pools. An admin fee is charged on the pool fee. For an overview of how fees are distributed, please refer to Fee Collection and Distribution.
The method commits new fee params: these fees do not take immediate effect.
Input
Type
Description
_new_fee
uint256
New pool fee
_new_admin_fee
uint256
New admin fee (expressed as a percentage of the pool fee)
Emits: CommitNewFee
Source code
MAX_ADMIN_FEE:constant(uint256)=10*10**9MAX_FEE:constant(uint256)=5*10**9ADMIN_ACTIONS_DELAY:constant(uint256)=3*86400@externaldefcommit_new_fee(new_fee:uint256,new_admin_fee:uint256):assertmsg.sender==self.owner# dev: only ownerassertself.admin_actions_deadline==0# dev: active actionassertnew_fee<=MAX_FEE# dev: fee exceeds maximumassertnew_admin_fee<=MAX_ADMIN_FEE# dev: admin fee exceeds maximum_deadline:uint256=block.timestamp+ADMIN_ACTIONS_DELAYself.admin_actions_deadline=_deadlineself.future_fee=new_feeself.future_admin_fee=new_admin_feelogCommitNewFee(_deadline,new_fee,new_admin_fee)
>>>pool.commit_new_fee()todo:logoutput
Note
Both the pool fee and the admin_fee are capped by the constants MAX_FEE and MAX_ADMIN_FEE, respectively. By default MAX_FEE is set at 50% and MAX_ADMIN_FEE at 100% (which is charged on the MAX_FEE amount).
Apply the previously committed new pool and admin fees for the pool.
Emits: NewFee
Source code
@externaldefapply_new_fee():assertmsg.sender==self.owner# dev: only ownerassertblock.timestamp>=self.admin_actions_deadline# dev: insufficient timeassertself.admin_actions_deadline!=0# dev: no active actionself.admin_actions_deadline=0_fee:uint256=self.future_fee_admin_fee:uint256=self.future_admin_feeself.fee=_feeself.admin_fee=_admin_feelogNewFee(_fee,_admin_fee)
>>>pool.commit_new_fee()todo:logoutput
Note
Unlike ownership transfers, pool and admin fees may be set more than once.
Withdraws and transfers admin fees of the pool to the pool owner.
@externaldefwithdraw_admin_fees():assertmsg.sender==self.owner# dev: only ownerforiinrange(N_COINS):c:address=self.coins[i]value:uint256=ERC20(c).balanceOf(self)-self.balances[i]ifvalue>0:assertERC20(c).transfer(msg.sender,value)
Donate all admin fees to the pool’s liquidity providers.
Source code
@externaldefdonate_admin_fees():assertmsg.sender==self.owner# dev: only ownerforiinrange(N_COINS):self.balances[i]=ERC20(self.coins[i]).balanceOf(self)
It is only possible for existing LPs to remove liquidity via remove_liquidity from a paused pool.
Source code
@external@nonreentrant('lock')defadd_liquidity(amounts:uint256[N_COINS],min_mint_amount:uint256)->uint256:""" @notice Deposit coins into the pool @param amounts List of amounts of coins to deposit @param min_mint_amount Minimum amount of LP tokens to mint from the deposit @return Amount of LP tokens received by depositing """assertnotself.is_killed# dev: is killed...@external@nonreentrant('lock')defexchange(i:int128,j:int128,dx:uint256,min_dy:uint256)->uint256:""" @notice Perform an exchange between two coins @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index valie of the coin to recieve @param dx Amount of `i` being exchanged @param min_dy Minimum amount of `j` to receive @return Actual amount of `j` received """assertnotself.is_killed# dev: is killed...@external@nonreentrant('lock')defremove_liquidity_imbalance(amounts:uint256[N_COINS],max_burn_amount:uint256)->uint256:""" @notice Withdraw coins from the pool in an imbalanced amount @param amounts List of amounts of underlying coins to withdraw @param max_burn_amount Maximum amount of LP token to burn in the withdrawal @return Actual amount of the LP token burned in the withdrawal """assertnotself.is_killed# dev: is killed...@external@nonreentrant('lock')defremove_liquidity_one_coin(_token_amount:uint256,i:int128,_min_amount:uint256)->uint256:""" @notice Withdraw a single coin from the pool @param _token_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @param _min_amount Minimum amount of coin to receive @return Amount of coin received """assertnotself.is_killed# dev: is killed...@externaldefkill_me():assertmsg.sender==self.owner# dev: only ownerassertself.kill_deadline>block.timestamp# dev: deadline has passedself.is_killed=True
todo:addexample
Note
Pools can only be killed within the first 30 days after deployment.