ETH Price: $3,411.31 (-7.57%)

Contract

0xaB080A16007DC2E34b99F269a0217B4e96f88813
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.2.16

Optimization Enabled:
N/A

Other Settings:
default evmVersion, MIT license

Contract Source Code (Vyper language format)

# @version 0.2.16
"""
@title Simple Vesting Escrow
@author Curve Finance, Yearn Finance
@license MIT
@notice Vests ERC20 tokens for a single address
@dev Intended to be deployed many times via `VotingEscrowFactory`
"""

from vyper.interfaces import ERC20

event Fund:
    recipient: indexed(address)
    amount: uint256

event Claim:
    recipient: indexed(address)
    claimed: uint256

event RugPull:
    recipient: address
    rugged: uint256

event CommitOwnership:
    admin: address

event ApplyOwnership:
    admin: address

recipient: public(address)
token: public(ERC20)
start_time: public(uint256)
end_time: public(uint256)
cliff_length: public(uint256)
total_locked: public(uint256)
total_claimed: public(uint256)
disabled_at: public(uint256)
initialized: public(bool)

admin: public(address)
future_admin: public(address)

@external
def __init__():
    # ensure that the original contract cannot be initialized
    self.initialized = True


@external
@nonreentrant('lock')
def initialize(
    admin: address,
    token: address,
    recipient: address,
    amount: uint256,
    start_time: uint256,
    end_time: uint256,
    cliff_length: uint256,
) -> bool:
    """
    @notice Initialize the contract.
    @dev This function is seperate from `__init__` because of the factory pattern
         used in `VestingEscrowFactory.deploy_vesting_contract`. It may be called
         once per deployment.
    @param admin Admin address
    @param token Address of the ERC20 token being distributed
    @param recipient Address to vest tokens for
    @param amount Amount of tokens being vested for `recipient`
    @param start_time Epoch time at which token distribution starts
    @param end_time Time until everything should be vested
    @param cliff_length Duration after which the first portion vests
    """
    assert not self.initialized  # dev: can only initialize once
    self.initialized = True

    self.token = ERC20(token)
    self.admin = admin
    self.start_time = start_time
    self.end_time = end_time
    self.cliff_length = cliff_length

    assert self.token.transferFrom(msg.sender, self, amount)  # dev: could not fund escrow

    self.recipient = recipient
    self.disabled_at = end_time  # Set to maximum time
    self.total_locked = amount
    log Fund(recipient, amount)

    return True


@internal
@view
def _total_vested_at(time: uint256 = block.timestamp) -> uint256:
    start: uint256 = self.start_time
    end: uint256 = self.end_time
    locked: uint256 = self.total_locked
    if time < start + self.cliff_length:
        return 0
    return min(locked * (time - start) / (end - start), locked)


@internal
@view
def _unclaimed(time: uint256 = block.timestamp) -> uint256:
    return self._total_vested_at(time) - self.total_claimed


@external
@view
def unclaimed() -> uint256:
    """
    @notice Get the number of unclaimed, vested tokens for recipient
    """
    # NOTE: if `rug_pull` is activated, limit by the activation timestamp
    return self._unclaimed(min(block.timestamp, self.disabled_at))


@internal
@view
def _locked(time: uint256 = block.timestamp) -> uint256:
    return self.total_locked - self._total_vested_at(time)


@external
@view
def locked() -> uint256:
    """
    @notice Get the number of locked tokens for recipient
    """
    # NOTE: if `rug_pull` is activated, limit by the activation timestamp
    return self._locked(min(block.timestamp, self.disabled_at))


@external
def claim(beneficiary: address = msg.sender, amount: uint256 = MAX_UINT256):
    """
    @notice Claim tokens which have vested
    @param beneficiary Address to transfer claimed tokens to
    @param amount Amount of tokens to claim
    """
    assert msg.sender == self.recipient  # dev: not recipient

    claim_period_end: uint256 = min(block.timestamp, self.disabled_at)
    claimable: uint256 = min(self._unclaimed(claim_period_end), amount)
    self.total_claimed += claimable

    assert self.token.transfer(beneficiary, claimable)
    log Claim(beneficiary, claimable)


