Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bancor Wrapper Update (Seeking Detailed Specs to Solve This LP Problem) #4

Open
stimuluspackage opened this issue Mar 10, 2021 · 3 comments

Comments

@stimuluspackage
Copy link
Collaborator

Bancor Wrapper Update (Seeking Detailed Specs to Solve This LP Problem)

We currently have a Bancor ETH to LP converter available here: https://github.com/plexus-money/contracts/blob/master/contracts/wrapperBancor.sol

We are soon to add it to this site: https://lp.plexus.money/

We are currently building an LP to LP converter: https://github.com/plexus-money/contracts/blob/master/contracts/LP2LP.sol, however, this won't work well with Bancor LP tokens.

There is a small issue. Bancor's LP tokens live in the Bancor smart contract and are not issued as ERC-20 tokens to users, like with SushiSwap or Uniswap when a user provides liquidity.

Therefore, our contract needs to be the recipient of the tokens (currently the tx.origin user is assigned the tokens, which is not good long-term for DeFi Lego building). We want to save a mapping on the BancorWrapping contract that links to the end-user (msg.sender or onBahalfOf if the request goes through the LP-to-LP converter), while the contract itself would be the holders of all user Bancor LPs (which we think is the only way to do this like we have done with Uniswap and SushiSwap).

We are seeking detailed specifications on how this can be accomplished. Specs should include some code where a critical element is outlined.

We have a similar way of achieving this with Harvest.Finance, which you can find here: https://github.com/plexus-money/contracts/blob/master/contracts/tier2Farm.sol

Looking forward to hearing from you!

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 0.135 ETH (251.62 USD @ $1863.84/ETH) attached to it.

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Workers have applied to start work.

These users each claimed they can complete the work by 265 years, 8 months from now.
Please review their action plans below:

1) cryptomalo has applied to start work (Funders only: approve worker | reject worker).

I want to help this community how can I do?

Learn more on the Gitcoin Issue Details page.

@mul1sh
Copy link
Contributor

mul1sh commented Mar 15, 2021

Ok for this issue, I think the bancor platform allows issuance of LP Tokens after providing liquidity, in fact it's well outlined here.

So simply do the following,

  1. Create a contract which implements a bancor converter interface and set it to the address of an existing converter /liquidity pool in the Bancor Network.
  2. Then call the addLiquidity function from our smart contract to enable a plexus user to be able to add liquidity into the pool.
  3. Voila! you'll get the LP tokens instantly in the smart contract if the tx is successful 😃

Though please note there are some pools with impermanent loss protection enabled in them. If this is the case, then the LP Tokens will be issued to the LiquidityProtection.sol contract which acts as msg.sender in this case.

The reason for this is because the LP tokens are held as literal insurance against impermanent loss, by the smart contract so that it can burn them in case it detects a high risk of IL exposure based on the protection settings.

This protection however is not available until 30 days have passed, see https://docs.bancor.network/getting-started/the-v2-difference#mitigating-impermanent-loss

Looking at wrapperBancor.sol this seems to be the issue i.e. the LP tokens are being sent to the LiquidityProtection.sol contract as a form of insurance against impermanent loss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants