Contract Address Details

0xFCe94193c3847a11920787274CF1Cf7Ea7DE73A1

AlienFarm Last Balance Update: Block #9873872
Created by 0x4b4f–eb5072 at 0x54cf–2ba5ac

Balance

0.001356069958702905 ETC

(@ /ETC)

Fetching tokens...

Contract name:
AlienFarm




Optimization enabled
true
Compiler version
v0.4.20+commit.3155dd80




Optimization runs
200
EVM Version
byzantium

Contract source code

/**
* Submitted for verification at blockscout.com on 2019-12-13 10:42:01.802455Z
*/
pragma solidity ^0.4.20;
/// @notice TomatoesAreComing!
/// @title CryptoTomatoes - Ethereum Classic Game
/// @author Highlander Network
/// @notice CryptoTomatoes is for entertainment purposes only and we don't accept any responsibility for any use case of this dApp.
/// @notice Smart Contracts have not been Verified.
contract AlienFarm{
uint256 public EGGS_TO_HATCH_1ALIEN=86400; //Hatching in 1 day
uint256 public STARTING_ALIEN=100;
uint256 PSN=10000;
uint256 PSNH=5000;
bool public initialized=false;
address public ceoAddress;
mapping (address => uint256) public hatcheryAlien;
mapping (address => uint256) public claimedEggs;
mapping (address => uint256) public lastHatch;
mapping (address => address) public referrals;
uint256 public marketEggs;
event onHatchEggs(
address indexed customerAddress,
uint256 Aliens,
address indexed referredBy
);
event onSellEggs(
address indexed customerAddress,
uint256 eggs,
uint256 ethereumEarned
);
event onBuyEggs(
address indexed customerAddress,
uint256 eggs,
uint256 incomingEthereum
);
function AlienFarm() public{
ceoAddress = 0x4B4f724B936290bDADC87439856Eaf2671eb5072;
}
function hatchEggs(address ref) public{
require(initialized);
if(referrals[msg.sender]==0 && referrals[msg.sender]!=msg.sender){
referrals[msg.sender]=ref;
}
uint256 eggsUsed=getMyEggs();
uint256 newAlien=SafeMath.div(eggsUsed,EGGS_TO_HATCH_1ALIEN);
hatcheryAlien[msg.sender]=SafeMath.add(hatcheryAlien[msg.sender],newAlien);
claimedEggs[msg.sender]=0;
lastHatch[msg.sender]=now;
//send referral eggs
claimedEggs[referrals[msg.sender]]=SafeMath.add(claimedEggs[referrals[msg.sender]],SafeMath.div(eggsUsed,5));
//boost market to nerf alien hoarding
marketEggs=SafeMath.add(marketEggs,SafeMath.div(eggsUsed,10));
onHatchEggs(msg.sender, newAlien, ref);
}
function sellEggs() public{
require(initialized);
uint256 hasEggs=getMyEggs();
uint256 eggValue=calculateEggSell(hasEggs);
uint256 fee=devFee(eggValue);
uint256 ethereumEarned = SafeMath.sub(eggValue,fee);
claimedEggs[msg.sender]=0;
lastHatch[msg.sender]=now;
marketEggs=SafeMath.add(marketEggs,hasEggs);
ceoAddress.transfer(fee);
msg.sender.transfer(ethereumEarned);
onSellEggs(msg.sender, hasEggs, ethereumEarned);
}
function buyEggs() public payable{
require(initialized);
uint256 eggsBought=calculateEggBuy(msg.value,SafeMath.sub(this.balance,msg.value));
uint256 fee = devFee(msg.value);
eggsBought=SafeMath.sub(eggsBought,devFee(eggsBought));
ceoAddress.transfer(fee);
claimedEggs[msg.sender]=SafeMath.add(claimedEggs[msg.sender],eggsBought);
onBuyEggs(msg.sender, eggsBought, msg.value);
}
//magic trade balancing algorithm
function calculateTrade(uint256 rt,uint256 rs, uint256 bs) public view returns(uint256){
//(PSN*bs)/(PSNH+((PSN*rs+PSNH*rt)/rt));
return SafeMath.div(SafeMath.mul(PSN,bs),SafeMath.add(PSNH,SafeMath.div(SafeMath.add(SafeMath.mul(PSN,rs),SafeMath.mul(PSNH,rt)),rt)));
}
function calculateEggSell(uint256 eggs) public view returns(uint256){
return calculateTrade(eggs,marketEggs,this.balance);
}
function calculateEggBuy(uint256 eth,uint256 contractBalance) public view returns(uint256){
return calculateTrade(eth,contractBalance,marketEggs);
}
function calculateEggBuySimple(uint256 eth) public view returns(uint256){
return calculateEggBuy(eth,this.balance);
}
function devFee(uint256 amount) public pure returns(uint256){
return SafeMath.div(SafeMath.mul(amount,4),100);
}
function seedMarket(uint256 eggs) public payable{
require(marketEggs==0);
initialized=true;
marketEggs=eggs;
}
function setFreeAlien(uint16 _newFreeAlien) public{
require(msg.sender==ceoAddress);
require(_newFreeAlien >= 10);
STARTING_ALIEN=_newFreeAlien;
}
function getFreeAlien() public{
require(initialized);
require(hatcheryAlien[msg.sender]==0);
lastHatch[msg.sender]=now;
hatcheryAlien[msg.sender]=STARTING_ALIEN;
}
function getBalance() public view returns(uint256){
return this.balance;
}
function getMyAlien() public view returns(uint256){
return hatcheryAlien[msg.sender];
}
function getMyEggs() public view returns(uint256){
return SafeMath.add(claimedEggs[msg.sender],getEggsSinceLastHatch(msg.sender));
}
function getEggsSinceLastHatch(address adr) public view returns(uint256){
uint256 secondsPassed=min(EGGS_TO_HATCH_1ALIEN,SafeMath.sub(now,lastHatch[adr]));
return SafeMath.mul(secondsPassed,hatcheryAlien[adr]);
}
function min(uint256 a, uint256 b) private pure returns (uint256) {
return a < b ? a : b;
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"ceoAddress","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"getBalance","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"initialized","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"calculateTrade","inputs":[{"type":"uint256","name":"rt"},{"type":"uint256","name":"rs"},{"type":"uint256","name":"bs"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"calculateEggBuy","inputs":[{"type":"uint256","name":"eth"},{"type":"uint256","name":"contractBalance"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"marketEggs","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"sellEggs","inputs":[],"constant":false},{"type":"function","stateMutability":"payable","payable":true,"outputs":[],"name":"seedMarket","inputs":[{"type":"uint256","name":"eggs"}],"constant":false},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"devFee","inputs":[{"type":"uint256","name":"amount"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"hatchEggs","inputs":[{"type":"address","name":"ref"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"getMyEggs","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"lastHatch","inputs":[{"type":"address","name":""}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setFreeAlien","inputs":[{"type":"uint16","name":"_newFreeAlien"}],"constant":false},{"type":"function","stateMutability":"payable","payable":true,"outputs":[],"name":"buyEggs","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"claimedEggs","inputs":[{"type":"address","name":""}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"hatcheryAlien","inputs":[{"type":"address","name":""}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"calculateEggBuySimple","inputs":[{"type":"uint256","name":"eth"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"calculateEggSell","inputs":[{"type":"uint256","name":"eggs"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"EGGS_TO_HATCH_1ALIEN","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"referrals","inputs":[{"type":"address","name":""}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"getMyAlien","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"getEggsSinceLastHatch","inputs":[{"type":"address","name":"adr"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"STARTING_ALIEN","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"getFreeAlien","inputs":[],"constant":false},{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"event","name":"onHatchEggs","inputs":[{"type":"address","name":"customerAddress","indexed":true},{"type":"uint256","name":"Aliens","indexed":false},{"type":"address","name":"referredBy","indexed":true}],"anonymous":false},{"type":"event","name":"onSellEggs","inputs":[{"type":"address","name":"customerAddress","indexed":true},{"type":"uint256","name":"eggs","indexed":false},{"type":"uint256","name":"ethereumEarned","indexed":false}],"anonymous":false},{"type":"event","name":"onBuyEggs","inputs":[{"type":"address","name":"customerAddress","indexed":true},{"type":"uint256","name":"eggs","indexed":false},{"type":"uint256","name":"incomingEthereum","indexed":false}],"anonymous":false}]
            

Contract Byte Code

0x60606040526004361061013d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a0f8168811461014257806312065fe014610171578063158ef93e14610196578063229824c4146101bd57806326fd8422146101d95780632e9392bb146101f25780633955f0fe146102055780633b6537551461021a5780633bc0461a146102255780633ec862a81461023b57806343ce74221461025a578063467ece791461026d57806348887c8b1461028c5780634f74acfe146102a657806372670361146102ae5780637848515d146102cd5780637e56fde5146102ec5780638e31632714610302578063989c1855146103185780639ca423b31461032b578063c843c0c81461034a578063d7c8843b1461035d578063dde976b81461037c578063de742c2d1461038f575b600080fd5b341561014d57600080fd5b6101556103a2565b604051600160a060020a03909116815260200160405180910390f35b341561017c57600080fd5b6101846103b6565b60405190815260200160405180910390f35b34156101a157600080fd5b6101a96103c4565b604051901515815260200160405180910390f35b34156101c857600080fd5b6101846004356024356044356103cd565b34156101e457600080fd5b61018460043560243561041a565b34156101fd57600080fd5b610184610430565b341561021057600080fd5b610218610436565b005b610218600435610568565b341561023057600080fd5b610184600435610587565b341561024657600080fd5b610218600160a060020a03600435166105a4565b341561026557600080fd5b610184610758565b341561027857600080fd5b610184600160a060020a0360043516610791565b341561029757600080fd5b61021861ffff600435166107a3565b6102186107de565b34156102b957600080fd5b610184600160a060020a03600435166108ec565b34156102d857600080fd5b610184600160a060020a03600435166108fe565b34156102f757600080fd5b610184600435610910565b341561030d57600080fd5b610184600435610926565b341561032357600080fd5b61018461093f565b341561033657600080fd5b610155600160a060020a0360043516610945565b341561035557600080fd5b610184610960565b341561036857600080fd5b610184600160a060020a036004351661097c565b341561038757600080fd5b6101846109d3565b341561039a57600080fd5b6102186109d9565b6004546101009004600160a060020a031681565b600160a060020a0330163190565b60045460ff1681565b60006104126103de60025484610a39565b61040d6003546104026104076103f66002548a610a39565b6104026003548c610a39565b610a6f565b89610a7e565b610a7e565b949350505050565b600061042983836009546103cd565b9392505050565b60095481565b60045460009081908190819060ff16151561045057600080fd5b610458610758565b935061046384610926565b925061046e83610587565b915061047a8383610a95565b600160a060020a0333166000908152600660209081526040808320839055600790915290204290556009549091506104b29085610a6f565b6009556004546101009004600160a060020a03166108fc83150283604051600060405180830381858888f1935050505015156104ed57600080fd5b600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050151561051e57600080fd5b33600160a060020a03167f5105d1d486c1fbe3b88388650f235c06cac5e57dc734a1a11e48383734f563d3858360405191825260208201526040908101905180910390a250505050565b6009541561057557600080fd5b6004805460ff19166001179055600955565b600061059e610597836004610a39565b6064610a7e565b92915050565b600454600090819060ff1615156105ba57600080fd5b600160a060020a03338116600090815260086020526040902054161580156105fd5750600160a060020a0333811660008181526008602052604090205490911614155b1561063f5733600160a060020a039081166000908152600860205260409020805473ffffffffffffffffffffffffffffffffffffffff19169185169190911790555b610647610758565b915061065582600054610a7e565b600160a060020a03331660009081526005602052604090205490915061067b9082610a6f565b600160a060020a03338116600090815260056020818152604080842095909555600680825285842084905560078252858420429055600882528584205490941683529290925291909120546106d591610402908590610a7e565b600160a060020a03338116600090815260086020908152604080832054909316825260069052205560095461070f9061040284600a610a7e565b600955600160a060020a038084169033167f496192b07562340afee67764647e94b51eee7a54ea2fdcea8073da0c0fd315d98360405190815260200160405180910390a3505050565b600061078c6006600033600160a060020a0316600160a060020a03168152602001908152602001600020546104023361097c565b905090565b60076020526000908152604090205481565b60045433600160a060020a0390811661010090920416146107c357600080fd5b600a61ffff821610156107d557600080fd5b61ffff16600155565b600454600090819060ff1615156107f457600080fd5b6108113461080c30600160a060020a03163134610a95565b61041a565b915061081c34610587565b90506108308261082b84610587565b610a95565b6004549092506101009004600160a060020a03166108fc82150282604051600060405180830381858888f19350505050151561086b57600080fd5b600160a060020a03331660009081526006602052604090205461088e9083610a6f565b600160a060020a0333166000818152600660205260409081902092909255907f7b6331640beaea5e54363de30ce55f1f6e4e8d2ed499e96a1308353fecd01edf90849034905191825260208201526040908101905180910390a25050565b60066020526000908152604090205481565b60056020526000908152604090205481565b600061059e8230600160a060020a03163161041a565b600061059e8260095430600160a060020a0316316103cd565b60005481565b600860205260009081526040902054600160a060020a031681565b600160a060020a03331660009081526005602052604090205490565b60008054600160a060020a03831682526007602052604082205482916109ac916109a7904290610a95565b610aa7565b600160a060020a038416600090815260056020526040902054909150610429908290610a39565b60015481565b60045460ff1615156109ea57600080fd5b600160a060020a03331660009081526005602052604090205415610a0d57600080fd5b600160a060020a0333166000908152600760209081526040808320429055600154600590925290912055565b600080831515610a4c5760009150610a68565b50828202828482811515610a5c57fe5b0414610a6457fe5b8091505b5092915050565b600082820183811015610a6457fe5b6000808284811515610a8c57fe5b04949350505050565b600082821115610aa157fe5b50900390565b6000818310610ab65781610429565b50909190505600a165627a7a72305820b00eaad3fcaccbd4185c533dd043e9154ec4d8671067d3213c7d9b421b96f8200029