fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
Success #stdin #stdout 0.1s 52620KB
stdin
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract ArbitParagon {
    address public owner;
    address public companyWallet;
    
    uint256 public referralCommission = 5; // 5% referral commission
    uint256 public binaryCommission = 10; // 10% binary commission
    uint256 public monthlyProfit = 6; // 6% monthly profit
    uint256 public withdrawalFee = 3; // 3% withdrawal fee
    uint256 public maxBinaryDaily = 10000 * 10**18; // $10000 max binary daily commission
    uint256 public goldenRewardVolume = 300000 * 10**18; // $300,000 for Golden Reward

    struct User {
        address wallet;
        uint256 totalDeposit;
        uint256 totalWithdraw;
        uint256 leftVolume;
        uint256 rightVolume;
        uint256 referralCommissionEarned;
        uint256 binaryCommissionEarned;
        uint256 goldenRewardEarned;
        uint256 nextMonthlyWithdraw;
        uint256 nextCommissionWithdraw;
        uint256 lastBinaryResetTime;
        uint256 totalBinaryWithdrawn;
    }

    mapping(address => User) public users;
    mapping(address => address) public referrals; // Wallet -> referrer
    mapping(address => bool) public activeUsers;

    event Deposit(address indexed user, uint256 amount);
    event Withdraw(address indexed user, uint256 amount, string category);
    event GoldenRewardEarned(address indexed user, uint256 reward);

    modifier onlyOwner() {
        require(msg.sender == owner, "Only owner can perform this action");
        _;
    }

    constructor(address _companyWallet) {
        owner = msg.sender;
        companyWallet = _companyWallet;
    }

    // Function to activate user with referral
    function activateUser(address referrer) external payable {
        require(!activeUsers[msg.sender], "User already active");
        require(msg.value >= 150 * 10**18, "Minimum activation fee is $150");

        activeUsers[msg.sender] = true;
        referrals[msg.sender] = referrer;

        // Add volumes for binary tree
        if (users[referrer].leftVolume == 0) {
            users[referrer].leftVolume += msg.value;
        } else {
            users[referrer].rightVolume += msg.value;
        }

        emit Deposit(msg.sender, msg.value);
    }

    // Function to deposit funds for investment
    function deposit() external payable {
        require(activeUsers[msg.sender], "User is not active");
        require(msg.value >= 100 * 10**18, "Minimum deposit is $100");

        uint256 commission = (msg.value * referralCommission) / 100;
        address referrer = referrals[msg.sender];

        users[referrer].referralCommissionEarned += commission;
        users[msg.sender].totalDeposit += (msg.value - commission);

        emit Deposit(msg.sender, msg.value);
    }

    // Function to withdraw funds
    function withdraw(string memory category, uint256 amount) external {
        require(activeUsers[msg.sender], "User is not active");
        require(amount > 0, "Withdraw amount must be greater than zero");
        uint256 fee = (amount * withdrawalFee) / 100;
        uint256 netAmount = amount - fee;

        if (keccak256(abi.encodePacked(category)) == keccak256(abi.encodePacked("profit"))) {
            require(
                block.timestamp >= users[msg.sender].nextMonthlyWithdraw,
                "Monthly withdrawal not allowed yet"
            );
            users[msg.sender].nextMonthlyWithdraw = block.timestamp + 30 days;
        } else if (keccak256(abi.encodePacked(category)) == keccak256(abi.encodePacked("commission"))) {
            require(
                block.timestamp >= users[msg.sender].nextCommissionWithdraw,
                "Commission withdrawal not allowed yet"
            );
            users[msg.sender].nextCommissionWithdraw = block.timestamp + 20 days;
        } else if (keccak256(abi.encodePacked(category)) == keccak256(abi.encodePacked("binary"))) {
            require(users[msg.sender].binaryCommissionEarned >= amount, "Not enough binary commission");
            users[msg.sender].binaryCommissionEarned -= amount;
        }

        users[msg.
stdout
Standard output is empty