// SPDX-License-Identifier: MIT
/* ! merlioneth.sol | (c) 2020 Develop by ghost29a (http://29a.dev) | License: MIT
...../ /\ / /\ / /\ / /\ ___ / /\ / /\
/ /::| / /::\ / /::\ / /:/ /__/\ / /::\ / /::|
/ /:|:| / /:/\:\ / /:/\:\ / /:/ \__\:\ / /:/\:\ / /:|:|
/ /:/|:|__ / /::\ \:\ / /::\ \:\ / /:/ / /::\ / /:/ \:\ / /:/|:|__
/__/:/_|::::\ /__/:/\:\ \:\ /__/:/\:\_\:\ /__/:/ __/ /:/\/ /__/:/ \__\:\ /__/:/ |:| /\
\__\/ /~~/:/ \ \:\ \:\_\/ \__\/~|::\/:/ \ \:\ /__/\/:/~~ \ \:\ / /:/ \__\/ |:|/:/
/ /:/ \ \:\ \:\ | |:|::/ \ \:\ \ \::/ \ \:\ /:/ | |:/:/
/ /:/ \ \:\_\/ | |:|\/ \ \:\ \ \:\ \ \:\/:/ |__|::/
/__/:/ \ \:\ |__|:|~ \ \:\ \__\/ \ \::/ /__/:/
\__\/ \__\/ \__\| \__\/ \__\/ \__\/ v1.0
URL : https://merlioneth.com
Hashtag: #merlioneth
*/
pragma solidity 0.6.8;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Merlioneth is Ownable {
using Counters for Counters.Counter;
address public ownerWallet;
Counters.Counter public currUserID;
Counters.Counter public counterDays;
uint REGISTRATION_FEE=0.025 ether;
uint public global_balance_lotery=0 ether;
uint block_Dayly_old=0;
uint blockday=5760;
struct UserStruct {
bool isExist;
uint id;
uint balanceUser;
uint referrerID;
uint referredUsers;
bool isEngine1Active;
bool isEngine2Active;
bool isEngine3Active;
}
struct EngineUserStruct {
bool isExist;
uint id;
uint payment_received;
uint payment_received_plus;
}
struct SmartpotWinnerStruct {
bool isExist;
address winner;
uint time;
}
struct SmartpotGlobalWinnerStruct {
bool isExist;
bool isWinner;
uint prize;
uint ticketWin;
address winner;
uint time;
}
mapping (address => UserStruct) public users;
mapping (uint => address) public userList;
mapping (uint =>uint) smartpotTiketsGlobal;
uint ticket_price= 0.025 ether;
uint ticket_price10= 0.23 ether;
uint ticket_price50= 1 ether;
uint currTicketID=1;
uint beforeticketID=0;
mapping (address => EngineUserStruct) public engine1users;
mapping (uint => address) public engine1userList;
mapping (uint => SmartpotWinnerStruct) public engine1Winners;
uint engine1_royalty=0.004 ether;
uint engine1_price=0.2 ether;
uint engine1_ref_dir=0.020 ether;
uint engine1_smart_pot=0.024 ether;
uint engine1_smartcontract=0.016 ether;
uint engine1_user_global=0.020 ether;
mapping(uint => uint) engine1_winer_smartpot;
uint public engine1currUserID = 0;
uint public engine1activeUserID = 0;
uint public engine1_balance_lotery=0 ether;
uint public engine1_index_winner=0;
mapping (address => EngineUserStruct) public engine2users;
mapping (uint => address) public engine2userList;
mapping (uint => SmartpotWinnerStruct) public engine2Winners;
uint engine2_royalty=0.01 ether;
uint engine2_price=0.5 ether;
uint engine2_ref_dir=0.065 ether;
uint engine2_smart_pot=0.070 ether;
uint engine2_smartcontract=0.04 ether;
uint engine2_user_global=0.065 ether;
mapping(uint => uint) engine2_winer_smartpot;
uint public engine2currUserID = 0;
uint public engine2activeUserID = 0;
uint public engine2_balance_lotery=0 ether;
uint public engine2_index_winner=0;
mapping (address => EngineUserStruct) public engine3users;
mapping (uint => address) public engine3userList;
mapping (uint => SmartpotWinnerStruct) public engine3Winners;
uint engine3_royalty=0.02 ether;
uint engine3_price=1 ether;
uint engine3_ref_dir=0.20 ether;
uint engine3_smart_pot=0.12 ether;
uint engine3_smartcontract=0.08 ether;
uint engine3_user_global=0.20 ether;
mapping(uint => uint) engine3_winer_smartpot;
uint public engine3currUserID = 0;
uint public engine3activeUserID = 0;
uint public engine3_balance_lotery=0 ether;
uint public engine3_index_winner=0;
uint _stack = 0;
mapping (uint => uint32) public commitBlock;
struct SmartpotStruct {
uint userID;
uint referredUsers;
}
mapping (uint => mapping (uint => uint)) smartpotListOne;
uint _indexSmartpotOne=1;
uint public currentSmartpotOne=0;
SmartpotStruct[] public smartpot_one;
uint public countSmartpotOne=0;
mapping (uint => mapping (uint => uint)) smartpotListTwo;
uint _indexSmartpotTwo=1;
uint public currentSmartpotTwo=0;
SmartpotStruct[] public smartpot_two;
uint public countSmartpotTwo=0;
mapping (uint => mapping (uint => uint)) smartpotListThree;
uint _indexSmartpotThree=1;
uint public currentSmartpotThree=0;
SmartpotStruct[] public smartpot_three;
uint public countSmartpotThree=0;
uint public block_Smartpot = 0;
uint[] winnersSmartpots;
mapping (uint => SmartpotGlobalWinnerStruct) public GlobalSPWinners;
uint public global_index_winner=0;
event regLevel(address indexed _user, address indexed _referrer, uint _time);
event regEngineEntry(address indexed _user,uint _level, uint _time);
event getEnginePayment(address indexed _user,address indexed _receiver, uint _level, uint _time);
event paySmartPotEngineOne(address indexed _user,uint _prize,uint _nrosmartpot, uint _time);
event paySmartPotEngineTwo(address indexed _user,uint _prize,uint _nrosmartpot, uint _time);
event paySmartPotEngineThree(address indexed _user,uint _prize,uint _nrosmartpot, uint _time);
event getTicket(address indexed _user,uint _idTicket,uint _time);
event paySmartpotGlobal(address indexed _user,uint _ticketWinner,uint _prize, uint _time);
event WithdrawEth(address indexed _user,uint _amount, uint _time);
constructor() public {
ownerWallet = msg.sender;
engine1_winer_smartpot[1]=1.5 ether;
engine1_winer_smartpot[2]=1 ether;
engine1_winer_smartpot[3]=0.5 ether;
engine2_winer_smartpot[1]=3 ether;
engine2_winer_smartpot[2]=2 ether;
engine2_winer_smartpot[3]=1 ether;
engine3_winer_smartpot[1]=4 ether;
engine3_winer_smartpot[2]=3 ether;
engine3_winer_smartpot[3]=2 ether;
UserStruct memory userStruct;
currUserID.increment();
userStruct = UserStruct({
isExist: true,
id: currUserID.current(),
balanceUser:0 ether,
referrerID: 0,
referredUsers:0,
isEngine1Active:true,
isEngine2Active:true,
isEngine3Active:true
});
users[ownerWallet] = userStruct;
userList[currUserID.current()] = ownerWallet;
EngineUserStruct memory engine1userStruct;
engine1currUserID++;
engine1userStruct = EngineUserStruct({
isExist:true,
id:engine1currUserID,
payment_received:0,
payment_received_plus:0
});
engine1activeUserID=engine1currUserID;
engine1users[msg.sender] = engine1userStruct;
engine1userList[engine1currUserID]=msg.sender;
EngineUserStruct memory engine2userStruct;
engine2currUserID++;
engine2userStruct = EngineUserStruct({
isExist:true,
id:engine2currUserID,
payment_received:0,
payment_received_plus:0
});
engine2activeUserID=engine2currUserID;
engine2users[msg.sender] = engine2userStruct;
engine2userList[engine2currUserID]=msg.sender;
EngineUserStruct memory engine3userStruct;
engine3currUserID++;
engine3userStruct = EngineUserStruct({
isExist:true,
id:engine3currUserID,
payment_received:0,
payment_received_plus:0
});
engine3activeUserID=engine3currUserID;
engine3users[msg.sender] = engine3userStruct;
engine3userList[engine3currUserID]=msg.sender;
winnersSmartpots.push(0);
winnersSmartpots.push(0);
winnersSmartpots.push(0);
block_Smartpot=block.number;
block_Dayly_old=block.number;
}
function registrationUser(uint _referrerID) public payable {
require(!isContract(msg.sender),"Address is Contract");
require(!users[msg.sender].isExist, "User Exists");
require(_referrerID > 0 && _referrerID <= currUserID.current(), 'Incorrect referral ID');
require(msg.value == REGISTRATION_FEE, 'Incorrect Value');
UserStruct memory userStruct;
currUserID.increment();
userStruct = UserStruct({
isExist: true,
id: currUserID.current(),
balanceUser: 0 ether,
referrerID: _referrerID,
referredUsers:0,
isEngine1Active:false,
isEngine2Active:false,
isEngine3Active:false
});
users[msg.sender] = userStruct;
userList[currUserID.current()]=msg.sender;
users[userList[users[msg.sender].referrerID]].referredUsers++;
global_balance_lotery+=REGISTRATION_FEE;
smartpotTiketsGlobal[currTicketID]=currUserID.current();
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
emit regLevel(msg.sender, userList[_referrerID], now);
}
function buyEngineOne() public payable {
require(users[msg.sender].isExist, "User Not Registered");
require(!users[msg.sender].isEngine1Active, "Already in Engine");
require(msg.value == engine1_price, 'Incorrect Value');
uint idreferer = users[msg.sender].referrerID;
uint idUser=users[msg.sender].id;
add_smartpot_one(idreferer);
address referer = userList[idreferer];
if(engine1users[referer].payment_received_plus+1<=2)
{
users[referer].balanceUser+=engine1_ref_dir;
engine1users[referer].payment_received_plus+=1;
emit getEnginePayment(msg.sender,referer, 1, now);
}else{
if(engine1users[referer].payment_received+5<=60){
users[referer].balanceUser+=engine1_ref_dir;
engine1users[referer].payment_received+=5;
emit getEnginePayment(msg.sender,referer, 1, now);
if(engine1users[referer].payment_received>=60)
{
users[referer].isEngine1Active=false;
engine1users[referer].isExist=false;
}
}else{
global_balance_lotery+=engine1_ref_dir;
}
}
engine1_balance_lotery+=engine1_smart_pot;
if(engine1_balance_lotery>=3 ether){
payWinnerSmartpotOne();
}
users[ownerWallet].balanceUser+=engine1_smartcontract;
EngineUserStruct memory userStruct;
engine1currUserID++;
userStruct = EngineUserStruct({
isExist:true,
id:engine1currUserID,
payment_received:0,
payment_received_plus:0
});
engine1users[msg.sender] = userStruct;
engine1userList[engine1currUserID]=msg.sender;
users[msg.sender].isEngine1Active=true;
smartpotTiketsGlobal[currTicketID]=idUser;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
emit regEngineEntry(msg.sender, 1, now);
}
function buyEngineTwo() public payable {
require(users[msg.sender].isExist, "User Not Registered");
require(!users[msg.sender].isEngine2Active, "Already in Engine");
require(msg.value == engine2_price, 'Incorrect Value');
uint idreferer = users[msg.sender].referrerID;
uint idUser=users[msg.sender].id;
add_smartpot_two(idreferer);
address referer = userList[idreferer];
if(engine2users[referer].payment_received_plus+1<=2)
{
users[referer].balanceUser+=engine2_ref_dir;
engine2users[referer].payment_received_plus+=1;
emit getEnginePayment(msg.sender,referer, 1, now);
}else{
if(engine2users[referer].payment_received+6<=65){
users[referer].balanceUser+=engine2_ref_dir;
engine2users[referer].payment_received+=6;
emit getEnginePayment(msg.sender,referer, 1, now);
if(engine2users[referer].payment_received>=65)
{
users[referer].isEngine2Active=false;
engine2users[referer].isExist=false;
}
}else{
global_balance_lotery+=engine2_ref_dir;
}
}
engine2_balance_lotery+=engine2_smart_pot;
if(engine2_balance_lotery>=6 ether){
payWinnerSmartpotTwo();
}
users[ownerWallet].balanceUser+=engine2_smartcontract;
EngineUserStruct memory userStruct;
engine2currUserID++;
userStruct = EngineUserStruct({
isExist:true,
id:engine2currUserID,
payment_received:0,
payment_received_plus:0
});
engine2users[msg.sender] = userStruct;
engine2userList[engine2currUserID]=msg.sender;
users[msg.sender].isEngine2Active=true;
smartpotTiketsGlobal[currTicketID]=idUser;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
smartpotTiketsGlobal[currTicketID]=idUser;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
emit regEngineEntry(msg.sender, 2, now);
}
function buyEngineThree() public payable {
require(users[msg.sender].isExist, "User Not Registered");
require(!users[msg.sender].isEngine3Active, "Already in Engine");
require(msg.value == engine3_price, 'Incorrect Value');
uint idreferer = users[msg.sender].referrerID;
uint idUser=users[msg.sender].id;
add_smartpot_three(idreferer);
address referer = userList[idreferer];
if(engine3users[referer].payment_received_plus+1<=3)
{
users[referer].balanceUser+=engine3_ref_dir;
engine3users[referer].payment_received_plus+=1;
emit getEnginePayment(msg.sender,referer, 1, now);
}else{
if(engine3users[referer].payment_received+10<=70){
users[referer].balanceUser+=engine3_ref_dir;
engine3users[referer].payment_received+=10;
emit getEnginePayment(msg.sender,referer, 1, now);
if(engine3users[referer].payment_received>=70)
{
users[referer].isEngine3Active=false;
engine3users[referer].isExist=false;
}
}else{
global_balance_lotery+=engine3_ref_dir;
}
}
engine3_balance_lotery+=engine3_smart_pot;
if(engine3_balance_lotery>=9 ether){
payWinnerSmartpotThree();
}
users[ownerWallet].balanceUser+=engine3_smartcontract;
EngineUserStruct memory userStruct;
engine3currUserID++;
userStruct = EngineUserStruct({
isExist:true,
id:engine3currUserID,
payment_received:0,
payment_received_plus:0
});
engine3users[msg.sender] = userStruct;
engine3userList[engine3currUserID]=msg.sender;
users[msg.sender].isEngine3Active=true;
smartpotTiketsGlobal[currTicketID]=idUser;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
smartpotTiketsGlobal[currTicketID]=idUser;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
smartpotTiketsGlobal[currTicketID]=idUser;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
emit regEngineEntry(msg.sender, 3, now);
}
function buyTicketOne() public payable{
require(users[msg.sender].isExist, "User Not Registered");
require(msg.value == ticket_price, 'Incorrect Value');
smartpotTiketsGlobal[currTicketID]=users[msg.sender].id;
global_balance_lotery+=msg.value;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
}
function buyTicketTen() public payable{
require(users[msg.sender].isExist, "User Not Registered");
require(msg.value == ticket_price10, 'Incorrect Value');
global_balance_lotery+=msg.value;
for(uint i=0;i<10;i++){
smartpotTiketsGlobal[currTicketID]=users[msg.sender].id;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
}
}
function buyTicketFifty() public payable{
require(users[msg.sender].isExist, "User Not Registered");
require(msg.value == ticket_price50, 'Incorrect Value');
global_balance_lotery+=msg.value;
for(uint i=0;i<50;i++){
smartpotTiketsGlobal[currTicketID]=users[msg.sender].id;
emit getTicket(msg.sender,currTicketID,now);
currTicketID++;
}
}
function donation_smartpot_global() public payable{
require(msg.value > 0, 'Incorrect Value');
global_balance_lotery+=msg.value;
}
function smartpot_global_run() internal {
uint prize=global_balance_lotery;
for(uint i=0;i<5;i++){
uint winnerSmartpotGlobal=getrandom(SafeMath.sub(currTicketID,beforeticketID));
uint idWinner = smartpotTiketsGlobal[winnerSmartpotGlobal+beforeticketID];
address addwinner = userList[idWinner];
SmartpotGlobalWinnerStruct memory smartpotwinnerStruct;
global_index_winner++;
if(users[addwinner].referredUsers>=2 && users[addwinner].isEngine1Active && users[addwinner].isEngine2Active && users[addwinner].isEngine3Active){
users[addwinner].balanceUser+=prize;
emit paySmartpotGlobal(addwinner,winnerSmartpotGlobal+beforeticketID,prize,now);
global_balance_lotery=global_balance_lotery-prize;
smartpotwinnerStruct = SmartpotGlobalWinnerStruct({
isExist: true,
isWinner:true,
prize:prize,
ticketWin:winnerSmartpotGlobal+beforeticketID,
winner: addwinner,
time:now
});
GlobalSPWinners[global_index_winner] = smartpotwinnerStruct;
i=5;
}else{
smartpotwinnerStruct = SmartpotGlobalWinnerStruct({
isExist: true,
isWinner:false,
prize:prize,
ticketWin:winnerSmartpotGlobal+beforeticketID,
winner: addwinner,
time:now
});
GlobalSPWinners[global_index_winner] = smartpotwinnerStruct;
prize= SafeMath.div(prize,2);
emit paySmartpotGlobal(addwinner,winnerSmartpotGlobal+beforeticketID,0, now);
}
}
beforeticketID=currTicketID;
}
function getrandom(uint zise) internal returns (uint) {
commitBlock[_stack]=uint32(block.number);
uint a = uint(keccak256(abi.encodePacked(blockhash(commitBlock[_stack]), SafeMath.add(commitBlock[_stack],_stack++),now,msg.sender))) % zise;
return a;
}
function add_smartpot_one(uint iduser) internal {
countSmartpotOne++;
if(smartpotListOne[currentSmartpotOne][iduser]==0){
SmartpotStruct memory smartpotStruct;
smartpotStruct.userID = iduser;
smartpotStruct.referredUsers = 1;
smartpot_one.push(smartpotStruct);
smartpotListOne[currentSmartpotOne][iduser]=_indexSmartpotOne;
_indexSmartpotOne++;
}else{
uint _indexuser=smartpotListOne[currentSmartpotOne][iduser];
smartpot_one[_indexuser-1].referredUsers++;
}
}
function add_smartpot_two(uint iduser) internal {
countSmartpotTwo++;
if(smartpotListTwo[currentSmartpotTwo][iduser]==0){
SmartpotStruct memory smartpotStruct;
smartpotStruct.userID = iduser;
smartpotStruct.referredUsers = 1;
smartpot_two.push(smartpotStruct);
smartpotListTwo[currentSmartpotTwo][iduser]=_indexSmartpotTwo;
_indexSmartpotTwo++;
}else{
uint _indexuser=smartpotListTwo[currentSmartpotTwo][iduser];
smartpot_two[_indexuser-1].referredUsers++;
}
}
function add_smartpot_three(uint iduser) internal {
countSmartpotThree++;
if(smartpotListThree[currentSmartpotThree][iduser]==0){
SmartpotStruct memory smartpotStruct;
smartpotStruct.userID = iduser;
smartpotStruct.referredUsers = 1;
smartpot_three.push(smartpotStruct);
smartpotListThree[currentSmartpotThree][iduser]=_indexSmartpotThree;
_indexSmartpotThree++;
}else{
uint _indexuser=smartpotListThree[currentSmartpotThree][iduser];
smartpot_three[_indexuser-1].referredUsers++;
}
}
function new_smartpotOne() internal{
delete smartpot_one;
_indexSmartpotOne=1;
countSmartpotOne=0;
currentSmartpotOne++;
engine1_balance_lotery=0 ether;
}
function new_smartpotTwo() internal{
delete smartpot_two;
_indexSmartpotTwo=1;
countSmartpotTwo=0;
currentSmartpotTwo++;
engine2_balance_lotery=0 ether;
}
function new_smartpotThree() internal{
delete smartpot_three;
_indexSmartpotThree=1;
countSmartpotThree=0;
currentSmartpotThree++;
engine3_balance_lotery=0 ether;
}
function payWinnerSmartpotOne() internal {
quickSort(smartpot_one,int(0), int(smartpot_one.length - 1));
//Pagando ganadores
for(uint i=0;i<3;i++){
address adduserwin = userList[winnersSmartpots[i]];
users[adduserwin].balanceUser+=engine1_winer_smartpot[i+1];
SmartpotWinnerStruct memory smartpotwinnerStruct;
engine1_index_winner++;
smartpotwinnerStruct = SmartpotWinnerStruct({
isExist: true,
winner: adduserwin,
time:now
});
engine1Winners[engine1_index_winner] = smartpotwinnerStruct;
emit paySmartPotEngineOne(adduserwin,engine1_winer_smartpot[i+1],currentSmartpotOne, now);
}
new_smartpotOne();
}
function payWinnerSmartpotTwo() internal {
quickSort(smartpot_two,int(0), int(smartpot_two.length - 1));
//Pagando ganadores
for(uint i=0;i<3;i++){
address adduserwin = userList[winnersSmartpots[i]];
users[adduserwin].balanceUser+=engine2_winer_smartpot[i+1];
SmartpotWinnerStruct memory smartpotwinnerStruct;
engine2_index_winner++;
smartpotwinnerStruct = SmartpotWinnerStruct({
isExist: true,
winner: adduserwin,
time:now
});
engine2Winners[engine2_index_winner] = smartpotwinnerStruct;
emit paySmartPotEngineTwo(adduserwin,engine2_winer_smartpot[i+1],currentSmartpotTwo, now);
}
new_smartpotTwo();
}
function payWinnerSmartpotThree() internal {
quickSort(smartpot_three,int(0), int(smartpot_three.length - 1));
for(uint i=0;i<3;i++){
address adduserwin = userList[winnersSmartpots[i]];
users[adduserwin].balanceUser+=engine3_winer_smartpot[i+1];
SmartpotWinnerStruct memory smartpotwinnerStruct;
engine3_index_winner++;
smartpotwinnerStruct = SmartpotWinnerStruct({
isExist: true,
winner: adduserwin,
time:now
});
engine3Winners[engine3_index_winner] = smartpotwinnerStruct;
emit paySmartPotEngineThree(adduserwin,engine3_winer_smartpot[i+1],currentSmartpotThree, now);
}
new_smartpotThree();
}
function quickSort(SmartpotStruct[] memory arr,int left, int right) internal{
int i = left;
int j = right;
if(i==j) return;
uint pivot = arr[uint(left + (right - left) / 2)].referredUsers;
while (i <= j) {
while (arr[uint(i)].referredUsers < pivot) i++;
while (pivot < arr[uint(j)].referredUsers) j--;
if (i <= j) {
(arr[uint(i)].referredUsers, arr[uint(j)].referredUsers) = (arr[uint(j)].referredUsers, arr[uint(i)].referredUsers);
(arr[uint(i)].userID, arr[uint(j)].userID) = (arr[uint(j)].userID, arr[uint(i)].userID);
i++;
j--;
}
}
if (left < j)
quickSort(arr,left, j);
if (i < right)
quickSort(arr,i, right);
winnersSmartpots[0]=arr[arr.length - 1].userID;
winnersSmartpots[1]=arr[arr.length - 2].userID;
winnersSmartpots[2]=arr[arr.length - 3].userID;
}
function ownerKill(address payable addr) public onlyOwner {
selfdestruct(addr);
}
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function Withdraw() public {
require(!isContract(msg.sender),"Address is Contract");
require(users[msg.sender].isExist, "User Not Registered");
require(users[msg.sender].balanceUser > 0 ether, "Insufficient balance");
uint amount = users[msg.sender].balanceUser;
bool sent=false;
(sent, ) = msg.sender.call{value: amount}("");
if(sent){
users[msg.sender].balanceUser = 0 ether;
}
emit WithdrawEth(msg.sender,amount,now);
}
function searchWinnerSmartPotGlobal() public {
require(!isContract(msg.sender),"Address is Contract");
require(block.number>block_Smartpot+86400,"15 days did not pass");
smartpot_global_run();
block_Smartpot=block_Smartpot+86400;
}
function payDailyRoyalty() public {
require(!isContract(msg.sender),"Address is Contract");
require(block.number>block_Dayly_old+blockday,"1 day did not pass");
counterDays.increment();
for(uint i=1;i<=engine1currUserID;i++){
address engine1user=engine1userList[i];
if(users[engine1user].isEngine1Active){
users[engine1user].balanceUser+=engine1_royalty;
engine1users[engine1user].payment_received+=1;
}
}
for(uint i=1;i<=engine2currUserID;i++){
address engine2user=engine2userList[i];
if(users[engine2user].isEngine2Active){
users[engine2user].balanceUser+=engine2_royalty;
engine2users[engine2user].payment_received+=1;
}
}
for(uint i=1;i<=engine3currUserID;i++){
address engine3user=engine3userList[i];
if(users[engine3user].isEngine3Active){
users[engine3user].balanceUser+=engine3_royalty;
engine3users[engine3user].payment_received+=1;
}
}
if(counterDays.current()%5==0){
block_Dayly_old=block_Dayly_old+(blockday*3);
}else{
block_Dayly_old+=blockday;
}
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
library Counters {
using SafeMath for uint256;
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
// The {SafeMath} overflow check can be skipped here, see the comment at the top
counter._value += 1;
}
function decrement(Counter storage counter) internal {
counter._value = counter._value.sub(1);
}
}
{
"compilationTarget": {
"browser/ether2.sol": "Merlioneth"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"WithdrawEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"_level","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"getEnginePayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_idTicket","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"getTicket","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_prize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nrosmartpot","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"paySmartPotEngineOne","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_prize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nrosmartpot","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"paySmartPotEngineThree","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_prize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nrosmartpot","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"paySmartPotEngineTwo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_ticketWinner","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_prize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"paySmartpotGlobal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_level","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"regEngineEntry","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"address","name":"_referrer","type":"address"},{"indexed":false,"internalType":"uint256","name":"_time","type":"uint256"}],"name":"regLevel","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"GlobalSPWinners","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"bool","name":"isWinner","type":"bool"},{"internalType":"uint256","name":"prize","type":"uint256"},{"internalType":"uint256","name":"ticketWin","type":"uint256"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"time","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"Withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"block_Smartpot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyEngineOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"buyEngineThree","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"buyEngineTwo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"buyTicketFifty","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"buyTicketOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"buyTicketTen","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"commitBlock","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"countSmartpotOne","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"countSmartpotThree","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"countSmartpotTwo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"counterDays","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currUserID","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentSmartpotOne","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentSmartpotThree","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentSmartpotTwo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"donation_smartpot_global","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"engine1Winners","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"time","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine1_balance_lotery","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine1_index_winner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine1activeUserID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine1currUserID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"engine1userList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"engine1users","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"payment_received","type":"uint256"},{"internalType":"uint256","name":"payment_received_plus","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"engine2Winners","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"time","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine2_balance_lotery","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine2_index_winner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine2activeUserID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine2currUserID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"engine2userList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"engine2users","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"payment_received","type":"uint256"},{"internalType":"uint256","name":"payment_received_plus","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"engine3Winners","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"address","name":"winner","type":"address"},{"internalType":"uint256","name":"time","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine3_balance_lotery","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine3_index_winner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine3activeUserID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"engine3currUserID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"engine3userList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"engine3users","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"payment_received","type":"uint256"},{"internalType":"uint256","name":"payment_received_plus","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"global_balance_lotery","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"global_index_winner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"addr","type":"address"}],"name":"ownerKill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ownerWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payDailyRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_referrerID","type":"uint256"}],"name":"registrationUser","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"searchWinnerSmartPotGlobal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"smartpot_one","outputs":[{"internalType":"uint256","name":"userID","type":"uint256"},{"internalType":"uint256","name":"referredUsers","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"smartpot_three","outputs":[{"internalType":"uint256","name":"userID","type":"uint256"},{"internalType":"uint256","name":"referredUsers","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"smartpot_two","outputs":[{"internalType":"uint256","name":"userID","type":"uint256"},{"internalType":"uint256","name":"referredUsers","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"userList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"bool","name":"isExist","type":"bool"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"balanceUser","type":"uint256"},{"internalType":"uint256","name":"referrerID","type":"uint256"},{"internalType":"uint256","name":"referredUsers","type":"uint256"},{"internalType":"bool","name":"isEngine1Active","type":"bool"},{"internalType":"bool","name":"isEngine2Active","type":"bool"},{"internalType":"bool","name":"isEngine3Active","type":"bool"}],"stateMutability":"view","type":"function"}]