Contract 0xe35a879e5efb4f1bb7f70dcf3250f2e19f096bd8 3

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7dd8fced64cb6da3121d74fa7466da3c1650135f09e55cb987a3826d3961a9780x6001600983368922022-03-22 21:18:59191 days 19 hrs ago0x71f718d3e4d1449d1502a6a7595eb84ebccb1683 IN  Create: Vyper_contract0 ETH0.00431517022 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.3.1

Optimization Enabled:
N/A

Other Settings:
, None license

Contract Source Code (Vyper language format)

# @version 0.3.1
"""
@title Curve LP Token V5
@author Curve.Fi
@notice Base implementation for an LP token provided for supplying liquidity
@dev Follows the ERC-20 token standard as defined at https://eips.ethereum.org/EIPS/eip-20
"""
from vyper.interfaces import ERC20

implements: ERC20


interface ERC1271:
    def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view


event Approval:
    _owner: indexed(address)
    _spender: indexed(address)
    _value: uint256

event Transfer:
    _from: indexed(address)
    _to: indexed(address)
    _value: uint256


EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
PERMIT_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")

# keccak256("isValidSignature(bytes32,bytes)")[:4] << 224
ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000
VERSION: constant(String[8]) = "v5.0.0"


name: public(String[64])
symbol: public(String[32])
DOMAIN_SEPARATOR: public(bytes32)

balanceOf: public(HashMap[address, uint256])
allowance: public(HashMap[address, HashMap[address, uint256]])
totalSupply: public(uint256)

minter: public(address)
nonces: public(HashMap[address, uint256])


@external
def __init__():
    self.minter = 0x0000000000000000000000000000000000000001


@external
def transfer(_to: address, _value: uint256) -> bool:
    """
    @dev Transfer token for a specified address
    @param _to The address to transfer to.
    @param _value The amount to be transferred.
    """
    # NOTE: vyper does not allow underflows
    #       so the following subtraction would revert on insufficient balance
    self.balanceOf[msg.sender] -= _value
    self.balanceOf[_to] += _value

    log Transfer(msg.sender, _to, _value)
    return True


@external
def transferFrom(_from: address, _to: address, _value: uint256) -> bool:
    """
     @dev Transfer tokens from one address to another.
     @param _from address The address which you want to send tokens from
     @param _to address The address which you want to transfer to
     @param _value uint256 the amount of tokens to be transferred
    """
    self.balanceOf[_from] -= _value
    self.balanceOf[_to] += _value

    _allowance: uint256 = self.allowance[_from][msg.sender]
    if _allowance != MAX_UINT256:
        self.allowance[_from][msg.sender] = _allowance - _value

    log Transfer(_from, _to, _value)
    return True


@external
def approve(_spender: address, _value: uint256) -> bool:
    """
    @notice Approve the passed address to transfer the specified amount of
            tokens on behalf of msg.sender
    @dev Beware that changing an allowance via this method brings the risk
         that someone may use both the old and new allowance by unfortunate
         transaction ordering. This may be mitigated with the use of
         {increaseAllowance} and {decreaseAllowance}.
         https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
    @param _spender The address which will transfer the funds
    @param _value The amount of tokens that may be transferred
    @return bool success
    """
    self.allowance[msg.sender][_spender] = _value

    log Approval(msg.sender, _spender, _value)
    return True


@external
def permit(
    _owner: address,
    _spender: address,
    _value: uint256,
    _deadline: uint256,
    _v: uint8,
    _r: bytes32,
    _s: bytes32
) -> bool:
    """
    @notice Approves spender by owner's signature to expend owner's tokens.
        See https://eips.ethereum.org/EIPS/eip-2612.
    @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793
    @dev Supports smart contract wallets which implement ERC1271
        https://eips.ethereum.org/EIPS/eip-1271
    @param _owner The address which is a source of funds and has signed the Permit.
    @param _spender The address which is allowed to spend the funds.
    @param _value The amount of tokens to be spent.
    @param _deadline The timestamp after which the Permit is no longer valid.
    @param _v The bytes[64] of the valid secp256k1 signature of permit by owner
    @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner
    @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner
    @return True, if transaction completes successfully
    """
    assert _owner != ZERO_ADDRESS
    assert block.timestamp <= _deadline

    nonce: uint256 = self.nonces[_owner]
    digest: bytes32 = keccak256(
        concat(
            b"\x19\x01",
            self.DOMAIN_SEPARATOR,
            keccak256(_abi_encode(PERMIT_TYPEHASH, _owner, _spender, _value, nonce, _deadline))
        )
    )

    if _owner.is_contract:
        sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1))
        # reentrancy not a concern since this is a staticcall
        assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL
    else:
        assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner

    self.allowance[_owner][_spender] = _value
    self.nonces[_owner] = nonce + 1

    log Approval(_owner, _spender, _value)
    return True


