Проверенный контрактЧастичное
MyAdvancedToken
Адрес0x5d0a6b60dca7943dfb0c6ceea9fe13967844c19f
- Баланс
0 ETH
- Транзакций
18
- Компилятор
solc 0.4.16
- Тот же код
Только этот контракт
Подробности
- Компилятор
- solc 0.4.16+commit.d7661dd9
- Язык
- solidity
- Оптимизация
- Да, 200 прогонов
- Лицензия
- Не указана
- Совпадение
- Частичноекод создания: да, код в сети: да
- Проверен на Sourcify
- Создан в блоке
- 4 499 824
- Транзакция создания
- 0xc32d6afdda…cafb05eb86
MyAdvancedToken.sol
// 白纸铸意,信仰始成
// From white papyrus, ideologies forged.
// 丝路漫漫,盗贼伏道
// Roads of silk are long and lined with thieves.
// 巨山崩为齑粉
// A Great Mount crumbles to dust.
// 创世封锁旧途
// A genesis blocks the past.
// 善王困于己殿之下
// The philanthropist king crushed by his own palace.
// 地月灰烬中生社稷
// From the ashes of ground and moon grows community.
// 金币越过百年之山
// The golden coin crosses the Centennial Mountain.
// 慧元裹零而归,每零一年沉眠,马年终醒
// The Wise Yuan wraps itself in zeroes
// one for each year of slumber.
// A solitary billion in the year of the horse.
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
contract token {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
event Transfer(address indexed from, address indexed to, uint256 value);
function token(
uint256 initialSupply,
string tokenName,
uint8 decimalUnits,
string tokenSymbol
) public {
balanceOf[this] = initialSupply;
totalSupply = initialSupply;
name = tokenName;
symbol = tokenSymbol;
decimals = decimalUnits;
}
}
contract MyAdvancedToken is owned, token {
uint256 public sellPrice;
uint256 public buyPrice;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
_transfer(_from, _to, _value);
return true;
}
function MyAdvancedToken(
uint256 initialSupply,
string tokenName,
uint8 decimalUnits,
string tokenSymbol
) token(initialSupply, tokenName, decimalUnits, tokenSymbol) public {}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] > _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
}
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
function buy() payable public returns (uint amount) {
amount = msg.value / buyPrice;
require(balanceOf[this] >= amount);
balanceOf[msg.sender] += amount;
balanceOf[this] -= amount;
Transfer(this, msg.sender, amount);
}
function sell(uint256 amount) public returns (uint revenue) {
require(balanceOf[msg.sender] >= amount);
balanceOf[this] += amount;
balanceOf[msg.sender] -= amount;
revenue = amount * sellPrice;
msg.sender.transfer(revenue);
Transfer(msg.sender, this, amount);
}
}
Настройки компилятораПоказать
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
}
}Исходный код и метаданные: Sourcify.
Исходный код принадлежит авторам контракта.