@external
def rug_pull():
    """
    @notice Disable further flow of tokens and clawback the unvested part to admin
    """
    assert msg.sender == self.admin  # dev: admin only
    # NOTE: Rugging more than once is futile

    self.disabled_at = block.timestamp
    ruggable: uint256 = self._locked()

    assert self.token.transfer(self.admin, ruggable)
    log RugPull(self.recipient, ruggable)


@external
def commit_transfer_ownership(addr: address):
    """
    @notice Transfer ownership of the contract to `addr`
    @param addr Address to have ownership transferred to
    """
    assert msg.sender == self.admin  # dev: admin only
    self.future_admin = addr
    log CommitOwnership(addr)


@external
def apply_transfer_ownership():
    """
    @notice Apply pending ownership transfer
    """
    assert msg.sender == self.future_admin  # dev: future admin only
    self.admin = msg.sender
    self.future_admin = ZERO_ADDRESS
    log ApplyOwnership(msg.sender)


@external
def renounce_ownership():
    """
    @notice Renounce admin control of the escrow
    """
    assert msg.sender == self.admin  # dev: admin only
    self.future_admin = ZERO_ADDRESS
    self.admin = ZERO_ADDRESS
    log ApplyOwnership(ZERO_ADDRESS)

Contract Security Audit

Contract ABI

