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

Add a delegate function where we can specify the amount we want to delegate to Votes.sol and IVotes.sol #3624

Closed
JoaoMorais96 opened this issue Aug 16, 2022 · 2 comments

Comments

@JoaoMorais96
Copy link

JoaoMorais96 commented Aug 16, 2022

Add a delegate function where we can specify the amount we want to delegate to Votes.sol and IVotes.sol

delegate_amount(address delegatee, uint256 amount)
delegateBySig_amount(
        address delegatee,
        uint256 amount,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    )
_delegate_amount(address account, address delegatee, uint256 amount)
  • This is useful in cases where the tokens are locked in a timelock contract but we still want to allow the holders to vote (even if the tokens are only promised to the address, for example after a X years lock, and are yet to actually be owned by their future owner). In this case, the contract can have a certain number of tokens in its balance and still only give a portion of the votes to each user.
  • It can also be used by individuals who want to spread their vote to various entities they trust in order to avoid having a single entity abuse their voting power for malicious purposes.

An example of the possible changes in the code can be seen here: https://github.com/JoaoMorais96/openzeppelin-contracts/tree/master/contracts/governance/utils. I thought it would be best to create a discussion before a pull to get some feedback.

Maybe it is easier to join the functions into only one, since the total balance of the caller of the address is always simpler to get via code, and so it can be placed in the "amount" variable. This would save some gas.

I have made this change before for a project where the company employees had their tokens locked for 3 years and then slowly released, but they still wanted to participate in the DAO immediately. If the current delegate delegates the entire voting power of the caller (if I am reading it correctly), the contract would have to give its entire voting power to one employee.

@frangio
Copy link
Contributor

frangio commented Aug 17, 2022

Thanks for the suggestion @JoaoMorais96.

I'd prefer to avoid adding more functions to the Votes interface. But more importantly, as far as I can tell this is not possible to implement. If an account that has multiple delegates for various portions of their tokens, and they transfer some of their tokens to another account, which of the delegates will have their votes reduced? The only technically feasible approach would be to proportionally reduce the votes of all delegates, but this is not necessarily what you want, and in the example you shared I'm pretty sure it is not what you would want.

There is another way to achieve what you want. See this article on Flexible Voting.

@frangio frangio closed this as completed Aug 17, 2022
@JoaoMorais96
Copy link
Author

Thanks for the clarification and ofr the article :) !

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

2 participants