EvolvingProteus.sol
Github Link: https://github.com/Shell-Protocol/Shell-Protocol/blob/main/src/proteus/EvolvingProteus.sol
constructor()
Parameter Name | Type | Description |
---|---|---|
_py_init | int128 | initial price on the y axis |
_px_init | int128 | initial price on the x axis |
_py_final | int128 | final price on the y axis |
_px_final | int128 | initial price on the x axis |
_curveEvolutionStartTime | uint256 | timestamp in seconds |
_curveEvolutionDuration | uint256 | evolution duration in seconds |
This method is called whenever a new EvolvingProteus pool is deployed.
params()
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()
This function returns the time that has passed since contract deployment.
t()
This function returns percentage of how much time has passed since the evolution started.
p_min()
This function returns the minimum price at the current block.
p_max()
This function returns the maximum price at the current block.
a()
This function returns a sq. root of the inverse of y instantaneous price.
b()
This function returns a sq. root of the inverse of x instantaneous price.
swapGivenInputAmount()
Parameter Name | Type | Description |
---|---|---|
xBalance | unit256 | x token balance |
yBalance | unit256 | y token balance |
inputAmount | unit256 | amount of input tokens to swap for output tokens |
inputToken | SpecifiedToken enum | SpecifiedToken.X or SpecifiedToken.Y |
SpecifiedToken enum:
Enum Member Name | Type | Description |
---|---|---|
X | enum member (technically token Ocean ID) | an indicator stating usage of token X in the operation |
Y | enum member (technically token Ocean ID) | an indicator stating usage of token Y in the operation |
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()
Parameter Name | Type | Description |
---|---|---|
xBalance | unit256 | x token balance |
yBalance | unit256 | y token balance |
outputAmount | unit256 | amount of output tokens to swap for input tokens |
outputToken | SpecifiedToken enum | SpecifiedToken.X or SpecifiedToken.Y |
SpecifiedToken enum:
Enum Member Name | Type | Description |
---|---|---|
X | enum member (technically token Ocean ID) | an indicator stating usage of token X in the operation |
Y | enum member (technically token Ocean ID) | an indicator stating usage of token Y in the operation |
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()
Parameter Name | Type | Description |
---|---|---|
xBalance | unit256 | x token balance |
yBalance | unit256 | y token balance |
totalSupply | unit256 | total supply of the LP tokens that exists currently |
depositedAmount | unit256 | the amount of token to be deposited |
depositedToken | SpecifiedToken enum | SpecifiedToken.X or SpecifiedToken.Y |
SpecifiedToken enum:
Enum Member Name | Type | Description |
---|---|---|
X | enum member (technically token Ocean ID) | an indicator stating usage of token X in the operation |
Y | enum member (technically token Ocean ID) | an indicator stating usage of token Y in the operation |
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()
Parameter Name | Type | Description |
---|---|---|
xBalance | unit256 | x token balance |
yBalance | unit256 | y token balance |
totalSupply | unit256 | total supply of the LP tokens that exists currently |
mintedAmount | unit256 | the amount of LP token to be minted |
depositedToken | SpecifiedToken enum | SpecifiedToken.X or SpecifiedToken.Y |
SpecifiedToken enum:
Enum Member Name | Type | Description |
---|---|---|
X | enum member (technically token Ocean ID) | an indicator stating usage of token X in the operation |
Y | enum member (technically token Ocean ID) | an indicator stating usage of token Y in the operation |
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()
Parameter Name | Type | Description |
---|---|---|
xBalance | unit256 | x token balance |
yBalance | unit256 | y token balance |
totalSupply | unit256 | total supply of the LP tokens that exists currently |
withdrawnAmount | unit256 | the amount of token to be withdrawn |
withdrawnToken | SpecifiedToken enum | SpecifiedToken.X or SpecifiedToken.Y |
SpecifiedToken enum:
Enum Member Name | Type | Description |
---|---|---|
X | enum member (technically token Ocean ID) | an indicator stating usage of token X in the operation |
Y | enum member (technically token Ocean ID) | an indicator stating usage of token Y in the operation |
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()
Parameter Name | Type | Description |
---|---|---|
xBalance | unit256 | x token balance |
yBalance | unit256 | y token balance |
totalSupply | unit256 | total supply of the LP tokens that exists currently |
burnedAmount | unit256 | the amount of LP tokens that are going to be burned |
withdrawnToken | SpecifiedToken enum | SpecifiedToken.X or SpecifiedToken.Y |
SpecifiedToken enum:
Enum Member Name | Type | Description |
---|---|---|
X | enum member (technically token Ocean ID) | an indicator stating usage of token X in the operation |
Y | enum member (technically token Ocean ID) | an indicator stating usage of token Y in the operation |
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.
Last updated