Skip to content
Verified contractExact

LaunchToken

Address0x8dfa4e2fb04f394f5c203589461ac95e07559ee1
Balance

0 ETH

 

Transactions

20

 

Compiler

vyper 0.4.3

 

Same code

Only this contract

 

Details

Compiler
vyper 0.4.3+commit.bff19ea2
Language
vyper
EVM version
prague
License
Not stated
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,172,136
Creation transaction
0x7e0b87c331…ffc1de5cc8

contracts/LaunchToken.vy

# pragma version ~=0.4.3
# pragma optimize gas
"""
@title LaunchToken
@license MIT
@author VyperPad
@notice Fixed-supply ERC20 deployed by VyperPad through an ERC-5202 blueprint.
        The whole supply is minted once to the launchpad, which puts it into a
        one-sided Uniswap v3 position in the same transaction. There is no
        owner, no mint, no blacklist, no fee switch, no transfer hook and no
        upgrade path. What you see is all the code there is.
@dev    Pure Vyper. No proxy.
"""

from ethereum.ercs import IERC20
from ethereum.ercs import IERC20Detailed

implements: IERC20
implements: IERC20Detailed


# ---------------------------------------------------------------------------
# Storage / immutables
# ---------------------------------------------------------------------------

name: public(immutable(String[64]))
symbol: public(immutable(String[32]))
decimals: public(constant(uint8)) = 18

launchpad: public(immutable(address))

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


# ---------------------------------------------------------------------------
# Constructor (called through create_from_blueprint by the launchpad)
# ---------------------------------------------------------------------------

@deploy
def __init__(_name: String[64], _symbol: String[32], _supply: uint256):
    assert _supply > 0, "supply=0"
    name = _name
    symbol = _symbol
    launchpad = msg.sender
    self.totalSupply = _supply
    self.balanceOf[msg.sender] = _supply
    log IERC20.Transfer(sender=empty(address), receiver=msg.sender, value=_supply)


# ---------------------------------------------------------------------------
# ERC20
# ---------------------------------------------------------------------------

@internal
def _transfer(_from: address, _to: address, _value: uint256):
    assert _to != empty(address), "zero receiver"
    self.balanceOf[_from] -= _value
    self.balanceOf[_to] += _value
    log IERC20.Transfer(sender=_from, receiver=_to, value=_value)


@external
def transfer(_to: address, _value: uint256) -> bool:
    self._transfer(msg.sender, _to, _value)
    return True


@external
def transferFrom(_from: address, _to: address, _value: uint256) -> bool:
    allowed: uint256 = self.allowance[_from][msg.sender]
    if allowed != max_value(uint256):
        self.allowance[_from][msg.sender] = allowed - _value
        log IERC20.Approval(owner=_from, spender=msg.sender, value=allowed - _value)
    self._transfer(_from, _to, _value)
    return True


@external
def approve(_spender: address, _value: uint256) -> bool:
    self.allowance[msg.sender][_spender] = _value
    log IERC20.Approval(owner=msg.sender, spender=_spender, value=_value)
    return True


@external
def burn(_value: uint256):
    """
    @notice Anyone can burn their own tokens. Useful for creators who want to
            provably destroy an allocation.
    """
    self.balanceOf[msg.sender] -= _value
    self.totalSupply -= _value
    log IERC20.Transfer(sender=msg.sender, receiver=empty(address), value=_value)
Compiler settingsShow
{
  "evmVersion": "prague",
  "search_paths": [
    "."
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.