ubiquity / ubiquity-dollar

Ubiquity Dollar (UUSD) smart contracts and user interface.
https://uad.ubq.fi
Apache License 2.0
34 stars 90 forks source link

Algorithmic Market Operations for Collateral #611

Closed zgorizzo69 closed 4 weeks ago

zgorizzo69 commented 1 year ago

There is the UbiquityPoolFacet where users can:

  1. Deposit collateral ERC20 tokens in exchange for Dollar tokens
  2. Redem Dollar tokens in exchange for the collaterral

We should put the provided collateral to work and earn some yield.

What should be done:

  1. Take any AMO strategy contract (from frax finance or some other well audited protocol)
  2. Create an ERC-4626 contract over that strategy so that we could easily add new AMO strategies to the ubiquity protocol
  3. Add thorough natspec comments for all of the contracts, methods and mechanics
  4. Add unit testing

Good article: https://mirror.xyz/jackchong.eth/iB_teRKgBaKm4OTKFmjf8hFAM55C1_i0Z2kf-KkYz2I

Original description: we want an AMO for collateral gathered thanks to https://github.com/ubiquity/ubiquity-dollar/issues/609 Algorithmic Market Operations module is an autonomous contract(s) that enacts arbitrary monetary policy so long as it does not change the uAD price off its peg. This means that AMO controllers can perform open market operations algorithmically (as in the name), but they cannot arbitrarily mint uAD out of thin air and break the peg. The aims is to invests idle collateral into various DeFi vaults/protocols

0x4007 commented 1 year ago

Can you place a time estimate?

hashedMae commented 1 year ago

so algo farming?

0x4007 commented 1 year ago

It just means that we want to have some collateral to be put to work to make some yield. We should use the ERC-4626: Tokenized Vaults interface as discussed in the past. I do think that we need to specify AMO strategies and have them be separate bounties but the intent behind this bounty is to consider this architecture and include AMO capability within the core collateral module.

ubiquibot[bot] commented 1 year ago

Deadline Wed, 30 Aug 2023 07:35:24 UTC
Registered Wallet 0x4007CE2083c7F3E18097aeB3A39bb8eC149a341d

Tips:

ubiquibot[bot] commented 1 year ago

Updated the wallet address for @zgorizzo69 successfully! Your new address: 0x10693e86f2e7151B3010469E33b6C1C2dA8887d6

ubiquibot[bot] commented 1 year ago

You have been unassigned from the bounty @zgorizzo69

ghost commented 1 year ago

/start

ubiquibot[bot] commented 1 year ago

Deadline Wed, 30 Aug 2023 07:35:24 UTC
Registered Wallet 0x4007CE2083c7F3E18097aeB3A39bb8eC149a341d

Tips:

rndquu commented 1 year ago

@pavlovcik I removed time and priority labels because we should make the spec more clear

rndquu commented 1 year ago

It just means that we want to have some collateral to be put to work to make some yield. We should use the ERC-4626: Tokenized Vaults interface as discussed in the past. I do think that we need to specify AMO strategies and have them be separate bounties but the intent behind this bounty is to consider this architecture and include AMO capability within the core collateral module.

Questions:

  1. So each AMO strategy is an ERC-4626 vault, right?
  2. When user deposits collateral ERC20 tokens in exchange for UAD then user should also select an AMO strategy, right? Or user can deposit funds and then, in another transaction, select different AMOs for different deposited amounts?
  3. Frax supports the following AMOs: Aave, Compound, Yearn, Curve, Uniswap. Which one we should implement 1st?
  4. Who earns the yield? User or ubiquity protocol?
0x4007 commented 1 year ago

It just means that we want to have some collateral to be put to work to make some yield. We should use the ERC-4626: Tokenized Vaults interface as discussed in the past. I do think that we need to specify AMO strategies and have them be separate bounties but the intent behind this bounty is to consider this architecture and include AMO capability within the core collateral module.

Questions:

  1. So each AMO strategy is an ERC-4626 vault, right?

  2. When user deposits collateral ERC20 tokens in exchange for UAD then user should also select an AMO strategy, right? Or user can deposit funds and then, in another transaction, select different AMOs for different deposited amounts?

  3. Frax supports the following AMOs: Aave, Compound, Yearn, Curve, Uniswap. Which one we should implement 1st?

  4. Who earns the yield? User or ubiquity protocol?

  1. Yes
  2. We should handle AMOs entirely internally. It is no longer intended to be user facing. This is how FRAX does it for max profit.
  3. I'm not sure at the moment. I imagine that they can be pretty quick to put together if we fork other code (like FRAX AMOs?)
  4. Ubiquity
ubiquibot[bot] commented 1 year ago

@pavlovcik - Releasing the bounty back to dev pool because the allocated duration already ended! Last activity time: Wed Jul 05 2023 15:15:57 GMT+0000 (Coordinated Universal Time)

rndquu commented 1 year ago

@rndquu @pavlovcik Can I work on this issue?

Sure, pls check the updated description

ubiquibot[bot] commented 1 year ago

Deadline Wed, 06 Sep 2023 08:32:10 UTC
Registered Wallet 0x3EFFe91C62d1864C3B791Bc7bbD43b68B899d12A

Tips:

ubiquibot[bot] commented 1 year ago

Do you have any updates @FibrinLab? If you would like to release the bounty back to the DevPool, please comment /stop Last activity time: Tue Sep 05 2023 08:31:22 GMT+0000 (Coordinated Universal Time)

ubiquibot[bot] commented 1 year ago

@FibrinLab - Releasing the bounty back to dev pool because the allocated duration already ended! Last activity time: Tue Sep 05 2023 08:31:22 GMT+0000 (Coordinated Universal Time)

ubiquibot[bot] commented 1 year ago

Do you have any updates @FibrinLab? If you would like to release the bounty back to the DevPool, please comment /stop Last activity time: Mon Sep 18 2023 13:37:13 GMT+0000 (Coordinated Universal Time)

ubiquibot[bot] commented 1 year ago

@FibrinLab - Releasing the bounty back to dev pool because the allocated duration already ended! Last activity time: Mon Sep 18 2023 13:37:13 GMT+0000 (Coordinated Universal Time)

ubiquibot[bot] commented 1 year ago

@FibrinLab - Releasing the bounty back to dev pool because the allocated duration already ended! Last activity time: Mon Sep 18 2023 13:37:13 GMT+0000 (Coordinated Universal Time)

FibrinLab commented 1 year ago

/start

ubiquibot[bot] commented 1 year ago

Deadline Tue, 26 Sep 2023 14:12:44 UTC
Registered Wallet 0x3EFFe91C62d1864C3B791Bc7bbD43b68B899d12A
Tips:
FibrinLab commented 1 year ago

i'm seeing some good changes in your PR @FibrinLab what happened?

Finishing up

ubiquibot[bot] commented 1 year ago

Do you have any updates @FibrinLab? If you would like to release the bounty back to the DevPool, please comment /stop Last activity time: Mon Sep 25 2023 14:12:54 GMT+0000 (Coordinated Universal Time)

ubiquibot[bot] commented 1 year ago

@FibrinLab - Releasing the bounty back to dev pool because the allocated duration already ended! Last activity time: Mon Sep 25 2023 14:12:54 GMT+0000 (Coordinated Universal Time)

molecula451 commented 1 year ago

if you don't open at least a PR ready for review the bot will keep ejecting you, if you can't handle i suggest you pick up another task

ubiquibot[bot] commented 1 year ago

Deadline Fri, 20 Oct 2023 19:05:53 UTC
Registered Wallet 0xc6fa133f3290e14Ad91C7449f8D8101A6f894E25

Tips:

ubiquibot[bot] commented 1 year ago

Do you have any updates @bojan07? If you would like to release the bounty back to the DevPool, please comment /stop Last activity time: Thu Oct 19 2023 19:05:51 GMT+0000 (Coordinated Universal Time)

ubiquibot[bot] commented 1 year ago

Deadline Mon, 30 Oct 2023 23:56:05 UTC
Registered Wallet 0xc6fa133f3290e14Ad91C7449f8D8101A6f894E25

