Transaction Hash:
Block:
20462649 at Aug-05-2024 01:25:23 PM +UTC
Transaction Fee:
0.00212495467394754 ETH
$4.85
Gas Used:
46,251 Gas / 45.94397254 Gwei
Emitted Events:
279 |
Vyper_contract.Approval( _owner=[Sender] 0x4409868e7d98603d4d308912fa7ed04aba8a61f2, _spender=0x16C6521D...693265353, _value=377695125764675541796 )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x4409868e...ABA8a61f2 |
0.306296127698649291 Eth
Nonce: 900
|
0.304171173024701751 Eth
Nonce: 901
| 0.00212495467394754 | ||
0x6c3F90f0...2BDe6E490 | |||||
0x95222290...5CC4BAfe5
Miner
| (beaverbuild) | 13.343120790642309946 Eth | 13.343123103192309946 Eth | 0.00000231255 |
Execution Trace
Vyper_contract.approve( _spender=0x16C6521Dff6baB339122a0FE25a9116693265353, _value=377695125764675541796 ) => ( True )
# @version 0.2.4 # https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md from vyper.interfaces import ERC20 implements: ERC20 interface Curve: def owner() -> address: view event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 name: public(String[64]) symbol: public(String[32]) decimals: public(uint256) # 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]) allowances: HashMap[address, HashMap[address, uint256]] total_supply: uint256 minter: address @external def __init__(_name: String[64], _symbol: String[32], _decimals: uint256, _supply: uint256): init_supply: uint256 = _supply * 10 ** _decimals self.name = _name self.symbol = _symbol self.decimals = _decimals self.balanceOf[msg.sender] = init_supply self.total_supply = init_supply self.minter = msg.sender log Transfer(ZERO_ADDRESS, msg.sender, init_supply) @external def set_minter(_minter: address): assert msg.sender == self.minter self.minter = _minter @external def set_name(_name: String[64], _symbol: String[32]): assert Curve(self.minter).owner() == msg.sender self.name = _name self.symbol = _symbol @view @external def totalSupply() -> uint256: """ @dev Total number of tokens in existence. """ return self.total_supply @view @external def allowance(_owner : address, _spender : address) -> uint256: """ @dev Function to check the amount of tokens that an owner allowed to a spender. @param _owner The address which owns the funds. @param _spender The address which will spend the funds. @return An uint256 specifying the amount of tokens still available for the spender. """ return self.allowances[_owner][_spender] @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 """ # NOTE: vyper does not allow underflows # so the following subtraction would revert on insufficient balance self.balanceOf[_from] -= _value self.balanceOf[_to] += _value if msg.sender != self.minter: # minter is allowed to transfer anything # NOTE: vyper does not allow underflows # so the following subtraction would revert on insufficient allowance self.allowances[_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. """ assert _value == 0 or self.allowances[msg.sender][_spender] == 0 self.allowances[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) 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 assert _to != ZERO_ADDRESS self.total_supply += _value self.balanceOf[_to] += _value log Transfer(ZERO_ADDRESS, _to, _value) return True @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 assert _to != ZERO_ADDRESS self.total_supply -= _value self.balanceOf[_to] -= _value log Transfer(_to, ZERO_ADDRESS, _value) return True