-
-
Save skilesare/f8e76626419d30584a8376343b04392f to your computer and use it in GitHub Desktop.
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.11+commit.68ef5810.js&optimize=undefined&gist=
This file contains 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.8; | |
//© copyright 2017 - Catallax Bank and Rivvir Consulting | |
// Developed by Austin Fatheree | |
// http://catallax.info @hypercatallax | |
// All rights reserved. | |
contract NameService { | |
mapping(address => address) public addressContracts; | |
uint public coolNumber; | |
event NameReserved(address indexed caller, address indexed nameObject); | |
function NameService(){ | |
coolNumber = 12; | |
} | |
function lookUp(address theAddress) constant returns(address contractAddress){ | |
return addressContracts[theAddress]; | |
} | |
function Claim(address theAddress) returns (address aName){ | |
if(addressContracts[theAddress] != 0) throw; | |
address anAddress = theAddress; | |
aName = new NameObject(msg.sender, anAddress); | |
addressContracts[theAddress] = aName; | |
address theSender = msg.sender; | |
NameReserved(theSender, aName); | |
return aName; | |
} | |
function ClaimSet(address theAddress, uint256 aCoolNumber) returns (address aName){ | |
//note the uint256, uint didn't work | |
if(addressContracts[theAddress] != 0) throw; | |
coolNumber = aCoolNumber; | |
return Claim(theAddress); | |
} | |
function FindCoolNumber() returns (uint256 aNumber){ | |
aNumber = coolNumber; | |
return aNumber; | |
} | |
} | |
contract NameObject{ | |
address public owner; | |
address public claimedAddress; | |
bool public hereIam; | |
event IExist(address owner); | |
event Transfered(address owner); | |
function NameObject(address aOwner, address aClaimedAddress){ | |
owner = aOwner; | |
claimedAddress = aClaimedAddress; | |
} | |
function ProveExistance() returns (bool ok){ | |
hereIam = true; | |
IExist(owner); | |
return true; | |
} | |
function Transfer(address __newOwner) returns(bool ok){ | |
if(msg.sender != owner) throw; | |
owner = __newOwner; | |
Transfered(owner); | |
return true; | |
} | |
} | |
contract BeepBopBot { | |
address public owner; | |
bytes32 emptyBytes; | |
event Impersonation( address indexed caller, address indexed executer, string functionSig); | |
function BeepBopBot(){ | |
owner = msg.sender; | |
} | |
function impersonate(address aContract, string functionSig, | |
bytes32 _1, | |
bytes32 _2, | |
bytes32 _3, | |
bytes32 _4, | |
bytes32 _5, | |
bytes32 _6, | |
bytes32 _7, | |
bytes32 _8) returns (bool ok){ | |
bool result = false; | |
bytes4 sig = bytes4(sha3(functionSig)); | |
if(_8 != emptyBytes){ | |
result = aContract.call(sig, _1, _2, _3, _4, _5, _6, _7, _8); | |
} | |
else if(_7 != emptyBytes){ | |
result = aContract.call(sig, _1, _2, _3, _4, _5, _6, _7); | |
} | |
else if(_6 != emptyBytes){ | |
result = aContract.call(sig, _1, _2, _3, _4, _5, _6); | |
} | |
else if(_5 != emptyBytes){ | |
result = aContract.call(sig, _1, _2, _3, _4, _5); | |
} | |
else if(_4 != emptyBytes){ | |
result = aContract.call(sig, _1, _2, _3, _4); | |
} | |
else if(_3 != emptyBytes){ | |
result = aContract.call(sig, _1, _2, _3); | |
} | |
else if(_2 != emptyBytes){ | |
result = aContract.call(sig, _1, _2); | |
} | |
else if(_1 != emptyBytes){ | |
result = aContract.call(sig, _1); | |
} | |
else { | |
result = aContract.call(sig); | |
} | |
if(result == false) throw; | |
address theSender = msg.sender; | |
Impersonation(theSender, this, functionSig); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment