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

Investigate and confirm the behaviour for new staking users for uad-contracts and diamond #939

Open
gitcoindev opened this issue May 22, 2024 · 11 comments

Comments

@gitcoindev
Copy link
Contributor

gitcoindev commented May 22, 2024

Right now the behaviour for new staking users is this one:

  1. User deposits 1000 UAD3CRV LP to https://etherscan.io/address/0xc251ecd9f1bd5230823f9a0f99a44a87ddd4ca38 for 1 week
  2. User waits for 1 week
  3. User withdraws 1000 UAD3CRV LP and gets 178 UAD3CRV LP + 72 UBQ. User would expect to get 1000 UAD3CRV LP instead of 178.

Originally posted by @rndquu in #752 (comment)

@gitcoindev
Copy link
Contributor Author

I extracted this to a separate issue, will post finding for both uad-contracts and diamond-based staking contract.

@0x4007
Copy link
Member

0x4007 commented Sep 25, 2024

I'm assuming its because I moved collateral out of the contract which I know affects the withdrawal amounts.

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

ubiquity-os bot commented Sep 25, 2024

# Issue was not closed as completed. Skipping.

@rndquu
Copy link
Member

rndquu commented Sep 27, 2024

I'm assuming its because I moved collateral out of the contract which I know affects the withdrawal amounts.

Do we plan to move it back to the staking contract?

@0x4007
Copy link
Member

0x4007 commented Sep 27, 2024

Yeah I think we need to migrate to v2 somehow. It was mostly removed because of some problem discovered in Sherlock if I recall correctly.

@rndquu
Copy link
Member

rndquu commented Sep 27, 2024

Yeah I think we need to migrate to v2 somehow. It was mostly removed because of some problem discovered in Sherlock if I recall correctly.

Staking contracts weren't part of the Sherlock audit.

@0x4007
Copy link
Member

0x4007 commented Sep 27, 2024

Then I don't remember why some was moved

@rndquu
Copy link
Member

rndquu commented Sep 27, 2024

Then I don't remember why some was moved

Then perhaps we should reopen this issue?

@0x4007 0x4007 reopened this Sep 27, 2024
@0x4007
Copy link
Member

0x4007 commented Sep 27, 2024

It isn't clear to me if we redid the staking yet and if we should migrate? If so perhaps we should make a new issue instead.

@rndquu
Copy link
Member

rndquu commented Sep 27, 2024

It isn't clear to me if we redid the staking yet and if we should migrate? If so perhaps we should make a new issue instead.

What we have right now:

  1. MasterChefV2.1 contract (i.e. old staking) which seems to be working fine (almost)
  2. StakingFacet (i.e. new staking) which:
    a) is not used right now
    b) not fully covered with tests so it's hard to say that it works as the original MasterChef
    c) ideally requires an audit

The only issue with the MasterChefV2.1 contract (old staking) is current github issue with missing LP tokens. If this issue is the result of owner actions or some other expected behavior then it makes sense to save development time and simply use the old staking contract.

That is why we'd better to find out the root cause of missing LP tokens and then decide whether we should proceed with the old staking or migrate to the diamond's StakingFacet contract.

@rndquu
Copy link
Member

rndquu commented Jan 14, 2025

As far as I understand the root cause for missing liquidity is the uADPriceReset method and the following transactions:

The uADPriceReset method works this way:

  1. Bonding manager calls uADPriceReset with a specific amount
  2. BondingV2 withdraws uAD token from the 3CRV/uAD curve pool in exchange for the 3CRV/uAD LP tokens (which users staked)
  3. BondingV2 transfers uAD to the treasury address

So the main purpose of the uADPriceReset method is to increase the uAD price.

I suppose all of the transactions above were executed in order to keep uAD close to 1$ peg.

Anyway the staking contract liquidity is not lost, it just sits in the form of uAD tokens in the treasury.

When all staking positions are expired in the old staking we should put the 3CRV/uAD LP token liquidity back in the staking contract so that users who staked were not affected. Not sure how it affects exact rewards when you put tons of liquidity in the end, this requires a research.

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