Address Contract Partially Verified
Address
0x84A4eCCB81A1Fd0867C7682E2c85FFeF4538A2F4
Balance
0 ETH
Nonce
1
Code Size
5581 bytes
Creator
0xcB71EB21...D1EC at tx 0x82fb6175...276b76
Indexed Transactions
Index loading...
Contract Bytecode
5581 bytes
0x6080604052600436106101735763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461017a57806306501a6a146101ad57806310d0ffdd146101d157806315cfc405146101e957806318160ddd146102435780633151ecfc146102585780633ccfd60b1461026d5780633d4b2c2c1461028257806341c61383146102975780634b750334146102ac578063537a39bb146102c157806370a08231146102d657806371201a0e146102f75780637d8820971461030c5780638620410b146103215780638dd4b8ad14610336578063949e8acd1461034e5780639d76ea5814610363578063a9059cbb14610394578063b9db102a146103cc578063ca3ea930146103e1578063d96a094a146103f6578063dc0b35641461040e578063e4849b3214610423578063eedc966a1461043b578063f4d980581461045c578063fbaf1bbd14610474578063fc439f7714610495578063fdb5a03e146104aa575b600080fd5b005b34801561018657600080fd5b5061019b600160a060020a03600435166104bf565b60408051918252519081900360200190f35b3480156101b957600080fd5b5061019b600160a060020a03600435166024356104f9565b3480156101dd57600080fd5b5061019b600435610626565b3480156101f557600080fd5b5061020a600160a060020a0360043516610655565b60405180826101c080838360005b83811015610230578181015183820152602001610218565b5050505090500191505060405180910390f35b34801561024f57600080fd5b5061019b6107d6565b34801561026457600080fd5b5061019b6107dc565b34801561027957600080fd5b506101786107ee565b34801561028e57600080fd5b5061019b61097e565b3480156102a357600080fd5b5061019b610a14565b3480156102b857600080fd5b5061019b610a1a565b3480156102cd57600080fd5b5061019b610a49565b3480156102e257600080fd5b5061019b600160a060020a0360043516610a4f565b34801561030357600080fd5b5061019b610a6a565b34801561031857600080fd5b5061019b610a70565b34801561032d57600080fd5b5061019b610a76565b34801561034257600080fd5b5061019b600435610a9d565b34801561035a57600080fd5b5061019b610ad1565b34801561036f57600080fd5b50610378610add565b60408051600160a060020a039092168252519081900360200190f35b3480156103a057600080fd5b506103b8600160a060020a0360043516602435610aec565b604080519115158252519081900360200190f35b3480156103d857600080fd5b5061019b610d66565b3480156103ed57600080fd5b5061019b610d6c565b34801561040257600080fd5b5061019b600435610d72565b34801561041a57600080fd5b5061019b610d84565b34801561042f57600080fd5b50610178600435610d8a565b34801561044757600080fd5b5061019b600160a060020a0360043516610f0e565b34801561046857600080fd5b5061019b600435610f1b565b34801561048057600080fd5b5061019b600160a060020a036004351661100a565b3480156104a157600080fd5b5061019b61107c565b3480156104b657600080fd5b50610178611082565b600160a060020a03166000908152600160209081526040808320549183905290912054600454680100000000000000009102919091030490565b600f54604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152306024830152604482018590529151600093849316916323b872dd91606480830192602092919082900301818787803b15801561056f57600080fd5b505af1158015610583573d6000803e3d6000fd5b505050506040513d602081101561059957600080fd5b505115156105a657600080fd5b60058054840190556105b884846111c9565b600160a060020a038516600081815260026020818152604080842080548584529482902054848452930154815194855291840192909252828201524260608301525192935090916000805160206115828339815191529181900360800190a261061f61135e565b9392505050565b600080808061064061063986600a61146e565b6064611497565b925061064c85846114ac565b95945050505050565b61065d6114f1565b610665611511565b61066d6114f1565b6002600085600160a060020a0316600160a060020a031681526020019081526020016000206101c0604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820154815260200160098201548152602001600a8201548152602001600b8201548152602001600c8201548152602001600d8201548152505091506101c060405190810160405280836000015181526020018360400151815260200183606001518152602001836080015181526020018360a0015181526020018360c0015181526020018360e0015181526020018361012001518152602001836101400151815260200183610160015181526020018361018001518152602001836101a0015181526020018360200151815260200183610100015181525090508092505050919050565b60035490565b6000336107e8816104bf565b91505090565b60008060006107fb6107dc565b1161080557600080fd5b3391506108106107dc565b600160a060020a0380841660008181526001602090815260408083208054680100000000000000008802019055600f5481517fa9059cbb00000000000000000000000000000000000000000000000000000000815260048101959095526024850187905290519596509093169363a9059cbb936044808501949193918390030190829087803b1580156108a257600080fd5b505af11580156108b6573d6000803e3d6000fd5b505050506040513d60208110156108cc57600080fd5b5050600160a060020a038216600090815260026020819052604090912001546108f590826114be565b600160a060020a03831660008181526002602081815260409283902091820194909455600b9081018054600190810190915560088054909101905580548501905580518481524293810193909352805191927f1b091269e929df55d64d6ea7e9cadbe4fb38dce5ccdc995767bc515030dbfbbf929081900390910190a261097a61135e565b5050565b600f54604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b1580156109e357600080fd5b505af11580156109f7573d6000803e3d6000fd5b505050506040513d6020811015610a0d57600080fd5b5051905090565b600b5481565b6000670de0b6b3a76400008180610a3561063984600a61146e565b9150610a4183836114ac565b949350505050565b60085481565b600160a060020a031660009081526020819052604090205490565b600d5481565b60055481565b6000670de0b6b3a76400008180610a9161063984600a61146e565b9150610a4183836114be565b6000806000806003548511151515610ab457600080fd5b849250610ac561063984600a61146e565b915061064c83836114ac565b6000336107e881610a4f565b600e54600160a060020a031681565b6000806000610af9610ad1565b11610b0357600080fd5b5033600081815260208190526040902054831115610b2057600080fd5b6000610b2a6107dc565b1115610b3857610b386107ee565b600160a060020a038116600090815260208190526040902054610b5b90846114ac565b600160a060020a038083166000908152602081905260408082209390935590861681522054610b8a90846114be565b600160a060020a0385811660008181526020818152604080832095909555600480549487168352600182528583208054958a029095039094559254918152838120805492880290920190915560029091522054158015610c035750600160a060020a038416600090815260026020526040902060060154155b15610c12576007805460010190555b600160a060020a038082166000818152600260209081526040808320600c810180546001908101909155600590910180548a019055948916808452928190206006810180548a019055600d018054860190556008805490950190945583518781524291810191909152835191937f91c7d71a3ae3fb7cf61e00517bf4868e9e23d0bace5e304cbc3b68de5d85350e92918290030190a3600160a060020a03811660008181526002602081815260408084208054858452948290205484845293015481519485529184019290925282820152426060830152516000805160206115828339815191529181900360800190a2600160a060020a03841660008181526002602081815260408084208054858452948290205484845293015481519485529184019290925282820152426060830152516000805160206115828339815191529181900360800190a25060019392505050565b600a5481565b60095481565b6000610d7e33836104f9565b92915050565b60075481565b6000806000806000610d9a610ad1565b11610da457600080fd5b33600081815260208190526040902054909450851115610dc357600080fd5b6064610dd086600a61146e565b811515610dd957fe5b049250610de685846114ac565b9150610df1836114cb565b610dfd600354866114ac565b600355600160a060020a038416600090815260208190526040902054610e2390866114ac565b600160a060020a0385166000818152602081815260408083209490945560045460018252918490208054928a026801000000000000000088020192839003905583518981529081018690524281850152925190935090917f723391258f051422e0be75f0bbcc5c94947b440ae6162c87b3efb5fecde315e5919081900360600190a2600160a060020a03841660008181526002602081815260408084208054858452948290205484845293015481519485529184019290925282820152426060830152516000805160206115828339815191529181900360800190a2610f0761135e565b5050505050565b600160a060020a03163190565b600f54604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490529051600092600160a060020a0316916323b872dd91606480830192602092919082900301818787803b158015610f8d57600080fd5b505af1158015610fa1573d6000803e3d6000fd5b505050506040513d6020811015610fb757600080fd5b50511515610fc457600080fd5b600980548301905560408051838152426020820152815133927f73cd5c58cef87bb4066d9a2323ff8623db2025f5df3e71fc9f8dd410d69f31a3928290030190a2919050565b600080611037606461102b600260ff1660095461146e90919063ffffffff16565b9063ffffffff61149716565b905060006003541161104a57600061061f565b600354600160a060020a03841660009081526020819052604090205461061f919061102b90849063ffffffff61146e16565b600c5481565b6000806000806110906107dc565b1161109a57600080fd5b6110a26107dc565b336000818152600160205260409020805468010000000000000000840201905590935091506110d182846111c9565b604080518581526020810183905242818301529051919250600160a060020a038416917f17aaea3d55ba445f06d158973e18525f80eafebc9d74964ae85b9c3681021b329181900360600190a2600160a060020a03821660009081526002602052604090206001015461114490846114be565b600160a060020a03831660008181526002602081815260408084206001808201979097556008810180549097019096558554848352938190205483835295909201548251938452908301949094528181019390935242606082015291519091600080516020611582833981519152919081900360800190a26111c461135e565b505050565b600160a060020a03821660009081526002602052604081205481908190819015801561120e5750600160a060020a038616600090815260026020526040902060060154155b1561121d576007805460010190555b600880546001019055606461123386600a61146e565b81151561123c57fe5b04925061124985846114ac565b9150611254836114cb565b604080518681526020810184905242818301529051600160a060020a038816917f810900bb33e423094372279f779b623ab22b73472a8a91fce3c018129c205019919081900360600190a26000821180156112b957506003546112b783826114be565b115b15156112c457600080fd5b600060035411156112dc5760038054830190556112e2565b60038290555b600160a060020a03861660009081526020819052604090205461130590836114be565b600160a060020a0396909616600090815260208181526040808320989098556004546001808352898420805492870290920190915560029091529690208054959095018555506007909301805490940190935550919050565b600080600c54611379600654426114d690919063ffffffff16565b11156113c3577fa14e3b1c1ae7cf637a6a97eacba61965eaf456b6994afc09a2097bdf7da639816113a861097e565b604080519182524260208301528051918290030190a1426006555b600d546113d242600a546114d6565b1180156113e157506000600354115b1561097a5761140b6201518061102b606461102b600260ff1660095461146e90919063ffffffff16565b9150611422600a54426114d690919063ffffffff16565b600954908302915061143a908263ffffffff6114d616565b600955600454600354611463919068010000000000000000840281151561145d57fe5b046114be565b60045542600a555050565b600082151561147f57506000610d7e565b5081810281838281151561148f57fe5b0414610d7e57fe5b600081838115156114a457fe5b049392505050565b6000828211156114b857fe5b50900390565b81810182811015610d7e57fe5b600980549091019055565b6000828211156114e857506000610d7e565b50808203610d7e565b6101c060405190810160405280600e906020820280388339509192915050565b6101c060405190810160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815250905600a1f02c754056a0800f9d81f943b5136b52f3b5bbde1ae99c6935adb95b54271aa165627a7a72305820ab8c238359884e1e142570d4d3cbc933afdae4166b981959ef6c305fb00e48640029
Verified Source Code Partial Match
Compiler: v0.4.26+commit.4563c3fc
EVM: byzantium
Optimization: Yes (200 runs)
BankrollNetworkStack.sol 636 lines
/*
SPDX-License-Identifier: MIT
A Bankteller Production
Bankroll Network
Copyright 2020
*/
pragma solidity ^0.4.25;
contract Token {
function transferFrom(address from, address to, uint256 value) public returns (bool);
function transfer(address to, uint256 value) public returns (bool);
function balanceOf(address who) public view returns (uint256);
}
/*
* @dev Life is a perpetual rewards contract the collects 9% fee for a dividend pool that drips 2% daily.
* A 1% fee is used to buy back a specified ERC20/TRC20 token and distribute to LYF holders via a 2% drip
*/
contract BankrollNetworkStack {
using SafeMath for uint;
/*=================================
= MODIFIERS =
=================================*/
/// @dev Only people with tokens
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
/// @dev Only people with profits
modifier onlyStronghands {
require(myDividends() > 0);
_;
}
/*==============================
= EVENTS =
==============================*/
event onLeaderBoard(
address indexed customerAddress,
uint256 invested,
uint256 tokens,
uint256 soldTokens,
uint timestamp
);
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingeth,
uint256 tokensMinted,
uint timestamp
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethEarned,
uint timestamp
);
event onReinvestment(
address indexed customerAddress,
uint256 ethReinvested,
uint256 tokensMinted,
uint timestamp
);
event onWithdraw(
address indexed customerAddress,
uint256 ethWithdrawn,
uint timestamp
);
event onTransfer(
address indexed from,
address indexed to,
uint256 tokens,
uint timestamp
);
event onBalance(
uint256 balance,
uint256 timestamp
);
event onDonation(
address indexed from,
uint256 amount,
uint timestamp
);
// Onchain Stats!!!
struct Stats {
uint invested;
uint reinvested;
uint withdrawn;
uint rewarded;
uint contributed;
uint transferredTokens;
uint receivedTokens;
uint xInvested;
uint xReinvested;
uint xRewarded;
uint xContributed;
uint xWithdrawn;
uint xTransferredTokens;
uint xReceivedTokens;
}
/*=====================================
= CONFIGURABLES =
=====================================*/
/// @dev 15% dividends for token purchase
uint8 constant internal entryFee_ = 10;
/// @dev 5% dividends for token selling
uint8 constant internal exitFee_ = 10;
uint8 constant internal dripFee = 80; //80% of fees go to drip, the rest to the Swap buyback
uint8 constant payoutRate_ = 2;
uint256 constant internal magnitude = 2 ** 64;
/*=================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) private tokenBalanceLedger_;
mapping(address => int256) private payoutsTo_;
mapping(address => Stats) private stats;
//on chain referral tracking
uint256 private tokenSupply_;
uint256 private profitPerShare_;
uint256 public totalDeposits;
uint256 internal lastBalance_;
uint public players;
uint public totalTxs;
uint public dividendBalance_;
uint public lastPayout;
uint public totalClaims;
uint256 public balanceInterval = 6 hours;
uint256 public distributionInterval = 2 seconds;
address public tokenAddress;
Token private token;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
constructor(address _tokenAddress) public {
tokenAddress = _tokenAddress;
token = Token(_tokenAddress);
lastPayout = now;
}
/// @dev This is how you pump pure "drip" dividends into the system
function donatePool(uint amount) public returns (uint256) {
require(token.transferFrom(msg.sender, address(this),amount));
dividendBalance_ += amount;
emit onDonation(msg.sender, amount,now);
}
/// @dev Converts all incoming eth to tokens for the caller, and passes down the referral addy (if any)
function buy(uint buy_amount) public returns (uint256) {
return buyFor(msg.sender, buy_amount);
}
/// @dev Converts all incoming eth to tokens for the caller, and passes down the referral addy (if any)
function buyFor(address _customerAddress, uint buy_amount) public returns (uint256) {
require(token.transferFrom(_customerAddress, address(this), buy_amount));
totalDeposits += buy_amount;
uint amount = purchaseTokens(_customerAddress, buy_amount);
emit onLeaderBoard(_customerAddress,
stats[_customerAddress].invested,
tokenBalanceLedger_[_customerAddress],
stats[_customerAddress].withdrawn,
now
);
//distribute
distribute();
return amount;
}
/**
* @dev Fallback function to return any TRX/ETH accidentally sent to the contract
*/
function() payable public {
require(false);
}
/// @dev Converts all of caller's dividends to tokens.
function reinvest() onlyStronghands public {
// fetch dividends
uint256 _dividends = myDividends();
// retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(msg.sender, _dividends);
// fire event
emit onReinvestment(_customerAddress, _dividends, _tokens, now);
//Stats
stats[_customerAddress].reinvested = SafeMath.add(stats[_customerAddress].reinvested, _dividends);
stats[_customerAddress].xReinvested += 1;
emit onLeaderBoard(_customerAddress,
stats[_customerAddress].invested,
tokenBalanceLedger_[_customerAddress],
stats[_customerAddress].withdrawn,
now
);
//distribute
distribute();
}
/// @dev Withdraws all of the callers earnings.
function withdraw() onlyStronghands public {
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends();
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// lambo delivery service
token.transfer(_customerAddress,_dividends);
//stats
stats[_customerAddress].withdrawn = SafeMath.add(stats[_customerAddress].withdrawn, _dividends);
stats[_customerAddress].xWithdrawn += 1;
totalTxs += 1;
totalClaims += _dividends;
// fire event
emit onWithdraw(_customerAddress, _dividends, now);
//distribute
distribute();
}
/// @dev Liquifies tokens to eth.
function sell(uint256 _amountOfTokens) onlyBagholders public {
// setup data
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// data setup
uint256 _undividedDividends = SafeMath.mul(_amountOfTokens, exitFee_) / 100;
uint256 _taxedeth = SafeMath.sub(_amountOfTokens, _undividedDividends);
//drip and buybacks
allocateFees(_undividedDividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _amountOfTokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens + (_taxedeth * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// fire event
emit onTokenSell(_customerAddress, _amountOfTokens, _taxedeth, now);
emit onLeaderBoard(_customerAddress,
stats[_customerAddress].invested,
tokenBalanceLedger_[_customerAddress],
stats[_customerAddress].withdrawn,
now
);
//distribute
distribute();
}
/**
* @dev Transfer tokens from the caller to a new holder.
* Zero fees
*/
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders external returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if (myDividends() > 0) {
withdraw();
}
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _amountOfTokens);
/* Members
A player can be initialized by buying or receiving and we want to add the user ASAP
*/
if (stats[_toAddress].invested == 0 && stats[_toAddress].receivedTokens == 0) {
players += 1;
}
//Stats
stats[_customerAddress].xTransferredTokens += 1;
stats[_customerAddress].transferredTokens += _amountOfTokens;
stats[_toAddress].receivedTokens += _amountOfTokens;
stats[_toAddress].xReceivedTokens += 1;
totalTxs += 1;
// fire event
emit onTransfer(_customerAddress, _toAddress, _amountOfTokens,now);
emit onLeaderBoard(_customerAddress,
stats[_customerAddress].invested,
tokenBalanceLedger_[_customerAddress],
stats[_customerAddress].withdrawn,
now
);
emit onLeaderBoard(_toAddress,
stats[_toAddress].invested,
tokenBalanceLedger_[_toAddress],
stats[_toAddress].withdrawn,
now
);
// ERC20
return true;
}
/*=====================================
= HELPERS AND CALCULATORS =
=====================================*/
/**
* @dev Method to view the current eth stored in the contract
*/
function totalTokenBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
/// @dev Retrieve the total token supply.
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
/// @dev Retrieve the tokens owned by the caller.
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* @dev Retrieve the dividends owned by the caller.
*/
function myDividends() public view returns (uint256) {
address _customerAddress = msg.sender;
return dividendsOf(_customerAddress);
}
/// @dev Retrieve the token balance of any single address.
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
/// @dev Retrieve the token balance of any single address.
function tokenBalance(address _customerAddress) public view returns (uint256) {
return _customerAddress.balance;
}
/// @dev Retrieve the dividend balance of any single address.
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/// @dev Return the sell price of 1 individual token.
function sellPrice() public pure returns (uint256) {
uint256 _eth = 1e18;
uint256 _dividends = SafeMath.div(SafeMath.mul(_eth, exitFee_), 100);
uint256 _taxedeth = SafeMath.sub(_eth, _dividends);
return _taxedeth;
}
/// @dev Return the buy price of 1 individual token.
function buyPrice() public pure returns (uint256) {
uint256 _eth = 1e18;
uint256 _dividends = SafeMath.div(SafeMath.mul(_eth, entryFee_), 100);
uint256 _taxedeth = SafeMath.add(_eth, _dividends);
return _taxedeth;
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint256 _ethToSpend) public pure returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethToSpend, entryFee_), 100);
uint256 _taxedeth = SafeMath.sub(_ethToSpend, _dividends);
uint256 _amountOfTokens = _taxedeth;
return _amountOfTokens;
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of sell orders.
function calculateethReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _eth = _tokensToSell;
uint256 _dividends = SafeMath.div(SafeMath.mul(_eth, exitFee_), 100);
uint256 _taxedeth = SafeMath.sub(_eth, _dividends);
return _taxedeth;
}
/// @dev Stats of any single address
function statsOf(address _customerAddress) public view returns (uint256[14] memory){
Stats memory s = stats[_customerAddress];
uint256[14] memory statArray = [s.invested, s.withdrawn, s.rewarded, s.contributed, s.transferredTokens, s.receivedTokens, s.xInvested, s.xRewarded, s.xContributed, s.xWithdrawn, s.xTransferredTokens, s.xReceivedTokens, s.reinvested, s.xReinvested];
return statArray;
}
function dailyEstimate(address _customerAddress) public view returns (uint256){
uint256 share = dividendBalance_.mul(payoutRate_).div(100);
return (tokenSupply_ > 0) ? share.mul(tokenBalanceLedger_[_customerAddress]).div(tokenSupply_) : 0;
}
function allocateFees(uint fee) private {
//Add to dividend drip pools
dividendBalance_ += fee;
}
function distribute() private {
if (now.safeSub(lastBalance_) > balanceInterval) {
emit onBalance(totalTokenBalance(), now);
lastBalance_ = now;
}
if (SafeMath.safeSub(now, lastPayout) > distributionInterval && tokenSupply_ > 0) {
//A portion of the dividend is paid out according to the rate
uint256 share = dividendBalance_.mul(payoutRate_).div(100).div(24 hours);
//divide the profit by seconds in the day
uint256 profit = share * now.safeSub(lastPayout);
//share times the amount of time elapsed
dividendBalance_ = dividendBalance_.safeSub(profit);
//Apply divs
profitPerShare_ = SafeMath.add(profitPerShare_, (profit * magnitude) / tokenSupply_);
lastPayout = now;
}
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
/// @dev Internal function to actually purchase the tokens.
function purchaseTokens(address _customerAddress, uint256 _incomingeth) internal returns (uint256) {
/* Members */
if (stats[_customerAddress].invested == 0 && stats[_customerAddress].receivedTokens == 0) {
players += 1;
}
totalTxs += 1;
// data setup
uint256 _undividedDividends = SafeMath.mul(_incomingeth, entryFee_) / 100;
uint256 _amountOfTokens = SafeMath.sub(_incomingeth, _undividedDividends);
//drip and buybacks
allocateFees(_undividedDividends);
// fire event
emit onTokenPurchase(_customerAddress, _incomingeth, _amountOfTokens, now);
// yes we know that the safemath function automatically rules out the "greater then" equation.
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
// we can't give people infinite eth
if (tokenSupply_ > 0) {
// add tokens to the pool
tokenSupply_ += _amountOfTokens;
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
// really i know you think you do but you don't
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_customerAddress] += _updatedPayouts;
//Stats
stats[_customerAddress].invested += _incomingeth;
stats[_customerAddress].xInvested += 1;
return _amountOfTokens;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
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 a / b;
}
/**
* @dev Subtracts 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 Subtracts two numbers, else returns zero */
function safeSub(uint a, uint b) internal pure returns (uint) {
if (b > a) {
return 0;
} else {
return a - b;
}
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
Read Contract
balanceInterval 0xfc439f77 → uint256
balanceOf 0x70a08231 → uint256
buyPrice 0x8620410b → uint256
calculateTokensReceived 0x10d0ffdd → uint256
calculateethReceived 0x8dd4b8ad → uint256
dailyEstimate 0xfbaf1bbd → uint256
distributionInterval 0x71201a0e → uint256
dividendBalance_ 0xca3ea930 → uint256
dividendsOf 0x0065318b → uint256
lastPayout 0xb9db102a → uint256
myDividends 0x3151ecfc → uint256
myTokens 0x949e8acd → uint256
players 0xdc0b3564 → uint256
sellPrice 0x4b750334 → uint256
statsOf 0x15cfc405 → uint256[14]
tokenAddress 0x9d76ea58 → address
tokenBalance 0xeedc966a → uint256
totalClaims 0x41c61383 → uint256
totalDeposits 0x7d882097 → uint256
totalSupply 0x18160ddd → uint256
totalTokenBalance 0x3d4b2c2c → uint256
totalTxs 0x537a39bb → uint256
Write Contract 7 functions
These functions modify contract state and require a wallet transaction to execute.
buy 0xd96a094a
uint256 buy_amount
returns: uint256
buyFor 0x06501a6a
address _customerAddress
uint256 buy_amount
returns: uint256
donatePool 0xf4d98058
uint256 amount
returns: uint256
reinvest 0xfdb5a03e
No parameters
sell 0xe4849b32
uint256 _amountOfTokens
transfer 0xa9059cbb
address _toAddress
uint256 _amountOfTokens
returns: bool
withdraw 0x3ccfd60b
No parameters
Recent Transactions
Transaction index is loading. Only unfinalized transactions are shown while the index starts up.