Bitcoin Forum
May 11, 2024, 10:36:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Please help creat own erc20 token  (Read 105 times)
cryptozahi (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 4


View Profile
December 16, 2019, 04:38:40 PM
 #1

Guys im trying to creat own token for learn how to do it but about etherscan publish share i have problem

i see like this error end of the share public on etherscan


Error! Unable to locate Contract Code at 0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4
Is this a valid Contract Address?

What is it mean guys? What should I do to solve this problem?


Bellow you can see my code text.

Please help me.

pragma solidity ^0.5.0;

// ----------------------------------------------------------------------------
// 'DNM' token contract

// Symbol      : DNM
// Name        : Deneme token
// Total supply: 9.000.000.000
// Decimals    : 8
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
        c = a + b;
        require(c >= a);
    }
    function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
        require(b <= a);
        c = a - b;
    }
    function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
        c = a * b;
        require(a == 0 || c / a == b);
    }
    function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
        require(b > 0);
        c = a / b;
    }
}


// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
    function totalSupply() public view returns (uint256);
    function balanceOf(address tokenOwner) public view returns (uint256 balance);
    function allowance(address tokenOwner, address spender) public view returns (uint256 remaining);
    function transfer(address to, uint256 tokens) public returns (bool success);
    function approve(address spender, uint256 tokens) public returns (bool success);
    function transferFrom(address payable from, address to, uint256 tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint256 tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}


// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
    address public owner;
    address public newOwner;

    event OwnershipTransferred(address indexed _from, address indexed _to);

    constructor() public {
        owner = msg.sender;
    }

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

    function transferOwnership(address _newOwner) public onlyOwner {
        newOwner = _newOwner;
    }
}


// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Deneme is ERC20Interface, Owned {
    using SafeMath for uint256;
    string public symbol = "DNM";
    string public  name = "Deneme Token";
    uint256 public decimals = 8;
    uint256 _totalSupply = 9e9* 10 ** uint(decimals);
   
    mapping(address => uint256) balances;
    mapping(address => mapping(address => uint256)) allowed;
   
    mapping(address => walletDetail) walletsAllocation;

    struct walletDetail{
        uint256 tokens;
        bool lock;
    }

    // ------------------------------------------------------------------------
    // Constructor
    // ------------------------------------------------------------------------
    constructor() public {
        owner = address(0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4);
        balances[address(this)] = totalSupply();
        emit Transfer(address(0),address(this), totalSupply());

        _makeAllocations();
    }

    function _makeAllocations() private{
        //Team Wallet(Locted 2 years)
        _transfer(0x1G4713Af0CFe2s4ebA123456A8F55982416c2453, 1e9 * 10 ** uint(decimals));
        walletsAllocation[0x1G4713Af0CFe2s4ebA123456A8F55982416c2453] = walletDetail(2e9 * 10 ** uint(decimals), false);
        //Airdrop Wallet
        _transfer(0xfA5401eac451793v65432109Ed44A50bE5A22CBV, 2e9 * 10 ** uint(decimals));
        walletsAllocation[0xfA5401eac451793v65432109Ed44A50bE5A22CBV] = walletDetail(4e9 * 10 ** uint(decimals), false);
        //Development Wallet (Locked 1 years)
        _transfer(0x06cC0DDA81A17F98765e30d147c6021d87675fa, 2e9 * 10 ** uint(decimals));
        walletsAllocation[0x06cC0DDA81A17F98765e30d147c6021d87675fa] = walletDetail(3e9 * 10 ** uint(decimals), false);
        //Marketing Wallet
        _transfer(0x084J4E3V6c01124567894eE3G42CE91E6016c675, 4e9 * 10 ** uint(decimals));
        walletsAllocation[0x084J4E3V6c01124567894eE3G42CE91E6016c675] = walletDetail(3e9 * 10 ** uint(decimals), false);
    }
   
    /** ERC20Interface function's implementation **/
   
    function totalSupply() public view returns (uint256){
       return _totalSupply;
    }
   
    // ------------------------------------------------------------------------
    // Get the token balance for account `tokenOwner`
    // ------------------------------------------------------------------------
    function balanceOf(address tokenOwner) public view returns (uint256 balance) {
        return balances[tokenOwner];
    }

    // ------------------------------------------------------------------------
    // Transfer the balance from token owner's account to `to` account
    // - Owner's account must have sufficient balance to transfer
    // - 0 value transfers are allowed
    // ------------------------------------------------------------------------
    function transfer(address to, uint256 tokens) public returns (bool success) {
        // prevent transfer to 0x0, use burn instead
        require(address(to) != address(0));
        require(balances[msg.sender] >= tokens );
        require(balances[to] + tokens >= balances[to]);

        balances[msg.sender] = balances[msg.sender].sub(tokens);
        balances[to] = balances[to].add(tokens);
        emit Transfer(msg.sender,to,tokens);
        return true;
    }
   
    // ------------------------------------------------------------------------
    // Token owner can approve for `spender` to transferFrom(...) `tokens`
    // from the token owner's account
    // ------------------------------------------------------------------------
    function approve(address spender, uint256 tokens) public returns (bool success){
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender,spender,tokens);
        return true;
    }

    // ------------------------------------------------------------------------
    // Transfer `tokens` from the `from` account to the `to` account
    //
    // The calling account must already have sufficient tokens approve(...)-d
    // for spending from the `from` account and
    // - From account must have sufficient balance to transfer
    // - Spender must have sufficient allowance to transfer
    // - 0 value transfers are allowed
    // ------------------------------------------------------------------------
    function transferFrom(address payable from, address to, uint256 tokens) public returns (bool success){
        require(tokens <= allowed[from][msg.sender]); //check allowance
        require(balances[from] >= tokens);

        balances[from] = balances[from].sub(tokens);
        balances[to] = balances[to].add(tokens);
        allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
        emit Transfer(from,to,tokens);
        return true;
    }
   
    // ------------------------------------------------------------------------
    // Returns the amount of tokens approved by the owner that can be
    // transferred to the spender's account
    // ------------------------------------------------------------------------
    function allowance(address tokenOwner, address spender) public view returns (uint256 remaining) {
        return allowed[tokenOwner][spender];
    }
   
    function transferFromContract(address to, uint256 tokens) public onlyOwner returns (bool success){
        _transfer(to,tokens);
        return true;
    }

    function _transfer(address to, uint256 tokens) internal {
        // prevent transfer to 0x0, use burn instead
        require(address(to) != address(0));
        require(balances[address(this)] >= tokens );
        require(balances[to] + tokens >= balances[to]);
       
        balances[address(this)] = balances[address(this)].sub(tokens);
        balances[to] = balances[to].add(tokens);
        emit Transfer(address(this),to,tokens);
    }

    function openLock(address _address) public onlyOwner{
        // open lock and transfer to respective address
        require(walletsAllocation[_address].lock);
        require(walletsAllocation[_address].tokens > 0);
        require(balances[_address] == 0);

        _transfer(_address, walletsAllocation[_address].tokens);
        walletsAllocation[_address].lock = false;
    }
   
    // ------------------------------------------------------------------------
    // Don't Accepts ETH
    // ------------------------------------------------------------------------
    function () external payable {
        revert();
    }
}
1715467005
Hero Member
*
Offline Offline

Posts: 1715467005

View Profile Personal Message (Offline)

Ignore
1715467005
Reply with quote  #2

1715467005
Report to moderator
No Gods or Kings. Only Bitcoin
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715467005
Hero Member
*
Offline Offline

Posts: 1715467005

View Profile Personal Message (Offline)

Ignore
1715467005
Reply with quote  #2

1715467005
Report to moderator
walerikus
Member
**
Offline Offline

Activity: 180
Merit: 18


View Profile WWW
December 17, 2019, 01:20:37 AM
 #2

Guys im trying to creat own token for learn how to do it but about etherscan publish share i have problem

i see like this error end of the share public on etherscan