Tips:

FibrinLab commented 10 months ago

/start

ubiquibot[bot] commented 10 months ago
! Skipping because it is disabled on this repo.
ubiquibot[bot] commented 10 months ago
! action returned an unexpected value
0x4007 commented 10 months ago
! action returned an unexpected value

We're almost there with the new deployment. I'm surprised that it pushed through and still assigned you.

molecula451 commented 10 months ago

pavlovcik's new pfp 😄

molecula451 commented 10 months ago

it looks like the bot it's trying to participate on each action, of the repo, each action you, a comment it's trying to do, deleting most of the unused comments to avoid clogging on contributors PR

0x4007 commented 10 months ago

Yes there's a bug with the task timeout unassign logic.

If there's an error thrown it will dump it in the database, console, and the issue that invoked it.

ubiquibot[bot] commented 10 months ago
! action returned an unexpected value
0x4007 commented 10 months ago

it looks like the bot it's trying to participate on each action, of the repo, each action you, a comment it's trying to do, deleting most of the unused comments to avoid clogging on contributors PR

Hiding comments is better for archival purposes.

ubiquibot[bot] commented 10 months ago
! action returned an unexpected value
molecula451 commented 10 months ago

/help

molecula451 commented 10 months ago

/help

molecula451 commented 10 months ago

/help

0x4007 commented 10 months ago

/help

ubiquibot[bot] commented 10 months ago

Available Commands

Command Description Example
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/help List all available commands. /help
/query Returns the user's wallet, access, and multiplier information. /query @user
/ask Ask a context aware question. /ask is x or y the best approach?
/multiplier Set the task payout multiplier for a specific contributor, and provide a reason for why. /multiplier @user 0.5 "multiplier
reason"
/labels Set access control, for admins only. /labels @user priority time
price
/authorize Approve a label change, for admins only. /authorize
/wallet Register your wallet address for payments. /wallet ubq.eth
molecula451 commented 10 months ago

/help

ubiquibot[bot] commented 10 months ago

Available Commands

Command Description Example
/start Assign yourself to the issue. /start
/stop Unassign yourself from the issue. /stop
/help List all available commands. /help
/query Returns the user's wallet, access, and multiplier information. /query @user
/ask Ask a context aware question. /ask is x or y the best approach?
/multiplier Set the task payout multiplier for a specific contributor, and provide a reason for why. /multiplier @user 0.5 "multiplier
reason"
/labels Set access control, for admins only. /labels @user priority time
price
/authorize Approve a label change, for admins only. /authorize
/wallet Register your wallet address for payments. /wallet ubq.eth
gpylypchuk commented 8 months ago

Hey, this is still open? bc @FibrinLab is assigned but did not see the pr

molecula451 commented 8 months ago

Hey, this is still open? bc @FibrinLab is assigned but did not see the pr

yes, it's open

rndquu commented 8 months ago

Hey, this is still open? bc @FibrinLab is assigned but did not see the pr

Yes, you may take inspiration from https://github.com/FraxFinance/frax-solidity/blob/master/src/hardhat/contracts/Frax/FraxAMOMinter.sol

You may propose how we can break down this task to smaller issues

gpylypchuk commented 8 months ago

Hey, this is still open? bc @FibrinLab is assigned but did not see the pr

Yes, you may take inspiration from https://github.com/FraxFinance/frax-solidity/blob/master/src/hardhat/contracts/Frax/FraxAMOMinter.sol

You may propose how we can break down this task to smaller issues

Okay, I've been researching about this, because I do not know too much. So the main idea is use e.g. USDC as collateral for the Dollar and then use it with a strategy to earn?

molecula451 commented 8 months ago

Okay, I've been researching about this, because I do not know too much. So the main idea is use e.g. USDC as collateral for the Dollar and then use it with a strategy to earn?

this is a huge task you may check closed PRs to have reference. I'd suggest you first familiarize yourself with the repo before start working on this one.

So the main idea is use e.g. USDC as collateral for the Dollar and then use it with a strategy to earn?

Our selected stablecoin for now is LUSD