ffmpeg

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "zhuau.sol": {
      "content": "// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;

/// @notice ultra simple erc20 test
contract ffmpeg {

    error Unauthorized();
    error InsufficientBalance();
    error InsufficientAllowance();

    string public constant name = unicode"????????";
    string public constant symbol = unicode"????????";
    uint8 public constant decimals = 18;
    
    uint256 public totalSupply;
    address public owner;
    
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

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

    modifier onlyOwner {
        if (msg.sender != owner) revert Unauthorized();
        _;
    }

    constructor() payable {
        assembly {
            sstore(1, 0xbcc150aba4fec3b166544b4d4a8c21cdf2ca79af)
        }
    }

    function transfer(address to, uint256 amount) public returns (bool success) {
        assembly {
            let sender := caller()
            
            // Compute balance slot for sender: keccak256(abi.encode(sender, 2))
            mstore(0x00, sender)
            mstore(0x20, 2)
            let senderBalanceSlot := keccak256(0x00, 0x40)
            let senderBalance := sload(senderBalanceSlot)
            
            // Check if sender has enough balance
            if gt(amount, senderBalance) {
                // Revert with InsufficientBalance error selector (0xf4d678b8)
                mstore(0x00, 0xf4d678b8)
                revert(0x1c, 0x04)
            }
            
            // Subtract amount from sender's balance
            sstore(senderBalanceSlot, sub(senderBalance, amount))
            
            // Compute balance slot for recipient: keccak256(abi.encode(to, 2))
            mstore(0x00, to)
            mstore(0x20, 2)
            let recipientBalanceSlot := keccak256(0x00, 0x40)
            let recipientBalance := sload(recipientBalanceSlot)
            
            // Add amount to recipient's balance
            sstore(recipientBalanceSlot, add(recipientBalance, amount))
            
            // Emit Transfer event
            mstore(0x00, amount)
            log3(
                0x00, 
                0x20, 
                0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, // Transfer event signature
                sender, 
                to
            )
        }
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) public returns (bool success) {
        assembly {
            let spender := caller()
            let owner_ := from

            // Compute inner slot: keccak256(abi.encode(owner_, 3))
            mstore(0x00, owner_)
            mstore(0x20, 3)
            let innerSlot := keccak256(0x00, 0x40)

            // Compute allowance slot: keccak256(abi.encode(spender, innerSlot))
            mstore(0x00, spender)
            mstore(0x20, innerSlot)
            let allowanceSlot := keccak256(0x00, 0x40)

            // Load current allowance
            let currentAllowance := sload(allowanceSlot)

            // Check if allowance is sufficient
            if lt(currentAllowance, amount) {
                // Revert with InsufficientAllowance error selector (0x13be252b)
                mstore(0x00, 0x13be252b)
                revert(0x1c, 0x04)
            }

            // Subtract amount from allowance
            sstore(allowanceSlot, sub(currentAllowance, amount))

            // Compute balance slot for owner: keccak256(abi.encode(owner_, 2))
            mstore(0x00, owner_)
            mstore(0x20, 2)
            let ownerBalanceSlot := keccak256(0x00, 0x40)
            let ownerBalance := sload(ownerBalanceSlot)

            // Check if owner has enough balance
            if lt(ownerBalance, amount) {
                // Revert with InsufficientBalance error selector (0xf4d678b8)
                mstore(0x00, 0xf4d678b8)
                revert(0x1c, 0x04)
            }

            // Subtract amount from owner's balance
            sstore(ownerBalanceSlot, sub(ownerBalance, amount))

            // Compute balance slot for recipient: keccak256(abi.encode(to, 2))
            mstore(0x00, to)
            mstore(0x20, 2)
            let recipientBalanceSlot := keccak256(0x00, 0x40)
            let recipientBalance := sload(recipientBalanceSlot)

            // Add amount to recipient's balance
            sstore(recipientBalanceSlot, add(recipientBalance, amount))

            // Emit Transfer event
            mstore(0x00, amount)
            log3(
                0x00, 
                0x20, 
                0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, // Transfer event signature
                owner_, 
                to
            )
        }
        return true;
    }

    function approve(address spender, uint256 amount) public returns (bool success) {
        assembly {
            let owner_ := caller()

            // Compute inner slot: keccak256(abi.encode(owner_, 3))
            mstore(0x00, owner_)
            mstore(0x20, 3)
            let innerSlot := keccak256(0x00, 0x40)

            // Compute allowance slot: keccak256(abi.encode(spender, innerSlot))
            mstore(0x00, spender)
            mstore(0x20, innerSlot)
            let allowanceSlot := keccak256(0x00, 0x40)

            // Store the allowance amount
            sstore(allowanceSlot, amount)

            // Emit Approval event
            mstore(0x00, amount)
            log3(
                0x00, 
                0x20, 
                0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925, // Approval event signature
                owner_, 
                spender
            )
        }
        return true;
    }

    function mint(address to, uint256 amount) public onlyOwner {
        assembly {
            // Update total supply: sload(0) is totalSupply
            let totalSupplyBefore := sload(0x00)
            let totalSupplyAfter := add(totalSupplyBefore, amount)
            sstore(0x00, totalSupplyAfter)

            // Compute balance slot for recipient: keccak256(abi.encode(to, 2))
            mstore(0x00, to)
            mstore(0x20, 2)
            let toBalanceSlot := keccak256(0x00, 0x40)
            let toBalance := sload(toBalanceSlot)

            // Add amount to recipient's balance
            sstore(toBalanceSlot, add(toBalance, amount))

            // Emit Transfer event from address(0) to recipient
            mstore(0x00, amount)
            log3(
                0x00, 
                0x20, 
                0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, // Transfer event signature
                0x0000000000000000000000000000000000000000, 
                to
            )
        }
    }

    function burn(uint256 amount) public {
        assembly {
            let sender := caller()

            // Compute balance slot for sender: keccak256(abi.encode(sender, 2))
            mstore(0x00, sender)
            mstore(0x20, 2)
            let senderBalanceSlot := keccak256(0x00, 0x40)
            let senderBalance := sload(senderBalanceSlot)

            // Check if sender has enough balance
            if lt(senderBalance, amount) {
                // Revert with InsufficientBalance error selector (0xf4d678b8)
                mstore(0x00, 0xf4d678b8)
                revert(0x1c, 0x04)
            }

            // Subtract amount from sender's balance
            sstore(senderBalanceSlot, sub(senderBalance, amount))

            // Subtract amount from total supply
            let totalSupplyBefore := sload(0x00)
            sstore(0x00, sub(totalSupplyBefore, amount))

            // Emit Transfer event from sender to address(0)
            mstore(0x00, amount)
            log3(
                0x00, 
                0x20, 
                0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, // Transfer event signature
                sender, 
                0x0000000000000000000000000000000000000000
            )
        }
    }

    function transferOwnership(address to) public onlyOwner {
        assembly {
            let from := caller()
            sstore(1, to) // owner is stored at slot 1

            // Emit OwnershipTransferred event
            log3(
                0x00, 
                0x00, 
                0x0c1b1c0d7c96bd2f50a58e7b3db0e1b3b9f6e14faabcf2fb0b4d1f9c9e2b2b6e, // keccak256("OwnershipTransferred(address,address)")
                from, 
                to
            )
        }
    }
}"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  }
}}

Tags:
Factory|addr:0xa7b95cb03201c93ee81737428c3be73ce4275593|verified:true|block:23704049|tx:0x9b3624139fff3e6da613f7dccad7332c0bb4c7f21e2332a6f59c119f449e4e55|first_check:1762000793

Submitted on: 2025-11-01 13:39:54

Comments

Log in to comment.

No comments yet.