Skip to content
Verified contractPartial

DividendsDistributor

Address0xc086a12baba801b2ff76e0ceb1f75efac4da8c26
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.4.24

 

Same code

5 more contracts

 

Details

Compiler
solc 0.4.24+commit.e67f0147
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
7,951,048
Creation transaction
0xb66bc8a564…42bcb91575

DividendsDistributor.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;
import "./SafeMath.sol";
import "./IColor.sol";
import "./Modifiers.sol";

contract DividendsDistributor is Modifiers {
    using SafeMath for uint;
    
    function claimDividends() external {
        //if users dividends=0, revert 
        require(pendingWithdrawals[msg.sender] != 0, "Your withdrawal balance is zero.");
        claimId = claimId.add(1);
        Claim memory c;
        c.id = claimId;
        c.claimer = msg.sender;
        c.isResolved = false;
        c.timestamp = now;
        claims.push(c);
        emit DividendsClaimed(msg.sender, claimId, now);
    }
    
     function withdrawFoundersComission() external onlyAdmin() returns (bool) {
        require(pendingWithdrawals[founders] != 0, "Foundrs withdrawal balance is zero.");
        uint balance = pendingWithdrawals[founders];
        pendingWithdrawals[founders] = 0;
        founders.transfer(balance);
        return true;
    }
    

    function approveClaim(uint _claimId) public onlyAdmin() {
        
        Claim storage claim = claims[_claimId];
        
        require(!claim.isResolved);
        
        address claimer = claim.claimer;

        //Checks-Effects-Interactions pattern
        uint withdrawalAmount = pendingWithdrawals[claimer];

        
        pendingWithdrawals[claimer] = 0;

        
        claimer.transfer(withdrawalAmount);
        
        //set last withdr time for user
        addressToLastWithdrawalTime[claimer] = now;
        emit DividendsWithdrawn(claimer, _claimId, withdrawalAmount);

        claim.isResolved = true;
    }

}

IColor.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;

interface Color {
    function totalSupply() external view returns (uint);
    function ownerOf(uint _tokenId) external view returns (address);
}

IPixel.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;

interface Pixel {
    function totalSupply() external view returns (uint);
    function ownerOf(uint _tokenId) external view returns (address);
}

Modifiers.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;
import "./SafeMath.sol";
import "./StorageV1.sol";

contract Modifiers is StorageV1 {
    using SafeMath for uint;

    modifier onlyAdmin() {
        require(isAdmin[msg.sender] == true, "You don't have admin rights.");
        _;
    }

    modifier isLiveGame() {
        require(isGamePaused == false, "Game is paused.");
        _;
    }

    modifier canDistributeCBP() {
        require(isCBPDistributable == true, "Cannot distribute color bank prize at the moment.");
        _;
    }

    modifier canDistributeTBP() {
        require(isTBPDistributable == true, "Cannot distribute time bank prize at the moment.");
        _;
    }

    //should be 4-8 symbols
    modifier isValidRefLink(string _str) {
        require(bytes(_str).length >= 4, "Ref link should be of length [4,8]");
        require(bytes(_str).length <= 8, "Ref link should be of length [4,8]");
        _;
    }
    
}

Ownable.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address private _owner;

  event OwnershipTransferred(
    address indexed previousOwner,
    address indexed newOwner
  );

  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() internal {
    _owner = msg.sender;
    emit OwnershipTransferred(address(0), _owner);
  }

  /**
   * @return the address of the owner.
   */
  function owner() public view returns(address) {
    return _owner;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(isOwner());
    _;
  }

  /**
   * @return true if `msg.sender` is the owner of the contract.
   */
  function isOwner() public view returns(bool) {
    return msg.sender == _owner;
  }

  /**
   * @dev Allows the current owner to relinquish control of the contract.
   * @notice Renouncing to ownership will leave the contract without an owner.
   * It will not be possible to call the functions with the `onlyOwner`
   * modifier anymore.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipTransferred(_owner, address(0));
    _owner = address(0);
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    _transferOwnership(newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address newOwner) internal {
    require(newOwner != address(0));
    emit OwnershipTransferred(_owner, newOwner);
    _owner = newOwner;
  }
}

SafeMath.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;

/**
 * @title SafeMath
 * @dev Math operations with safety checks that revert on error
 */