[{"name":"Fund","inputs":[{"name":"recipient","type":"address","indexed":true},{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Claim","inputs":[{"name":"recipient","type":"address","indexed":true},{"name":"claimed","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RugPull","inputs":[{"name":"recipient","type":"address","indexed":false},{"name":"rugged","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitOwnership","inputs":[{"name":"admin","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"ApplyOwnership","inputs":[{"name":"admin","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"initialize","inputs":[{"name":"admin","type":"address"},{"name":"token","type":"address"},{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"},{"name":"start_time","type":"uint256"},{"name":"end_time","type":"uint256"},{"name":"cliff_length","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":402331},{"stateMutability":"view","type":"function","name":"unclaimed","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":26060},{"stateMutability":"view","type":"function","name":"locked","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":26120},{"stateMutability":"nonpayable","type":"function","name":"claim","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"claim","inputs":[{"name":"beneficiary","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"claim","inputs":[{"name":"beneficiary","type":"address"},{"name":"amount","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"rug_pull","inputs":[],"outputs":[],"gas":72184},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"addr","type":"address"}],"outputs":[],"gas":39595},{"stateMutability":"nonpayable","type":"function","name":"apply_transfer_ownership","inputs":[],"outputs":[],"gas":59523},{"stateMutability":"nonpayable","type":"function","name":"renounce_ownership","inputs":[],"outputs":[],"gas":44555},{"stateMutability":"view","type":"function","name":"recipient","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2628},{"stateMutability":"view","type":"function","name":"token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2658},{"stateMutability":"view","type":"function","name":"start_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2688},{"stateMutability":"view","type":"function","name":"end_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2718},{"stateMutability":"view","type":"function","name":"cliff_length","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2748},{"stateMutability":"view","type":"function","name":"total_locked","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2778},{"stateMutability":"view","type":"function","name":"total_claimed","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2808},{"stateMutability":"view","type":"function","name":"disabled_at","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2838},{"stateMutability":"view","type":"function","name":"initialized","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":2868},{"stateMutability":"view","type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2898},{"stateMutability":"view","type":"function","name":"future_admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2928}]

600160095561086256600436101561000d5761067d565b600035601c526000513461085457632b4656c881141561011d5760005461085457600160005560043560a01c6108545760243560a01c6108545760443560a01c61085457600954610854576001600955602435600255600435600a5560843560035560a43560045560c435600555602061020060646323b872dd61014052336101605230610180526064356101a05261015c60006002545af11561085457601f3d11156108545760005061020051156108545760443560015560a4356008556064356006556044357fda8220a878ff7a89474ccffdaa31ea1ed1ffbb0207d5051afccc4fbaf81f9bcd61014080808060643581525050602090509050610140a26001600052600060005560206000f35b63669416b881141561017357426008548082111561013b578061013d565b815b90509050610140526101405161014051610160526101605160065801610784565b6101c052610140526101c05160005260206000f35b63cf3090128114156101c95742600854808211156101915780610193565b815b905090506101405261014051610140516101605261016051600658016107f9565b6101c052610140526101c05160005260206000f35b634e71d92d8114156102045733610140527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61016052610282565b631e83409a81141561024f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101605260043560a01c610854576020600461014037600050610282565b63aad3ec9681141561027d5760043560a01c6108545760206004610140376020602461016037600050610282565b61039f565b60015433141561085457426008548082111561029e57806102a0565b815b90509050610180526101405161016051610180516101a051610180516101c0526101c05160065801610784565b610220526101a0526101805261016052610140526102205161016051808211156102f757806102f9565b815b905090506101a052600780546101a051818183011061085457808201905090508155506020610260604463a9059cbb6101c052610140516101e0526101a051610200526101dc60006002545af11561085457601f3d111561085457600050610260511561085457610140517f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d46101c08080806101a051815250506020905090506101c0a2005b63713533b381141561046357600a54331415610854574260085561014051600658016107e3565b610160526101405261016051610140526020610200604463a9059cbb61016052600a5461018052610140516101a05261017c60006002545af11561085457601f3d1115610854576000506102005115610854577f26c39210ac9cda246a6cc6e33da67c1971d5f14bbc32e2b66c3e14ab813549d76101608080806001548152505060208101905080806101405181525050604090509050610160a1005b636b441a408114156104c35760043560a01c61085457600a5433141561085457600435600b557f2f56810a6bf40af059b96d3aea4db54081f378029a518390491093a7b67032e961014080808060043581525050602090509050610140a1005b636a1c05ae81141561051a57600b543314156108545733600a556000600b557febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a11891056101408080803381525050602090509050610140a1005b63b15e13ee81141561057357600a54331415610854576000600b556000600a557febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a1189105610140808080600081525050602090509050610140a1005b6366d003ac81141561058b5760015460005260206000f35b63fc0c546a8114156105a35760025460005260206000f35b63834ee4178114156105bb5760035460005260206000f35b63162433568114156105d35760045460005260206000f35b6394abf7608114156105eb5760055460005260206000f35b633c48a6208114156106035760065460005260206000f35b636af904c681141561061b5760075460005260206000f35b63ac1a2f698114156106335760085460005260206000f35b63158ef93e81141561064b5760095460005260206000f35b63f851a44081141561066357600a5460005260206000f35b6317f7182a81141561067b57600b5460005260206000f35b505b60006000fd610695575b6101605242610140526106ae565b6000156106ad575b61016052610140526000506106ae565b5b600354610180526004546101a0526006546101c05261018051600554818183011061085457808201905090506101405110156106f257600060005260005161016051565b6101c0516101405161018051808210610854578082039050905080820282158284830414171561085457809050905090506101a051610180518082106108545780820390509050808015610854578204905090506101c05180821115610758578061075a565b815b90509050600052600051610160515661077c575b610160524261014052610795565b600015610794575b6101605261014052600050610795565b5b61014051610160516101405161018052610180516006580161069d565b6101e05261016052610140526101e051600754808210610854578082039050905060005260005161016051566107f1575b61016052426101405261080a565b600015610809575b610160526101405260005061080a565b5b60065461014051610160516101405161018052610180516006580161069d565b6101e05261016052610140526101e051808210610854578082039050905060005260005161016051565b600080fd5b61000961086203610009600039610009610862036000f3

Deployed Bytecode

0x600436101561000d5761067d565b600035601c526000513461085457632b4656c881141561011d5760005461085457600160005560043560a01c6108545760243560a01c6108545760443560a01c61085457600954610854576001600955602435600255600435600a5560843560035560a43560045560c435600555602061020060646323b872dd61014052336101605230610180526064356101a05261015c60006002545af11561085457601f3d11156108545760005061020051156108545760443560015560a4356008556064356006556044357fda8220a878ff7a89474ccffdaa31ea1ed1ffbb0207d5051afccc4fbaf81f9bcd61014080808060643581525050602090509050610140a26001600052600060005560206000f35b63669416b881141561017357426008548082111561013b578061013d565b815b90509050610140526101405161014051610160526101605160065801610784565b6101c052610140526101c05160005260206000f35b63cf3090128114156101c95742600854808211156101915780610193565b815b905090506101405261014051610140516101605261016051600658016107f9565b6101c052610140526101c05160005260206000f35b634e71d92d8114156102045733610140527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61016052610282565b631e83409a81141561024f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101605260043560a01c610854576020600461014037600050610282565b63aad3ec9681141561027d5760043560a01c6108545760206004610140376020602461016037600050610282565b61039f565b60015433141561085457426008548082111561029e57806102a0565b815b90509050610180526101405161016051610180516101a051610180516101c0526101c05160065801610784565b610220526101a0526101805261016052610140526102205161016051808211156102f757806102f9565b815b905090506101a052600780546101a051818183011061085457808201905090508155506020610260604463a9059cbb6101c052610140516101e0526101a051610200526101dc60006002545af11561085457601f3d111561085457600050610260511561085457610140517f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d46101c08080806101a051815250506020905090506101c0a2005b63713533b381141561046357600a54331415610854574260085561014051600658016107e3565b610160526101405261016051610140526020610200604463a9059cbb61016052600a5461018052610140516101a05261017c60006002545af11561085457601f3d1115610854576000506102005115610854577f26c39210ac9cda246a6cc6e33da67c1971d5f14bbc32e2b66c3e14ab813549d76101608080806001548152505060208101905080806101405181525050604090509050610160a1005b636b441a408114156104c35760043560a01c61085457600a5433141561085457600435600b557f2f56810a6bf40af059b96d3aea4db54081f378029a518390491093a7b67032e961014080808060043581525050602090509050610140a1005b636a1c05ae81141561051a57600b543314156108545733600a556000600b557febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a11891056101408080803381525050602090509050610140a1005b63b15e13ee81141561057357600a54331415610854576000600b556000600a557febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a1189105610140808080600081525050602090509050610140a1005b6366d003ac81141561058b5760015460005260206000f35b63fc0c546a8114156105a35760025460005260206000f35b63834ee4178114156105bb5760035460005260206000f35b63162433568114156105d35760045460005260206000f35b6394abf7608114156105eb5760055460005260206000f35b633c48a6208114156106035760065460005260206000f35b636af904c681141561061b5760075460005260206000f35b63ac1a2f698114156106335760085460005260206000f35b63158ef93e81141561064b5760095460005260206000f35b63f851a44081141561066357600a5460005260206000f35b6317f7182a81141561067b57600b5460005260206000f35b505b60006000fd610695575b6101605242610140526106ae565b6000156106ad575b61016052610140526000506106ae565b5b600354610180526004546101a0526006546101c05261018051600554818183011061085457808201905090506101405110156106f257600060005260005161016051565b6101c0516101405161018051808210610854578082039050905080820282158284830414171561085457809050905090506101a051610180518082106108545780820390509050808015610854578204905090506101c05180821115610758578061075a565b815b90509050600052600051610160515661077c575b610160524261014052610795565b600015610794575b6101605261014052600050610795565b5b61014051610160516101405161018052610180516006580161069d565b6101e05261016052610140526101e051600754808210610854578082039050905060005260005161016051566107f1575b61016052426101405261080a565b600015610809575b610160526101405260005061080a565b5b60065461014051610160516101405161018052610180516006580161069d565b6101e05261016052610140526101e051808210610854578082039050905060005260005161016051565b600080fd

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.