Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active May 13, 2021 05:10
Show Gist options
  • Save percybolmer/5732b06eed6bc4796abcd105f9a17d39 to your computer and use it in GitHub Desktop.
Save percybolmer/5732b06eed6bc4796abcd105f9a17d39 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/**
* @notice DevToken is a development token that we use to learn how to code solidity
* and what BEP-20 interface requires
*/
contract DevToken {
/**
* @notice Our Tokens required variables that are needed to operate everything
*/
uint private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
/**
* @notice _balances is a mapping that contains a address as KEY
* and the balance of the address as the value
*/
mapping (address => uint256) private _balances;
/**
* @notice Events are created below.
* Transfer event is a event that notify the blockchain that a transfer of assets has taken place
*
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @notice constructor will be triggered when we create the Smart contract
* _name = name of the token
* _short_symbol = Short Symbol name for the token
* token_decimals = The decimal precision of the Token, defaults 18
* _totalSupply is how much Tokens there are totally
*/
constructor(string memory token_name, string memory short_symbol, uint8 token_decimals, uint256 token_totalSupply){
_name = token_name;
_symbol = short_symbol;
_decimals = token_decimals;
_totalSupply = token_totalSupply;
// Add all the tokens created to the creator of the token
_balances[msg.sender] = _totalSupply;
// Emit an Transfer event to notify the blockchain that an Transfer has occured
emit Transfer(address(0), msg.sender, _totalSupply);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment