Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
Vesting Escrow Factory
Compiler Version
vyper:0.3.7
Contract Source Code (Vyper language format)
# @version 0.3.7 """ @title Vesting Escrow Factory @author Curve Finance, Yearn Finance, Lido Finance @license GPL-3.0 @notice Stores and distributes ERC20 tokens by deploying `VestingEscrow` contracts """ from vyper.interfaces import ERC20 interface IVestingEscrow: def initialize( token: address, amount: uint256, recipient: address, start_time: uint256, end_time: uint256, cliff_length: uint256, is_fully_revokable: bool, voting_adapter_addr: address, ) -> bool: nonpayable event VestingEscrowCreated: creator: indexed(address) recipient: indexed(address) escrow: address event ERC20Recovered: token: address amount: uint256 event ETHRecovered: amount: uint256 event VotingAdapterUpgraded: voting_adapter: address event OwnerChanged: owner: address event ManagerChanged: manager: address TARGET: immutable(address) TOKEN: immutable(address) voting_adapter: public(address) owner: public(address) manager: public(address) @external def __init__( target: address, token: address, owner: address, manager: address, voting_adapter: address, ): """ @notice Contract constructor @dev Prior to deployment you must deploy one copy of `VestingEscrow` which is used as a library for vesting contracts deployed by this factory @param target `VestingEscrow` contract address @param token Address of the ERC20 token being distributed using escrows @param owner Address of the owner of the deployed escrows @param manager Address of the manager of the deployed escrows @param voting_adapter Address of the Lido Voting Adapter """ assert target != empty(address), "zero target" assert owner != empty(address), "zero owner" assert token != empty(address), "zero token" TARGET = target TOKEN = token self.owner = owner self.manager = manager self.voting_adapter = voting_adapter @external def deploy_vesting_contract( amount: uint256, recipient: address, vesting_duration: uint256, vesting_start: uint256 = block.timestamp, cliff_length: uint256 = 0, is_fully_revokable: bool = False, # use ordinary escrow by default ) -> address: """ @notice Deploy and fund a new vesting contract @param amount Amount of the tokens to be vested after fundings @param recipient Address to vest tokens for @param vesting_duration Time period over which tokens are released @param vesting_start Epoch time when tokens begin to vest @param cliff_length Duration after which the first portion vests @param is_fully_revokable Fully revockable flag """ assert vesting_duration > 0, "incorrect vesting duration" assert cliff_length <= vesting_duration, "incorrect vesting cliff" assert recipient != empty(address), "zero recipient" assert amount > 0, "incorrect amount" escrow: address = create_minimal_proxy_to(TARGET) assert ERC20(TOKEN).transferFrom( msg.sender, escrow, amount, default_return_value=True ), "transferFrom deployer to escrow failed" IVestingEscrow(escrow).initialize( TOKEN, amount, recipient, vesting_start, vesting_start + vesting_duration, cliff_length, is_fully_revokable, self, ) log VestingEscrowCreated( msg.sender, recipient, escrow, ) return escrow @external def recover_erc20(token: address, amount: uint256): """ @notice Recover ERC20 tokens to owner @param token Address of the ERC20 token to be recovered """ if amount != 0: assert ERC20(token).transfer( self.owner, amount, default_return_value=True ), "transfer failed" log ERC20Recovered(token, amount) @external def recover_ether(): """ @notice Recover Ether to owner """ amount: uint256 = self.balance if amount != 0: self._safe_send_ether(self.owner, amount) log ETHRecovered(amount) @external def update_voting_adapter(voting_adapter: address): """ @notice Update voting_adapter to be used by vestings @param voting_adapter Address of the new VotingAdapter implementation """ self._check_sender_is_owner() self.voting_adapter = voting_adapter log VotingAdapterUpgraded(voting_adapter) @external def change_owner(owner: address): """ @notice Change contract owner. @param owner Address of the new owner. Must be non-zero. """ self._check_sender_is_owner() assert owner != empty(address), "zero owner address" self.owner = owner log OwnerChanged(owner) @external def change_manager(manager: address): """ @notice Set contract manager. Can update manager if it is already set. Can be called only by the owner. @param manager Address of the new manager """ self._check_sender_is_owner() self.manager = manager log ManagerChanged(manager) @external @view def token() -> address: return TOKEN @external @view def target() -> address: return TARGET @internal def _check_sender_is_owner(): assert msg.sender == self.owner, "msg.sender not owner" @internal def _safe_send_ether(_to: address, _value: uint256): """ @notice Overcome 2300 gas limit on simple send """ _response: Bytes[32] = raw_call( _to, empty(bytes32), value=_value, max_outsize=32 ) if len(_response) > 0: assert convert(_response, bool), "ETH transfer failed"
[{"name":"VestingEscrowCreated","inputs":[{"name":"creator","type":"address","indexed":true},{"name":"recipient","type":"address","indexed":true},{"name":"escrow","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"ERC20Recovered","inputs":[{"name":"token","type":"address","indexed":false},{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"ETHRecovered","inputs":[{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"VotingAdapterUpgraded","inputs":[{"name":"voting_adapter","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"OwnerChanged","inputs":[{"name":"owner","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"ManagerChanged","inputs":[{"name":"manager","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"target","type":"address"},{"name":"token","type":"address"},{"name":"owner","type":"address"},{"name":"manager","type":"address"},{"name":"voting_adapter","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"deploy_vesting_contract","inputs":[{"name":"amount","type":"uint256"},{"name":"recipient","type":"address"},{"name":"vesting_duration","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"deploy_vesting_contract","inputs":[{"name":"amount","type":"uint256"},{"name":"recipient","type":"address"},{"name":"vesting_duration","type":"uint256"},{"name":"vesting_start","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"deploy_vesting_contract","inputs":[{"name":"amount","type":"uint256"},{"name":"recipient","type":"address"},{"name":"vesting_duration","type":"uint256"},{"name":"vesting_start","type":"uint256"},{"name":"cliff_length","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"deploy_vesting_contract","inputs":[{"name":"amount","type":"uint256"},{"name":"recipient","type":"address"},{"name":"vesting_duration","type":"uint256"},{"name":"vesting_start","type":"uint256"},{"name":"cliff_length","type":"uint256"},{"name":"is_fully_revokable","type":"bool"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"recover_erc20","inputs":[{"name":"token","type":"address"},{"name":"amount","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"recover_ether","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"update_voting_adapter","inputs":[{"name":"voting_adapter","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"change_owner","inputs":[{"name":"owner","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"change_manager","inputs":[{"name":"manager","type":"address"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"token","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"target","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"voting_adapter","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"manager","inputs":[],"outputs":[{"name":"","type":"address"}]}]
Contract Creation Code
6020610b5c6000396000518060a01c610b57576040526020610b7c6000396000518060a01c610b57576060526020610b9c6000396000518060a01c610b57576080526020610bbc6000396000518060a01c610b575760a0526020610bdc6000396000518060a01c610b575760c05234610b57576040516100d857600b60e0527f7a65726f207461726765740000000000000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b60805161013e57600a60e0527f7a65726f206f776e6572000000000000000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b6060516101a457600a60e0527f7a65726f20746f6b656e000000000000000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b604051610980526060516109a05260805160015560a05160025560c0516000556109806101d6610000396109c0610000f36003361161000c5761083c565b60003560e01c3461096e5763f90795678118610039576064361061096e57426060526040366080376100aa565b639ec5cc74811861005d576084361061096e576064356060526040366080376100aa565b6354eb54c781186100815760a4361061096e5760406064606037600060a0526100aa565b63bb89e57d81186104865760c4361061096e576040606460603760a4358060011c61096e5760a0525b6024358060a01c61096e5760405260443561011c57601a60c0527f696e636f72726563742076657374696e67206475726174696f6e00000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b604435608051111561018557601760c0527f696e636f72726563742076657374696e6720636c69666600000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b6040516101e957600e60c0527f7a65726f20726563697069656e7400000000000000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b60043561024d57601060c0527f696e636f727265637420616d6f756e740000000000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b7f602d3d8160093d39f3363d3d373d3d3d363d730000000000000000000000000060e052602061098060003960005160601b60f3527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000061010752603660e06000f0801561096e5760c05260206109a06000396000516323b872dd60e052336101005260c0516101205260043561014052602060e0606460fc6000855af16102f9573d600060003e3d6000fd5b3d61031057803b1561096e57600161016052610328565b60203d1061096e5760e0518060011c61096e57610160525b6101609050516103bd576026610180527f7472616e7366657246726f6d206465706c6f79657220746f20657363726f77206101a0527f6661696c656400000000000000000000000000000000000000000000000000006101c0526101805061018051806101a001601f826000031636823750506308c379a061014052602061016052601f19601f61018051011660440161015cfd5b60c051633d4da16d60e05260206109a06000396000516101005260043561012052604051610140526060516101605260605160443580820182811061096e5790509050610180526080516101a05260a0516101c052306101e052602060e061010460fc6000855af1610434573d600060003e3d6000fd5b60203d1061096e5760e0518060011c61096e57610200526102005050604051337f659e7063929179b65f98fbe698cafb1002b78dce1bc9d24be13c2db289d9dd4760c05160e052602060e0a3602060c0f35b6323a50d3c81186105ac576044361061096e576004358060a01c61096e57604052602435156105aa5760405163a9059cbb60605260015460805260243560a052602060606044607c6000855af16104e2573d600060003e3d6000fd5b3d6104f857803b1561096e57600160c05261050f565b60203d1061096e576060518060011c61096e5760c0525b60c090505161057757600f60e0527f7472616e73666572206661696c656400000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b7f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799960405160605260243560805260406060a15b005b63644613468118610614576004361061096e574761012052610120511561061257600154604052610120516060526105e2610842565b7f0296f2c4dbc8c0e53c0ffab63f84aeebd5c28aa143475a37346bf15ac003f32761012051610140526020610140a15b005b6341ae7c0c8118610671576024361061096e576004358060a01c61096e5760805261063d610905565b6080516000557fff77725eff1df9ae1e638351c3d1a3801f223349bb7cf17735fd580813cfc0f960805160a052602060a0a1005b63253c8bd48118610732576024361061096e576004358060a01c61096e5760805261069a610905565b6080516106fe57601260a0527f7a65726f206f776e65722061646472657373000000000000000000000000000060c05260a05060a0518060c001601f826000031636823750506308c379a06060526020608052601f19601f60a0510116604401607cfd5b6080516001557fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf3660805160a052602060a0a1005b63e87f26bd811861078f576024361061096e576004358060a01c61096e5760805261075b610905565b6080516002557f198db6e425fb8aafd1823c6ca50be2d51e5764571a5ae0f0f21c6812e45def0b60805160a052602060a0a1005b63fc0c546a81186107b6576004361061096e5760206109a060003960005160405260206040f35b63d4b8399281186107dd576004361061096e57602061098060003960005160405260206040f35b6336e4461281186107fc576004361061096e5760005460405260206040f35b638da5cb5b811861081b576004361061096e5760015460405260206040f35b63481c6a75811861083a576004361061096e5760025460405260206040f35b505b60006000fd5b600060c05260c050602061010060c05160e06060516040515af161086b573d600060003e3d6000fd5b3d602081183d602010021860e05260e080518060805260208201805160a052505050608051156109035760a05160805160200360031b1c61090357601360c0527f455448207472616e73666572206661696c65640000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b565b60015433181561096c5760146040527f6d73672e73656e646572206e6f74206f776e657200000000000000000000000060605260405060405180606001601f826000031636823750506308c379a06000526020602052601f19601f6040510116604401601cfd5b565b600080fda165767970657283000307000b005b600080fd000000000000000000000000b8c6ab52b9491fcef27f6c313768cfe966a3cfbd00000000000000000000000014ae7daeecdf57034f3e9db8564e46dba8d97344000000000000000000000000e92329ec7ddb11d25e25b3c21eebf11f15eb325d00000000000000000000000096d2ff1c4d30f592b91fd731e218247689a76915000000000000000000000000c911398c001e400ba0ad62518909863465bab35e
Deployed Bytecode
0x6003361161000c5761083c565b60003560e01c3461096e5763f90795678118610039576064361061096e57426060526040366080376100aa565b639ec5cc74811861005d576084361061096e576064356060526040366080376100aa565b6354eb54c781186100815760a4361061096e5760406064606037600060a0526100aa565b63bb89e57d81186104865760c4361061096e576040606460603760a4358060011c61096e5760a0525b6024358060a01c61096e5760405260443561011c57601a60c0527f696e636f72726563742076657374696e67206475726174696f6e00000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b604435608051111561018557601760c0527f696e636f72726563742076657374696e6720636c69666600000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b6040516101e957600e60c0527f7a65726f20726563697069656e7400000000000000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b60043561024d57601060c0527f696e636f727265637420616d6f756e740000000000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b7f602d3d8160093d39f3363d3d373d3d3d363d730000000000000000000000000060e052602061098060003960005160601b60f3527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000061010752603660e06000f0801561096e5760c05260206109a06000396000516323b872dd60e052336101005260c0516101205260043561014052602060e0606460fc6000855af16102f9573d600060003e3d6000fd5b3d61031057803b1561096e57600161016052610328565b60203d1061096e5760e0518060011c61096e57610160525b6101609050516103bd576026610180527f7472616e7366657246726f6d206465706c6f79657220746f20657363726f77206101a0527f6661696c656400000000000000000000000000000000000000000000000000006101c0526101805061018051806101a001601f826000031636823750506308c379a061014052602061016052601f19601f61018051011660440161015cfd5b60c051633d4da16d60e05260206109a06000396000516101005260043561012052604051610140526060516101605260605160443580820182811061096e5790509050610180526080516101a05260a0516101c052306101e052602060e061010460fc6000855af1610434573d600060003e3d6000fd5b60203d1061096e5760e0518060011c61096e57610200526102005050604051337f659e7063929179b65f98fbe698cafb1002b78dce1bc9d24be13c2db289d9dd4760c05160e052602060e0a3602060c0f35b6323a50d3c81186105ac576044361061096e576004358060a01c61096e57604052602435156105aa5760405163a9059cbb60605260015460805260243560a052602060606044607c6000855af16104e2573d600060003e3d6000fd5b3d6104f857803b1561096e57600160c05261050f565b60203d1061096e576060518060011c61096e5760c0525b60c090505161057757600f60e0527f7472616e73666572206661696c656400000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b7f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799960405160605260243560805260406060a15b005b63644613468118610614576004361061096e574761012052610120511561061257600154604052610120516060526105e2610842565b7f0296f2c4dbc8c0e53c0ffab63f84aeebd5c28aa143475a37346bf15ac003f32761012051610140526020610140a15b005b6341ae7c0c8118610671576024361061096e576004358060a01c61096e5760805261063d610905565b6080516000557fff77725eff1df9ae1e638351c3d1a3801f223349bb7cf17735fd580813cfc0f960805160a052602060a0a1005b63253c8bd48118610732576024361061096e576004358060a01c61096e5760805261069a610905565b6080516106fe57601260a0527f7a65726f206f776e65722061646472657373000000000000000000000000000060c05260a05060a0518060c001601f826000031636823750506308c379a06060526020608052601f19601f60a0510116604401607cfd5b6080516001557fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf3660805160a052602060a0a1005b63e87f26bd811861078f576024361061096e576004358060a01c61096e5760805261075b610905565b6080516002557f198db6e425fb8aafd1823c6ca50be2d51e5764571a5ae0f0f21c6812e45def0b60805160a052602060a0a1005b63fc0c546a81186107b6576004361061096e5760206109a060003960005160405260206040f35b63d4b8399281186107dd576004361061096e57602061098060003960005160405260206040f35b6336e4461281186107fc576004361061096e5760005460405260206040f35b638da5cb5b811861081b576004361061096e5760015460405260206040f35b63481c6a75811861083a576004361061096e5760025460405260206040f35b505b60006000fd5b600060c05260c050602061010060c05160e06060516040515af161086b573d600060003e3d6000fd5b3d602081183d602010021860e05260e080518060805260208201805160a052505050608051156109035760a05160805160200360031b1c61090357601360c0527f455448207472616e73666572206661696c65640000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b565b60015433181561096c5760146040527f6d73672e73656e646572206e6f74206f776e657200000000000000000000000060605260405060405180606001601f826000031636823750506308c379a06000526020602052601f19601f6040510116604401601cfd5b565b600080fda165767970657283000307000b000000000000000000000000b8c6ab52b9491fcef27f6c313768cfe966a3cfbd00000000000000000000000014ae7daeecdf57034f3e9db8564e46dba8d97344
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b8c6ab52b9491fcef27f6c313768cfe966a3cfbd00000000000000000000000014ae7daeecdf57034f3e9db8564e46dba8d97344000000000000000000000000e92329ec7ddb11d25e25b3c21eebf11f15eb325d00000000000000000000000096d2ff1c4d30f592b91fd731e218247689a76915000000000000000000000000c911398c001e400ba0ad62518909863465bab35e
-----Decoded View---------------
Arg [0] : target (address): 0xb8c6aB52b9491FcEf27F6c313768CFe966a3CFBd
Arg [1] : token (address): 0x14ae7daeecdf57034f3E9db8564e46Dba8D97344
Arg [2] : owner (address): 0xE92329EC7ddB11D25e25b3c21eeBf11f15eB325d
Arg [3] : manager (address): 0x96d2Ff1C4D30f592B91fd731E218247689a76915
Arg [4] : voting_adapter (address): 0xC911398C001E400ba0Ad62518909863465BAb35e
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000b8c6ab52b9491fcef27f6c313768cfe966a3cfbd
Arg [1] : 00000000000000000000000014ae7daeecdf57034f3e9db8564e46dba8d97344
Arg [2] : 000000000000000000000000e92329ec7ddb11d25e25b3c21eebf11f15eb325d
Arg [3] : 00000000000000000000000096d2ff1c4d30f592b91fd731e218247689a76915
Arg [4] : 000000000000000000000000c911398c001e400ba0ad62518909863465bab35e
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.