LiquidityPoolProxy.sol

Github Link: https://github.com/Shell-Protocol/Shell-Protocol/blob/main/src/proteus/LiquidityPoolProxy.solarrow-up-right

constructor()

constructor(
    uint256 xToken_,
    uint256 yToken_,
    address ocean_,
    uint256 initialLpTokenSupply_
) LiquidityPool(
    xToken_,
    yToken_,
    ocean_,
    initialLpTokenSupply_,
    address(0)
);
Parameter Name
Type
Description

xToken_

unit256

Ocean ID of the first of two tokens that make up the base pair

yToken_

unit256

Ocean ID of the second of two tokens that make up the base pair

ocean_

address

an address of the Ocean contract

initialLpTokenSupply_

unit256

the initial supply of the Liquidity Provider token. It should be an even number

This method is called whenever a new LiquidityPoolProxy contract is deployed.

swapGivenInputAmount()

Parameter Name
Type
Description

inputToken

unit256

Ocean ID of one of two tokens that make up the base pair

inputAmount

unit256

amount of tokens to swap

This function executes a swap of the input amount of input token for the second of the tokens that make up the pool base pair.

It should...

  1. Swap specified of input tokens for the second token that makes the liquidity pool.

depositGivenInputAmount()

Parameter Name
Type
Description

depositToken

unit256

Ocean ID of the token to be deposited. It should be one of the two tokens that make up the LP base pair

depositAmount

unit256

amount of tokens to deposit

This function deposits specified deposit amount of the specified deposit token into Liquidity Pool. Deposit token should be one of the two tokens that make up the LP base pair.

It should...

  1. Deposit a token into the Liquidity Pool.

withdrawGivenInputAmount()

Parameter Name
Type
Description

withdrawnToken

unit256

Ocean ID of the token to be withdrawn. It should be one of the two tokens that make up the LP base pair

burnAmount

unit256

amount of tokens to withdraw

This function withdraws specified withdraw amount of the specified withdraw token from the Liquidity Pool. Withdraw token should be one of the two tokens that make up the LP base pair.

It should...

  1. Withdraw a token from the Liquidity Pool.

swapGivenOutputAmount()

Parameter Name
Type
Description

outputToken

unit256

Ocean ID of one of two tokens that make up the base pair

outputAmount

unit256

amount of tokens desired to get from the swap

This function returns how many input tokens should be given for the desired output amount of the specified output token. Output token should be one of the two tokens that make up the LP base pair.

It should...

  1. Return the number of the other of the tokens that make up Liquidity Pool's base pair should be given for the specified output token.

depositGivenOutputAmount()

Parameter Name
Type
Description

depositToken

unit256

Ocean ID of one of two tokens that make up the base pair

mintAmount

unit256

amount of LP tokens to be minted

This function returns how many deposit tokens should be deposited for the desired amount of the LP tokens. Deposit token should be one of the two tokens that make up the LP base pair.

It should...

  1. Return the number of deposit tokens necessary to receive specified mint amount of LP tokens.

withdrawGivenOutputAmount()

Parameter Name
Type
Description

withdrawnToken

unit256

Ocean ID of one of two tokens that make up the base pair

withdrawnAmount

unit256

amount of tokens to be withdrawn

This function returns how many LP tokens should be burned in order to receive specified withdrawn amount of the specified withdrawn token. Withdrawn token should be one of the two tokens that make up the LP base pair.

It should...

  1. Return the number of LP tokens that should be burned in order to receive specified amount of wanted token.

Last updated