poanetwork / token-wizard

(Discontinued) TokenWizard is an DApp to create and manage crowdsale and token contracts using a simple UI
MIT License
381 stars 216 forks source link

Created a token and I get an error when trying to verify: Error! Unable to generate Contract ByteCode and ABI #1248

Open zueljin opened 3 years ago

zueljin commented 3 years ago

Hello, I used a youtube tutorial to create a token on the Binance smart chain and have been distributing it to my community for rewards and role designation in discord. I want to get it verified so that I can add add an image to it through bscscan but I'm getting an error:

Error! Unable to generate Contract ByteCode and ABI Found the following ContractName(s) in source code : Token But we were unable to locate a matching bytecode (err_code_2)

I've never coded anything before this in my life before this and have very little knowledge about what anything means in the code. It compiles correctly on Remix 0.8.2 but will not verify. I've also tried optimization enabled and disabled with the same result. I'll paste it below for your review. I heard flattening it may resolve it but I couldn't figure out how to use truffle-flattener. Any help is appreciated

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.2;

contract Token { mapping(address => uint) public balances; mapping(address => mapping(address => uint)) public allowance; uint public totalSupply = 10000000 * 10 ** 18; string public name = "Zuelyen"; string public symbol = "ZYN"; uint public decimals = 18;

event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);

constructor() {
    balances[msg.sender] = totalSupply;
}

function balanceOf(address owner) public view returns(uint) {
    return balances[owner];
}

function transfer(address to, uint value) public returns(bool) {
    require(balanceOf(msg.sender) >= value, 'balance too low');
    balances[to] += value;
    balances[msg.sender] -= value;
    emit Transfer(msg.sender, to, value);
    return true;
}

function transferFrom(address from, address to, uint value) public returns(bool) {
    require(balanceOf(from) >= value, 'balance to low');
    require(allowance[from][msg.sender] >=value, 'allowance too low');
    balances[to] += value;
    balances[from] -= value;
    emit Transfer(from, to, value);
    return true;
}

function approve(address spender, uint value) public returns(bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}

}

aderdzinski commented 2 years ago

Any luck on resolving this issue?