Skip to content

Commit

Permalink
minting + minting to 3rd party added
Browse files Browse the repository at this point in the history
  • Loading branch information
salemalem committed Jul 24, 2021
1 parent 807fb9b commit 2076380
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions trc20token.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.5.0;
pragma solidity ^0.4.26 < 0.5.0;

contract TRC20 {
contract CraftStakeToken {

string public name; // token name
string public symbol; // token symbol
Expand All @@ -14,6 +14,7 @@ contract TRC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 value);
event EcoBurn(address indexed from, uint256 value);
event Mint(address indexed to, uint256 value);

constructor() public {
decimals = 8;
Expand All @@ -25,7 +26,7 @@ contract TRC20 {
}

function _transfer(address _from, address _to, uint256 _value) internal {
require(_to!=address(0));
require(_to!=0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);

Expand Down Expand Up @@ -85,4 +86,29 @@ contract TRC20 {

return true;
}

// generate new tokens (only owner can do it)
function mint(uint256 _value) public returns (bool success) {
require(msg.sender==owner);

balanceOf[owner] += _value;
totalSupply += _value;

emit Mint(owner, _value);

return true;
}

// generate new tokens to 3rd party (only owner can do it)
function mintTo(address _to, uint256 _value) public returns (bool success) {
require(msg.sender==owner);
require(_to!=address(0));

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

emit Mint(_to, _value);

return true;
}
}

0 comments on commit 2076380

Please sign in to comment.