@external
def increaseAllowance(_spender: address, _added_value: uint256) -> bool:
    """
    @notice Increase the allowance granted to `_spender` by the caller
    @dev This is alternative to {approve} that can be used as a mitigation for
         the potential race condition
    @param _spender The address which will transfer the funds
    @param _added_value The amount of to increase the allowance
    @return bool success
    """
    allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value
    self.allowance[msg.sender][_spender] = allowance

    log Approval(msg.sender, _spender, allowance)
    return True


@external
def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool:
    """
    @notice Decrease the allowance granted to `_spender` by the caller
    @dev This is alternative to {approve} that can be used as a mitigation for
         the potential race condition
    @param _spender The address which will transfer the funds
    @param _subtracted_value The amount of to decrease the allowance
    @return bool success
    """
    allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value
    self.allowance[msg.sender][_spender] = allowance

    log Approval(msg.sender, _spender, allowance)
    return True


@external
def mint(_to: address, _value: uint256) -> bool:
    """
    @dev Mint an amount of the token and assigns it to an account.
         This encapsulates the modification of balances such that the
         proper events are emitted.
    @param _to The account that will receive the created tokens.
    @param _value The amount that will be created.
    """
    assert msg.sender == self.minter

    self.totalSupply += _value
    self.balanceOf[_to] += _value

    log Transfer(ZERO_ADDRESS, _to, _value)
    return True


@external
def mint_relative(_to: address, frac: uint256) -> uint256:
    """
    @dev Increases supply by factor of (1 + frac/1e18) and mints it for _to
    """
    assert msg.sender == self.minter

    supply: uint256 = self.totalSupply
    d_supply: uint256 = supply * frac / 10**18
    if d_supply > 0:
        self.totalSupply = supply + d_supply
        self.balanceOf[_to] += d_supply
        log Transfer(ZERO_ADDRESS, _to, d_supply)

    return d_supply


@external
def burnFrom(_to: address, _value: uint256) -> bool:
    """
    @dev Burn an amount of the token from a given account.
    @param _to The account whose tokens will be burned.
    @param _value The amount that will be burned.
    """
    assert msg.sender == self.minter

    self.totalSupply -= _value
    self.balanceOf[_to] -= _value

    log Transfer(_to, ZERO_ADDRESS, _value)
    return True


@view
@external
def decimals() -> uint8:
    """
    @notice Get the number of decimals for this token
    @dev Implemented as a view method to reduce gas costs
    @return uint8 decimal places
    """
    return 18


@view
@external
def version() -> String[8]:
    """
    @notice Get the version of this token contract
    """
    return VERSION


@external
def initialize(_name: String[64], _symbol: String[32], _pool: address):
    assert self.minter == ZERO_ADDRESS  # dev: check that we call it from factory

    self.name = _name
    self.symbol = _symbol
    self.minter = _pool

    self.DOMAIN_SEPARATOR = keccak256(
        _abi_encode(EIP712_TYPEHASH, keccak256(_name), keccak256(VERSION), chain.id, self)
    )

    # fire a transfer event so block explorers identify the contract as an ERC20
    log Transfer(ZERO_ADDRESS, msg.sender, 0)

Contract ABI

