Secure Smart Contract library for Solidity with upgradeable implementations of standards like ERC20 and ERC721, flexible role-based permissioning schemes, and reusable components for building custom contracts and complex decentralized systems.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Financial utilities including vesting wallets with linear and cliff-based release schedules for token distribution and payment management.
Linear vesting wallet that releases tokens over time.
/**
* @dev Contract that handles the vesting of Ether and ERC-20 tokens for a beneficiary
*/
contract VestingWalletUpgradeable {
function __VestingWallet_init(address beneficiaryAddress, uint64 startTimestamp, uint64 durationSeconds) internal onlyInitializing;
/**
* @dev Returns the beneficiary of the tokens
*/
function beneficiary() external view returns (address);
/**
* @dev Returns the start time of the vesting period
*/
function start() external view returns (uint256);
/**
* @dev Returns the duration of the vesting period
*/
function duration() external view returns (uint256);
/**
* @dev Returns the end time of the vesting period
*/
function end() external view returns (uint256);
/**
* @dev Amount of eth already released
*/
function released() external view returns (uint256);
/**
* @dev Amount of token already released
*/
function released(address token) external view returns (uint256);
/**
* @dev Amount of releasable eth
*/
function releasable() external view returns (uint256);
/**
* @dev Amount of releasable token
*/
function releasable(address token) external view returns (uint256);
/**
* @dev Release the native token (ether) that have already vested
*/
function release() external;
/**
* @dev Release the tokens that have already vested
*/
function release(address token) external;
/**
* @dev Calculates the amount of ether that has already vested
*/
function vestedAmount(uint64 timestamp) external view returns (uint256);
/**
* @dev Calculates the amount of tokens that has already vested
*/
function vestedAmount(address token, uint64 timestamp) external view returns (uint256);
}
// Events
event EtherReleased(uint256 amount);
event ERC20Released(address indexed token, uint256 amount);Vesting wallet with cliff period before vesting begins.
/**
* @dev Extension of VestingWallet that includes a cliff period
*/
contract VestingWalletCliffUpgradeable {
function __VestingWalletCliff_init(address beneficiaryAddress, uint64 startTimestamp, uint64 durationSeconds, uint64 cliffSeconds) internal onlyInitializing;
/**
* @dev Returns the cliff time of the vesting period
*/
function cliff() external view returns (uint256);
// Inherits all VestingWalletUpgradeable functions
}import {VestingWalletUpgradeable} from "@openzeppelin/contracts-upgradeable/finance/VestingWalletUpgradeable.sol";
contract TeamVesting is VestingWalletUpgradeable {
function initialize(
address teamMember,
uint64 vestingStart,
uint64 vestingDuration
) initializer public {
__VestingWallet_init(teamMember, vestingStart, vestingDuration);
}
// Contract can receive ETH and ERC-20 tokens
receive() external payable {}
}import {VestingWalletCliffUpgradeable} from "@openzeppelin/contracts-upgradeable/finance/VestingWalletCliffUpgradeable.sol";
contract PrivateSaleVesting is VestingWalletCliffUpgradeable {
function initialize(
address investor,
uint64 saleEnd,
uint64 vestingDuration,
uint64 cliffDuration
) initializer public {
__VestingWalletCliff_init(investor, saleEnd, vestingDuration, cliffDuration);
}
function getVestingInfo() external view returns (
address beneficiaryAddr,
uint256 startTime,
uint256 cliffTime,
uint256 endTime,
uint256 totalDuration
) {
return (
beneficiary(),
start(),
cliff(),
end(),
duration()
);
}
}Install with Tessl CLI
npx tessl i tessl/npm-openzeppelin--contracts-upgradeable