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

Remove TokenTimelock, PaymentSplitter, ERC20Snapshot, ERC20VotesComp, GovernorVotesComp #4276

Merged
merged 14 commits into from May 26, 2023

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented May 24, 2023

Fixes LIB-874

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

@changeset-bot
Copy link

changeset-bot bot commented May 24, 2023

⚠️ No Changeset found

Latest commit: e51e218

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@socket-security
Copy link

socket-security bot commented May 24, 2023

No dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No dependency changes detected in pull request

Pull request alert summary
Issue Status
Critical CVE ✅ 0 issues
CVE ✅ 0 issues
Mild CVE ✅ 0 issues
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
GitHub dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues
AI detected security risk ✅ 0 issues
AI warning ✅ 0 issues

@Amxx Amxx changed the base branch from master to next-v5.0 May 24, 2023 09:23
@Amxx Amxx changed the title Remove TokenTimelock in favor of VestingWallet Remove TokenTimelock (in favor of VestingWallet), PaymentSplitter and ERC20Snapshot. May 24, 2023
@Amxx Amxx requested review from frangio and ernestognw and removed request for frangio May 24, 2023 16:24
@frangio
Copy link
Contributor

frangio commented May 24, 2023

Upgradeable patch needs to be updated.

contracts/finance/VestingWallet.sol Show resolved Hide resolved
.changeset/clever-eagles-unite.md Outdated Show resolved Hide resolved
@Amxx Amxx force-pushed the refator/remove/TokenTimelock branch from 5a7efab to baaf484 Compare May 25, 2023 08:52
@frangio frangio changed the title Remove TokenTimelock (in favor of VestingWallet), PaymentSplitter and ERC20Snapshot. Remove TokenTimelock, PaymentSplitter, ERC20Snapshot, ERC20VotesComp, GovernorVotesComp May 26, 2023
@frangio frangio merged commit 15c5c71 into OpenZeppelin:next-v5.0 May 26, 2023
12 checks passed
@Amxx Amxx deleted the refator/remove/TokenTimelock branch May 29, 2023 19:12
@ItsCuzzo
Copy link

ItsCuzzo commented Jun 9, 2023

Hey there, out of curiosity what was the rationale behind the removal of PaymentSplitter? It was quite a useful contract that I have utilised a variety of times during development, particularly with ERC-721 token contracts with multiple shareholders.

@Amxx
Copy link
Collaborator Author

Amxx commented Jun 9, 2023

Hello @ItsCuzzo

The PaymentSplitter received a lot of criticism related to the inability to update the share. Some people would expect the shares to be transferable using an ERC20 or ERC721 interface.

The plan is to remove the old version (that suffers limitations) in version 5.0, and then reintroduce a better version down the line in 5.1 or 5.2. In the meantime, the old version remains available in the 4.X versions.

@ItsCuzzo
Copy link

ItsCuzzo commented Jun 9, 2023

Awesome, I did see some of that discussion now that you mention it. Thanks for the detailed reply!

@Arvolear
Copy link

Arvolear commented Oct 7, 2023

Hey, is it the same story with ERC20Snapshot? It was indeed ultra useful for some lightweight DAOs.

@frangio
Copy link
Contributor

frangio commented Oct 7, 2023

Please say more about "ultra lightweight"?

@Arvolear
Copy link

Arvolear commented Oct 7, 2023

I mean DAOs with ERC20Snapshot as a voting token.

@Amxx
Copy link
Collaborator Author

Amxx commented Oct 7, 2023

ERC20Snapshot does not support delegation, and requires someone to create a snapshot when needed (part of the proposal workflow I guess).

This doesn't sound like the best design.

@Arvolear
Copy link

Arvolear commented Oct 8, 2023

There are many approaches to build DAOs and I agree that the absence of delegation might break some design decision.

But there is one case with 2 step DAOs. In these DAOs there is a set of validators that is elected by regular members to veto proposals.

These validators should not delegate and they have fixed voting power. Snapshots here fix the problem when there are 2 proposals (regular and to remove a validator).

Let's say the regular one lasts for 2 weeks and the removal is only 1 week long.

So if validator gets removed, he won't be able to vote on the regular proposal even though it was created first.

@Amxx
Copy link
Collaborator Author

Amxx commented Oct 9, 2023

To add more context:

  • ERC20Snapshot was released before ERC20Votes, it was a first approach.
  • When ERC20Votes was released it was considered the better option. In particular becauseits a more standard interface that is supported by some third party tools (such as Tally)
  • Our governor is compatible with ERC20Votes (and ERC721Votes), but not with ERC20Snapshot.

Planning for 5.0, we felt that the Votes module was the go to solution, and that ERC20Snapshot was no longer relevant. We decided to deprecate it, and it is now removed for the repo. It remains available in the 4.x packages.

If you really want, you should be able to adapt ERC20Snapshot to 5.0 easily.

@ernestognw
Copy link
Member

ernestognw commented Oct 27, 2023

We got similar questions quite a few times and I think we need to provide a bit more clarity on how to replace ERC20Snapshot. Although I agree with @Amxx in that people should generally use ERC20Votes for governance (idk how the "lightweight" DAO case works), it's true there are use cases for snapshotting that aren't related to governance and the alternatives aren't trivial:

  • On one hand, you can use the 4.x version of ERC20Snapshot, but if you mix it with 5.x contracts, they wont be guaranteed to have compatible storage and semantics with 4.x. In a new minor version, we may add new storage variables or slightly modify the semantics of a function in a way that mixed with a 4.x's ERC20Snapshot could break some of your assumptions.
  • On the other, you can use a modification of ERC20Votes to mimic the ERC20Snapshot behavior, but I don't think that's as easy as it sounds, and requires a bit of context.

I'd generally go for adapting an ERC20Votes because it guarantees support during the 5.x version, but given that the contract is built for governance purposes, I see there are a few important differences to ERC20Snapshot:

So the ERC20Votes should be overridden to use a counter as clock() and have self-delegation by default. Here's a PoC
for reference purposes, note its unaudited code.

Also, an ERC20Snapshot implemented from scratch is also relatively easy using the OpenZeppelin Checkpoints primitive. Here's a reference PoC. Unaudited as well.

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.

None yet

5 participants