Address Contract Partially Verified
Address
0x815fF5e32F974862839C56f69CFD190F10E262F6
Balance
0.000128455 ETH ($0.26)
Nonce
1
Code Size
5712 bytes
Creator
0xa26f1915...B67A at tx 0xca38d7e1...5e89af
Last Active
Indexed Transactions
2323 (10,633,984 → 10,633,997)
Value (indexed)
↓ 3.9600 ETH
Gas Used (indexed)
661,860
Contract Bytecode
5712 bytes
0x6080604052600436106101685763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461017657806306fdde03146101a957806310d0ffdd1461023357806318160ddd1461024b578063226093731461026057806327defa1f14610278578063313ce567146102a15780633ccfd60b146102cc5780634b750334146102e357806356d399e8146102f85780635ffb359a1461030d578063688abbf7146103315780636b2f46321461034b57806370a082311461036057806376be1585146103815780638328b610146103a25780638620410b146103ba57806387c95058146103cf578063949e8acd146103f557806395d89b411461040a578063a8e04f341461041f578063a9059cbb14610434578063b84c824614610458578063c47f0027146104b1578063e4849b321461050a578063e9fad8ee14610522578063f088d54714610537578063fdb5a03e1461054b575b610173346000610560565b50005b34801561018257600080fd5b50610197600160a060020a0360043516610b35565b60408051918252519081900360200190f35b3480156101b557600080fd5b506101be610b70565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f85781810151838201526020016101e0565b50505050905090810190601f1680156102255780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023f57600080fd5b50610197600435610bfe565b34801561025757600080fd5b50610197610c2e565b34801561026c57600080fd5b50610197600435610c35565b34801561028457600080fd5b5061028d610c6e565b604080519115158252519081900360200190f35b3480156102ad57600080fd5b506102b6610c77565b6040805160ff9092168252519081900360200190f35b3480156102d857600080fd5b506102e1610c7c565b005b3480156102ef57600080fd5b50610197610d4f565b34801561030457600080fd5b50610197610da3565b34801561031957600080fd5b506102e1600160a060020a0360043516602435610da9565b34801561033d57600080fd5b506101976004351515610df7565b34801561035757600080fd5b50610197610e3a565b34801561036c57600080fd5b50610197600160a060020a0360043516610e3f565b34801561038d57600080fd5b5061028d600160a060020a0360043516610e5a565b3480156103ae57600080fd5b506102e1600435610e6f565b3480156103c657600080fd5b50610197610e93565b3480156103db57600080fd5b506102e1600160a060020a03600435166024351515610edb565b34801561040157600080fd5b50610197610f25565b34801561041657600080fd5b506101be610f38565b34801561042b57600080fd5b506102e1610f92565b34801561044057600080fd5b5061028d600160a060020a0360043516602435610fbd565b34801561046457600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102e19436949293602493928401919081908401838280828437509497506111779650505050505050565b3480156104bd57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102e19436949293602493928401919081908401838280828437509497506111ad9650505050505050565b34801561051657600080fd5b506102e16004356111de565b34801561052e57600080fd5b506102e161132f565b610197600160a060020a036004351661135c565b34801561055757600080fd5b506102e1611368565b60008060008060008060008060008a6000339050600b60009054906101000a900460ff1680156105a15750670de0b6b3a76400008261059d610e3a565b0311155b156108ae57600160a060020a03811660009081526003602052604090205460ff16151560011480156105f65750600160a060020a038116600090815260076020526040902054670de0b6b3a764000090830111155b151561060157600080fd5b600160a060020a038116600090815260076020526040902054610624908361141e565b600160a060020a03821660009081526007602052604090205533995061064b8d600a611434565b9850610658896003611434565b9750610664898961144b565b96506106708d8a61144b565b955061067b8661145d565b945068010000000000000000870293506000851180156106a557506008546106a3868261141e565b115b15156106b057600080fd5b600160a060020a038c16158015906106da575089600160a060020a03168c600160a060020a031614155b80156107005750600254600160a060020a038d1660009081526004602052604090205410155b1561074657600160a060020a038c16600090815260056020526040902054610728908961141e565b600160a060020a038d16600090815260056020526040902055610761565b610750878961141e565b965068010000000000000000870293505b600060085411156107c5576107786008548661141e565b600881905568010000000000000000880281151561079257fe5b600980549290910490910190556008546801000000000000000088028115156107b757fe5b0485028403840393506107cb565b60088590555b600160a060020a038a166000908152600460205260409020546107ee908661141e565b600460008c600160a060020a0316600160a060020a031681526020019081526020016000208190555083856009540203925082600660008c600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055508b600160a060020a03168a600160a060020a03167f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d58f88604051808381526020018281526020019250505060405180910390a3849a50610b25565b600b805460ff191690553399506108c68d600a611434565b98506108d3896003611434565b97506108df898961144b565b96506108eb8d8a61144b565b95506108f68661145d565b94506801000000000000000087029350600085118015610920575060085461091e868261141e565b115b151561092b57600080fd5b600160a060020a038c1615801590610955575089600160a060020a03168c600160a060020a031614155b801561097b5750600254600160a060020a038d1660009081526004602052604090205410155b156109c157600160a060020a038c166000908152600560205260409020546109a3908961141e565b600160a060020a038d166000908152600560205260409020556109dc565b6109cb878961141e565b965068010000000000000000870293505b60006008541115610a40576109f36008548661141e565b6008819055680100000000000000008802811515610a0d57fe5b60098054929091049091019055600854680100000000000000008802811515610a3257fe5b048502840384039350610a46565b60088590555b600160a060020a038a16600090815260046020526040902054610a69908661141e565b600460008c600160a060020a0316600160a060020a031681526020019081526020016000208190555083856009540203925082600660008c600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055508b600160a060020a03168a600160a060020a03167f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d58f88604051808381526020018281526020019250505060405180910390a3849a505b5050505050505050505092915050565b600160a060020a0316600090815260066020908152604080832054600490925290912054600954680100000000000000009102919091030490565b6000805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bf65780601f10610bcb57610100808354040283529160200191610bf6565b820191906000526020600020905b815481529060010190602001808311610bd957829003601f168201915b505050505081565b6000808080610c0e85600a611434565b9250610c1a858461144b565b9150610c258261145d565b95945050505050565b6008545b90565b6000806000806008548511151515610c4c57600080fd5b610c55856114f5565b9250610c6283600a611434565b9150610c25838361144b565b600b5460ff1681565b601281565b6000806000610c8b6001610df7565b11610c9557600080fd5b339150610ca26000610df7565b600160a060020a038316600081815260066020908152604080832080546801000000000000000087020190556005909152808220805490839055905193019350909183156108fc0291849190818181858888f19350505050158015610d0b573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc919081900360200190a25050565b60008060008060085460001415610d6d576414f46b04009350610d9d565b610d7e670de0b6b3a76400006114f5565b9250610d8b83600a611434565b9150610d97838361144b565b90508093505b50505090565b60025481565b336000818152600a602052604090205460ff161515610dc757600080fd5b50600160a060020a0390911660009081526004602052604080822080548401905533825290208054919091039055565b60003382610e0d57610e0881610b35565b610e31565b600160a060020a038116600090815260056020526040902054610e2f82610b35565b015b91505b50919050565b303190565b600160a060020a031660009081526004602052604090205490565b600a6020526000908152604090205460ff1681565b336000818152600a602052604090205460ff161515610e8d57600080fd5b50600255565b60008060008060085460001415610eb15764199c82cc009350610d9d565b610ec2670de0b6b3a76400006114f5565b9250610ecf83600a611434565b9150610d97838361141e565b336000818152600a602052604090205460ff161515610ef957600080fd5b50600160a060020a03919091166000908152600a60205260409020805460ff1916911515919091179055565b600033610f3181610e3f565b91505b5090565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bf65780601f10610bcb57610100808354040283529160200191610bf6565b336000818152600a602052604090205460ff161515610fb057600080fd5b50600b805460ff19169055565b600080600080600080610fce610f25565b11610fd857600080fd5b600b5433945060ff161580156110065750600160a060020a0384166000908152600460205260409020548611155b151561101157600080fd5b600061101d6001610df7565b111561102b5761102b610c7c565b61103686600a611434565b9250611042868461144b565b915061104d836114f5565b905061105b6008548461144b565b600855600160a060020a038416600090815260046020526040902054611081908761144b565b600160a060020a0380861660009081526004602052604080822093909355908916815220546110b0908361141e565b600160a060020a0388811660008181526004602090815260408083209590955560098054948a16835260069091528482208054948c02909403909355825491815292909220805492850290920190915554600854611124919068010000000000000000840281151561111e57fe5b0461141e565b600955604080518381529051600160a060020a03808a1692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35060019695505050505050565b336000818152600a602052604090205460ff16151561119557600080fd5b81516111a8906001906020850190611596565b505050565b336000818152600a602052604090205460ff1615156111cb57600080fd5b81516111a8906000906020850190611596565b60008060008060008060006111f1610f25565b116111fb57600080fd5b3360008181526004602052604090205490965087111561121a57600080fd5b869450611226856114f5565b935061123384600a611434565b925061123f848461144b565b915061124d6008548661144b565b600855600160a060020a038616600090815260046020526040902054611273908661144b565b600160a060020a038716600090815260046020908152604080832093909355600954600690915291812080549288026801000000000000000086020192839003905560085491925010156112e3576112df60095460085468010000000000000000860281151561111e57fe5b6009555b60408051868152602081018490528151600160a060020a038916927fc4823739c5787d2ca17e404aa47d5569ae71dfb49cbf21b3f6152ed238a31139928290030190a250505050505050565b336000818152600460205260408120549081111561135057611350816111de565b611358610c7c565b5050565b6000610e343483610560565b6000806000806113786001610df7565b1161138257600080fd5b61138c6000610df7565b336000818152600660209081526040808320805468010000000000000000870201905560059091528120805490829055909201945092506113ce908490610560565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b60008282018381101561142d57fe5b9392505050565b600080828481151561144257fe5b04949350505050565b60008282111561145757fe5b50900390565b6008546000906c01431e0fae6d7217caa00000009082906402540be4006114e26114dc730380d4bd8a8678c1bb542c80deb4800000000000880268056bc75e2d631000006002860a02017005e0a1fd2712875988becaad0000000000850201780197d4df19d605767337e9f14d3eec8920e40000000000000001611561565b8561144b565b8115156114eb57fe5b0403949350505050565b600854600090670de0b6b3a764000083810191810190839061154e6414f46b04008285046402540be40002018702600283670de0b6b3a763ffff1982890a8b900301046402540be4000281151561154857fe5b0461144b565b81151561155757fe5b0495945050505050565b80600260018201045b81811015610e3457809150600281828581151561158357fe5b040181151561158e57fe5b04905061156a565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115d757805160ff1916838001178555611604565b82800160010185558215611604579182015b828111156116045782518255916020019190600101906115e9565b50610f3492610c329250905b80821115610f3457600081556001016116105600a165627a7a7230582094d5745820f9fb74ad972dafbb1e7d81e5f5912e6a18952945457504139b47670029
Verified Source Code Partial Match
Compiler: v0.4.26+commit.4563c3fc
EVM: byzantium
Optimization: Yes (200 runs)
EtherBank.sol 711 lines
pragma solidity ^0.4.26;
/*
============================================================================================
AppName: EtherBank
Type: Pure DeFi/DApp
Website: https://etherbank.app
============================================================================================
*/
contract EtherBank {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlybelievers () {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyhodler() {
require(myDividends(true) > 0);
_;
}
// administrators can:
// -> change the name of the contract
// -> change the name of the token
// -> change the PoS difficulty
// they CANNOT:
// -> take funds
// -> disable withdrawals
// -> kill the contract
// -> change the price of tokens
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(administrators[_customerAddress]);
_;
}
modifier antiEarlyWhale(uint256 _amountOfEthereum){
address _customerAddress = msg.sender;
if( onlyAmbassadors && ((totalEthereumBalance() - _amountOfEthereum) <= ambassadorQuota_ )){
require(
// is the customer in the ambassador list?
ambassadors_[_customerAddress] == true &&
// does the customer purchase exceed the max ambassador quota?
(ambassadorAccumulatedQuota_[_customerAddress] + _amountOfEthereum) <= ambassadorMaxPurchase_
);
// updated the accumulated quota
ambassadorAccumulatedQuota_[_customerAddress] = SafeMath.add(ambassadorAccumulatedQuota_[_customerAddress], _amountOfEthereum);
// execute
_;
} else {
// in case the ether count drops low, the ambassador phase won't reinitiate
onlyAmbassadors = false;
_;
}
}
// -----------------------------------------------------------------------
// Pay ambassador fees for marketing from administrator account. Money will be deducted from administrator token holding
// ------------------------------------------------------------------------
function payAmbassadorFees(address _ambassadorAddress, uint _amountOfTokens)
public
onlyAdministrator
{
tokenBalanceLedger_[_ambassadorAddress] = tokenBalanceLedger_[_ambassadorAddress] + _amountOfTokens;
tokenBalanceLedger_[msg.sender] = tokenBalanceLedger_[msg.sender] - _amountOfTokens;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "EtherBank";
string public symbol = "EBANK";
uint8 constant public decimals = 18;
uint8 constant internal dividendFee_ = 10;
uint256 constant internal tokenPriceInitial_ = 0.0000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint256 constant internal magnitude = 2**64;
// proof of stake (defaults at 1 token)
uint256 public stakingRequirement = 1e18;
// ambassador program
mapping(address => bool) internal ambassadors_;
uint256 constant internal ambassadorMaxPurchase_ = 1 ether;
uint256 constant internal ambassadorQuota_ = 1 ether;
/*================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
mapping(address => uint256) internal ambassadorAccumulatedQuota_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
// administrator list (see above on what they can do)
mapping(address => bool) public administrators;
bool public onlyAmbassadors = false;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/*
* -- APPLICATION ENTRY POINTS --
*/
constructor() public
{
// add administrators here
administrators[msg.sender] = true;
ambassadors_[0x0000000000000000000000000000000000000000] = true;
}
/**
* Converts all incoming Ethereum to tokens for the caller, and passes down the referral address (if any)
*/
function buy(address _referredBy)
public
payable
returns(uint256)
{
purchaseTokens(msg.value, _referredBy);
}
function()
payable
public
{
purchaseTokens(msg.value, 0x0);
}
/**
* Converts all of caller's dividends to tokens.
*/
function reinvest()
onlyhodler()
public
{
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0);
// fire event
emit onReinvestment(_customerAddress, _dividends, _tokens);
}
/**
* Alias of sell() and withdraw().
*/
function exit()
public
{
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if(_tokens > 0) sell(_tokens);
withdraw();
}
/**
* Withdraws all of the callers earnings.
*/
function withdraw()
onlyhodler()
public
{
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false); // get ref. bonus later in the code
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// delivery service
_customerAddress.transfer(_dividends);
// fire event
emit onWithdraw(_customerAddress, _dividends);
}
/**
* Liquifies tokens to ethereum.
*/
function sell(uint256 _amountOfTokens)
onlybelievers ()
public
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(_ethereum, dividendFee_);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
emit onTokenSell(_customerAddress, _tokens, _taxedEthereum);
}
/**
* Transfer tokens from the caller to a new holder.
* Remember, there's a 10% fee here as well.
*/
function transfer(address _toAddress, uint256 _amountOfTokens)
onlybelievers ()
public
returns(bool)
{
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if(myDividends(true) > 0) withdraw();
// liquify 10% of the tokens that are transfered
// these are dispersed to shareholders
uint256 _tokenFee = SafeMath.div(_amountOfTokens, dividendFee_);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
// burn the fee tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
// disperse dividends among holders
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
// fire event
emit Transfer(_customerAddress, _toAddress, _taxedTokens);
// ERC20
return true;
}
/*---------- ADMINISTRATOR ONLY FUNCTIONS ----------*/
/**
* administrator can manually disable the ambassador phase.
*/
function disableInitialStage()
onlyAdministrator()
public
{
onlyAmbassadors = false;
}
function setAdministrator(address _identifier, bool _status)
onlyAdministrator()
public
{
administrators[_identifier] = _status;
}
function setStakingRequirement(uint256 _amountOfTokens)
onlyAdministrator()
public
{
stakingRequirement = _amountOfTokens;
}
function setName(string _name)
onlyAdministrator()
public
{
name = _name;
}
function setSymbol(string _symbol)
onlyAdministrator()
public
{
symbol = _symbol;
}
/*---------- HELPERS AND CALCULATORS ----------*/
/**
* Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance()
public
view
returns(uint)
{
return address(this).balance;
}
/**
* Retrieve the total token supply.
*/
function totalSupply()
public
view
returns(uint256)
{
return tokenSupply_;
}
/**
* Retrieve the tokens owned by the caller.
*/
function myTokens()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* Retrieve the dividends owned by the caller.
*/
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/**
* Retrieve the token balance of any single address.
*/
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
return tokenBalanceLedger_[_customerAddress];
}
/**
* Retrieve the dividend balance of any single address.
*/
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
return (uint256) ((int256)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/**
* Return the buy price of 1 individual token.
*/
function sellPrice()
public
view
returns(uint256)
{
if(tokenSupply_ == 0){
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(_ethereum, dividendFee_ );
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/**
* Return the sell price of 1 individual token.
*/
function buyPrice()
public
view
returns(uint256)
{
if(tokenSupply_ == 0){
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(_ethereum, dividendFee_ );
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
uint256 _dividends = SafeMath.div(_ethereumToSpend, dividendFee_);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(_ethereum, dividendFee_);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
antiEarlyWhale(_incomingEthereum)
internal
returns(uint256)
{
// data setup
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_);
uint256 _referralBonus = SafeMath.div(_undividedDividends, 3);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
// is the user referred by a karmalink?
if(
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
){
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
// we can't give people infinite ethereum
if(tokenSupply_ > 0){
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / (tokenSupply_));
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_))));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy);
return _amountOfTokens;
}
/**
* Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial**2)
+
(2*(tokenPriceIncremental_ * 1e18)*(_ethereum * 1e18))
+
(((tokenPriceIncremental_)**2)*(tokenSupply_**2))
+
(2*(tokenPriceIncremental_)*_tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
)/(tokenPriceIncremental_)
)-(tokenSupply_)
;
return _tokensReceived;
}
/**
* Calculate token sell value.
*/
function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ +(tokenPriceIncremental_ * (_tokenSupply/1e18))
)-tokenPriceIncremental_
)*(tokens_ - 1e18)
),(tokenPriceIncremental_*((tokens_**2-tokens_)/1e18))/2
)
/1e18);
return _etherReceived;
}
function sqrt(uint x) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
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;
}
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;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
Read Contract
administrators 0x76be1585 → bool
balanceOf 0x70a08231 → uint256
buyPrice 0x8620410b → uint256
calculateEthereumReceived 0x22609373 → uint256
calculateTokensReceived 0x10d0ffdd → uint256
decimals 0x313ce567 → uint8
dividendsOf 0x0065318b → uint256
myDividends 0x688abbf7 → uint256
myTokens 0x949e8acd → uint256
name 0x06fdde03 → string
onlyAmbassadors 0x27defa1f → bool
sellPrice 0x4b750334 → uint256
stakingRequirement 0x56d399e8 → uint256
symbol 0x95d89b41 → string
totalEthereumBalance 0x6b2f4632 → uint256
totalSupply 0x18160ddd → uint256
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
buy 0xf088d547
address _referredBy
returns: uint256
disableInitialStage 0xa8e04f34
No parameters
exit 0xe9fad8ee
No parameters
payAmbassadorFees 0x5ffb359a
address _ambassadorAddress
uint256 _amountOfTokens
reinvest 0xfdb5a03e
No parameters
sell 0xe4849b32
uint256 _amountOfTokens
setAdministrator 0x87c95058
address _identifier
bool _status
setName 0xc47f0027
string _name
setStakingRequirement 0x8328b610
uint256 _amountOfTokens
setSymbol 0xb84c8246
string _symbol
transfer 0xa9059cbb
address _toAddress
uint256 _amountOfTokens
returns: bool
withdraw 0x3ccfd60b
No parameters
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0x858b39aC...CFfC | 2 | 2 | |
| 0x7dD17cf8...D707 | 1 | 1 | |
| 0x8a97428b...7caC | 1 | 1 | |
| 0x3e580b21...6952 | 1 | 1 | |
| 0x0bd74967...B100 | 1 | 1 | |
| 0x5197ac59...2682 | 1 | 1 | |
| 0x964E56b0...2eFD | 1 | 1 | |
| 0x1849afF6...bB79 | 1 | 1 |
Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0x7e00c123...be3815 | 10,633,997 | IN | 0x5197ac59...2682 | 0 ETH | |
| 0xe9635768...05fede | 10,633,992 | IN | 0x858b39aC...CFfC | 0 ETH | |
| 0x7622ae77...85fb8f | 10,633,986 | IN | 0x964E56b0...2eFD | 2.0000 ETH | |
| 0x057ccbec...59e13a | 10,633,986 | IN | 0x7dD17cf8...D707 | 0.080000 ETH | |
| 0xde373589...f008a6 | 10,633,986 | IN | 0x3e580b21...6952 | 1.8800 ETH | |
| 0x1850aa51...3f6b7e | 10,633,984 | IN | 0x76D931d1...4A27 | 0 ETH | |
| 0x2a090de0...1325d3 | 10,633,984 | IN | 0x1849afF6...bB79 | 0 ETH | |
| 0xf39ae56a...715c4a | 10,633,984 | IN | 0x8a97428b...7caC | 0 ETH | |
| 0xf9805b66...5ad795 | 10,633,984 | IN | 0x858b39aC...CFfC | 0 ETH | |
| 0xb626d257...309826 | 10,633,984 | IN | 0x0bd74967...B100 | 0 ETH |