Liquidity Providers
Liquidity providers provide liquidity to a pool of their choice and earn trading fees. LiquidityProviderTool is the relevant component of the SDK.
LiquidityProviderTool ⇐ WriteAccessHandler
WriteAccessHandler
Functions to provide liquidity. This class requires a private key and executes smart-contract interactions that require gas-payments.
Kind: global class
Extends: WriteAccessHandler
LiquidityProviderTool ⇐
WriteAccessHandler
new LiquidityProviderTool(config, signer)
.addLiquidity(poolSymbolName, amountCC) ⇒
.initiateLiquidityWithdrawal(poolSymbolName, amountPoolShares) ⇒
.executeLiquidityWithdrawal(poolSymbolName) ⇒
new LiquidityProviderTool(config, signer)
Constructor
Param | Type | Description |
---|---|---|
config |
| Configuration object, see PerpetualDataHandler. readSDKConfig. |
signer |
| Private key or ethers Signer of the account |
Example
liquidityProviderTool.addLiquidity(poolSymbolName, amountCC) ⇒
Add liquidity to the PnL participant fund. The address gets pool shares in return.
Kind: instance method of LiquidityProviderTool
Returns:
Transaction object
Param | Type | Description |
---|---|---|
poolSymbolName |
| Name of pool symbol (e.g. MATIC) |
amountCC |
| Amount in pool-collateral currency |
Example
liquidityProviderTool.initiateLiquidityWithdrawal(poolSymbolName, amountPoolShares) ⇒
Initiates a liquidity withdrawal from the pool It triggers a time-delayed unlocking of the given number of pool shares. The amount of pool shares to be unlocked is fixed by this call, but not their value in pool currency.
Kind: instance method of LiquidityProviderTool
Returns:
Transaction object.
Param | Type | Description |
---|---|---|
poolSymbolName |
| Name of pool symbol (e.g. MATIC). |
amountPoolShares |
| Amount in pool-shares, removes everything if > available amount. |
Example
liquidityProviderTool.executeLiquidityWithdrawal(poolSymbolName) ⇒
Withdraws as much liquidity as there is available after a call to initiateLiquidityWithdrawal. The address loses pool shares in return.
Kind: instance method of LiquidityProviderTool
Returns:
Transaction object.
Param |
---|
poolSymbolName |
Example