Error! Unable to locate Contract Code at 0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4
Is this a valid Contract Address?

What is it mean guys? What should I do to solve this problem?


Bellow you can see my code text.

Please help me.

pragma solidity ^0.5.0;

// ----------------------------------------------------------------------------
// 'DNM' token contract

// Symbol      : DNM
// Name        : Deneme token
// Total supply: 9.000.000.000
// Decimals    : 8
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
        c = a + b;
        require(c >= a);
    }
    function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
        require(b <= a);
        c = a - b;
    }
    function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
        c = a * b;
        require(a == 0 || c / a == b);
    }
    function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
        require(b > 0);
        c = a / b;
    }
}


// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
    function totalSupply() public view returns (uint256);
    function balanceOf(address tokenOwner) public view returns (uint256 balance);
    function allowance(address tokenOwner, address spender) public view returns (uint256 remaining);
    function transfer(address to, uint256 tokens) public returns (bool success);
    function approve(address spender, uint256 tokens) public returns (bool success);
    function transferFrom(address payable from, address to, uint256 tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint256 tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}


// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
    address public owner;
    address public newOwner;

    event OwnershipTransferred(address indexed _from, address indexed _to);

    constructor() public {
        owner = msg.sender;
    }

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

    function transferOwnership(address _newOwner) public onlyOwner {
        newOwner = _newOwner;
    }
}


// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Deneme is ERC20Interface, Owned {
    using SafeMath for uint256;
    string public symbol = "DNM";
    string public  name = "Deneme Token";
    uint256 public decimals = 8;
    uint256 _totalSupply = 9e9* 10 ** uint(decimals);
   
    mapping(address => uint256) balances;
    mapping(address => mapping(address => uint256)) allowed;
   
    mapping(address => walletDetail) walletsAllocation;

    struct walletDetail{
        uint256 tokens;
        bool lock;
    }

    // ------------------------------------------------------------------------
    // Constructor
    // ------------------------------------------------------------------------
    constructor() public {
        owner = address(0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4);
        balances[address(this)] = totalSupply();
        emit Transfer(address(0),address(this), totalSupply());

        _makeAllocations();
    }

    function _makeAllocations() private{
        //Team Wallet(Locted 2 years)
        _transfer(0x1G4713Af0CFe2s4ebA123456A8F55982416c2453, 1e9 * 10 ** uint(decimals));
        walletsAllocation[0x1G4713Af0CFe2s4ebA123456A8F55982416c2453] = walletDetail(2e9 * 10 ** uint(decimals), false);
        //Airdrop Wallet
        _transfer(0xfA5401eac451793v65432109Ed44A50bE5A22CBV, 2e9 * 10 ** uint(decimals));
        walletsAllocation[0xfA5401eac451793v65432109Ed44A50bE5A22CBV] = walletDetail(4e9 * 10 ** uint(decimals), false);
        //Development Wallet (Locked 1 years)
        _transfer(0x06cC0DDA81A17F98765e30d147c6021d87675fa, 2e9 * 10 ** uint(decimals));
        walletsAllocation[0x06cC0DDA81A17F98765e30d147c6021d87675fa] = walletDetail(3e9 * 10 ** uint(decimals), false);
        //Marketing Wallet
        _transfer(0x084J4E3V6c01124567894eE3G42CE91E6016c675, 4e9 * 10 ** uint(decimals));
        walletsAllocation[0x084J4E3V6c01124567894eE3G42CE91E6016c675] = walletDetail(3e9 * 10 ** uint(decimals), false);
    }
   
    /** ERC20Interface function's implementation **/
   
    function totalSupply() public view returns (uint256){
       return _totalSupply;
    }
   
    // ------------------------------------------------------------------------
    // Get the token balance for account `tokenOwner`
    // ------------------------------------------------------------------------
    function balanceOf(address tokenOwner) public view returns (uint256 balance) {
        return balances[tokenOwner];
    }

    // ------------------------------------------------------------------------
    // Transfer the balance from token owner's account to `to` account
    // - Owner's account must have sufficient balance to transfer
    // - 0 value transfers are allowed
    // ------------------------------------------------------------------------
    function transfer(address to, uint256 tokens) public returns (bool success) {
        // prevent transfer to 0x0, use burn instead
        require(address(to) != address(0));
        require(balances[msg.sender] >= tokens );
        require(balances[to] + tokens >= balances[to]);

        balances[msg.sender] = balances[msg.sender].sub(tokens);
        balances[to] = balances[to].add(tokens);
        emit Transfer(msg.sender,to,tokens);
        return true;
    }
   
    // ------------------------------------------------------------------------
    // Token owner can approve for `spender` to transferFrom(...) `tokens`
    // from the token owner's account
    // ------------------------------------------------------------------------
    function approve(address spender, uint256 tokens) public returns (bool success){
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender,spender,tokens);
        return true;
    }

    // ------------------------------------------------------------------------
    // Transfer `tokens` from the `from` account to the `to` account
    //
    // The calling account must already have sufficient tokens approve(...)-d
    // for spending from the `from` account and
    // - From account must have sufficient balance to transfer
    // - Spender must have sufficient allowance to transfer
    // - 0 value transfers are allowed
    // ------------------------------------------------------------------------
    function transferFrom(address payable from, address to, uint256 tokens) public returns (bool success){
        require(tokens <= allowed[from][msg.sender]); //check allowance
        require(balances[from] >= tokens);

        balances[from] = balances[from].sub(tokens);
        balances[to] = balances[to].add(tokens);
        allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
        emit Transfer(from,to,tokens);
        return true;
    }
   
    // ------------------------------------------------------------------------
    // Returns the amount of tokens approved by the owner that can be
    // transferred to the spender's account
    // ------------------------------------------------------------------------
    function allowance(address tokenOwner, address spender) public view returns (uint256 remaining) {
        return allowed[tokenOwner][spender];
    }
   
    function transferFromContract(address to, uint256 tokens) public onlyOwner returns (bool success){
        _transfer(to,tokens);
        return true;
    }

    function _transfer(address to, uint256 tokens) internal {
        // prevent transfer to 0x0, use burn instead
        require(address(to) != address(0));
        require(balances[address(this)] >= tokens );
        require(balances[to] + tokens >= balances[to]);
       
        balances[address(this)] = balances[address(this)].sub(tokens);
        balances[to] = balances[to].add(tokens);
        emit Transfer(address(this),to,tokens);
    }

    function openLock(address _address) public onlyOwner{
        // open lock and transfer to respective address
        require(walletsAllocation[_address].lock);
        require(walletsAllocation[_address].tokens > 0);
        require(balances[_address] == 0);

        _transfer(_address, walletsAllocation[_address].tokens);
        walletsAllocation[_address].lock = false;
    }
   
    // ------------------------------------------------------------------------
    // Don't Accepts ETH
    // ------------------------------------------------------------------------
    function () external payable {
        revert();
    }
}

Just try Digiassets by Digibyte blockchain, much easier, use createdigiassets.com and Digibyte blockchain is also faster, with lower fees, and with higher security.
tinyteapot
Sr. Member
****
Offline Offline

Activity: 1148
Merit: 275


View Profile
December 17, 2019, 07:59:22 AM
 #3

