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

Create a voting escrow veHATs contract #103

Open
jellegerbrandy opened this issue Mar 21, 2022 · 7 comments
Open

Create a voting escrow veHATs contract #103

jellegerbrandy opened this issue Mar 21, 2022 · 7 comments

Comments

@jellegerbrandy
Copy link
Collaborator

jellegerbrandy commented Mar 21, 2022

We will want the rewardcontroller alloc points (and perhaps also other settings) controlled by a voting escrow contract.

@jellegerbrandy
Copy link
Collaborator Author

jellegerbrandy commented Mar 22, 2022

  • users with locked tokens will take part of governance - so users should be able to delegate tokens

@jellegerbrandy
Copy link
Collaborator Author

jellegerbrandy commented Apr 5, 2022

Examples:

@jellegerbrandy jellegerbrandy changed the title Create a veHATs contract Create a voting escrow veHATs contract Apr 28, 2022
@lirona
Copy link
Contributor

lirona commented Sep 12, 2022

Examples:

i think it would be great to implement this in a simpler version, to remove totalSupplyAt and balanceAt (which are there for aragon compatibility, unless we will want to use aragon) and like this we can save just the last point (for global and every user) and no need to keep all point history and epochs, and we can get rid of all the block tracking and extrapolation. it will also simplify the checkpoint logic (need to update in the loop for every scheduled slope change since last update, and not every week). also some other minor improvements like have the for loop in the checkpoint run until current week and not 255 times (so can never break, the curve contract will break if unused for 5 years)
there are a few projects that have translated this contract to solidity, but kept it as is (like InsureDAO, snowwhitedev
)
and a lot of projects that copied the vyper contract (pickle finance, hundred-finance, angle protocol )

the repo seems to have vanished (as the creators decided to take down the project) but i think boba network forked it:
https://github.com/bobanetwork/boba/blob/develop/packages/boba/ve-boba/contracts/ve.sol
anyway i don't think we need these extra features (and don't think we would want to have the voting power transferable)

simple but doesn't calculate total voting power. i think this is a pretty good idea actually, because unless we need to know the total voting power (can't think rn what for), it really doesn't matter for the voting mechanism. i think would be the best to implement something like this, with the deposit/withdraw/extend etc.

they have done a v2 already:
https://github.com/tranchess/contract-core/blob/main/contracts/governance/VotingEscrowV2.sol
which improves a lot the classic curve contract and adds a calibrateSupply function to deal with accumulated rounding errors

an ERC20Votes contract which mints voting tokens (which can be transferred and delegated) so voting power doesn't diminish during locking period. still not sure why diminishing values are better actually.. it also has the option to withdraw before lock expires and pay a penalty relative to how far is the expiration

@lirona
Copy link
Contributor

lirona commented Sep 12, 2022

@lirona
Copy link
Contributor

lirona commented Sep 13, 2022

ben's comments about the tranchess v2 contract:

  1. it's written for solidity less than 8, so need to update safemath into regular math.
  2. their upgradeability is a bit weird, but do we even want it to be upgradeable?
  3. they have some some pausemanage contract it inherits from to manage pausing it with a separate puser role, so do we even need it? and if so I think we could replace most or all of their code with OZ code...
  4. They have a check that a smart contract cannot use create a lock unless it is whitelisted in a whitelisting contract. Do we want that?
  5. They have some value checks like if the callback address is a contract, should we remove unnecessary value checks like that to save gas?
  6. Since their contract is already v2 it has some code that was meant for the upgrade process, but we should remove since for us there's no existing contract.

@lirona
Copy link
Contributor

lirona commented Sep 13, 2022

ben's comments about the tranchess v2 contract:

  1. it's written for solidity less than 8, so need to update safemath into regular math.
  2. their upgradeability is a bit weird, but do we even want it to be upgradeable?
  3. they have some some pausemanage contract it inherits from to manage pausing it with a separate puser role, so do we even need it? and if so I think we could replace most or all of their code with OZ code...
  4. They have a check that a smart contract cannot use create a lock unless it is whitelisted in a whitelisting contract. Do we want that?
  5. They have some value checks like if the callback address is a contract, should we remove unnecessary value checks like that to save gas? 6. Since their contract is already v2 it has some code that was meant for the upgrade process, but we should remove since for us there's no existing contract.

don't think we would want to have it upgradeable or pauseable, but let's discuss
as for the check for contracts on lock creation, this is something from the original curve contract, which checks this on creation, increase amount and increase lock time, and their explanation for it is to prevent it from being traded or tokenized, and the whitelist is to allow widely used multisigs.

@jellegerbrandy
Copy link
Collaborator Author

  1. yes
  2. no upgradeability
  3. no pausing
  4. whitelist for createlock contracst is good to keep the locked tokens non-transferable
  5. not sure let's look case-by-case
  6. ok

@lirona lirona linked a pull request Sep 14, 2022 that will close this issue
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.

2 participants