HW17: Ponzi-scheme

Problem statement

Implement a smart contract for a Ponzi-scheme.

Example scenario

Alice decides that she wants to create an organization based on the Ponzi-scheme (which is illegal).

When Bob joins, he sends 10 ether and refers Alice. Thus, Alice gets 10 ether.

When Clair joins, she sends 10 ether and refers Bob. Thus, Bob, and Alice both get 5-5 ether (as Bob referred Alice).

When Dan joins, he sends 15 ether and refers Claire. Thus, Claire, Bob, and Alice all get 5-5 ether.

When Eve joins, she sends 15 ether and refers Dan. Thus, Dan, Claire and Bob all get 5-5 ether. But this time Alice does not get anything, i.e. we go "up" the referral chain for at most 3 levels.

Contract interface

Contract skeleton

pragma solidity ^0.4.21;

contract Ponzi {

    // <contract_variables>

    // </contract_variables>

    function Ponzi() public {
        // TODO
    }

    function join(address inviter) public payable {
        // TODO
    }

}