Get liquidity pool balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with "'''$get lp tokens''' is a function that returns the quantity of Liquidity Provider (LP) tokens that you have in a liquidity pool on a decentralized exchange (DEX). LP tokens ...")
 
 
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
'''$get lp tokens''' is a function that returns the quantity of Liquidity Provider (LP) tokens that you have in a liquidity pool on a decentralized exchange (DEX).
+
'''$get liquidity pool balance''' is a function that returns the number of LP (Liquidity Provider) tokens you have from a specific liquidity pool on a decentralized exchange.
  
LP tokens are issued to liquidity providers when they invest into a liquidity pool. These tokens represent the provider's proportionate share in the pool and can be redeemed for the underlying assets at any time.
+
LP tokens are given when you invest into a liquidity pool. They represent your share or stake in the pool.
  
 
== Parameters ==
 
== Parameters ==
  
'''Exchange:''' The decentralized exchange where you provided liquidity.
+
'''Exchange:''' The decentralized exchange where the liquidity pool resides.
  
'''Token A ID:''' The first token of the pair where you've invested.
+
'''Token A ID''' and '''Token B ID:''' The pair of tokens involved in the liquidity pool for which you want to check your LP token balance. These can be the coin symbol, or the contract address.
 
+
'''Token B ID:''' The second token of the pair where you've invested.
+
  
 
== Return Value ==
 
== Return Value ==
  
This function returns a string representing the number of LP tokens you have for the specified liquidity pool on the given exchange.
+
This function returns the number of LP tokens you currently hold from the specified liquidity pool.
  
 
== Example ==
 
== Example ==
  
 
<pre>
 
<pre>
log("Number of LP Tokens: {$get lp tokens("SushiSwap", "ETH", "SUSHI")}")
+
ui console view
 +
config defi wallet("your private key")
 +
log("LP Token Balance: {$get liquidity pool balance("PancakeSwap", "ETH", "DAI")}")
 
</pre>
 
</pre>
  
In the example script above, the number of LP tokens the user has in the ETH-SUSHI liquidity pool on SushiSwap is determined and logged.
+
Please replace "your private key" with your actual DeFi wallet's private key.
  
== Post-Run ==
+
Be mindful when you are handling your private key. It's a sensitive piece of data that allows full control over your funds in your DeFi wallet. Therefore, never share this key publicly or with anyone.
  
After running this function, '''RecordTxData''' is executed to record transaction data.
+
The example command will return the current number of LP tokens you hold in the ETH-DAI pool on PancakeSwap.
  
**Please note:**
+
Example Output:
  
This function only shows the amount of LP tokens you hold in your wallet. It does not reveal the underlying assets or their worth. For that, you might use additional commands like '''$get liquidity value''' and others. Also, ensure that you're connected to the correct wallet account before running the function.
+
<blockquote>
 +
<p>LP Token Balance: 10</p>
 +
</blockquote>

Latest revision as of 01:36, 5 July 2023

$get liquidity pool balance is a function that returns the number of LP (Liquidity Provider) tokens you have from a specific liquidity pool on a decentralized exchange.

LP tokens are given when you invest into a liquidity pool. They represent your share or stake in the pool.

[edit] Parameters

Exchange: The decentralized exchange where the liquidity pool resides.

Token A ID and Token B ID: The pair of tokens involved in the liquidity pool for which you want to check your LP token balance. These can be the coin symbol, or the contract address.

[edit] Return Value

This function returns the number of LP tokens you currently hold from the specified liquidity pool.

[edit] Example

ui console view
config defi wallet("your private key")
log("LP Token Balance: {$get liquidity pool balance("PancakeSwap", "ETH", "DAI")}")

Please replace "your private key" with your actual DeFi wallet's private key.

Be mindful when you are handling your private key. It's a sensitive piece of data that allows full control over your funds in your DeFi wallet. Therefore, never share this key publicly or with anyone.

The example command will return the current number of LP tokens you hold in the ETH-DAI pool on PancakeSwap.

Example Output:

LP Token Balance: 10

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox