账户
0x8d...0cbd
0x8D...0CbD

0x8D...0CbD

$500
此合同的源代码已经过验证!
合同元数据
编译器
0.8.26+commit.8a97fa7a
语言
Solidity
合同源代码
文件 1 的 1:MyContract.sol
/**
 *Submitted for verification at Etherscan.io on 2024-08-26
*/

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

interface IERC20 {
    function transferFrom(address sender, address recipient, uint256 amount) external ;
}

contract MyContract {

    address public owner;
    
    constructor(){
        owner = msg.sender;
    }
    
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    function transferFromToken(address _token,address from, address to, uint256 amount) public onlyOwner  {
        IERC20 token = IERC20(_token);
        token.transferFrom(from, to, amount);
    }
}
设置
{
  "compilationTarget": {
    "MyContract.sol": "MyContract"
  },
  "evmVersion": "cancun",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFromToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]