编译器
0.8.21+commit.d9974bed
文件 1 的 5:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 2 的 5:ERC20Relayer.sol
pragma solidity ^0.8.21;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./ISemiFungibleERC741.sol";
contract ERC20Relayer is IERC20, IERC20Metadata, Context {
ISemiFungibleERC741 public erc741;
modifier onlyNFT() {
require(
_msgSender() == address(erc741),
"onlyNFT can call this function"
);
_;
}
constructor() {
erc741 = ISemiFungibleERC741(_msgSender());
}
function name() external view override returns (string memory) {
return erc741.name();
}
function symbol() external view override returns (string memory) {
return erc741.symbol();
}
function decimals() external view override returns (uint8) {
return erc741._decimals();
}
function totalSupply() external view override returns (uint256) {
return erc741._erc20Supply();
}
function balanceOf(
address account
) external view override returns (uint256) {
return erc741.balanceOfERC20(account);
}
function transfer(
address to,
uint256 amount
) external override returns (bool) {
bool status = erc741.transferERC20(_msgSender(), to, amount);
emit Transfer(_msgSender(), to, amount);
return status;
}
function allowance(
address owner,
address spender
) external view override returns (uint256) {
return erc741.allowance(owner, spender);
}
function approve(
address spender,
uint256 amount
) external override returns (bool) {
bool status = erc741.approveERC20(_msgSender(), spender, amount);
emit Approval(_msgSender(), spender, amount);
return status;
}
function transferFrom(
address from,
address to,
uint256 amount
) external override returns (bool) {
bool status = erc741.transferFromERC20(_msgSender(), from, to, amount);
emit Transfer(from, to, amount);
return status;
}
function emitTransfer(
address from,
address to,
uint256 amount
) external onlyNFT {
emit Transfer(from, to, amount);
}
}
文件 3 的 5:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
文件 4 的 5:IERC20Metadata.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
文件 5 的 5:ISemiFungibleERC741.sol
pragma solidity ^0.8.21;
interface ISemiFungibleERC741 {
function allowance(address, address) external view returns (uint256);
function approve(
address spender,
uint256 amountOrId
) external returns (bool);
function balanceOf(address) external view returns (uint256);
function balanceOfERC20(address) external view returns (uint256);
function baseTokenURI() external view returns (string memory);
function _decimals() external view returns (uint8);
function erc721totalSupply() external view returns (uint256);
function getApproved(uint256) external view returns (address);
function getBurnedToken() external view returns (uint256[] memory);
function isApprovedForAll(address, address) external view returns (bool);
function maxMintedId() external view returns (uint256);
function name() external view returns (string memory);
function owner() external view returns (address);
function ownerOf(uint256 id) external view returns (address owner);
function renounceOwnership() external;
function safeTransferFrom(address from, address to, uint256 id) external;
function safeTransferFrom(
address from,
address to,
uint256 id,
bytes memory data
) external;
function setApprovalForAll(address operator, bool approved) external;
function setTokenURI(string memory _tokenURI) external;
function setWhitelist(address target, bool state) external;
function symbol() external view returns (string memory);
function tokenIdPool(uint256) external view returns (uint256);
function tokenURI(uint256 id) external returns (string memory);
function _erc20Supply() external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amountOrId
) external;
function transferOwnership(address newOwner) external;
function whitelist(address) external view returns (bool);
function transferERC20(
address sender,
address to,
uint256 amount
) external returns (bool);
function transferFromERC20(
address sender,
address from,
address to,
uint256 amount
) external returns (bool);
function approveERC20(
address sender,
address spender,
uint256 amountOrId
) external returns (bool);
}
{
"compilationTarget": {
"contracts/ERC20Relayer.sol": "ERC20Relayer"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"erc741","outputs":[{"internalType":"contract ISemiFungibleERC741","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]