Skip to content

Commit

Permalink
max supply function added
Browse files Browse the repository at this point in the history
  • Loading branch information
salemalem committed Jul 27, 2021
1 parent f001d48 commit d7c584d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions trc20token.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
pragma solidity ^0.5.0;

contract CraftStakeToken {
contract JDoge {

string public name; // token name
string public symbol; // token symbol
uint8 public decimals;
uint256 public totalSupply;
address public owner;
uint256 constant public maxSupply = 1000000*10**uint256(decimals);

mapping (address => uint256) public balanceOf;
mapping (address => mapping (address=> uint256)) public allowance;
Expand All @@ -22,8 +23,8 @@ contract CraftStakeToken {
totalSupply = 1000000*10**uint256(decimals);
owner = msg.sender;
balanceOf[owner] = totalSupply;
name = "CraftStake";
symbol = "CRS";
name = "JDoge";
symbol = "JDG";
}

function _transfer(address _from, address _to, uint256 _value) internal {
Expand Down Expand Up @@ -93,6 +94,7 @@ contract CraftStakeToken {
// generate new tokens (only owner can do it)
function mint(uint256 _value) public returns (bool success) {
require(msg.sender == owner);
require(totalSupply + _value <= maxSupply);

balanceOf[owner] += _value;
totalSupply += _value;
Expand All @@ -106,6 +108,7 @@ contract CraftStakeToken {
function mintTo(address _to, uint256 _value) public returns (bool success) {
require(msg.sender == owner);
require(_to != address(0));
require(totalSupply + _value <= maxSupply);

balanceOf[_to] += _value;
totalSupply += _value;
Expand Down

0 comments on commit d7c584d

Please sign in to comment.