Implement a smart contract for a Ponzi-scheme.
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.
constructor: function Ponzi()
msg.sender
) being the first member.join: function join(address inviter) payable
inviter
.inviter
is a member, but the sender of the transaction is not.inviter
, the member referred by inviter
, and the member referred by the member referred by inviter
(see the example above for clarification).pragma solidity ^0.4.21;
contract Ponzi {
// <contract_variables>
// </contract_variables>
function Ponzi() public {
// TODO
}
function join(address inviter) public payable {
// TODO
}
}