I can assist with this free of charge if i understand what your project is all about and your commitment towards its success.
Send me pm if your need my help.
cryptozahi (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 4


View Profile
December 17, 2019, 08:39:32 AM
 #4

I can assist with this free of charge if i understand what your project is all about and your commitment towards its success.
Send me pm if your need my help.

Its not project token. I just trying to learn how can i creat my own token. And also, Why you need name of my producut details? I just asked how can i creat own token.
unbanked_peon
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
December 17, 2019, 09:15:30 AM
 #5

Figured I'd chime in here. You should really be testing on the remix online website unless you have your own development node running locally. This really just simplifies testing, it will even tell you where it failed and why? (too much gas, i.e.) http://remix.ethereum.org/ and depending on your editor most have cool useful plugins to help you develop.  Wink
Stanlo
Full Member
***
Offline Offline

Activity: 952
Merit: 110


View Profile
December 17, 2019, 12:12:47 PM
 #6

People should stop creating tokens because of how easy they are to create, you are just doing this to learn or what? We already have too many shitcoins pls don't add to the list
mirgo1791
Member
**
Offline Offline

Activity: 1022
Merit: 10


View Profile WWW
December 17, 2019, 03:08:35 PM
 #7

someday my project of the label set with the name of UMBU LEUIT should have with chance as might to put of work along with the desktop as applying the security and utility function on noticing records of credit and gains with benefit as the practice of the alternative live of finance with the offers of manage with work on development from our studio CARESSEN WEBWORKS.
if someone should be with interest to supports our project please visit: https://ronceng55.blogspot.com/ to put of investment fund as we might move to stages of IEO with the bitcoin talk bounty jobs to helps as spreading the good news for pro investors with money to helps us with the good project of social medium of online communication app for pupils of indonesia only
as as with the future investors from india might be with interest for the brick and mortaring the goods of service in kerala or near kerala then our work shop to gives option for smart contract as characteristic of field of business in india must have of one of business company with modest ability to work on reference of manege with product delivery that is the investors company with complete of right to release service within their locale heuristic of domestic field of business as we collects of minimum 1 million of usd per company to work with the customs delivery of the UMBU LEUIT service of soccom.

💌💌💌💌💌        DO NEAR - GAMES ARE LOVE         💌💌💌💌💌
walerikus
Member
**
Offline Offline

Activity: 180
Merit: 18


View Profile WWW
December 17, 2019, 06:41:03 PM
 #8

I can assist with this free of charge if i understand what your project is all about and your commitment towards its success.
Send me pm if your need my help.

Its not project token. I just trying to learn how can i creat my own token. And also, Why you need name of my producut details? I just asked how can i creat own token.

I am telling you again, just use createdigiassets.com it's much easier
walerikus
Member
**
Offline Offline

Activity: 180
Merit: 18


View Profile WWW
December 17, 2019, 06:43:27 PM
 #9

Figured I'd chime in here. You should really be testing on the remix online website unless you have your own development node running locally. This really just simplifies testing, it will even tell you where it failed and why? (too much gas, i.e.) http://remix.ethereum.org/ and depending on your editor most have cool useful plugins to help you develop.  Wink


Im using http://remix.ethereum.org/ for make own token but i see same problem. I cant understand where im making mistake.

You are using the wrong Blockchain. Ethereum is not scalable, it is not efficient, and soon it will lose it's last credibility of being decentralized. Just use createdigiassets.com for the peace of mind.
diazepam666
Hero Member
*****
Offline Offline

Activity: 1162
Merit: 516


1BTC Welcome Bonus


View Profile
December 17, 2019, 06:46:56 PM
 #10

Solidity.exe is the open source platform for you to create the smart contract and token can be created for project with the decimal level and use ethereum infrastructure to make your token easily buddy.

.
.
        ▄▄▄▄▄▄▄
       ████████     ▄█▄▄
       ▀█▀▀▀▀▀▀█▀   ▄██████
         ▀▀▀▀▀▀    ███████▀
 ▄▄███▄▄          ███████▀
█████████▄        █████▀
███████████▄       ▀▀▀▀
▀████████████▄
 ▀████████████▄
  ▀████████████▄
    ▀███████████
      ▀████████▀
        ▀▀████▀
        ▄▄▄▄▄▄▄
       ████████     ▄█▄▄
       ▀█▀▀▀▀▀▀█▀   ▄██████
         ▀▀▀▀▀▀    ███████▀
 ▄▄███▄▄          ███████▀
█████████▄        █████▀
███████████▄       ▀▀▀▀
▀████████████▄
 ▀████████████▄
  ▀████████████▄
    ▀███████████
      ▀████████▀
        ▀▀████▀
.
..Learn More..
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!