Nobility vs RocketBUSD
669 lines
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
// https://t.me/RocketBUSD
pragma solidity ^0.6.2;
pragma solidity ^0.6.2;
import "./DividendPayingToken.sol";
import "./DividendPayingToken.sol";
import "./SafeMath.sol";
import "./SafeMath.sol";
import "./IterableMapping.sol";
import "./IterableMapping.sol";
import "./Ownable.sol";
import "./Ownable.sol";
import "./IUniswapV2Pair.sol";
import "./IUniswapV2Pair.sol";
import "./IUniswapV2Factory.sol";
import "./IUniswapV2Factory.sol";
import "./IUniswapV2Router.sol";
import "./IUniswapV2Router.sol";
contract NOBLILITY is ERC20, Ownable {
contract ROCKETbusd is ERC20, Ownable {
using SafeMath for uint256;
using SafeMath for uint256;
IUniswapV2Router02 public uniswapV2Router;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
address public uniswapV2Pair;
bool private swapping;
bool private swapping;
NOBILITYDividendTracker public dividendTracker;
ROCKETbusdDividendTracker public dividendTracker;
address public deadWallet = 0x000000000000000000000000000000000000dEaD;
address public deadWallet = 0x000000000000000000000000000000000000dEaD;
address public immutable BUSD = address(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
address public immutable BUSD = address(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56); //BUSD
uint256 public swapTokensAtAmount = 2000000 * (10**18);
uint256 public swapTokensAtAmount = 2000000 * (10**18);
uint256 public maxTxAmount = 1000000000000 * (10**18);
mapping(address => bool) public _isBlacklisted;
mapping(address => bool) public _isBlacklisted;
uint256 public BUSDRewardsFee = 7;
uint256 public BUSDRewardsFee = 4;
uint256 public liquidityFee = 2;
uint256 public liquidityFee = 4;
uint256 public marketingFee = 2;
uint256 public marketingFee = 2;
uint256 public totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee);
uint256 public rocketboostFee = 4;
uint256 public developmentFee = 1;
uint256 public totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee).add(developmentFee).add(rocketboostFee);
address public _marketingWalletAddress = 0xe48214F384cf2Db3423f6d1B0C7d79ea53C7Af5a;
uint256 public BUSDRewardsSellFee = 10;
uint256 public liquiditySellFee = 5;
uint256 public marketingSellFee = 3;
uint256 public rocketboostSellFee = 10;
uint256 public developmentSellFee = 2;
uint256 public totalSellFees = BUSDRewardsFee.add(liquiditySellFee).add(marketingSellFee).add(developmentSellFee).add(rocketboostSellFee);
address public _marketingWalletAddress = 0x8DFE0329a54027Fad140E9d7F055151eeFb34128;
address public _developmentWalletAddress = 0x4879B597090f9FCb256977940799c9cf220E5a36;
address public _rocketboostWalletAddress = 0xfA18fe704a69A05c9BFdB20aDd468D452aF19CDd;
// use by default 300,000 gas to process auto-claiming dividends
// use by default 300,000 gas to process auto-claiming dividends
uint256 public gasForProcessing = 300000;
uint256 public gasForProcessing = 300000;
// exlcude from fees and max transaction amount
// exlcude from fees and max transaction amount
mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) private _isExcludedFromFees;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
// could be subject to a maximum transfer amount
mapping (address => bool) public automatedMarketMakerPairs;
mapping (address => bool) public automatedMarketMakerPairs;
event UpdateDividendTracker(address indexed newAddress, address indexed oldAddress);
event UpdateDividendTracker(address indexed newAddress, address indexed oldAddress);
event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);
event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);
event ExcludeFromFees(address indexed account, bool isExcluded);
event ExcludeFromFees(address indexed account, bool isExcluded);
event ExcludeMultipleAccountsFromFees(address[] accounts, bool isExcluded);
event ExcludeMultipleAccountsFromFees(address[] accounts, bool isExcluded);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event LiquidityWalletUpdated(address indexed newLiquidityWallet, address indexed oldLiquidityWallet);
event LiquidityWalletUpdated(address indexed newLiquidityWallet, address indexed oldLiquidityWallet);
event GasForProcessingUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event GasForProcessingUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event SwapAndLiquify(
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 tokensSwapped,
uint256 ethReceived,
uint256 ethReceived,
uint256 tokensIntoLiqudity
uint256 tokensIntoLiqudity
);
);
event SendDividends(
event SendDividends(
uint256 tokensSwapped,
uint256 tokensSwapped,
uint256 amount
uint256 amount
);
);
event ProcessedDividendTracker(
event ProcessedDividendTracker(
uint256 iterations,
uint256 iterations,
uint256 claims,
uint256 claims,
uint256 lastProcessedIndex,
uint256 lastProcessedIndex,
bool indexed automatic,
bool indexed automatic,
uint256 gas,
uint256 gas,
address indexed processor
address indexed processor
);
);
constructor() public ERC20("Nobility", "NBL") {
constructor() public ERC20("RocketBUSD", "RocketBUSD") {
dividendTracker = new NOBILITYDividendTracker();
dividendTracker = new ROCKETbusdDividendTracker();
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
// Create a uniswap pair for this new token
// Create a uniswap pair for this new token
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = _uniswapV2Pair;
uniswapV2Pair = _uniswapV2Pair;
_setAutomatedMarketMakerPair(_uniswapV2Pair, true);
_setAutomatedMarketMakerPair(_uniswapV2Pair, true);
// exclude from receiving dividends
// exclude from receiving dividends
dividendTracker.excludeFromDividends(address(dividendTracker));
dividendTracker.excludeFromDividends(address(dividendTracker));
dividendTracker.excludeFromDividends(address(this));
dividendTracker.excludeFromDividends(address(this));
dividendTracker.excludeFromDividends(owner());
dividendTracker.excludeFromDividends(owner());
dividendTracker.excludeFromDividends(deadWallet);
dividendTracker.excludeFromDividends(deadWallet);
dividendTracker.excludeFromDividends(address(_uniswapV2Router));
dividendTracker.excludeFromDividends(address(_uniswapV2Router));
// exclude from paying fees or having max transaction amount
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(owner(), true);
excludeFromFees(_marketingWalletAddress, true);
excludeFromFees(_marketingWalletAddress, true);
excludeFromFees(_developmentWalletAddress, true);
excludeFromFees(address(this), true);
excludeFromFees(address(this), true);
/*
/*
_mint is an internal function in ERC20.sol that is only called here,
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
and CANNOT be called ever again
*/
*/
_mint(owner(), 100000000000 * (10**18));
_mint(owner(), 1000000000000 * (10**18));
}
}
receive() external payable {
receive() external payable {
}
}
function updateDividendTracker(address newAddress) public onlyOwner {
function updateDividendTracker(address newAddress) public onlyOwner {
require(newAddress != address(dividendTracker), "NOBILITY: The dividend tracker already has that address");
require(newAddress != address(dividendTracker), "ROCKETbusd: The dividend tracker already has that address");
NOBILITYDividendTracker newDividendTracker = NOBILITYDividendTracker(payable(newAddress));
ROCKETbusdDividendTracker newDividendTracker = ROCKETbusdDividendTracker(payable(newAddress));
require(newDividendTracker.owner() == address(this), "NOBILITY: The new dividend tracker must be owned by the NOBILITY token contract");
require(newDividendTracker.owner() == address(this), "ROCKETbusd: The new dividend tracker must be owned by the ROCKETbusd token contract");
newDividendTracker.excludeFromDividends(address(newDividendTracker));
newDividendTracker.excludeFromDividends(address(newDividendTracker));
newDividendTracker.excludeFromDividends(address(this));
newDividendTracker.excludeFromDividends(address(this));
newDividendTracker.excludeFromDividends(owner());
newDividendTracker.excludeFromDividends(owner());
newDividendTracker.excludeFromDividends(address(uniswapV2Router));
newDividendTracker.excludeFromDividends(address(uniswapV2Router));
emit UpdateDividendTracker(newAddress, address(dividendTracker));
emit UpdateDividendTracker(newAddress, address(dividendTracker));
dividendTracker = newDividendTracker;
dividendTracker = newDividendTracker;
}
}
function updateUniswapV2Router(address newAddress) public onlyOwner {
function updateUniswapV2Router(address newAddress) public onlyOwner {
require(newAddress != address(uniswapV2Router), "NOBILITY: The router already has that address");
require(newAddress != address(uniswapV2Router), "ROCKETbusd: The router already has that address");
emit UpdateUniswapV2Router(newAddress, address(uniswapV2Router));
emit UpdateUniswapV2Router(newAddress, address(uniswapV2Router));
uniswapV2Router = IUniswapV2Router02(newAddress);
uniswapV2Router = IUniswapV2Router02(newAddress);
address _uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())
address _uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())
.createPair(address(this), uniswapV2Router.WETH());
.createPair(address(this), uniswapV2Router.WETH());
uniswapV2Pair = _uniswapV2Pair;
uniswapV2Pair = _uniswapV2Pair;
}
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
function excludeFromFees(address account, bool excluded) public onlyOwner {
require(_isExcludedFromFees[account] != excluded, "NOBILITY: Account is already the value of 'excluded'");
require(_isExcludedFromFees[account] != excluded, "ROCKETbusd: Account is already the value of 'excluded'");
_isExcludedFromFees[account] = excluded;
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
emit ExcludeFromFees(account, excluded);
}
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFees[accounts[i]] = excluded;
_isExcludedFromFees[accounts[i]] = excluded;
}
}
emit ExcludeMultipleAccountsFromFees(accounts, excluded);
emit ExcludeMultipleAccountsFromFees(accounts, excluded);
}
}
function setMarketingWallet(address payable wallet) external onlyOwner{
function setMarketingWallet(address payable wallet) external onlyOwner{
_marketingWalletAddress = wallet;
_marketingWalletAddress = wallet;
}
}
function setDevelopmentWallet(address payable wallet) public onlyOwner{
_developmentWalletAddress = wallet;
}
function setRocketBoostWallet(address payable wallet) public onlyOwner{
_rocketboostWalletAddress = wallet;
}
function setBUSDRewardsFee(uint256 value) external onlyOwner{
function setBUSDRewardsFee(uint256 value) external onlyOwner{
BUSDRewardsFee = value;
BUSDRewardsFee = value;
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee);
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee).add(developmentFee).add(rocketboostFee);
}
}
function setLiquiditFee(uint256 value) external onlyOwner{
function setBUSDRewardsSellFee(uint256 value) external onlyOwner{
BUSDRewardsSellFee = value;
totalSellFees = BUSDRewardsSellFee.add(liquiditySellFee).add(marketingSellFee).add(developmentSellFee).add(rocketboostSellFee);
}
function setLiquidityFee(uint256 value) external onlyOwner{
liquidityFee = value;
liquidityFee = value;
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee);
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee).add(developmentFee).add(rocketboostFee);
}
function setLiquiditySellFee(uint256 value) external onlyOwner{
liquiditySellFee = value;
totalSellFees = BUSDRewardsSellFee.add(liquiditySellFee).add(marketingSellFee).add(developmentSellFee).add(rocketboostSellFee);
}
}
function setMarketingFee(uint256 value) external onlyOwner{
function setMarketingFee(uint256 value) external onlyOwner{
marketingFee = value;
marketingFee = value;
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee);
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee).add(developmentFee).add(rocketboostFee);
}
function setMarketingSellFee(uint256 value) external onlyOwner{
marketingSellFee = value;
totalSellFees = BUSDRewardsSellFee.add(liquiditySellFee).add(marketingSellFee).add(developmentSellFee).add(rocketboostSellFee);
}
function setDevelopmentFee(uint256 value) external onlyOwner{
developmentFee = value;
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee).add(developmentFee).add(rocketboostFee);
}
function setDevelopmentSellFee(uint256 value) external onlyOwner{
developmentSellFee = value;
totalSellFees = BUSDRewardsSellFee.add(liquiditySellFee).add(marketingSellFee).add(developmentSellFee).add(rocketboostSellFee);
}
function setRocketBoostFee(uint256 value) external onlyOwner{
rocketboostFee = value;
totalFees = BUSDRewardsFee.add(liquidityFee).add(marketingFee).add(developmentFee).add(rocketboostFee);
}
function setRocketBoostSellFee(uint256 value) external onlyOwner{
rocketboostSellFee = value;
totalSellFees = BUSDRewardsSellFee.add(liquiditySellFee).add(marketingSellFee).add(developmentSellFee).add(rocketboostSellFee);
}
function setMaxTxAmount(uint256 amount) external onlyOwner{
maxTxAmount = amount * (10**18);
}
}
function setSwapTokensAtAmount(uint256 amount) external onlyOwner{
swapTokensAtAmount = amount * (10**18);
}
function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {
function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {
require(pair != uniswapV2Pair, "NOBILITY: The PancakeSwap pair cannot be removed from automatedMarketMakerPairs");
require(pair != uniswapV2Pair, "ROCKETbusd: The PancakeSwap pair cannot be removed from automatedMarketMakerPairs");
_setAutomatedMarketMakerPair(pair, value);
_setAutomatedMarketMakerPair(pair, value);
}
}
function blacklistAddress(address account, bool value) external onlyOwner{
function blacklistAddress(address account, bool value) external onlyOwner{
_isBlacklisted[account] = value;
_isBlacklisted[account] = value;
}
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
function _setAutomatedMarketMakerPair(address pair, bool value) private {
require(automatedMarketMakerPairs[pair] != value, "NOBILITY: Automated market maker pair is already set to that value");
require(automatedMarketMakerPairs[pair] != value, "ROCKETbusd: Automated market maker pair is already set to that value");
automatedMarketMakerPairs[pair] = value;
automatedMarketMakerPairs[pair] = value;
if(value) {
if(value) {
dividendTracker.excludeFromDividends(pair);
dividendTracker.excludeFromDividends(pair);
}
}
emit SetAutomatedMarketMakerPair(pair, value);
emit SetAutomatedMarketMakerPair(pair, value);
}
}
function updateGasForProcessing(uint256 newValue) public onlyOwner {
function updateGasForProcessing(uint256 newValue) public onlyOwner {
require(newValue >= 200000 && newValue <= 500000, "NOBILITY: gasForProcessing must be between 200,000 and 500,000");
require(newValue >= 200000 && newValue <= 500000, "ROCKETbusd: gasForProcessing must be between 200,000 and 500,000");
require(newValue != gasForProcessing, "NOBILITY: Cannot update gasForProcessing to same value");
require(newValue != gasForProcessing, "ROCKETbusd: Cannot update gasForProcessing to same value");
emit GasForProcessingUpdated(newValue, gasForProcessing);
emit GasForProcessingUpdated(newValue, gasForProcessing);
gasForProcessing = newValue;
gasForProcessing = newValue;
}
}
function updateClaimWait(uint256 claimWait) external onlyOwner {
function updateClaimWait(uint256 claimWait) external onlyOwner {
dividendTracker.updateClaimWait(claimWait);
dividendTracker.updateClaimWait(claimWait);
}
}
function getClaimWait() external view returns(uint256) {
function getClaimWait() external view returns(uint256) {
return dividendTracker.claimWait();
return dividendTracker.claimWait();
}
}
function getTotalDividendsDistributed() external view returns (uint256) {
function getTotalDividendsDistributed() external view returns (uint256) {
return dividendTracker.totalDividendsDistributed();
return dividendTracker.totalDividendsDistributed();
}
}
function isExcludedFromFees(address account) public view returns(bool) {
function isExcludedFromFees(address account) public view returns(bool) {
return _isExcludedFromFees[account];
return _isExcludedFromFees[account];
}
}
function withdrawableDividendOf(address account) public view returns(uint256) {
function withdrawableDividendOf(address account) public view returns(uint256) {
return dividendTracker.withdrawableDividendOf(account);
return dividendTracker.withdrawableDividendOf(account);
}
}
function dividendTokenBalanceOf(address account) public view returns (uint256) {
function dividendTokenBalanceOf(address account) public view returns (uint256) {
return dividendTracker.balanceOf(account);
return dividendTracker.balanceOf(account);
}
}
function excludeFromDividends(address account) external onlyOwner{
function excludeFromDividends(address account) external onlyOwner{
dividendTracker.excludeFromDividends(account);
dividendTracker.excludeFromDividends(account);
}
}
function getAccountDividendsInfo(address account)
function getAccountDividendsInfo(address account)
external view returns (
external view returns (
address,
address,
int256,
int256,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256) {
uint256) {
return dividendTracker.getAccount(account);
return dividendTracker.getAccount(account);
}
}
function getAccountDividendsInfoAtIndex(uint256 index)
function getAccountDividendsInfoAtIndex(uint256 index)
external view returns (
external view returns (
address,
address,
int256,
int256,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256) {
uint256) {
return dividendTracker.getAccountAtIndex(index);
return dividendTracker.getAccountAtIndex(index);
}
}
function processDividendTracker(uint256 gas) external {
function processDividendTracker(uint256 gas) external {
(uint256 iterations, uint256 claims, uint256 lastProcessedIndex) = dividendTracker.process(gas);
(uint256 iterations, uint256 claims, uint256 lastProcessedIndex) = dividendTracker.process(gas);
emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, false, gas, tx.origin);
emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, false, gas, tx.origin);
}
}
function claim() external {
function claim() external {
dividendTracker.processAccount(msg.sender, false);
dividendTracker.processAccount(msg.sender, false);
}
}
function getLastProcessedIndex() external view returns(uint256) {
function getLastProcessedIndex() external view returns(uint256) {
return dividendTracker.getLastProcessedIndex();
return dividendTracker.getLastProcessedIndex();
}
}
function getNumberOfDividendTokenHolders() external view returns(uint256) {
function getNumberOfDividendTokenHolders() external view returns(uint256) {
return dividendTracker.getNumberOfTokenHolders();
return dividendTracker.getNumberOfTokenHolders();
}
}
function _transfer(
function _transfer(
address from,
address from,
address to,
address to,
uint256 amount
uint256 amount
) internal override {
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(!_isBlacklisted[from] && !_isBlacklisted[to], 'Blacklisted address');
require(!_isBlacklisted[from] && !_isBlacklisted[to], 'Blacklisted address');
require(amount <= maxTxAmount, 'Transaction size exceeds contract transaction limit');
if(amount == 0) {
if(amount == 0) {
super._transfer(from, to, 0);
super._transfer(from, to, 0);
return;
return;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if( canSwap &&
if( canSwap &&
!swapping &&
!swapping &&
!automatedMarketMakerPairs[from] &&
!automatedMarketMakerPairs[from] &&
from != owner() &&
from != owner() &&
to != owner()
to != owner()
) {
) {
swapping = true;
swapping = true;
Text moved with changes to lines 431-435 (92.0% similarity)
uint256 marketingTokens = contractTokenBalance.mul(marketingFee).div(totalFees);
processFees(contractTokenBalance, !(to == uniswapV2Pair));
swapAndSendToFee(marketingTokens);
uint256 swapTokens = contractTokenBalance.mul(liquidityFee).div(totalFees);
swapAndLiquify(swapTokens);
uint256 sellTokens = balanceOf(address(this));
uint256 sellTokens = balanceOf(address(this));
swapAndSendDividends(sellTokens);
swapAndSendDividends(sellTokens);
swapping = false;
swapping = false;
}
}
bool takeFee = !swapping;
bool takeFee = !swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
// if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
takeFee = false;
}
}
if(takeFee) {
if(takeFee) {
uint256 fees = amount.mul(totalFees).div(100);
uint256 fees = amount.mul(totalFees).div(100);
if(automatedMarketMakerPairs[to]){
if(automatedMarketMakerPairs[to]){
fees += amount.mul(1).div(100);
fees += amount.mul(1).div(100);
}
}
amount = amount.sub(fees);
amount = amount.sub(fees);
super._transfer(from, address(this), fees);
super._transfer(from, address(this), fees);
}
}
super._transfer(from, to, amount);
super._transfer(from, to, amount);
try dividendTracker.setBalance(payable(from), balanceOf(from)) {} catch {}
try dividendTracker.setBalance(payable(from), balanceOf(from)) {} catch {}
try dividendTracker.setBalance(payable(to), balanceOf(to)) {} catch {}
try dividendTracker.setBalance(payable(to), balanceOf(to)) {} catch {}
if(!swapping) {
if(!swapping) {
uint256 gas = gasForProcessing;
uint256 gas = gasForProcessing;
try dividendTracker.process(gas) returns (uint256 iterations, uint256 claims, uint256 lastProcessedIndex) {
try dividendTracker.process(gas) returns (uint256 iterations, uint256 claims, uint256 lastProcessedIndex) {
emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, true, gas, tx.origin);
emit ProcessedDividendTracker(iterations, claims, lastProcessedIndex, true, gas, tx.origin);
}
}
catch {
catch {
}
}
}
}
}
}
function swapAndSendToFee(uint256 tokens) private {
function processFees(uint256 contractTokenBalance, bool isSell) internal {
if (isSell) {
uint256 marketingTokens = contractTokenBalance.mul(marketingSellFee).div(totalSellFees);
swapAndSendToFee(marketingTokens, _marketingWalletAddress);
uint256 developmentTokens = contractTokenBalance.mul(developmentSellFee).div(totalSellFees);
swapAndSendToFee(developmentTokens, _developmentWalletAddress);
uint256 rocketboostTokens = contractTokenBalance.mul(rocketboostSellFee).div(totalSellFees);
swapAndSendToFee(rocketboostTokens, _rocketboostWalletAddress);
uint256 swapTokens = contractTokenBalance.mul(liquiditySellFee).div(totalFees);
swapAndLiquify(swapTokens);
} else {
uint256 marketingTokens = contractTokenBalance.mul(marketingFee).div(totalFees);
swapAndSendToFee(marketingTokens, _marketingWalletAddress);
uint256 developmentTokens = contractTokenBalance.mul(developmentFee).div(totalFees);
swapAndSendToFee(developmentTokens, _developmentWalletAddress);
Text moved with changes from lines 312-316 (92.0% similarity)
uint256 rocketboostTokens = contractTokenBalance.mul(rocketboostFee).div(totalFees);
swapAndSendToFee(rocketboostTokens, _rocketboostWalletAddress);
uint256 swapTokens = contractTokenBalance.mul(liquidityFee).div(totalFees);
swapAndLiquify(swapTokens);
}
}
function swapAndSendToFee(uint256 tokens, address walletAddress) private {
uint256 initialBUSDBalance = IERC20(BUSD).balanceOf(address(this));
uint256 initialBUSDBalance = IERC20(BUSD).balanceOf(address(this));
swapTokensForBusd(tokens);
swapTokensForBusd(tokens);
uint256 newBalance = (IERC20(BUSD).balanceOf(address(this))).sub(initialBUSDBalance);
uint256 newBalance = (IERC20(BUSD).balanceOf(address(this))).sub(initialBUSDBalance);
IERC20(BUSD).transfer(_marketingWalletAddress, newBalance);
IERC20(BUSD).transfer(walletAddress, newBalance);
}
}
function swapAndLiquify(uint256 tokens) private {
function swapAndLiquify(uint256 tokens) private {
// split the contract balance into halves
// split the contract balance into halves
uint256 half = tokens.div(2);
uint256 half = tokens.div(2);
uint256 otherHalf = tokens.sub(half);
uint256 otherHalf = tokens.sub(half);
// capture the contract's current ETH balance.
// capture the contract's current ETH balance.
// this is so that we can capture exactly the amount of ETH that the
// this is so that we can capture exactly the amount of ETH that the
// swap creates, and not make the liquidity event include any ETH that
// swap creates, and not make the liquidity event include any ETH that
// has been manually sent to the contract
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
uint256 initialBalance = address(this).balance;
// swap tokens for ETH
// swap tokens for ETH
swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
// how much ETH did we just swap into?
// how much ETH did we just swap into?
uint256 newBalance = address(this).balance.sub(initialBalance);
uint256 newBalance = address(this).balance.sub(initialBalance);
// add liquidity to uniswap
// add liquidity to uniswap
addLiquidity(otherHalf, newBalance);
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
}
function swapTokensForEth(uint256 tokenAmount) private {
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
address[] memory path = new address[](2);
path[0] = address(this);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
tokenAmount,
0, // accept any amount of ETH
0, // accept any amount of ETH
path,
path,
address(this),
address(this),
block.timestamp
block.timestamp
);
);
}
}
function swapTokensForBusd(uint256 tokenAmount) private {
function swapTokensForBusd(uint256 tokenAmount) private {
address[] memory path = new address[](3);
address[] memory path = new address[](3);
path[0] = address(this);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
path[1] = uniswapV2Router.WETH();
path[2] = BUSD;
path[2] = BUSD;
_approve(address(this), address(uniswapV2Router), tokenAmount);
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
// make the swap
uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
tokenAmount,
tokenAmount,
0,
0,
path,
path,
address(this),
address(this),
block.timestamp
block.timestamp
);
);
}
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
address(this),
tokenAmount,
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
address(0),
block.timestamp
block.timestamp
);
);
}
}
function swapAndSendDividends(uint256 tokens) private{
function swapAndSendDividends(uint256 tokens) private{
swapTokensForBusd(tokens);
swapTokensForBusd(tokens);
uint256 dividends = IERC20(BUSD).balanceOf(address(this));
uint256 dividends = IERC20(BUSD).balanceOf(address(this));
bool success = IERC20(BUSD).transfer(address(dividendTracker), dividends);
bool success = IERC20(BUSD).transfer(address(dividendTracker), dividends);
if (success) {
if (success) {
dividendTracker.distributeBUSDDividends(dividends);
dividendTracker.distributeBUSDDividends(dividends);
emit SendDividends(tokens, dividends);
emit SendDividends(tokens, dividends);
}
}
}
}
}
}
contract NOBILITYDividendTracker is Ownable, DividendPayingToken {
contract ROCKETbusdDividendTracker is Ownable, DividendPayingToken {
using SafeMath for uint256;
using SafeMath for uint256;
using SafeMathInt for int256;
using SafeMathInt for int256;
using IterableMapping for IterableMapping.Map;
using IterableMapping for IterableMapping.Map;
IterableMapping.Map private tokenHoldersMap;
IterableMapping.Map private tokenHoldersMap;
uint256 public lastProcessedIndex;
uint256 public lastProcessedIndex;
mapping (address => bool) public excludedFromDividends;
mapping (address => bool) public excludedFromDividends;
mapping (address => uint256) public lastClaimTimes;
mapping (address => uint256) public lastClaimTimes;
uint256 public claimWait;
uint256 public claimWait;
uint256 public immutable minimumTokenBalanceForDividends;
uint256 public immutable minimumTokenBalanceForDividends;
event ExcludeFromDividends(address indexed account);
event ExcludeFromDividends(address indexed account);
event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event Claim(address indexed account, uint256 amount, bool indexed automatic);
event Claim(address indexed account, uint256 amount, bool indexed automatic);
constructor() public DividendPayingToken("NOBILITY_Dividen_Tracker", "NOBILITY_Dividend_Tracker") {
constructor() public DividendPayingToken("ROCKETbusd_Dividend_Tracker", "ROCKETbusd_Dividend_Tracker") {
claimWait = 3600;
claimWait = 3600;
minimumTokenBalanceForDividends = 200000 * (10**18); //must hold 200000+ tokens
minimumTokenBalanceForDividends = 200000 * (10**18); //must hold 200000+ tokens
}
}
function _transfer(address, address, uint256) internal override {
function _transfer(address, address, uint256) internal override {
require(false, "NOBILITY_Dividend_Tracker: No transfers allowed");
require(false, "ROCKETbusd_Dividend_Tracker: No transfers allowed");
}
}
function withdrawDividend() public override {
function withdrawDividend() public override {
require(false, "NOBILITY_Dividend_Tracker: withdrawDividend disabled. Use the 'claim' function on the main NOBILITY contract.");
require(false, "ROCKETbusd_Dividend_Tracker: withdrawDividend disabled. Use the 'claim' function on the main ROCKETbusd contract.");
}
}
function excludeFromDividends(address account) external onlyOwner {
function excludeFromDividends(address account) external onlyOwner {
require(!excludedFromDividends[account]);
require(!excludedFromDividends[account]);
excludedFromDividends[account] = true;
excludedFromDividends[account] = true;
_setBalance(account, 0);
_setBalance(account, 0);
tokenHoldersMap.remove(account);
tokenHoldersMap.remove(account);
emit ExcludeFromDividends(account);
emit ExcludeFromDividends(account);
}
}
function updateClaimWait(uint256 newClaimWait) external onlyOwner {
function updateClaimWait(uint256 newClaimWait) external onlyOwner {
require(newClaimWait >= 3600 && newClaimWait <= 86400, "NOBILITY_Dividend_Tracker: claimWait must be updated to between 1 and 24 hours");
require(newClaimWait >= 3600 && newClaimWait <= 86400, "ROCKETbusd_Dividend_Tracker: claimWait must be updated to between 1 and 24 hours");
require(newClaimWait != claimWait, "NOBILITY_Dividend_Tracker: Cannot update claimWait to same value");
require(newClaimWait != claimWait, "ROCKETbusd_Dividend_Tracker: Cannot update claimWait to same value");
emit ClaimWaitUpdated(newClaimWait, claimWait);
emit ClaimWaitUpdated(newClaimWait, claimWait);
claimWait = newClaimWait;
claimWait = newClaimWait;
}
}
function getLastProcessedIndex() external view returns(uint256) {
function getLastProcessedIndex() external view returns(uint256) {
return lastProcessedIndex;
return lastProcessedIndex;
}
}
function getNumberOfTokenHolders() external view returns(uint256) {
function getNumberOfTokenHolders() external view returns(uint256) {
return tokenHoldersMap.keys.length;
return tokenHoldersMap.keys.length;
}
}
function getAccount(address _account)
function getAccount(address _account)
public view returns (
public view returns (
address account,
address account,
int256 index,
int256 index,
int256 iterationsUntilProcessed,
int256 iterationsUntilProcessed,
uint256 withdrawableDividends,
uint256 withdrawableDividends,
uint256 totalDividends,
uint256 totalDividends,
uint256 lastClaimTime,
uint256 lastClaimTime,
uint256 nextClaimTime,
uint256 nextClaimTime,
uint256 secondsUntilAutoClaimAvailable) {
uint256 secondsUntilAutoClaimAvailable) {
account = _account;
account = _account;
index = tokenHoldersMap.getIndexOfKey(account);
index = tokenHoldersMap.getIndexOfKey(account);
iterationsUntilProcessed = -1;
iterationsUntilProcessed = -1;
if(index >= 0) {
if(index >= 0) {
if(uint256(index) > lastProcessedIndex) {
if(uint256(index) > lastProcessedIndex) {
iterationsUntilProcessed = index.sub(int256(lastProcessedIndex));
iterationsUntilProcessed = index.sub(int256(lastProcessedIndex));
}
}
else {
else {
uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length > lastProcessedIndex ?
uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length > lastProcessedIndex ?
tokenHoldersMap.keys.length.sub(lastProcessedIndex) :
tokenHoldersMap.keys.length.sub(lastProcessedIndex) :
0;
0;
iterationsUntilProcessed = index.add(int256(processesUntilEndOfArray));
iterationsUntilProcessed = index.add(int256(processesUntilEndOfArray));
}
}
}
}
withdrawableDividends = withdrawableDividendOf(account);
withdrawableDividends = withdrawableDividendOf(account);
totalDividends = accumulativeDividendOf(account);
totalDividends = accumulativeDividendOf(account);
lastClaimTime = lastClaimTimes[account];
lastClaimTime = lastClaimTimes[account];
nextClaimTime = lastClaimTime > 0 ?
nextClaimTime = lastClaimTime > 0 ?
lastClaimTime.add(claimWait) :
lastClaimTime.add(claimWait) :
0;
0;
secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ?
secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ?
nextClaimTime.sub(block.timestamp) :
nextClaimTime.sub(block.timestamp) :
0;
0;
}
}
function getAccountAtIndex(uint256 index)
function getAccountAtIndex(uint256 index)
public view returns (
public view returns (
address,
address,
int256,
int256,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
uint256) {
uint256) {
if(index >= tokenHoldersMap.size()) {
if(index >= tokenHoldersMap.size()) {
return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);
return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);
}
}
address account = tokenHoldersMap.getKeyAtIndex(index);
address account = tokenHoldersMap.getKeyAtIndex(index);
return getAccount(account);
return getAccount(account);
}
}
function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {
function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {
if(lastClaimTime > block.timestamp) {
if(lastClaimTime > block.timestamp) {
return false;
return false;
}
}
return block.timestamp.sub(lastClaimTime) >= claimWait;
return block.timestamp.sub(lastClaimTime) >= claimWait;
}
}
function setBalance(address payable account, uint256 newBalance) external onlyOwner {
function setBalance(address payable account, uint256 newBalance) external onlyOwner {
if(excludedFromDividends[account]) {
if(excludedFromDividends[account]) {
return;
return;
}
}
if(newBalance >= minimumTokenBalanceForDividends) {
if(newBalance >= minimumTokenBalanceForDividends) {
_setBalance(account, newBalance);
_setBalance(account, newBalance);
tokenHoldersMap.set(account, newBalance);
tokenHoldersMap.set(account, newBalance);
}
}
else {
else {
_setBalance(account, 0);
_setBalance(account, 0);
tokenHoldersMap.remove(account);
tokenHoldersMap.remove(account);
}
}
processAccount(account, true);
processAccount(account, true);
}
}
function process(uint256 gas) public returns (uint256, uint256, uint256) {
function process(uint256 gas) public returns (uint256, uint256,
uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;
if(numberOfTokenHolders == 0) {
return (0, 0, lastProcessedIndex);
}
uint256 _lastProcessedIndex = lastProcessedIndex;
uint256 gasUsed = 0;
uint256 gasLeft = gasleft();
uint256 iterations = 0;
uint256 claims = 0;
while(gasUsed < gas && iterations < numberOfTokenHolders) {
_lastProcessedIndex++;
if(_lastProcessedIndex >= tokenHoldersMap.keys.length) {
_lastProcessedIndex = 0;
}
address account = tokenHoldersMap.keys[_lastProcessedIndex];
if(canAutoClaim(lastClaimTimes[account])) {
if(processAccount(payable(account), true)) {
claims++;
}
}
iterations++;
uint256 newGasLeft = gasleft();
if(gasLeft > newGasLeft) {
gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));
}
gasLeft = newGasLeft;
}
lastProcessedIndex = _lastProcessedIndex;
return (iterations, claims, lastProcessedIndex);
}
function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) {
uint256 amount = _withdrawDividendOfUser(account);
if(amount > 0) {
lastClaimTimes[account] = block.timestamp;
emit Claim(account, amount, automatic);
return true;
}
return false;
}
}