Transaction Details
Tx Hash:
4RJDpcEhQWw2RTELFyowVH
Status:
OnChain
Block:
Bundler:
0xF5d3B0bF5C6F4bEC970679Ee78caDbeA8bb72417
Timestamp:
Nov.25.2023 02:41:53 AM
Caller:
0x5d9c5c3192dbcc66c84908cb1677cee5ab2a1086
Signature:
0x9004f1ee3232c04f4865870ee131dfff17309e94b3269b50d0e9be8081e364c708f19690e20c3cc19d13984a20a1d1a5424a6947e82bd968836d2439c31edaa21b
SepId:
3
Namespace:
cryptojing
Dataset:
Collection:
Action:
insertOne
Document:
{
  "JING1": "// SPDX-License-Identifier: MIT\n// WTF Solidity by 0xAA\n\npragma solidity ^0.8.4;\n\ninterface IERC20 {\n    /**\n     * @dev 释放条件:当 `value` 单位的货币从账户 (`from`) 转账到另一账户 (`to`)时.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev 释放条件:当 `value` 单位的货币从账户 (`owner`) 授权给另一账户 (`spender`)时.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev 返回代币总供给.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev 返回账户`account`所持有的代币数.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev 转账 `amount` 单位代币,从调用者账户到另一账户 `to`.\n     *\n     * 如果成功,返回 `true`.\n     *\n     * 释放 {Transfer} 事件.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev 返回`owner`账户授权给`spender`账户的额度,默认为0。\n     *\n     * 当{approve} 或 {transferFrom} 被调用时,`allowance`会改变.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev 调用者账户给`spender`账户授权 `amount`数量代币。\n     *\n     * 如果成功,返回 `true`.\n     *\n     * 释放 {Approval} 事件.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev 通过授权机制,从`from`账户向`to`账户转账`amount`数量代币。转账的部分会从调用者的`allowance`中扣除。\n     *\n     * 如果成功,返回 `true`.\n     *\n     * 释放 {Transfer} 事件.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n\ncontract ERC20 is IERC20 {\n\n    mapping(address => uint256) public override balanceOf;\n\n    mapping(address => mapping(address => uint256)) public override allowance;\n\n    uint256 public override totalSupply;   // 代币总供给\n\n    string public name;   // 名称\n    string public symbol;  // 符号\n    \n    uint8 public decimals = 18; // 小数位数\n    address public owner;\n\n    // @dev 在合约部署的时候实现合约名称和符号\n    constructor(string memory name_, string memory symbol_){\n        name = name_;\n        symbol = symbol_;\n        owner = msg.sender;\n    }\n\n    // @dev 实现`transfer`函数,代币转账逻辑\n    function transfer(address recipient, uint amount) external override returns (bool) {\n        balanceOf[msg.sender] -= amount;\n        balanceOf[recipient] += amount;\n        emit Transfer(msg.sender, recipient, amount);\n        return true;\n    }\n\n    // @dev 实现 `approve` 函数, 代币授权逻辑\n    function approve(address spender, uint amount) external override returns (bool) {\n        allowance[msg.sender][spender] = amount;\n        emit Approval(msg.sender, spender, amount);\n        return true;\n    }\n\n    // @dev 实现`transferFrom`函数,代币授权转账逻辑\n    function transferFrom(\n        address sender,\n        address recipient,\n        uint amount\n    ) external override returns (bool) {\n        allowance[sender][msg.sender] -= amount;\n        balanceOf[sender] -= amount;\n        balanceOf[recipient] += amount;\n        emit Transfer(sender, recipient, amount);\n        return true;\n    }\n\n    // @dev 铸造代币,从 `0` 地址转账给 调用者地址\n    function mint(uint amount) external {\n        require(owner == msg.sender);\n        balanceOf[msg.sender] += amount;\n        totalSupply += amount;\n        emit Transfer(address(0), msg.sender, amount);\n    }\n\n    // @dev 销毁代币,从 调用者地址 转账给  `0` 地址\n    function burn(uint amount) external {\n        balanceOf[msg.sender] -= amount;\n        totalSupply -= amount;\n        emit Transfer(msg.sender, address(0), amount);\n    }\n\n}"
}