Katanapools lets you enter any liquidity pool and earn pool rewards either with all reserves or any one of the reserves in the pool
Katanapools allows you to create liquidity pools as well as fund and liquidate existing pools via a flexible UI solution suitable to intermediate and advanced crypto investors. Through the view-pool interface, you can view pool details, your pool reserve token holdings, set allowance for the pool converter and Bancor network contract as well as fund any liquidity pool provided you have at-least one of the reserves of the pool. You can also liquidate your pool holdings into all of the reserves or any one of the reserves.
It is now possible to enter a pool using a single reserve, if the user chooses this option, the tokens are swapped in-place to create the ratio of reserves required to enter the pool.
You can interact with any Bancor liquidity pool via https://katanapools.com/pool/view
You can also create new Liquidity pools with arbitrary ERC20 tokens in arbitrary reserve ratio via https://katanapools.com/pool/create
Setting Approval and Allowances
Approval for PoolConverter contract
Funding a liquidity pool usually requires n + 1 transactions where n is the number of reserves in the pool because each reserve needs to be approved before a fund transaction can be made.
Additionally if there is already a previous allowance has been made which is > 0 but < allowance required for current transaction, then the allowance needs to be reset via calling approve(0) function. This makes the required number of transactions 2 * n + 1 for all practical cases.
This can be reduced to just 1 transaction is a high allowance is provided to the pool converter function for all of the reserves. This makes repeated funding much faster and also saves on gas costs. Katanapools thus allows the user of a wallet to approve a high amount for all of the pool reserves to the pool converter making funding using all reserves a single click process.
Approval for BancorNetwork contract
Additionally if the user wants to fund a pool using just 1 reserve (pool zap) they need to perform further 2* (n - 1) transactions in addition to the transactions mentioned in the previous section to convert the selected reserve to the pool reserves in the ratio needed for pool funding. This can be reduced to (n - 1) transactions if a high approval is provided for all the pool reserves for the BancorNetwork contract which is used for pool swaps. Thus the trading interface also allows the user to approve the BancorNetwork contract for all pool reserves.
All approvals can be revoked by the user at any time using the revoke functionality in the approvals section.
Thus by providing approvals to both the pool converter and bancor network contract the number of transactions needed for single token pool funding (zap) is reduced from 4 * n to just n transactions where n is the number of reserves in the pool.
Funding and liquidations
In addition to funding a liquidity pool using all of the reserve tokens, you can also zap into a liquidity pool using any one of the reserves.
The zap process is entirely controlled from the user wallet and is more effective than zap mechanisms which require the user to transfer the funds to a third party contract as in Katanapools zap any balance from the conversion is left in the user wallet.
Here are the different funding and liquidation mechanisms through which a user can enter or exit a Bancor liquidity pool.
Fund pool tokens using all pool reserves
The traditional method of funding pool tokens is still the most efficient one, in order to fund the pool just enter the number of pool tokens you desire and the app calculates the number of reserve tokens you would need to stake in order to obtain the desired number of pool tokens.
The transactions required in this method of pool funding are
- Approvals for all pool reserves to the Pool converter for the amount needed to mint the desired number of pool tokens as shown above.
- Calling the fund function of the pool converter.
After the transactions have completed the reserve tokens will be transferred to the pool and the newly minted pool tokens will be transferred to your wallet.
Fund pool tokens using any one of the pool reserves
With a large number of recently created pools which have an arbitrary number of reserves, there is a growing need for a mechanism that lets users to fund pools without requiring them to have all of the reserves. Single reserve funding (Zap) does just that. It allows the user to specify which reserve they would like to use to fund the pool and the amount of pool tokens they desire and calculates the amount of reserves needed to create the reserve array in the ratio required to mint the required number of pool tokens.
When the user confirms the app calls BancorNetwork contract to smartly create the reserve array in-place using the best path for swaps.
The main advantage for the community is that the liquidity never leaves Bancor as it uses either the same or different Bancor pools to create each of the swaps.
The main advantage for the user is that they do not need to trust a third party contract. All the transactions are initiated from the user wallet and any balance from the swaps is left in the user wallet rather than being deposit into a third party contract.
The transactions that will be needed for funding a pool with a single reserve are
- n - 1 Approvals for approving token swaps from chosen token to other reserve tokens (Not needed if BancorNetwork contract was previously approved as in section 1)
- n - 1 Transfers for token swaps for chosen token to other reserves.
- n approvals for approving token transfer from user wallet to Bancor converter contract. (Not needed if Converter contract was previously approved as in section 1)
- 1 Fund transaction to mint the pool tokens and transfer to user wallet.
Liquidate pool holdings to all pool reserves
You can liquidate your pool holdings to all pool reserves, just enter the number of pool tokens you would like to withdraw and the app will calculate the amount of reserve tokens you would receive after the transaction.
The pool liquidate event to all reserve tokens will encompass the following transactions-
- Approve converter to provide the necessary pool token allowance.
- Call the liquidate function to liquidate the pool tokens into pool reserve tokens according to the Bancor formula.
Liquidate pool holdings to one of the pool reserves
You can also liquidate your pool holding to any one of the pool reserves. When you withdraw to a single reserve the app will call the pool liquidate function and thereafter the reserves will be converted to the chosen token using the best path approach.
Amount of pool token to withdraw (Make sure you have enough pool tokens to cover the amount you wish to withdraw)
Click on calculate, this will show the amount of chosen tokens you will receive after the conversion has been completed.
Click withdraw and sign the subsequent transactions.
The following transactions will be a part of pool withdraw-
- Approve pool token liquidate.
- Liquidate pool token.
- For each of the reserves other than the chosen reserve-
-Approve transfer from reserve to chosen reserve token (Will be skipped if you have approved BancorNetwork contract previously and provided the necessary allowance)
-Transfer from pool reserve to the chosen reserve.
Be sure to checkout out Katanapools for swapping tokens, creating pools and interacting with pool tokens at https://katanapools.com/
For more information regarding creating and funding liquidity pools on Bancor head over to Bancor docs https://docs.bancor.network/