Bitcoin Forum
May 07, 2024, 11:03:19 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Код Ethereum Doubler.  (Read 4618 times)
menescort (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
February 21, 2016, 10:08:54 AM
 #1

Нужно сделать удвоитель с фиксированной суммой вклада 1ETH с адреса в день, комиссией 1%, оборот будет происходить постоянно и не нужно будет долго ждать выплату.Такая пирамида многих может заинтересовать,я и сам буду регулярно инвестировать. Вы как разработчик будите получать 1% от всех вкладов,еще нужен сайт на подобии этого. http://doubler-ethereum2.rhcloud.com

contract Doubler {

  struct Participant {
      address etherAddress;
      uint amount;
  }

  Participant[] public participants;

  uint public payoutIdx = 0;
  uint public collectedFees;
  uint public balance = 0;

  address public owner;

  // simple single-sig function modifier
  modifier onlyowner { if (msg.sender == owner) _ }

  // this function is executed at initialization and sets the owner of the contract
  function Doubler() {
    owner = msg.sender;
  }

  // fallback function - simple transactions trigger this
  function() {
    enter();
  }
 
  function enter() {
    if (msg.value < 100 finney) {
        msg.sender.send(msg.value);
        return;
    }
   
      uint amount;
      if (msg.value > 50 ether) {
         msg.sender.send(msg.value - 50 ether);   
         amount = 50 ether;
    }
      else {
         amount = msg.value;
      }

     // add a new participant to array
    uint idx = participants.length;
    participants.length += 1;
    participants[idx].etherAddress = msg.sender;
    participants[idx].amount = amount;
   
    // collect fees and update contract balance
    if (idx != 0) {
      collectedFees += amount / 50;
      balance += amount;
    }
    else {
      // first participant has no one above him,
      // so it goes all to fees
      collectedFees += amount;
    }

      // while there are enough ether on the balance we can pay out to an earlier participant
    while (balance > participants[payoutIdx].amount * 2) {
      uint transactionAmount = participants[payoutIdx].amount / 50 * 98;
      participants[payoutIdx].etherAddress.send(transactionAmount);

      balance -= participants[payoutIdx].amount * 2;
      payoutIdx += 1;
    }
  }

  function collectFees() onlyowner {
      if (collectedFees == 0) return;

      owner.send(collectedFees);
      collectedFees = 0;
  }

  function setOwner(address _owner) onlyowner {
      owner = _owner;
  }
}
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!