Verified contractPartial
token
Address0xd2d8d510980ef02fb2c3b79479d9b57d3bc7e2e7
- Balance
0 ETH
- Transactions
16
- Compiler
solc 0.1.4
- Same code
8 more contracts
Details
- Compiler
- solc 0.1.4+commit.5f6c3cdf
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: no, runtime code: yes
- Verified on Sourcify
- Created in block
- 346,687
- Creation transaction
- 0x864667fed1…324bdc36b3
token.sol
// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract token {
mapping (address => uint) public coinBalanceOf;
uint totalEther;
uint totalTokens;
uint tokenPrice;
event CoinTransfer(address sender, address receiver, uint amount);
function token(uint supply) {
coinBalanceOf[msg.sender] = supply;
totalTokens = supply;
totalEther = msg.value;
tokenPrice = totalEther / totalTokens;
}
function sendCoin(address receiver, uint amount) returns(bool sufficient) {
if (coinBalanceOf[msg.sender] < amount) return false;
coinBalanceOf[msg.sender] -= amount;
coinBalanceOf[receiver] += amount;
CoinTransfer(msg.sender, receiver, amount);
return true;
}
function showTokenPrice() returns (uint) {
return tokenPrice;
}
function showTokens(address addr) returns (uint) {
return coinBalanceOf[addr];
}
function showTotalEther() returns (uint) {
return totalEther;
}
function showBalance() returns (uint) {
return this.balance;
}
function showTotalTokens() returns (uint) {
return totalTokens;
}
function withdraw(uint amount) returns (bool) {
if (amount <= coinBalanceOf[msg.sender]) {
msg.sender.send(amount * tokenPrice);
totalTokens -= amount;
coinBalanceOf[msg.sender] -= amount;
totalEther -= amount * tokenPrice;
return true;
}
return false;
}
function deposit() returns (uint tokens) {
tokens = msg.value / tokenPrice;
coinBalanceOf[msg.sender] += tokens;
totalTokens += tokens;
totalEther += msg.value;
return tokens;
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.