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
Merged
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

### Removals

The following contracts were removed:

- `ERC20Snapshot`
- `ERC20VotesComp`
- `GovernorVotesComp`
- `PaymentSplitter`
- `TokenTimelock` (removed in favor of `VestingWallet`)

### How to upgrade from 4.x

#### ERC20, ERC721, and ERC1155
Expand Down
214 changes: 0 additions & 214 deletions contracts/finance/PaymentSplitter.sol

This file was deleted.

6 changes: 0 additions & 6 deletions contracts/finance/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/

This directory includes primitives for financial systems:

- {PaymentSplitter} allows to split Ether and ERC20 payments among a group of accounts. The sender does not need to be
aware that the assets will be split in this way, since it is handled transparently by the contract. The split can be
in equal parts or in any other arbitrary proportion.

- {VestingWallet} handles the vesting of Ether and ERC20 tokens for a given beneficiary. Custody of multiple tokens can
be given to this contract, which will release the token to the beneficiary following a given, customizable, vesting
schedule.

== Contracts

{{PaymentSplitter}}

{{VestingWallet}}
12 changes: 11 additions & 1 deletion contracts/finance/VestingWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import "../utils/Context.sol";
* Any token transferred to this contract will follow the vesting schedule as if they were locked from the beginning.
* Consequently, if the vesting has already started, any amount of tokens sent to this contract will (at least partly)
* be immediately releasable.
*
* By setting the duration to 0, one can configure this contract to behave like an asset timelock that hold tokens for
* a beneficiary until a specified time.
*/
contract VestingWallet is Context {
event EtherReleased(uint256 amount);
Expand Down Expand Up @@ -62,6 +65,13 @@ contract VestingWallet is Context {
return _duration;
}

/**
* @dev Getter for the end timestamp.
*/
function end() public view virtual returns (uint256) {
return start() + duration();
}

/**
* @dev Amount of eth already released
*/
Expand Down Expand Up @@ -136,7 +146,7 @@ contract VestingWallet is Context {
function _vestingSchedule(uint256 totalAllocation, uint64 timestamp) internal view virtual returns (uint256) {
if (timestamp < start()) {
return 0;
} else if (timestamp > start() + duration()) {
} else if (timestamp > end()) {
frangio marked this conversation as resolved.
Show resolved Hide resolved
return totalAllocation;
} else {
return (totalAllocation * (timestamp - start())) / duration();
Expand Down
4 changes: 0 additions & 4 deletions contracts/governance/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ Votes modules determine the source of voting power, and sometimes quorum number.

* {GovernorVotes}: Extracts voting weight from an {ERC20Votes}, or since v4.5 an {ERC721Votes} token.

* {GovernorVotesComp}: Extracts voting weight from a COMP-like or {ERC20VotesComp} token.

* {GovernorVotesQuorumFraction}: Combines with `GovernorVotes` to set the quorum as a fraction of the total token supply.

Counting modules determine valid voting options.
Expand Down Expand Up @@ -66,8 +64,6 @@ NOTE: Functions of the `Governor` contract do not include access control. If you

{{GovernorVotesQuorumFraction}}

{{GovernorVotesComp}}

=== Extensions

{{GovernorTimelockControl}}
Expand Down
55 changes: 0 additions & 55 deletions contracts/governance/extensions/GovernorVotesComp.sol

This file was deleted.

20 changes: 0 additions & 20 deletions contracts/mocks/governance/GovernorCompMock.sol

This file was deleted.

4 changes: 2 additions & 2 deletions contracts/mocks/governance/GovernorCompatibilityBravoMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ pragma solidity ^0.8.0;
import "../../governance/compatibility/GovernorCompatibilityBravo.sol";
import "../../governance/extensions/GovernorTimelockCompound.sol";
import "../../governance/extensions/GovernorSettings.sol";
import "../../governance/extensions/GovernorVotesComp.sol";
import "../../governance/extensions/GovernorVotes.sol";

abstract contract GovernorCompatibilityBravoMock is
GovernorCompatibilityBravo,
GovernorSettings,
GovernorTimelockCompound,
GovernorVotesComp
GovernorVotes
{
function quorum(uint256) public pure override returns (uint256) {
return 0;
Expand Down
Loading