Finance
| This document is better viewed at https://docs.openzeppelin.com/contracts/api/finance | 
This directory includes primitives for financial systems:
- 
PaymentSplitterallows 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. - 
VestingWallethandles 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 
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware that the Ether 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. The way this is specified is by assigning each account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the time of contract deployment and can’t be updated thereafter.
PaymentSplitter follows a pull payment model. This means that payments are not automatically forwarded to the
accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the release
function.
| This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you to run tests before sending real value to this contract. | 
constructor(address[] payees, uint256[] shares_) public
Creates an instance of PaymentSplitter where each account in payees is assigned the number of shares at
the matching position in the shares array.
All addresses in payees must be non-zero. Both arrays must have the same non-zero length, and there must be no
duplicates in payees.
receive() external
The Ether received will be logged with PaymentReceived events. Note that these events are not fully
reliable: it’s possible for a contract to receive Ether without triggering this function. This only affects the
reliability of the events, and not the actual splitting of Ether.
To learn more about this see the Solidity documentation for fallback functions.
totalReleased(contract IERC20 token) → uint256 public
Getter for the total amount of token already released. token should be the address of an IERC20
contract.
released(address account) → uint256 public
Getter for the amount of Ether already released to a payee.
released(contract IERC20 token, address account) → uint256 public
Getter for the amount of token tokens already released to a payee. token should be the address of an
IERC20 contract.
releasable(contract IERC20 token, address account) → uint256 public
Getter for the amount of payee’s releasable token tokens. token should be the address of an
IERC20 contract.
release(address payable account) public
Triggers a transfer to account of the amount of Ether they are owed, according to their percentage of the
total shares and their previous withdrawals.
VestingWallet 
import "@openzeppelin/contracts/finance/VestingWallet.sol";
This contract handles the vesting of Eth 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 vesting schedule.
The vesting schedule is customizable through the vestedAmount function.
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.
constructor(address beneficiaryAddress, uint64 startTimestamp, uint64 durationSeconds) public
Set the beneficiary, start timestamp and vesting duration of the vesting wallet.
releasable(address token) → uint256 public
Getter for the amount of releasable token tokens. token should be the address of an
IERC20 contract.
release() public
Release the native token (ether) that have already vested.
Emits a EtherReleased event.
release(address token) public
Release the tokens that have already vested.
Emits a ERC20Released event.
vestedAmount(uint64 timestamp) → uint256 public
Calculates the amount of ether that has already vested. Default implementation is a linear vesting curve.
vestedAmount(address token, uint64 timestamp) → uint256 public
Calculates the amount of tokens that has already vested. Default implementation is a linear vesting curve.