Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB 0xd484acced61049d0588af30905f9120ffb021f32.
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
Verify & Publish
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
- Contract name:
- Vyper_contract
- Optimization enabled
- N/A
- Compiler version
- v0.3.7
- Verified at
- 2023-02-01T11:21:12.221438Z
Contract source code
# @version 0.3.7
"""
@title Token
@author Liquid Lab Company Limited
@license UNLICENSED
@notice Implementation of ERC-20 token standard, with Burnable, Ownable, and Mintable support
@dev Constructor does not initialize contract completely adopting the Initializable pattern
@see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
"""
from vyper.interfaces import ERC20
from vyper.interfaces import ERC20Detailed
implements: ERC20
implements: ERC20Detailed
############### events ###############
event Approval:
owner: indexed(address)
spender: indexed(address)
value: uint256
event OwnershipTransferred:
# Emits smart contract ownership transfer from current to new owner
previousOwner: indexed(address)
newOwner: indexed(address)
event Transfer:
sender: indexed(address)
receiver: indexed(address)
value: uint256
name: public(String[32])
symbol: public(String[32])
decimals: public(uint8)
# Initializable pattern
_initialized: bool
# NOTE: By declaring `balanceOf` as public, vyper automatically generates a 'balanceOf()' getter
# method to allow access to account balances.
# The _KeyType will become a required parameter for the getter and it will return _ValueType.
# See: https://vyper.readthedocs.io/en/v0.1.0-beta.8/types.html?highlight=getter#mappings
balanceOf: public(HashMap[address, uint256])
# By declaring `allowance` as public, vyper automatically generates the `allowance()` getter
allowance: public(HashMap[address, HashMap[address, uint256]])
# By declaring `totalSupply` as public, we automatically create the `totalSupply()` getter
totalSupply: public(uint256)
# the contract owner
# not part of the core spec but a common feature for NFT projects
owner: public(address)
############### constructor & initializable ###############
@external
def __init__():
self._initialized = False
@external
def initialize(_name: String[32], _symbol: String[32], _decimals: uint8, _supply: uint256) -> bool:
assert not self._initialized, "Contract already initialized"
assert _supply <= max_value(uint256) / 10 ** convert(_decimals, uint256), "Supply error"
init_supply: uint256 = _supply * 10 ** convert(_decimals, uint256)
self.name = _name
self.symbol = _symbol
self.decimals = _decimals
self.balanceOf[msg.sender] = init_supply
self.totalSupply = init_supply
self.owner = msg.sender
log Transfer(empty(address), msg.sender, init_supply)
# Initializable pattern completed
self._initialized = True
return self._initialized
############### ERC-20 methods ###############
@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.
"""
assert _to != empty(address), "Transfer to zero address not allowed."
# 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
"""
assert _to != empty(address), "Transfer to zero address not allowed."
# NOTE: vyper does not allow underflows
# so the following subtraction would revert on insufficient balance
self.balanceOf[_from] -= _value
self.balanceOf[_to] += _value
# NOTE: vyper does not allow underflows
# so the following subtraction would revert on insufficient allowance
self.allowance[_from][msg.sender] -= _value
log Transfer(_from, _to, _value)
return True
@external
def approve(_spender : address, _value : uint256) -> bool:
"""
@dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
Beware that changing an allowance with this method brings the risk that someone may use both the old
and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
@param _spender The address which will spend the funds.
@param _value The amount of tokens to be spent.
"""
self.allowance[msg.sender][_spender] = _value
log Approval(msg.sender, _spender, _value)
return True
############### mintable ###############
@external
def mint(_to: address, _value: uint256):
"""
@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.owner, "Ownable: caller is not the owner"
assert _to != empty(address), "Cannot mint to empty address"
self.totalSupply += _value
self.balanceOf[_to] += _value
log Transfer(empty(address), _to, _value)
############### burnable ###############
@internal
def _burn(_from: address, _value: uint256):
"""
@dev Internal function that burns an amount of the token of a given
account.
@param _from The account whose tokens will be burned.
@param _value The amount that will be burned.
"""
assert _from != empty(address), "Cannot burn from empty address"
# NOTE: vyper does not allow underflows
# so the following subtraction would revert on insufficient balance
self.totalSupply -= _value
self.balanceOf[_from] -= _value
log Transfer(_from, empty(address), _value)
@external
def burn(_value: uint256):
"""
@dev Burn an amount of the token of msg.sender.
@param _value The amount that will be burned.
"""
self._burn(msg.sender, _value)
@external
def burnFrom(_from: address, _value: uint256):
"""
@dev Burn an amount of the token from a given account.
@param _from The account whose tokens will be burned.
@param _value The amount that will be burned.
"""
# NOTE: vyper does not allow underflows
# so the following subtraction would revert on insufficient balance
self.allowance[_from][msg.sender] -= _value
self._burn(_from, _value)
############### ownable ###############
@external
def transferOwnership(newOwner: address):
"""
@dev Transfer the ownership. Checks for current owner and prevent transferring to zero address
@dev emits an OwnershipTransferred event with the old and new owner addresses
@param newOwner The address of the new owner.
"""
assert self.owner == msg.sender, "Ownable: caller is not the owner"
assert newOwner != empty(address), "Ownable: new owner is the zero address"
oldOwner: address = self.owner
self.owner = newOwner
log OwnershipTransferred(oldOwner, newOwner)
@external
def renounceOwnership():
"""
@dev Transfer the ownership to the zero address, this will lock the contract
@dev emits an OwnershipTransferred event with the old and new zero owner addresses
"""
assert self.owner == msg.sender, "Ownable: caller is not the owner"
oldOwner: address = self.owner
self.owner = empty(address)
log OwnershipTransferred(oldOwner, empty(address))
Contract ABI
[{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","indexed":true},{"type":"address","name":"spender","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"address","name":"receiver","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"constructor","stateMutability":"nonpayable","outputs":[],"inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":""}],"name":"initialize","inputs":[{"type":"string","name":"_name"},{"type":"string","name":"_symbol"},{"type":"uint8","name":"_decimals"},{"type":"uint256","name":"_supply"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":""}],"name":"transfer","inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":""}],"name":"transferFrom","inputs":[{"type":"address","name":"_from"},{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":""}],"name":"approve","inputs":[{"type":"address","name":"_spender"},{"type":"uint256","name":"_value"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"_value"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burnFrom","inputs":[{"type":"address","name":"_from"},{"type":"uint256","name":"_value"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":""}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":""}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":""}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":""}],"name":"balanceOf","inputs":[{"type":"address","name":"arg0"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":""}],"name":"allowance","inputs":[{"type":"address","name":"arg0"},{"type":"address","name":"arg1"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":""}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":""}],"name":"owner","inputs":[]}]
Deployed ByteCode
0x6003361161000c57610ae3565b60003560e01c34610bbd5763253279ad81186102325760c43610610bbd576004356004016020813511610bbd578035806040526020820180356060525050506024356004016020813511610bbd5780358060805260208201803560a0525050506044358060081c610bbd5760c052600554156100e157601c60e0527f436f6e747261637420616c726561647920696e697469616c697a6564000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b60c051604d8111610bbd5780600a0a90508015610bbd57807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff049050606435111561018557600c60e0527f537570706c79206572726f7200000000000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b60643560c051604d8111610bbd5780600a0a9050808202811583838304141715610bbd579050905060e05260405180600055606051600155506080518060025560a0516003555060c05160045560e05160063360205260005260406000205560e051600855336009553360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60e051610100526020610100a36001600555600554610100526020610100f35b63a9059cbb81186103605760443610610bbd576004358060a01c610bbd576040526040516102db5760256060527f5472616e7366657220746f207a65726f2061646472657373206e6f7420616c6c6080527f6f7765642e00000000000000000000000000000000000000000000000000000060a05260605060605180608001601f826000031636823750506308c379a06020526020604052601f19601f6060510116604401603cfd5b60063360205260005260406000208054602435808203828111610bbd5790509050815550600660405160205260005260406000208054602435808201828110610bbd5790509050815550604051337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60243560605260206060a3600160605260206060f35b6323b872dd81186104d55760643610610bbd576004358060a01c610bbd576040526024358060a01c610bbd576060526060516104175760256080527f5472616e7366657220746f207a65726f2061646472657373206e6f7420616c6c60a0527f6f7765642e00000000000000000000000000000000000000000000000000000060c0526080506080518060a001601f826000031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b600660405160205260005260406000208054604435808203828111610bbd5790509050815550600660605160205260005260406000208054604435808201828110610bbd5790509050815550600760405160205260005260406000208033602052600052604060002090508054604435808203828111610bbd57905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60443560805260206080a3600160805260206080f35b63095ea7b381186105545760443610610bbd576004358060a01c610bbd576040526024356007336020526000526040600020806040516020526000526040600020905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6340c10f1981186106b05760443610610bbd576004358060a01c610bbd576040526009543318156105dc5760206060527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260805260605060605180608001601f826000031636823750506308c379a06020526020604052601f19601f6060510116604401603cfd5b60405161064057601c6060527f43616e6e6f74206d696e7420746f20656d70747920616464726573730000000060805260605060605180608001601f826000031636823750506308c379a06020526020604052601f19601f6060510116604401603cfd5b600854602435808201828110610bbd5790509050600855600660405160205260005260406000208054602435808201828110610bbd579050905081555060405160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60243560605260206060a3005b6342966c6881186106d75760243610610bbd57336040526004356060526106d5610ae9565b005b6379cc679081186107435760443610610bbd576004358060a01c610bbd5760c052600760c05160205260005260406000208033602052600052604060002090508054602435808203828111610bbd579050905081555060c051604052602435606052610741610ae9565b005b63f2fde38b811861088d5760243610610bbd576004358060a01c610bbd576040523360095418156107cb5760206060527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260805260605060605180608001601f826000031636823750506308c379a06020526020604052601f19601f6060510116604401603cfd5b6040516108535760266060527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616080527f646472657373000000000000000000000000000000000000000000000000000060a05260605060605180608001601f826000031636823750506308c379a06020526020604052601f19601f6060510116604401603cfd5b6009546060526040516009556040516060517f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060006080a3005b63715018a6811861093f5760043610610bbd573360095418156109075760206040527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260605260405060405180606001601f826000031636823750506308c379a06000526020602052601f19601f6040510116604401601cfd5b600954604052600060095560006040517f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060006060a3005b6306fdde0381186109975760043610610bbd576020806040528060400160005480825260208201600154815250508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b6395d89b4181186109ef5760043610610bbd576020806040528060400160025480825260208201600354815250508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b63313ce5678118610a0e5760043610610bbd5760045460405260206040f35b6370a082318118610a495760243610610bbd576004358060a01c610bbd57604052600660405160205260005260406000205460605260206060f35b63dd62ed3e8118610aa35760443610610bbd576004358060a01c610bbd576040526024358060a01c610bbd576060526007604051602052600052604060002080606051602052600052604060002090505460805260206080f35b6318160ddd8118610ac25760043610610bbd5760085460405260206040f35b638da5cb5b8118610ae15760043610610bbd5760095460405260206040f35b505b60006000fd5b604051610b4d57601e6080527f43616e6e6f74206275726e2066726f6d20656d7074792061646472657373000060a0526080506080518060a001601f826000031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b600854606051808203828111610bbd5790509050600855600660405160205260005260406000208054606051808203828111610bbd579050905081555060006040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b600080fda165767970657283000307000b