[{"name":"Approval","inputs":[{"name":"_owner","type":"address","indexed":true},{"name":"_spender","type":"address","indexed":true},{"name":"_value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Transfer","inputs":[{"name":"_from","type":"address","indexed":true},{"name":"_to","type":"address","indexed":true},{"name":"_value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"transfer","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":78632},{"stateMutability":"nonpayable","type":"function","name":"transferFrom","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":116616},{"stateMutability":"nonpayable","type":"function","name":"approve","inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":39151},{"stateMutability":"nonpayable","type":"function","name":"permit","inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_deadline","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"outputs":[{"name":"","type":"bool"}],"gas":102221},{"stateMutability":"nonpayable","type":"function","name":"increaseAllowance","inputs":[{"name":"_spender","type":"address"},{"name":"_added_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":41711},{"stateMutability":"nonpayable","type":"function","name":"decreaseAllowance","inputs":[{"name":"_spender","type":"address"},{"name":"_subtracted_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":41737},{"stateMutability":"nonpayable","type":"function","name":"mint","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":80902},{"stateMutability":"nonpayable","type":"function","name":"mint_relative","inputs":[{"name":"_to","type":"address"},{"name":"frac","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":81224},{"stateMutability":"nonpayable","type":"function","name":"burnFrom","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"gas":80954},{"stateMutability":"view","type":"function","name":"decimals","inputs":[],"outputs":[{"name":"","type":"uint8"}],"gas":630},{"stateMutability":"view","type":"function","name":"version","inputs":[],"outputs":[{"name":"","type":"string"}],"gas":6287},{"stateMutability":"nonpayable","type":"function","name":"initialize","inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_pool","type":"address"}],"outputs":[],"gas":259459},{"stateMutability":"view","type":"function","name":"name","inputs":[],"outputs":[{"name":"","type":"string"}],"gas":13109},{"stateMutability":"view","type":"function","name":"symbol","inputs":[],"outputs":[{"name":"","type":"string"}],"gas":10868},{"stateMutability":"view","type":"function","name":"DOMAIN_SEPARATOR","inputs":[],"outputs":[{"name":"","type":"bytes32"}],"gas":2880},{"stateMutability":"view","type":"function","name":"balanceOf","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"gas":3176},{"stateMutability":"view","type":"function","name":"allowance","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"gas":3472},{"stateMutability":"view","type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2970},{"stateMutability":"view","type":"function","name":"minter","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3000},{"stateMutability":"view","type":"function","name":"nonces","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"gas":3296}]

6001600955610e1a56600436101561000d57610e06565b60046000601c3760005134610e0c5763a9059cbb81186100c0576004358060a01c610e0c5760e05260063360a05260805260406080208054602435808210610e0c5780820390509050815550600660e05160a052608052604060802080546024358181830110610e0c578082019050905081555060e051337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602435610100526020610100a36001610100526020610100f35b6323b872dd81186101f7576004358060a01c610e0c5760e0526024358060a01c610e0c5761010052600660e05160a05260805260406080208054604435808210610e0c578082039050905081555060066101005160a052608052604060802080546044358181830110610e0c5780820190509050815550600760e05160a05260805260406080203360a052608052604060802054610120527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61012051146101b55761012051604435808210610e0c5780820390509050600760e05160a05260805260406080203360a0526080526040608020555b6101005160e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef604435610140526020610140a36001610140526020610140f35b63095ea7b3811861026f576004358060a01c610e0c5760e05260243560073360a052608052604060802060e05160a05260805260406080205560e051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602435610100526020610100a36001610100526020610100f35b63d505accf81186105dc576004358060a01c610e0c5760e0526024358060a01c610e0c57610100526084358060081c610e0c5761012052600060e05114610e0c576064354211610e0c57600a60e05160a0526080526040608020546101405260006002610400527f1901000000000000000000000000000000000000000000000000000000000000610420526104006002806020846106000101826020850160045afa5050805182019150506005546020826106000101526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c96105405260e0516105605261010051610580526044356105a052610140516105c0526064356105e05260c0610520526105208051602082012090506020826106000101526020810190508061060052610600905080516020820120905061016052600060e0513b116103f05760e0516101605161018052610120516101a052604060a46101c03760206080608061018060015afa5060805118610e0c57610550565b600060a4356102205260c435610240526040610200526102006040806020846102c00101826020850160045afa505080518201915050601f60016020820661026001602082840111610e0c576020806102808261012060045afa5050818152905090506001806020846102c00101826020850160045afa505080518201915050806102c0526102c09050805160200180610180828460045afa905050507f1626ba7e00000000000000000000000000000000000000000000000000000000631626ba7e610200526102208060406101605182526020820191508082528083018061018080516020018083828460045afa905050508051806020830101818260206001820306601f8201039050033682375050805160200160206001820306601f820103905090509050810150505050602061020060c461021c60e0515afa61053d573d600060003e3d6000fd5b601f3d1115610e0c576102005118610e0c575b604435600760e05160a05260805260406080206101005160a0526080526040608020556101405160018181830110610e0c5780820190509050600a60e05160a0526080526040608020556101005160e0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925604435610180526020610180a36001610180526020610180f35b6339509351811861068a576004358060a01c610e0c5760e05260073360a052608052604060802060e05160a0526080526040608020546024358181830110610e0c5780820190509050610100526101005160073360a052608052604060802060e05160a05260805260406080205560e051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561010051610120526020610120a36001610120526020610120f35b63a457c2d78118610736576004358060a01c610e0c5760e05260073360a052608052604060802060e05160a052608052604060802054602435808210610e0c5780820390509050610100526101005160073360a052608052604060802060e05160a05260805260406080205560e051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561010051610120526020610120a36001610120526020610120f35b6340c10f1981186107da576004358060a01c610e0c5760e0526009543318610e0c57600880546024358181830110610e0c5780820190509050815550600660e05160a052608052604060802080546024358181830110610e0c578082019050905081555060e05160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602435610100526020610100a36001610100526020610100f35b636962f84581186108c6576004358060a01c610e0c5760e0526009543318610e0c576008546101005261010051602435808202821582848304141715610e0c5790509050670de0b6b3a7640000808204905090506101205260006101205111156108b75761010051610120518181830110610e0c5780820190509050600855600660e05160a05260805260406080208054610120518181830110610e0c578082019050905081555060e05160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61012051610140526020610140a35b61012051610140526020610140f35b6379cc67908118610966576004358060a01c610e0c5760e0526009543318610e0c5760088054602435808210610e0c5780820390509050815550600660e05160a05260805260406080208054602435808210610e0c5780820390509050815550600060e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602435610100526020610100a36001610100526020610100f35b63313ce567811861097c57601260e052602060e0f35b6354fd4d508118610a1657610120806020808252600660e0527f76352e302e3000000000000000000000000000000000000000000000000000006101005260e0818401808280516020018083828460045afa905050508051806020830101818260206001820306601f8201039050033682375050805160200160206001820306601f82010390509050905090508101905090509050610120f35b63077f224a8118610bbc576004356004016040813511610e0c57808035602001808260e0375050506024356004016020813511610e0c578080356020018082610140375050506044358060a01c610e0c5761018052600954610e0c5760e0806000602082510160c060006003818352015b8260c0516020021115610a9957610ab8565b60c05160200285015160c0518501558151600101808352811415610a87575b505050505050610140806003602082510160c060006002818352015b8260c0516020021115610ae657610b05565b60c05160200285015160c0518501558151600101808352811415610ad4575b505050505050610180516009557f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6102805260e08051602082012090506102a0527f572f01d824885a118d5d21c74542f263b131d2897955c62a721594f1d7c3b2e26102c052466102e052306103005260a0610260526102608051602082012090506005553360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60006101a05260206101a0a3005b6306fdde038118610c5f5760e08060208082528083018060008082602082540160c060006003818352015b8260c0516020021115610bf957610c18565b60c05185015460c0516020028501528151600101808352811415610be7575b5050505050508051806020830101818260206001820306601f8201039050033682375050805160200160206001820306601f820103905090509050810190509050905060e0f35b6395d89b418118610d025760e08060208082528083018060038082602082540160c060006002818352015b8260c0516020021115610c9c57610cbb565b60c05185015460c0516020028501528151600101808352811415610c8a575b5050505050508051806020830101818260206001820306601f8201039050033682375050805160200160206001820306601f820103905090509050810190509050905060e0f35b633644e5158118610d195760055460e052602060e0f35b6370a082318118610d4e576004358060a01c610e0c5760e052600660e05160a052608052604060802054610100526020610100f35b63dd62ed3e8118610da1576004358060a01c610e0c5760e0526024358060a01c610e0c5761010052600760e05160a05260805260406080206101005160a052608052604060802054610120526020610120f35b6318160ddd8118610db85760085460e052602060e0f35b63075461728118610dcf5760095460e052602060e0f35b637ecebe008118610e04576004358060a01c610e0c5760e052600a60e05160a052608052604060802054610100526020610100f35b505b60006000fd5b600080fd5b610009610e1a03610009600039610009610e1a036000f3

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.