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

Add ZAP to collateral contract #610

Closed
zgorizzo69 opened this issue Mar 19, 2023 · 24 comments
Closed

Add ZAP to collateral contract #610

zgorizzo69 opened this issue Mar 19, 2023 · 24 comments

Comments

@zgorizzo69
Copy link
Contributor

zgorizzo69 commented Mar 19, 2023

There is the UbiquityPoolFacet contract which allows users to:

  • transfer any ERC20 tokens to the contract in exchange for uAD
  • redeem uAD tokens from the contract in exchange for the collateral ERC20 tokens

We should have the ability to swap any ERC20 token to LUSD under the hood when user deposits collateral in order to mint uAD.

Notice that:

  • swaps should be made via the CoW Swap.
  • there might be edge cases on mint or redeem when there is not enough liquidity in the pools

Original description:

@0x4007
Copy link
Member

0x4007 commented Mar 19, 2023

I assume 1. that we can fork how zapper does it 2. they call Uniswap to complete the transaction.

@hashedMae
Copy link
Contributor

Didn't someone build a ZAP contract for another feature before? If not this one should be built in a more extendable manner, so it'd be able to ZAP to any of our existing or future contracts. Instead of having to build a bespoke zapper for each one.

@0x4007
Copy link
Member

0x4007 commented May 1, 2023

@zapaz built the zap lol

Check out the Instadapp codebase under our organization.

@ubiquibot
Copy link

ubiquibot bot commented Jun 17, 2023

@malik672 The time limit for this bounty is on Sat, 24 Jun 2023 10:06:48 GMT

It looks like you haven't set your wallet address,
please use /wallet 0x4FDE...BA18 to do so.
(It's required to be paid for the bounty)

@ubiquibot
Copy link

ubiquibot bot commented Jun 21, 2023

Do you have any updates @malik672? If you would like to release the bounty back to the DevPool, please comment /unassign

@0x4007
Copy link
Member

0x4007 commented Jun 26, 2023

https://github.com/ubiquity/ubiquity-instadapp/tree/master/backend/contracts/mainnet

I just reviewed the old code to refresh my memory.

  • It was built to be used inside of Instadapp.
  • It is designed to allow users to instantly start farming our governance tokens (zap in) and then to also be able to zap out.
  • This does not leverage Uniswap/Curve for swapping tokens so perhaps it is non applicable. Sorry about that!

@rndquu
Copy link
Member

rndquu commented Jun 30, 2023

This issue #609 added the ability for users to:

  1. Transfer ERC20 tokens to the contract in exchange for UAD
  2. Redeem UAD tokens from the contract in exchange for the collateral ERC20 tokens

we want user to be able to ZAP In any token to be swapped to $LUSD to retrieve uAD as described in #609

So this issue describes this feature:

  1. User should be able to transfer any collateral ERC20 token
  2. Under the hood the collateral is swapped for LUSD

On step 2 we need to swap collateral ERC20 tokens for LUSD using any audited DEX aggregator, like 1inch

Is the description correct?

@molecula451
Copy link
Member

zapping smells flashloan like

@0x4007
Copy link
Member

0x4007 commented Jul 5, 2023

On step 2 we need to swap collateral ERC20 tokens for LUSD using any audited DEX aggregator, like 1inch

Is the description correct?

Seems all correct but I would pick CoW Swap

@rndquu
Copy link
Member

rndquu commented Jul 6, 2023

On step 2 we need to swap collateral ERC20 tokens for LUSD using any audited DEX aggregator, like 1inch
Is the description correct?

Seems all correct but I would pick CoW Swap

Updated description

@0x4007
Copy link
Member

0x4007 commented Jul 6, 2023

Notice that:

  • there might be edge cases on mint or redeem when there is not enough liquidity in the pools

Can you explain to me the edge cases? I don't understand the issue.

  • the underlying collateral token (LUSD in our case) should be configurable (i.e. we should be able to update it to some other token)

We should be able to eventually enable support for more assets in case there are issues with acquiring new LUSD. In the original specification for implementing the collateral module, I remember asking to enable support for sUSD as well, and then we should disable sUSD deposits after we deploy so that the architecture to support multiple collateral types is implemented.

@rndquu
Copy link
Member

rndquu commented Jul 6, 2023

Notice that:

  • there might be edge cases on mint or redeem when there is not enough liquidity in the pools

Can you explain to me the edge cases? I don't understand the issue.

I meant that freshly created ERC20 tokens might not have any liquidity at all so the swap would not be possible but I guess the CoW Protocol has already covered such cases

  • the underlying collateral token (LUSD in our case) should be configurable (i.e. we should be able to update it to some other token)

We should be able to eventually enable support for more assets in case there are issues with acquiring new LUSD. In the original specification for implementing the collateral module, I remember asking to enable support for sUSD as well, and then we should disable sUSD deposits after we deploy so that the architecture to support multiple collateral types is implemented.

Yes, I overlooked this feature. Multicolalteral feature (along with disabling deposits for certain ERC20 tokens) is already implemented as a part of #609.

Deleted this line from the description:

  • "the underlying collateral token (LUSD in our case) should be configurable (i.e. we should be able to update it to some other token)"

@molecula451
Copy link
Member

this is basically an array of addresses address[] virtualized on an interface so that it supports further tokens && more importantly so that it handles different chains, because tokens are not the same on the different chains, neither exchanges (exchanges are realtive, UniV2 impl, etc), and liquidity but there is probably more under the hood, am stepping if not bounty hunter comes, on and after latests pull requests

@rndquu
Copy link
Member

rndquu commented Jul 7, 2023

because tokens are not the same on the different chains

@pavlovcik do we have plans to run UAD on different networks apart from ethereum mainnet?

@0x4007
Copy link
Member

0x4007 commented Jun 14, 2024

@rndquu should we close this as unplanned

@molecula451
Copy link
Member

molecula451 commented Jun 18, 2024

i think it's a nice feature to have but we can close as not completed, for future developing if we see the value on the actual live protocol out of the necessity, my thoughts, rfc @gitcoindev

@0x4007 0x4007 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2024
Copy link

ubiquibot bot commented Jun 18, 2024

# Issue was not closed as completed. Skipping.

@rndquu
Copy link
Member

rndquu commented Jun 18, 2024

Yes, it is not a "must have" feature hence it makes sense to save time and close it as "not planned"

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

Successfully merging a pull request may close this issue.

7 participants