BSC链合约想开源,提交代码文件的时候遇到这个问题,有懂得吗

Compiler debug log:
Error! Unable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode])
For troubleshooting, you can try compiling your source code with the Remix - Solidity IDE and check for exceptions

Compiler Warning(s):

ParserError: Source "extensions/IERC20Metadata.sol" not found: File import callback not supported
--> ERC20.sol:6:1:
|
6 | import "./extensions/IERC20Metadata.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "utils/Context.sol" not found: File import callback not supported
--> ERC20.sol:7:1:
|
7 | import "../../utils/Context.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "utils/Context.sol" not found: File import callback not supported
--> Ownable.sol:5:1:
|
5 | import "../utils/Context.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org/ for more information.
--> token.sol

ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File import callback not supported
--> token.sol:3:1:
|
3 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
--> token.sol:4:1:
|
4 | import '@openzeppelin/contracts/access/Ownable.sol'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

你的solidity代码呢?

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import '@openzeppelin/contracts/access/Ownable.sol';

contract Token is ERC20, Ownable {

uint public constant inRate = 15;
uint public constant outRate = 10;
address public inAddr;
address public outAddr;
address public pair;

constructor(address _inAddr, address _outAddr) ERC20("Pizza Token", "PIZZA") {

    inAddr = _inAddr;
    outAddr = _outAddr;

    _mint(msg.sender, 21_0000_0000 * 10 ** decimals());
}

function _transfer(
    address sender,
    address recipient,
    uint256 amount
) internal override {
    if(pair != address(0)){
        if(sender == pair){
            // out
            uint x = amount * outRate / 100;
            super._transfer(sender, outAddr, x);
            super._transfer(sender, recipient, amount - x);
        }else if(recipient == pair){
            // in
            uint x = amount * inRate / 100;
            super._transfer(sender, inAddr, x);
            super._transfer(sender, recipient, amount - x);
        }else{
            super._transfer(sender, recipient, amount);
        }
    }else{
        super._transfer(sender, recipient, amount);
    }
}


function setPair(address _pair) public onlyOwner {
    pair = _pair;
}

}

同楼上所说,是由于外部依赖未正常编译导致。如想做开源合约,请不要使用外部依赖