文件 1 的 1:SNS.sol
pragma solidity ^0.4.6;
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
}
contract ERC20 {
function totalSupply() constant returns (uint256 totalSupply);
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, address to, uint value) returns (bool ok);
function approve(address spender, uint value) returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
event FrozenFunds(address target, bool frozen);
}
contract StandardToken is ERC20, SafeMath {
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
mapping (address => bool) public frozenAccount;
uint public _totalSupply;
address public _creator;
bool bIsFreezeAll = false;
function totalSupply() constant returns (uint256 totalSupply) {
totalSupply = _totalSupply;
}
function transfer(address _to, uint _value) returns (bool success) {
require(bIsFreezeAll == false);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_to]);
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) returns (bool success) {
require(bIsFreezeAll == false);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
var _allowance = allowed[_from][msg.sender];
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value) returns (bool success) {
require(bIsFreezeAll == false);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_spender]);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint remaining) {
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_owner]);
require(!frozenAccount[_spender]);
return allowed[_owner][_spender];
}
function freezeAll()
{
require(msg.sender == _creator);
bIsFreezeAll = !bIsFreezeAll;
}
function mintToken(address target, uint256 mintedAmount) {
require(msg.sender == _creator);
balances[target] += mintedAmount;
_totalSupply += mintedAmount;
Transfer(0, _creator, mintedAmount);
Transfer(_creator, target, mintedAmount);
}
function freezeAccount(address target, bool freeze) {
require(msg.sender == _creator);
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
}
contract SNS is StandardToken {
string public name = "Skyrim Network";
string public symbol = "SNS";
uint public decimals = 18;
uint public INITIAL_SUPPLY = 49900000000000000000000000000;
function SNS() {
_totalSupply = INITIAL_SUPPLY;
_creator = 0x5bd7Daa872D4e4EBe77420E368C0d683317840bA;
balances[_creator] = INITIAL_SUPPLY;
bIsFreezeAll = false;
}
function destroy() {
require(msg.sender == _creator);
suicide(_creator);
}
}
{
"compilationTarget": {
"SNS.sol": "SNS"
},
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}