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

Child Gauge Implementation update #11

Merged
merged 20 commits into from
Sep 16, 2024
Merged

Conversation

romanagureev
Copy link
Collaborator

@romanagureev romanagureev commented Aug 27, 2024

About

Making ready for handy use in curve-lite and update among all L2s.

Problems

  • CRV set later (already done in previous PR)
  • Currently reward period is strictly one WEEK, what is not convenient. Making it arbitrary
  • Bad precision for not 18 decimal tokens
  • If totalSupply == 0 and rewards were allocated, funds for that period will stuck in contract forever
  • CRV as a reward can not be distinguished from CRV emissions

What I did

  • Bumped latest LiquidityGaugeV6, so they are visually similar and have all comments and docs.
  • Added better calculation precision along with some tests

@martinkrung
Copy link

Another idea:

one-time donation

a function to make a one-time donation. Maybe a nice way to say thanks to stake. But it could be front-run?

**claim all rewards for stakers **

Is it now possible to claim for a different address? Is there a way to get all stakers for a reward_id?

This would allow looping trough all past stakers and clean up and having zero balance in the contract. this would be good, as we avoid future request if pools are not accessible in the front-end. On L2 this may be cheap to transact.

distribute without beeing set as distributor

Cold we open this up, so that everyone can use rewards? Whats the risk, beyond spam? Could somebody make a token, which then scams people?

We could take a fixed fee, like 1000 crvUSD, and have a limited amount, say 10 then bill on add_reward().
What could be done, is make it very expensive, like 10'000 crvUSD, then the owner could ask to get it back after 3 month, but would need to go over governance. And we would take 20% of the 10'000 crvUSD. But more vote for the DAO are not very good..

Or do you see any other way? But maybe this is anyway beyond your task.

@romanagureev
Copy link
Collaborator Author

one-time donation

a function to make a one-time donation. Maybe a nice way to say thanks to stake. But it could be front-run?

Don't really get, donation to whom, Like on staking LPs? That can be drained via spam

**claim all rewards for stakers **

Is it now possible to claim for a different address? Is there a way to get all stakers for a reward_id?

This would allow looping trough all past stakers and clean up and having zero balance in the contract. this would be good, as we avoid future request if pools are not accessible in the front-end. On L2 this may be cheap to transact.

You can already claim for anyone .claim_rewards(_addr), though there is no function with array that might be helpful. Will add.
You can get all stakers with Deposit event off-chain. Storing past stakers on-chain not really reasonable.

distribute without beeing set as distributor

Cold we open this up, so that everyone can use rewards? Whats the risk, beyond spam? Could somebody make a token, which then scams people?

I did open this method for everyone (see .deposit_reward(), L668). But one should control period of distribution and recover if needed as discussed before, hence you should trust to distributor and manager.
Not really seeing any other risks, spam/scam – any coins should be added through DAO or manager.

@martinkrung
Copy link

one-time donation

a function to make a one-time donation. Maybe a nice way to say thanks to stake. But it could be front-run?

Don't really get, donation to whom, Like on staking LPs? That can be drained via spam

mk: yes, just as a one-time payment, not time bound, not rate. To only reward the current users. In a way this could be done with an ultra short reward, like 20 secs. if we could say reward at least 1 day, but lower then 30 sec is allowed too then we would have that with the current code. (if its safe) but not sure if there is any demand..

**claim all rewards for stakers **

Is it now possible to claim for a different address? Is there a way to get all stakers for a reward_id?

This would allow looping trough all past stakers and clean up and having zero balance in the contract. this would be good, as we avoid future request if pools are not accessible in the front-end. On L2 this may be cheap to transact.

You can already claim for anyone .claim_rewards(_addr), though there is no function with array that might be helpful. Will add. mk: 👍

You can get all stakers with Deposit event off-chain. Storing past stakers on-chain not really reasonable.

mk: not needed, only stakers with none zero reward in a campaing? Can we get them?

distribute without beeing set as distributor

Cold we open this up, so that everyone can use rewards? Whats the risk, beyond spam? Could somebody make a token, which then scams people?

I did open this method for everyone (see .deposit_reward(), L668). But one should control period of distribution and recover if needed as discussed before, hence you should trust to distributor and manager.
Not really seeing any other risks, spam/scam – any coins should be added through DAO or manager.

mk: yep, that can we make without manager, but I agree this is beyond what we do now.

@romanagureev
Copy link
Collaborator Author

mk: yes, just as a one-time payment, not time bound, not rate. To only reward the current users. In a way this could be done with an ultra short reward, like 20 secs. if we could say reward at least 1 day, but lower then 30 sec is allowed too then we would have that with the current code. (if its safe) but not sure if there is any demand..

ra: don't think it's possible to implement, because you can not distinguish any one-time lock from lock+unlock+transfer to another eoa+lock

mk: not needed, only stakers with none zero reward in a campaing? Can we get them?

ra: too hard to implement on-chain, off-chain script can make any needed checks (like claimable()).

contracts/implementations/ChildGauge.vy Outdated Show resolved Hide resolved
contracts/implementations/ChildGauge.vy Outdated Show resolved Hide resolved
contracts/implementations/ChildGauge.vy Outdated Show resolved Hide resolved
@romanagureev romanagureev marked this pull request as ready for review September 13, 2024 09:05
@romanagureev romanagureev merged commit 3876cf0 into master Sep 16, 2024
0 of 5 checks passed
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

Successfully merging this pull request may close these issues.

3 participants