-
Notifications
You must be signed in to change notification settings - Fork 64
/
StableToken_v1.sol
45 lines (37 loc) · 1 KB
/
StableToken_v1.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
/**
* StableToken contract version v1
*/
contract StableToken is Initializable {
string public name;
string public symbol;
uint8 public decimals;
address public owner;
uint public totalSupply;
mapping(address => uint) public balances;
function initialize(
address _owner,
string memory _name,
string memory _symbol,
uint8 _decimals
)
public initializer
{
owner = _owner;
name = _name;
symbol = _symbol;
decimals = _decimals;
uint tokensToMint = 1000000 * (10 ** uint(decimals));
totalSupply += tokensToMint;
balances[owner] += tokensToMint;
}
//DO NOT USE THIS IN PRODUCTION
//Integer overflow possible
function transfer(address _to, uint _amount) public returns (bool) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
return true;
}
//Rest of the code
}