library SafeMath {

    /**
    * @dev Multiplies two numbers, reverts on overflow.
    */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b);

        return c;
    }

    /**
    * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0); // Solidity only automatically asserts 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 Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a);
        uint256 c = a - b;

        return c;
    }

    /**
    * @dev Adds two numbers, reverts on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a);

        return c;
    }

    /**
    * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
    * reverts when dividing by zero.
    */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0);
        return a % b;
    }
}

StorageV0.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;
import "./Ownable.sol";

contract StorageV0 is Ownable {

    // maps functions to the delegate contracts that execute the functions
    // funcId => delegate contract
    mapping(bytes4 => address) internal delegates;

    // array of function signatures supported by the contract
    bytes[] internal funcSignatures;

    // maps each function signature to its position in the funcSignatures array.
    // signature => index+1
    mapping(bytes => uint256) internal funcSignatureToIndex;

}

StorageV1.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.24;
import "./StorageV0.sol";
import "./IColor.sol";
import "./IPixel.sol";

contract StorageV1 is StorageV0 {

    //pixel color(round=> pixel=> color)
    mapping (uint => mapping (uint => uint)) public pixelToColorForRound; 

    //old pixel color(round=> pixel=> color)
    mapping (uint => mapping (uint => uint)) public pixelToOldColorForRound; 

    // (round => color => pixel amount)
    mapping (uint => mapping (uint => uint)) public colorToPaintedPixelsAmountForRound; 

    //color bank for round (round => color bank)
    mapping (uint => uint) public colorBankForRound; 

    //color bank for  color for round (round => color => color bank)
    mapping (uint => mapping (uint => uint)) public colorBankToColorForRound; 

    //time bank for round (round => time bank)
    mapping (uint => uint) public timeBankForRound; 
    
    // (round => timestamp)
    mapping (uint => uint) public lastPaintTimeForRound; 

    // (round => adress)
    mapping (uint => address) public lastPainterForRound; 

    
    mapping (uint => uint) public lastPaintedPixelForRound;

    // (round => color) 
    mapping (uint => uint) public winnerColorForRound; 

    // (round => color => paints amount)
    mapping (uint => mapping (uint => uint)) public colorToTotalPaintsForCBIteration; 

    // (round => adress)
    mapping (uint => address) public winnerOfRound; 

    //bank drawn in round (round => drawn bank) (1 = time bank, 2 = color bank)
    mapping (uint => uint) public winnerBankForRound; 

    
    mapping (uint => mapping (uint => uint)) public pixelToPaintTimeForRound;

   
    mapping (uint => uint) public totalPaintsForRound;
        
    
    mapping (uint => mapping (uint => uint)) public paintGenToAmountForColor;
    
    
    mapping (uint => mapping (uint => uint)) public paintGenToStartTimeForColor;
    
    
    mapping (uint => mapping (uint => uint)) public paintGenToEndTimeForColor;
    
    //bool 
    mapping (uint => mapping (uint => bool)) public paintGenStartedForColor;

   
    mapping (uint => uint) public currentPaintGenForColor;
    
   
    mapping (uint => uint) public callPriceForColor;
    
 
    mapping (uint => uint) public nextCallPriceForColor;
    
    
    mapping (uint => mapping (address => uint)) public moneySpentByUserForColor;

    
    mapping (address => uint) public moneySpentByUser;
    
    
    mapping (uint => mapping (address => bool)) public hasPaintDiscountForColor;
    
    //in percent 
    mapping (uint => mapping (address => uint)) public usersPaintDiscountForColor;

     
    mapping (address => bool) public isRegisteredUser;
    
    
    mapping (address => bool) public hasRefLink;

   
    mapping (address => address) public referralToReferrer;

    
    mapping (address => address[]) public referrerToReferrals;
    
   
    mapping (address => bool) public hasReferrer;
    
    
    mapping (address => string) public userToRefLink;
    

    mapping (bytes32 => address) public refLinkToUser;
    
    
    mapping (bytes32 => bool) public refLinkExists;
    
   
    mapping (address => uint) public newUserToCounter;
    
   
    uint public uniqueUsersCount;

   
    uint public maxPaintsInPool;

  
    uint public currentRound;

    //time bank iteration
    uint public tbIteration;

   //color bank iteration
    uint public cbIteration;

    
    uint public paintsCounter; 

    //Time Bank Iteration => Painter => Painter's Share in Time Team
    mapping (uint => mapping (address => uint)) public timeBankShare;

    //Color Bank Iteration => Color => Painter => Painter's Share in Time Team
    mapping (uint => mapping (uint => mapping (address => uint))) public colorBankShare;

   
    mapping (uint => uint) public paintsCounterForColor; 

    //cbIteration => color team
    mapping (uint => address[]) public cbTeam; 

    //tbIteration => color team 
    mapping (uint => address[]) public tbTeam;

     //counter => user
    mapping (uint => address) public counterToPainter;

    //color => counter => user    
    mapping (uint => mapping (uint => address)) public counterToPainterForColor; 

    //cbIteration => user !should not be public
    mapping (uint => mapping (address => bool)) public isInCBT; 

    //tbIteration => user !should not be public
    mapping (uint => mapping (address => bool)) public isInTBT; 

    //cbIteration => painter => color bank prize
    mapping (uint => mapping (address => uint)) public painterToCBP; 

    //tbIteration => painter => time bank prize
    mapping (uint => mapping (address => uint)) public painterToTBP; 

    //сbIteration =>  bool
    mapping (uint => bool) public isCBPTransfered;

    //tbIteration => bool
    mapping (uint => bool) public isTBPTransfered;

    
    mapping (address => uint) public lastPlayedRound;
    
    //Dividends Distribution
    mapping (uint => address) public ownerOfColor;

    mapping (address => uint) public pendingWithdrawals; 
    
    // (adress => time)
    mapping (address => uint) public addressToLastWithdrawalTime; 
    
  
    uint public dividendsBank;

    struct Claim {
        uint id;
        address claimer;
        bool isResolved;
        uint timestamp;
    }

    uint public claimId;

    Claim[] public claims;

    
    address public ownerOfPixel = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
    address public founders =0xe04f921cf3d6c882C0FAa79d0810a50B1101e2D4;

    bool public isGamePaused;
    
    bool public isCBPDistributable;
    bool public isTBPDistributable;
    
    mapping(address => bool) public isAdmin;

    Color public colorInstance;
    Pixel public pixelInstance;

    uint public totalColorsNumber; // 8
    uint public totalPixelsNumber; //225 in V1

   
    uint public refLinkPrice; 

   
    mapping (address => uint) public registrationTimeForUser;

    mapping (address => uint) public lastPaintTimeOfUser;
    mapping (uint => mapping (address => uint)) public lastPaintTimeOfUserForColor;

    mapping (uint => bool) public timeBankDrawnForRound;

    
    mapping (uint => uint) public usersCounterForRound;
 
    mapping (uint => mapping (address => bool)) public isUserCountedForRound;

   // Events

    event CBPDistributed(uint indexed round, uint indexed cbIteration, address indexed winner, uint prize);
    event DividendsWithdrawn(address indexed withdrawer, uint indexed claimId, uint indexed amount);
    event DividendsClaimed(address indexed claimer, uint indexed claimId, uint indexed currentTime);
    event Paint(uint indexed pixelId, uint colorId, address indexed painter, uint indexed round, uint timestamp);
    event ColorBankPlayed(address winnerOfRound, uint indexed round);
    event TimeBankPlayed(address winnerOfRound, uint indexed round);
    event CallPriceUpdated(uint indexed newCallPrice);
    event TBPDistributed(uint indexed round, uint indexed tbIteration, address indexed winner, uint prize);
    event EtherWithdrawn(uint balance, uint colorBank, uint timeBank, uint timestamp);
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.