/*** @param _py_init The initial price at the y axis* @param _px_init The initial price at the x axis* @param _py_final The final price at the y axis* @param _px_final The final price at the y axis* @param _curveEvolutionStartTime curve evolution start time* @param _curveEvolutionDuration duration for which the curve will evolve*/constructor(int128_py_init,int128_px_init,int128_py_final,int128_px_final,uint256_curveEvolutionStartTime,uint256_curveEvolutionDuration)
This method is called whenever a new EvolvingProteus pool is deployed.
params()
/*** @notice Returns all the pool configuration params in a tuple*/functionparams() publicviewreturns (int128,int128,int128,int128,uint256,uint256,uint256);
This function returns all the pool configuration.
It should...
Return a tuple of all the pool configuration params (py_init, px_init, py_final, px_final, t_init, t_final, curveEvolutionDuration).
elapsed()
/*** @notice Calculates the time that has passed since deployment*/functionelapsed() publicviewreturns (uint256);
This function returns the time that has passed since contract deployment.
t()
/*** @notice Calculates the time as a percent of total duration*/functiont() publicviewreturns (int128);
This function returns percentage of how much time has passed since the evolution started.
p_min()
/*** notice The minimum price (at the x asymptote) at the current block*/functionp_min() publicviewreturns (int128);
This function returns the minimum price at the current block.
p_max()
/*** @notice The maximum price (at the y asymptote) at the current block*/functionp_max() publicviewreturns (int128);
This function returns the maximum price at the current block.
a()
/*** @notice Calculates the a variable in the curve eq which is basically a sq. root* of the inverse of y instantaneous price*/functiona() publicviewreturns (int128);
This function returns a sq. root of the inverse of y instantaneous price.
b()
/*** @notice Calculates the b variable in the curve eq which is basically a sq. root* of the inverse of x instantaneous price*/functionb() publicviewreturns (int128);
This function returns a sq. root of the inverse of x instantaneous price.
swapGivenInputAmount()
/*** @dev Given an input amount of one reserve token, we compute the output* amount of the other reserve token, keeping utility invariant.* @dev We use FEE_DOWN because we want to decrease the perceived* input amount and decrease the observed output amount.*/functionswapGivenInputAmount(uint256 xBalance,uint256 yBalance,uint256 inputAmount,SpecifiedToken inputToken) externalviewreturns (uint256 outputAmount);
SpecifiedToken enum:
This function computes output amount of the reserve token based on the input amount of the reserved token.
It should...
Revert if the function is invoked before the pool evolution start date.
Return the output amount based on the input amount.
swapGivenOutputAmount()
/*** @dev Given an output amount of a reserve token, we compute an input* amount of the other reserve token, keeping utility invariant.* @dev We use FEE_UP because we want to increase the perceived output* amount and increase the observed input amount.*/functionswapGivenOutputAmount(uint256 xBalance,uint256 yBalance,uint256 outputAmount,SpecifiedToken outputToken) externalviewreturns (uint256 inputAmount);
SpecifiedToken enum:
This function computes input amount of the reserve token necessary to get for the desired amount of the output token.
It should...
Revert if the function is invoked before the pool evolution start date.
Return input amount necessary to receive the output amount.
depositGivenInputAmount()
/*** @dev Given an input amount of a reserve token, we compute an output* amount of LP tokens, scaling the total supply of the LP tokens with the* utility of the pool.* @dev We use FEE_DOWN because we want to decrease the perceived amount* deposited and decrease the amount of LP tokens minted.*/functiondepositGivenInputAmount(uint256 xBalance,uint256 yBalance,uint256 totalSupply,uint256 depositedAmount,SpecifiedToken depositedToken) externalviewreturns (uint256 mintedAmount);
SpecifiedToken enum:
This function computes output amount of LP tokens based on the amount of the input token.
It should...
Revert if the function is invoked before the pool evolution start date.
Return amount of LP tokens minted for the amount of the provided token.
depositGivenOutputAmount()
/*** @dev Given an output amount of the LP token, we compute an amount of* a reserve token that must be deposited to scale the utility of the pool* in proportion to the change in total supply of the LP token.* @dev We use FEE_UP because we want to increase the perceived change in* total supply and increase the observed amount deposited.*/functiondepositGivenOutputAmount(uint256 xBalance,uint256 yBalance,uint256 totalSupply,uint256 mintedAmount,SpecifiedToken depositedToken) externalviewreturns (uint256 depositedAmount);
SpecifiedToken enum:
This function computes deposit amount necessary to in order to receive desired amount of LP tokens (minted amount).
It should...
Revert if the function is invoked before the pool evolution start date.
Return amount of deposited token necessary to get the desired amount of LP tokens.
withdrawGivenOutputAmount()
/*** @dev Given an output amount of a reserve token, we compute an amount of* LP tokens that must be burned in order to decrease the total supply in* proportion to the decrease in utility.* @dev We use FEE_UP because we want to increase the perceived amount* withdrawn from the pool and increase the observed decrease in total* supply.*/functionwithdrawGivenOutputAmount(uint256 xBalance,uint256 yBalance,uint256 totalSupply,uint256 withdrawnAmount,SpecifiedToken withdrawnToken) externalviewreturns (uint256 burnedAmount);
SpecifiedToken enum:
This function computes how many LP tokens should be burned in exchange for the withdraw amount of the specified token.
It should...
Revert if the function is invoked before the pool evolution start date.
Return amount of LP tokens burned for the request amount of withdraw token.
withdrawGivenInputAmount()
/*** @dev Given an input amount of the LP token, we compute an amount of* a reserve token that must be output to decrease the pool's utility in* proportion to the pool's decrease in total supply of the LP token.* @dev We use FEE_UP because we want to increase the perceived amount of* reserve tokens leaving the pool and to increase the observed amount of* LP tokens being burned.*/functionwithdrawGivenInputAmount(uint256 xBalance,uint256 yBalance,uint256 totalSupply,uint256 burnedAmount,SpecifiedToken withdrawnToken) externalviewreturns (uint256 withdrawnAmount);
SpecifiedToken enum:
This function computes amount of specified withdrawn token to be received for the given amount of burned LP tokens.
It should...
Revert if the function is invoked before the pool evolution start date.
Return amount of withdraw tokens to be received for the amount of burned LP tokens.