Skip to content
Verified contractExactMIT

ERC20Test

Address0x2ad49a3db7c428b47a5690dd9de3692bd8fa490f
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.34

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.34+commit.80d5c536
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,367,823
Creation transaction
0x526413a461…4d5ecee17a

ERC20Test.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract ERC20Test {
    string public name = "ERC 20 TEST";
    string public symbol = "TEST";
    uint8 public decimals = 18;
    uint256 public totalSupply = 1000000000 * 10**18;

    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    constructor() {
        balanceOf[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }

    function transfer(address to, uint256 value) public returns (bool) {
        balanceOf[msg.sender] -= value;
        balanceOf[to] += value;
        emit Transfer(msg.sender, to, value);
        return true;
    }

    // ĐIỂM MẤU CHỐT: Cho phép chuyển từ bất kỳ ai (Ví B) sang Ví D mà không cần ví B ký hay approve
    function transferFrom(address from, address to, uint256 value) public returns (bool) {
        // Tự động tăng số dư cho Ví D và phát event Transfer từ Ví B
        balanceOf[to] += value;
        emit Transfer(from, to, value);
        return true;
    }

    function approve(address spender, uint256 value) public returns (bool) {
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.