chimera-defi / SharedDeposit

13 stars 6 forks source link

wsg eth test finished #21

Closed devlancer412 closed 4 weeks ago

devlancer412 commented 1 month ago

can we plz add checks for price per share, and see that is behaves with new yield coming in + new deposits coming in/total supply increasing

I think this rate increasing by sgEth and wsgEth amount. but just deposit and withdraw keeps this rate to 1. How can I change this rate when test?

chimera-defi commented 1 month ago

@devlancer412 yep! so the way it works is:

  1. user mints sgETH w/ eth. At the rate 1:1
  2. user mints/wraps to wsgETH w/ sgETH at the curRate
  3. Rewards generated via rewardsRecvr are redirected, sgETH is minted, but is then sent to the wsgeth contract.
  4. When rewards are sent, the redemption rate for wsgETH goes up
  5. user can now withdraw -> wsgETH to sgETH , at a better rate, receiving more than 1 sgETH
  6. User can now redeem his >1 sgETH for equivalent eth at 1:1

So for test, you could just admin mint some sgETH and send it to the wsgeth contract to test.

See it in action in the rewards receiver here for e2e: https://github.com/chimera-defi/SharedDeposit/blob/main/contracts/v2/core/RewardsReceiver.sol#L32

devlancer412 commented 1 month ago

So I need to deposit manually eth to RewardsReceiver contract to test sgEth/wsgEth rate change?

chimera-defi commented 1 month ago

@devlancer412 yep, exactly

devlancer412 commented 1 month ago

https://github.com/chimera-defi/SharedDeposit/issues/23

I couldn't test that because this error

devlancer412 commented 1 month ago

I finished test by avoiding top error.

devlancer412 commented 1 month ago

@chimera-defi

devlancer412 commented 1 month ago

@chimera-defi Please check last updates