morganjweaver / 08-Tokenized-Votes

HW project #2
0 stars 2 forks source link

Forward delegated votes #11

Open s6thgehr opened 2 years ago

s6thgehr commented 2 years ago
horky2004 commented 2 years ago

That seems reasonable, what is the scope of the change? We should stick to using ERC20Votes base contract as much as possible. At a glance, I see that ERC20Votes has delegates(address account) public function that returns delegatee for given address so implementation should not be a problem.

morganjweaver commented 2 years ago

What if we delegate our votes to two different parties? How would the code choose who to delegate the new votes to? LastDelegate? I see that the delegate Fx does indeed delegate all of your votes to one specified address, but if you get more votes, and then delegate them all to a second address, this could get complicated.

Ideas (I'm mostly a fan of 3, because it gets complicated fast):

  1. Write an override for the delegate function that emits an event on every new delegation for convenient alerting, and let the delegatee decide what to do with their new votes.

  2. Create lastDelegate address in ballots to store whoever you delegated to most recently, who will then receive all future votes if your contract receives new votes. On delegation, automatically forward a delegatee's new votes to lastDelegate address if set. Otherwise do nothing. This could get complicated if there are loops set up in members' lastDelegated addresses.

  3. Do nothing, letting the user check their votes manually via script, Etherscan, Infura, etc.

horky2004 commented 2 years ago

What if we delegate our votes to two different parties? How would the code choose who to delegate the new votes to? LastDelegate? I see that the delegate Fx does indeed delegate all of your votes to one specified address, but if you get more votes, and then delegate them all to a second address, this could get complicated.

I think the idea is if user delegates his voting power, then all other voting power delegated to that user would be delegated further to his delegatee. So the original user can not delegate his second batch of voting power to anyone else, delegatee has that voting power by default. Of course, user can always delegate back to himself to restore his voting power.