boncey / Flickr4Java

Java API For Flickr. Fork of FlickrJ
BSD 2-Clause "Simplified" License
176 stars 154 forks source link

METAMASK WALLET DIDNT GET THE TOTAL AMOUNT OF TOKEN CREATED IN WALLET #507

Closed Charlesbutter1 closed 3 years ago

Charlesbutter1 commented 3 years ago

METAMASK WALLET DIDNT GET THE TOTAL AMOUNT OF TOKEN CREATED IN WALLET

I recently deployed a contract on the binance smart chain network and i wanted to create a total of one billion token but instead of a total of 10000000000 to be created i got on 0.1 one after deploying the contract. please i am confused as i dont know what to do now about it . please i also included the code thta i used to create theh token.

please i need assitance.

// SPDX-License-Identifier: UNLISCENSED

pragma solidity 0.8.4;

/**

contract SampleBEP20Token { string public name = "AfriToken"; string public symbol = "AFT"; uint256 public totalSupply = 1000000000; // 1 million tokens uint8 public decimals = 10;

/**
 * @dev Emitted when `value` tokens are moved from one account (`from`) to
 * another (`to`).
 *
 * Note that `value` may be zero.
 */
event Transfer(address indexed _from, address indexed _to, uint256 _value);

 /**
 * @dev Emitted when the allowance of a `spender` for an `owner` is set by
 * a call to {approve}. `value` is the new allowance.
 */
event Approval(
    address indexed _owner,
    address indexed _spender,
    uint256 _value
);

mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;

/**
 * @dev Constructor that gives msg.sender all of existing tokens.
 */
constructor() {
    balanceOf[msg.sender] = totalSupply;
}

 /**
 * @dev Moves `amount` tokens from the caller's account to `recipient`.
 *
 * Returns a boolean value indicating whether the operation succeeded.
 *
 * Emits a {Transfer} event.
 */
function transfer(address _to, uint256 _value)
    public
    returns (bool success)
{
    require(balanceOf[msg.sender] >= _value);
    balanceOf[msg.sender] -= _value;
    balanceOf[_to] += _value;
    emit Transfer(msg.sender, _to, _value);
    return true;
}

 /**
 * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
 *
 * Returns a boolean value indicating whether the operation succeeded.
 *
 * IMPORTANT: Beware that changing an allowance with this method brings the risk
 * that someone may use both the old and the new allowance by unfortunate
 * transaction ordering. One possible solution to mitigate this race
 * condition is to first reduce the spender's allowance to 0 and set the
 * desired value afterwards:
 * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
 *
 * Emits an {Approval} event.
 */

function approve(address _spender, uint256 _value)
    public
    returns (bool success)
{
    allowance[msg.sender][_spender] = _value;
    emit Approval(msg.sender, _spender, _value);
    return true;
}

/**
 * @dev Moves `amount` tokens from `sender` to `recipient` using the
 * allowance mechanism. `amount` is then deducted from the caller's
 * allowance.
 *
 * Returns a boolean value indicating whether the operation succeeded.
 *
 * Emits a {Transfer} event.
 */
function transferFrom(
    address _from,
    address _to,
    uint256 _value
) public returns (bool success) {
    require(_value <= balanceOf[_from]);
    require(_value <= allowance[_from][msg.sender]);
    balanceOf[_from] -= _value;
    balanceOf[_to] += _value;
    allowance[_from][msg.sender] -= _value;
    emit Transfer(_from, _to, _value);
    return true;
}

}