Bitcoin Forum
May 07, 2024, 04:59:48 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Token yazmada ufak bir yardım lütfen  (Read 202 times)
cryptozahi (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 4


View Profile
December 16, 2019, 04:18:39 PM
 #1

Arkadaşlar merhaba. Token yazma konusunda kendimi geliştirmeye ve öğrenmeye çalışıyorum bazı videolara bakarak fakat en son aşamaya gelince bir türlü yapamıyorum. Bir yerde yazılan teksti kopyaladım ve oraya kendi tokenimle ilgili bilgileri girdim falan ama etherscanda public paylaşımı yaparken şöyle bir hata alıyorum;

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


Bu nedir? nerde hata yapıyorum?

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();
    }
}
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715057989
Hero Member
*
Offline Offline

Posts: 1715057989

View Profile Personal Message (Offline)

Ignore
1715057989
Reply with quote  #2

1715057989
Report to moderator
1715057989
Hero Member
*
Offline Offline

Posts: 1715057989

View Profile Personal Message (Offline)

Ignore
1715057989
Reply with quote  #2

1715057989
Report to moderator
bileq
Legendary
*
Offline Offline

Activity: 1274
Merit: 1068


View Profile
December 17, 2019, 04:14:19 PM
Merited by Blacknavy (1)
 #2

sadece bir gözlem..
0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4 adresi sizin kullandığınız erişebildiğiniz bir adres mi?
bu adres geçersiz uyarısı veriyor da?
https://etherscan.io/address/0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4
vincetcm
Hero Member
*****
Offline Offline

Activity: 1302
Merit: 533


View Profile
January 09, 2020, 06:46:40 PM
 #3

sadece bir gözlem..
0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4 adresi sizin kullandığınız erişebildiğiniz bir adres mi?
bu adres geçersiz uyarısı veriyor da?
https://etherscan.io/address/0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4

Üstadın da dediği gibi şu satırı değiştirirn
        owner = address(0xBa34b55dH7DA8FE540963Ed18Eb4808f5A656Ac4);

erişiminiz olan bir eth adresi yazın, yada adres sizin ise de eksik gibi görünüyor
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!