Latest 25 transactions from a total of 852 transactions

TxHash Age From To Value [TxFee]
0x5f1328bbebcaa30f50cd571a1cf354ecb77b649453b02e30a321d78d3ba8108094 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0xd56eaa33a689ff1badb165f977e36737623d457bc7476749f44ef1efdf95d8da94 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x2b09eef762930de4bf851c8af0e5bfd747e581370bf0d11bc7826018a07cfbce94 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x58b54dd8c3dd3a25d44b4e5efe7084606c74ffd7ea2bfe2623e6c39f769f836794 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x44a71d3f6461fb3b7dc9c3918aef5952b7c3d50b4b2bc3be14447ebc8aae625e94 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x3cebe09c7bc01359e1ef688e7d78cf615f486651ab819d927da67533a8ca077294 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x183ab4e2db7a8b3283c37968491a06ec6aa1770a82f09fd49b2e4b97aaff931c94 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0xaa3f22199319c816b98c4f387dce27f3810eebea2fe6b10f442e17dc95a6b57b94 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0xfcdd98ccdaa0e75258a0cb794ccc8df4055ddb7abd6fcd39c688b237cf9cf27594 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0xd5338e418938a06af906066b6b9eff31069192dbdec36d9af8dc2dfb710f47c794 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x84ec1cd80bd52c6d2affdeceb06f549e2024c4cb57c8619194b79e64c403c96794 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x9f309002df815194ddce18f29a482cb536dffc42bec73ebeee99ce840b327c7694 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x7df4322b8830b2b430e19cb18767bfdf79344a9cfbab37cad6c8cb3ca02efef594 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x12749128b90a5457eec54817b774a49d8a362ab3756f21ca676615ef7c1d927b94 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x48d1080f9fee2c09d21c721ad1bc13add2a27e98a40a3fcc7808566e91a0d52e94 days 23 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000051205
0x5a80427d4e8b091c10e0d3e64d75863d21a9ee9f1923597cef278e1356538afb119 days 7 hrs ago0xb91b6ecd8d1f21b3553da809eb446cde0de06aa4  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000397551
0x1aa41aac18a81a03ff5d218cf34420fe74320ca5a90f2bf2a7881d267a91d089124 days 8 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.00004557
0xdfeb51adc1d7493fe79f182eaeab982aef027edeebe844bcd5491692d06ea55d124 days 8 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.00004557
0x2e5a4ce54f9e4645e2a56190ccaf2cd1b91032ebfa1426ad07a0279f10c7ec02125 days 2 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.00004557
0xf0ced55f35622a88c1332c0043ae1dd510b9970b3bf0f6863adc7a2fa040c231125 days 5 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000030634
0x113cae449f541f5e2f50d00a1551475e4639a9cc158b6ab89f46349735704fdd125 days 5 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.00004557
0xfc7bbdd4770c9ba09a8d3bca443383c7866bc29e77db1a0af05deccab949cbe4125 days 5 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.00004557
0x8014e8c2b0949ec8986e3915ad581dc7d13c402b9765bf59958b945f78702131125 days 5 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.000045634
0x8416ce201e2adda777cdd0872ded27029137abe4780f56ab0c4acfdb3fb256b3125 days 5 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.00004557
0xb111457e4207adaaac6d384484128377fcaaeb02b2ffe559fd00993ee91e7192125 days 5 hrs ago0x950bc68ccd99e4bbe424288e6f0dd583e57c9174  IN   0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether0.00004557
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here To View More View All
ParentTxHash Block Age From To Value
0xa17563719b0b7648b806012f9c32ee015da188a3ef02d6a1d5f67a42173bf5898365716125 days 23 hrs ago0x1ae7fcaa710d618f1826a6d25e14943ba050d3dc0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x7ba37dcc6d97a3c9718272c95da48fb2d8cdf4c3a785b3fa3dd46a453a29bfde8365623125 days 23 hrs ago0xf0c5831153c085232b0889103a895f33139ce4a00xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xc852a6f967826facc331c6ab59b08719d8f69bb9dcb6d74a8ae2fddedefd93248365523125 days 23 hrs ago0xf0c5831153c085232b0889103a895f33139ce4a00xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x612994807f214d044067bbf761c292f598c25e9bd3063f42825aaceb45e2d3c58365395125 days 23 hrs ago0xa83c4c4b82463eb104fa84e7dff5c89d816e448f0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x1a33fcfe275d2ec19aa717fc343ec9d00db12771c2614ab2a62145d045ec1dd48365356126 days 2 mins ago0xa83c4c4b82463eb104fa84e7dff5c89d816e448f0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xf95fc6cf6112fd083617af3b2456f1433265ad9422dbfaaa07bbef58e631077a8365091126 days 34 mins ago0x66534c223df067f4a029cf880157b0df0954f6600xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xeb8aefc9fba9ccb8eebe81ef2078f02b971fc719df2f1c8a418da503256212128365088126 days 34 mins ago0x66534c223df067f4a029cf880157b0df0954f6600xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x97e9da06ac61fa15e391f2616f3bbf4f5504478bb8b91d2ce82ebc0e6b3b76368365080126 days 35 mins ago0x66534c223df067f4a029cf880157b0df0954f6600xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x9be5459e8565073c8630b7c25027c74f0e4617fb7263322a0bf03041ae5cb14b8364509126 days 1 hr ago0xd11ed57b03ef78e7f72fb450b4e71ae9793aba470xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x15285bf78070f7d743fae566088727afef10b32440d60aefad583e367f7cbfa68364496126 days 1 hr ago0xd11ed57b03ef78e7f72fb450b4e71ae9793aba470xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xdbacd999b2998b35c8b15af8df1ae889f8538d3da6763dce97aad9d0de79d6ec8364491126 days 1 hr ago0x1ae7fcaa710d618f1826a6d25e14943ba050d3dc0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x7b92afb75cc3f886ee6b03237e814cf3b784503fdac6e71823ab2c14a4aa6dbf8364356126 days 2 hrs ago0x108abfd9de7404e653b5cbab2bd3b5c5bcec2da30xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xb2405b77687c8a3a0b3b7df3d401846b3b153c9bb4341384514b18fbc8044ae38364212126 days 2 hrs ago0x108abfd9de7404e653b5cbab2bd3b5c5bcec2da30xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x980b1e79e7a61ae8d1456c0a7029148e011e346ca3859506eda2e5999798168a8364166126 days 2 hrs ago0x78cfa2046d447c874f8a963ebb8d44c74974576d0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x931c8ad442a75bd0ac37271e66e65d561ea2a5a1331965565305298ec0298df48364090126 days 2 hrs ago0x1015c0c8e73314d4b7288b37f6c16775c544aa2f0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xcbf8e50b88e34b50dff6509922525dcc0c40b8d9a2ede386851aa5488fd5f6578364081126 days 2 hrs ago0xc8df7ba0755bdd73cc9a1d3445dadc4096addf410xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xec7c731b8bdd36c6d7580841a51315f470f7b855cbfe79884634f8e90674cab18363807126 days 3 hrs ago0xafbfbe0d438cbedae77210bc8ce961fa82b3a87d0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xcb91db1ce72bc2286fe15efa9596f923ccefe41f419151f96093cc151455cda68363795126 days 3 hrs ago0x78cfa2046d447c874f8a963ebb8d44c74974576d0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xa9b609bbe5aa97abb37d66f13bd60881123d9a65e68dd06e50ed4058641bb5608363561126 days 3 hrs ago0x81b947ea09112552be30341b505c0a115014e0d00xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xa6f4303a69c2057e3f9d5c28c4897119199f14e350ac8bc9503ccb2851d32ff48363536126 days 3 hrs ago0xde342e89ea5ec393ac5537435d8560f33138fe280xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xf7463ca5d3ba116640d710f0773103d9829c237b6520d44935ac33bf7c446d348363532126 days 3 hrs ago0x81b947ea09112552be30341b505c0a115014e0d00xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xd268cadffb89290b9dcda8fe86b2cd29dc4b0dc02c0930cb85d13dae68920e768362537126 days 5 hrs ago0xafbfbe0d438cbedae77210bc8ce961fa82b3a87d0xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x8dedf83f594ac8961d84e9b9cd86486273327d7af6577b49d6007d479298ecf68362522126 days 5 hrs ago0xc8df7ba0755bdd73cc9a1d3445dadc4096addf410xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0x2a1dd8eedae9c9132d70883f81a5c897ad4a0ee0040439e7491583bcce7a02d58362510126 days 5 hrs ago0xb5ea9617d112829a2361ac669eca20aaa247b6870xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
0xc3270d6fcf93c2f9c7f45481fb0fda1fd0e4ab369593209e3d98ff0dc10b5cb18362502126 days 5 hrs ago0x950a9e5b95959a85936991bf920c4dabd38b5be50xe49c32368d1045f0dc1e4fd527d66762b64328f30 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: ReserveToken
Compiler Text: v0.4.19+commit.c4cbbb05
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.19;
// last compiled with v0.4.19+commit.c4cbbb05;

contract SafeMath {
  //internals

  function safeMul(uint a, uint b) internal pure returns (uint) {
    uint c = a * b;
    require(a == 0 || c / a == b);
    return c;
  }

  function safeSub(uint a, uint b) internal pure returns (uint) {
    require(b <= a);
    return a - b;
  }

  function safeAdd(uint a, uint b) internal pure returns (uint) {
    uint c = a + b;
    require(c>=a && c>=b);
    return c;
  }
}

contract Token {

  /// @return total amount of tokens
  function totalSupply() public constant returns (uint256 supply) {}

  /// @param _owner The address from which the balance will be retrieved
  /// @return The balance
  function balanceOf(address _owner) public constant returns (uint256 balance) {}

  /// @notice send `_value` token to `_to` from `msg.sender`
  /// @param _to The address of the recipient
  /// @param _value The amount of token to be transferred
  /// @return Whether the transfer was successful or not
  function transfer(address _to, uint256 _value) public returns (bool success) {}

  /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
  /// @param _from The address of the sender
  /// @param _to The address of the recipient
  /// @param _value The amount of token to be transferred
  /// @return Whether the transfer was successful or not
  function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {}

  /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
  /// @param _spender The address of the account able to transfer the tokens
  /// @param _value The amount of wei to be approved for transfer
  /// @return Whether the approval was successful or not
  function approve(address _spender, uint256 _value) public returns (bool success) {}

  /// @param _owner The address of the account owning tokens
  /// @param _spender The address of the account able to transfer the tokens
  /// @return Amount of remaining tokens allowed to spent
  function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {}

  event Transfer(address indexed _from, address indexed _to, uint256 _value);
  event Approval(address indexed _owner, address indexed _spender, uint256 _value);

}

contract StandardToken is Token {

  function transfer(address _to, uint256 _value) public returns (bool success) {
    //Default assumes totalSupply can't be over max (2^256 - 1).
    //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
    //Replace the if with this one instead.
    if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
    //if (balances[msg.sender] >= _value && _value > 0) {
      balances[msg.sender] -= _value;
      balances[_to] += _value;
      Transfer(msg.sender, _to, _value);
      return true;
    } else { return false; }
  }

  function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
    //same as above. Replace this line with the following if you want to protect against wrapping uints.
    if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
    //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
      balances[_to] += _value;
      balances[_from] -= _value;
      allowed[_from][msg.sender] -= _value;
      Transfer(_from, _to, _value);
      return true;
    } else { return false; }
  }

  function balanceOf(address _owner) public constant returns (uint256 balance) {
    return balances[_owner];
  }

  function approve(address _spender, uint256 _value) public returns (bool success) {
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
  }

  function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
    return allowed[_owner][_spender];
  }

  mapping(address => uint256) public balances;

  mapping (address => mapping (address => uint256)) public allowed;

  uint256 public totalSupply;

}

contract ReserveToken is StandardToken, SafeMath {
  string public name;
  string public symbol;
  uint public decimals = 18;
  address public minter;

  event Create(address account, uint amount);
  event Destroy(address account, uint amount);

  function ReserveToken(string name_, string symbol_) public {
    name = name_;
    symbol = symbol_;
    minter = msg.sender;
  }

  function create(address account, uint amount) public {
    require(msg.sender == minter);
    balances[account] = safeAdd(balances[account], amount);
    totalSupply = safeAdd(totalSupply, amount);
    Create(account, amount);
  }

  function destroy(address account, uint amount) public {
    require(msg.sender == minter);
    require(balances[account] >= amount);
    balances[account] = safeSub(balances[account], amount);
    totalSupply = safeSub(totalSupply, amount);
    Destroy(account, amount);
  }
}

contract Challenge is SafeMath {

  uint public fee = 10 * (10 ** 16); // fee percentage (100% = 10 ** 18)
  uint public blockPeriod = 6000; // period of blocks for waiting until certain transactions can be sent
  uint public blockNumber; // block number when this challenge was initiated
  bool public funded; // has the initial challenger funded the contract?
  address public witnessJury; // the WitnessJury smart contract
  address public token; // the token of the prize pool
  address public user1; // the initial challenger
  address public user2; // the responding challenger
  string public key1; // something to identify the initial challenger
  string public key2; // something to identify the responding challenger
  uint public amount; // the amount each challenger committed to prize pool
  address public host; // the witness who agreed to host
  string public hostKey; // something to identify the host
  string public witnessJuryKey; // something the host used to identify the challenge specifics
  uint public witnessJuryRequestNum; // the WitnessJury request number (in the WitnessJury smart contract)
  uint public winner; // the winner (1 or 2)
  bool public rescued; // has the contract been rescued?
  bool public juryCalled; // has the jury been called?
  address public referrer; // the referrer of the person who created the challenge (splits reward with host)

  event NewChallenge(uint amount, address user1, string key1);
  event Fund();
  event Respond(address user2, string key2);
  event Host(address host, string hostKey);
  event SetWitnessJuryKey(uint witnessJuryRequestNum, string witnessJuryKey);
  event RequestJury();
  event Resolve(uint winner, bool wasContested, uint winnerAmount, uint hostAmount, uint witnessJuryAmount);
  event Rescue();

  function Challenge(address witnessJury_, address token_, uint amount_, address user1_, string key1_, uint blockPeriod_, address referrer_) public {
    require(amount_ > 0);
    blockPeriod = blockPeriod_;
    witnessJury = witnessJury_;
    token = token_;
    user1 = user1_;
    key1 = key1_;
    amount = amount_;
    referrer = referrer_;
    blockNumber = block.number;
    NewChallenge(amount, user1, key1);
  }

  function fund() public {
    // remember to call approve() on the token first...
    require(!funded);
    require(!rescued);
    require(msg.sender == user1);
    require(Token(token).transferFrom(user1, this, amount));
    funded = true;
    blockNumber = block.number;
    Fund();
  }

  function respond(address user2_, string key2_) public {
    // remember to call approve() on the token first...
    require(user2 == 0x0);
    require(funded);
    require(!rescued);
    user2 = user2_;
    key2 = key2_;
    blockNumber = block.number;
    require(Token(token).transferFrom(user2, this, amount));
    Respond(user2, key2);
  }

  function host(string hostKey_) public {
    require(host == 0x0);
    require(!rescued);
    host = msg.sender;
    hostKey = hostKey_;
    blockNumber = block.number;
    Host(host, hostKey);
  }

  function setWitnessJuryKey(string witnessJuryKey_) public {
    require(witnessJuryRequestNum == 0);
    require(msg.sender == host);
    require(!rescued);
    witnessJuryRequestNum = WitnessJury(witnessJury).numRequests() + 1;
    witnessJuryKey = witnessJuryKey_;
    blockNumber = block.number;
    WitnessJury(witnessJury).newRequest(witnessJuryKey, this);
    SetWitnessJuryKey(witnessJuryRequestNum, witnessJuryKey);
  }

  function requestJury() public {
    require(!juryCalled);
    require(msg.sender == user1 || msg.sender == user2);
    require(!rescued);
    require(winner == 0);
    require(WitnessJury(witnessJury).getWinner1(witnessJuryRequestNum) != 0 && WitnessJury(witnessJury).getWinner2(witnessJuryRequestNum) != 0);
    juryCalled = true;
    blockNumber = block.number;
    WitnessJury(witnessJury).juryNeeded(witnessJuryRequestNum);
    RequestJury();
  }

  function resolve(uint witnessJuryRequestNum_, bool juryContested, address[] majorityJurors, uint winner_, address witness1, address witness2, uint witnessJuryRewardPercentage) public {
    require(winner == 0);
    require(witnessJuryRequestNum_ == witnessJuryRequestNum);
    require(msg.sender == witnessJury);
    require(winner_ == 1 || winner_ == 2);
    require(!rescued);
    require(block.number > blockNumber + blockPeriod);
    uint totalFee = safeMul(safeMul(amount, 2), fee) / (1 ether);
    uint winnerAmount = safeSub(safeMul(amount, 2), totalFee);
    uint witnessJuryAmount = safeMul(totalFee, witnessJuryRewardPercentage) / (1 ether);
    uint hostAmount = safeSub(totalFee, witnessJuryAmount);
    uint flipWinner = winner_ == 1 ? 2 : 1;
    winner = juryContested ? flipWinner : winner_;
    require(Token(token).transfer(winner == 1 ? user1 : user2, winnerAmount));
    if (referrer != 0x0) {
      require(Token(token).transfer(host, hostAmount / 2));
      require(Token(token).transfer(referrer, safeSub(hostAmount, hostAmount / 2)));
    } else {
      require(Token(token).transfer(host, hostAmount));
    }
    if (!juryContested) {
      require(Token(token).transfer(witness1, witnessJuryAmount / 2));
      require(Token(token).transfer(witness2, witnessJuryAmount / 2));
    } else {
      for (uint i = 0; i < majorityJurors.length; i++) {
        require(Token(token).transfer(majorityJurors[i], witnessJuryAmount / majorityJurors.length));
      }
    }
    uint excessBalance = Token(token).balanceOf(this);
    if (excessBalance > 0) {
      require(Token(token).transfer(0x0, excessBalance));
    }
    Resolve(winner, juryContested, winnerAmount, hostAmount, witnessJuryAmount);
  }

  function rescue() public {
    require(!rescued);
    require(block.number > blockNumber + blockPeriod * 10);
    require(msg.sender == user1 || msg.sender == user2);
    require(winner == 0);
    rescued = true;
    if (user2 != 0x0) {
      require(Token(token).transfer(user1, amount));
      require(Token(token).transfer(user2, amount));
    } else {
      require(Token(token).transfer(user1, amount));
    }
    Rescue();
  }

}

contract ChallengeFactory is SafeMath {

  address witnessJury;
  address token;

  mapping(uint => Challenge) public challenges;
  uint numChallenges;

  event NewChallenge(address addr, uint amount, address user, string key);

  function ChallengeFactory(address witnessJury_, address token_) public {
    witnessJury = witnessJury_;
    token = token_;
  }

  function newChallenge(uint amount, address user, string key, address referrer) public {
    numChallenges = safeAdd(numChallenges, 1);
    uint blockPeriod = 6000;
    challenges[numChallenges] = new Challenge(witnessJury, token, amount, user, key, blockPeriod, referrer);
    NewChallenge(address(challenges[numChallenges]), amount, user, key);
  }

}

contract WitnessJury is SafeMath {
  mapping(address => uint) public balances; // mapping of witness address to witness balance
  uint public limit = 10 ** 16; // 1% = the max percentage of the overall witness pool one person can have
  uint public numWitnessesBeforeLimit = 100; // the number of witnesses before the limit starts kicking in
  uint public totalBalance; // the total of all witness balances
  uint public numWitnesses; // count of total witnesses with non-zero balances
  uint public blockPeriod = 6000; // 1 day at 14.4 seconds per block
  uint public desiredWitnesses = 2; // desired number of witnesses to fulfill a request (witness a match)
  uint public desiredJurors = 3; // desired number of jurors
  uint public penalty = 50 * (10 ** 16); // penalty for witnesses if jury votes yes (penalty is sent back to the witnesses)
  address public token; // the token being staked by witnesses
  mapping(uint => Request) public requests; // mapping of requests that are partially or completely filled
  uint public numRequests; // count of total number of partially or completely filled requests
  mapping(uint => uint) public requestsPerBlockGroup; // map of number of requests per block group
  uint public drmVolumeCap = 10000; // after this many matches per block group, fee stops increasing
  uint public drmMinFee = 25 * (10 ** 16); // minimum witness reward percentage (100% = 10 ** 18)
  uint public drmMaxFee = 50 * (10 ** 16); // maximum witness reward percentage (100% = 10 ** 18)
  mapping(uint => bool) public juryNeeded; // mapping of requestNum to whether the jury is needed
  mapping(uint => mapping(address => bool)) public juryVoted; // mapping of requestNum to juror addresses who already voted
  mapping(uint => uint) public juryYesCount; // mapping of requestNum to number of yes votes
  mapping(uint => uint) public juryNoCount; // mapping of requestNum to number of no votes
  mapping(uint => address[]) public juryYesVoters; // mapping of requestNum to array of yes voters
  mapping(uint => address[]) public juryNoVoters; // mapping of requestNum to array of no voters

  struct Request {
    string key; // the key, which should contain details about the request (for example, match ID)
    address witness1; // the first witness
    address witness2; // the second witness
    string answer1; // the first witness' answer
    string answer2; // the second witness' answer
    uint winner1; // the first witness' winner
    uint winner2; // the second witness' winner
    uint fee; // percentage of match fee that will go to witness / jury pool (100% = 10 ** 18)
    address challenge; // challenge smart contract
    uint blockNumber; // block number when request was made
  }

  event Deposit(uint amount);
  event Withdraw(uint amount);
  event ReduceToLimit(address witness, uint amount);
  event Report(uint requestNum, string answer, uint winner);
  event NewRequest(uint requestNum, string key);
  event JuryNeeded(uint requestNum);
  event JuryVote(uint requestNum, address juror, bool vote);
  event Resolve(uint requestNum);
  event JuryContested(uint requestNum);

  function WitnessJury(address token_) public {
    token = token_;
  }

  function balanceOf(address user) public constant returns(uint) {
    return balances[user];
  }

  function reduceToLimit(address witness) public {
    require(witness == msg.sender);
    uint amount = balances[witness];
    uint limitAmount = safeMul(totalBalance, limit) / (1 ether);
    if (amount > limitAmount && numWitnesses > numWitnessesBeforeLimit) {
      uint excess = safeSub(amount, limitAmount);
      balances[witness] = safeSub(amount, excess);
      totalBalance = safeSub(totalBalance, excess);
      require(Token(token).transfer(witness, excess));
      ReduceToLimit(witness, excess);
    }
  }

  function deposit(uint amount) public {
    // remember to call approve() on the token first...
    require(amount > 0);
    if (balances[msg.sender] == 0) {
      numWitnesses = safeAdd(numWitnesses, 1);
    }
    balances[msg.sender] = safeAdd(balances[msg.sender], amount);
    totalBalance = safeAdd(totalBalance, amount);
    require(Token(token).transferFrom(msg.sender, this, amount));
    Deposit(amount);
  }

  function withdraw(uint amount) public {
    require(amount > 0);
    require(amount <= balances[msg.sender]);
    balances[msg.sender] = safeSub(balances[msg.sender], amount);
    totalBalance = safeSub(totalBalance, amount);
    if (balances[msg.sender] == 0) {
      numWitnesses = safeSub(numWitnesses, 1);
    }
    require(Token(token).transfer(msg.sender, amount));
    Withdraw(amount);
  }

  function isWitness(uint requestNum, address witness) public constant returns(bool) {
    //random number from 0-999999999
    bytes32 hash = sha256(this, requestNum, requests[requestNum].key);
    uint rand = uint(sha256(requestNum, hash, witness)) % 1000000000;
    return (
      rand * totalBalance < 1000000000 * desiredWitnesses * balances[witness] ||
      block.number > requests[requestNum].blockNumber + blockPeriod
    );
  }

  function isJuror(uint requestNum, address juror) public constant returns(bool) {
    //random number from 0-999999999
    bytes32 hash = sha256(1, this, requestNum, requests[requestNum].key);
    uint rand = uint(sha256(requestNum, hash, juror)) % 1000000000;
    return (
      rand * totalBalance < 1000000000 * desiredWitnesses * balances[juror]
    );
  }

  function newRequest(string key, address challenge) public {
    numRequests = safeAdd(numRequests, 1);
    require(requests[numRequests].challenge == 0x0);
    requests[numRequests].blockNumber = block.number;
    requests[numRequests].challenge = challenge;
    requests[numRequests].key = key;
    requestsPerBlockGroup[block.number / blockPeriod] = safeAdd(requestsPerBlockGroup[block.number / blockPeriod], 1);
    uint recentNumRequests = requestsPerBlockGroup[block.number / blockPeriod];
    if (recentNumRequests < drmVolumeCap) {
      requests[numRequests].fee = safeAdd(safeMul(safeMul(recentNumRequests, recentNumRequests), safeSub(drmMaxFee, drmMinFee)) / safeMul(drmVolumeCap, drmVolumeCap), drmMinFee);
    } else {
      requests[numRequests].fee = drmMaxFee;
    }
    NewRequest(numRequests, key);
  }

  function report(uint requestNum, string answer, uint winner) public {
    require(requests[requestNum].challenge != 0x0);
    require(requests[requestNum].witness1 == 0x0 || requests[requestNum].witness2 == 0x0);
    require(isWitness(requestNum, msg.sender));
    reportLogic(requestNum, answer, winner);
    Report(requestNum, answer, winner);
  }

  function reportLogic(uint requestNum, string answer, uint winner) private {
    reduceToLimit(msg.sender);
    if (requests[requestNum].witness1 == 0x0) {
      requests[requestNum].witness1 = msg.sender;
      requests[requestNum].answer1 = answer;
      requests[requestNum].winner1 = winner;
    } else if (requests[requestNum].witness2 == 0x0) {
      requests[requestNum].witness2 = msg.sender;
      requests[requestNum].answer2 = answer;
      requests[requestNum].winner2 = winner;
    }
  }

  function juryNeeded(uint requestNum) public {
    require(msg.sender == requests[requestNum].challenge);
    require(!juryNeeded[requestNum]);
    juryNeeded[requestNum] = true;
    JuryNeeded(requestNum);
  }

  function juryVote(uint requestNum, bool vote) public {
    require(!juryVoted[requestNum][msg.sender]);
    require(juryNeeded[requestNum]);
    require(safeAdd(juryYesCount[requestNum], juryNoCount[requestNum]) < desiredJurors);
    require(isJuror(requestNum, msg.sender));
    juryVoted[requestNum][msg.sender] = true;
    if (vote) {
      juryYesCount[requestNum] = safeAdd(juryYesCount[requestNum], 1);
      juryYesVoters[requestNum].push(msg.sender);
    } else {
      juryNoCount[requestNum] = safeAdd(juryNoCount[requestNum], 1);
      juryNoVoters[requestNum].push(msg.sender);
    }
    JuryVote(requestNum, msg.sender, vote);
  }

  function resolve(uint requestNum) public {
    if (requests[requestNum].winner1 == requests[requestNum].winner2) {
      bool juryContested = juryYesCount[requestNum] > juryNoCount[requestNum] && safeAdd(juryYesCount[requestNum], juryNoCount[requestNum]) == desiredJurors;
      Challenge(requests[requestNum].challenge).resolve(
        requestNum,
        juryContested,
        juryYesCount[requestNum] > juryNoCount[requestNum] ? juryYesVoters[requestNum] : juryNoVoters[requestNum],
        requests[requestNum].winner1,
        requests[requestNum].witness1,
        requests[requestNum].witness2,
        requests[requestNum].fee
      );
      if (juryContested) {
        uint penalty1 = safeMul(balances[requests[requestNum].witness1], penalty) / (1 ether);
        uint penalty2 = safeMul(balances[requests[requestNum].witness2], penalty) / (1 ether);
        balances[requests[requestNum].witness1] = safeSub(balances[requests[requestNum].witness1], penalty1);
        balances[requests[requestNum].witness2] = safeSub(balances[requests[requestNum].witness2], penalty2);
        require(Token(token).transfer(requests[requestNum].witness1, penalty1));
        require(Token(token).transfer(requests[requestNum].witness2, penalty2));
        JuryContested(requestNum);
      }
      Resolve(requestNum);
    }
  }

  function getWinner1(uint requestNum) public constant returns(uint) {
    return requests[requestNum].winner1;
  }

  function getWinner2(uint requestNum) public constant returns(uint) {
    return requests[requestNum].winner2;
  }

  function getRequest(uint requestNum) public constant returns(string, address, address, string, string, uint, address) {
    return (requests[requestNum].key,
            requests[requestNum].witness1,
            requests[requestNum].witness2,
            requests[requestNum].answer1,
            requests[requestNum].answer2,
            requests[requestNum].fee,
            requests[requestNum].challenge);
  }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minter","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"amount","type":"uint256"}],"name":"create","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"amount","type":"uint256"}],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"name_","type":"string"},{"name":"symbol_","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Destroy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60606040526012600555341561001457600080fd5b604051610a08380380610a08833981016040528080518201919060200180519091019050600382805161004b929160200190610082565b50600481805161005f929160200190610082565b505060068054600160a060020a03191633600160a060020a03161790555061011d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100c357805160ff19168380011785556100f0565b828001600101855582156100f0579182015b828111156100f05782518255916020019190600101906100d5565b506100fc929150610100565b5090565b61011a91905b808211156100fc5760008155600101610106565b90565b6108dc8061012c6000396000f3006060604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063075461721461015e578063095ea7b31461018d5780630ecaea73146101c357806318160ddd146101e757806323b872dd1461020c57806327e235e314610234578063313ce567146102535780635c6581651461026657806370a082311461028b57806395d89b41146102aa578063a24835d1146102bd578063a9059cbb146102df578063dd62ed3e14610301575b600080fd5b34156100df57600080fd5b6100e7610326565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012357808201518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561016957600080fd5b6101716103c4565b604051600160a060020a03909116815260200160405180910390f35b341561019857600080fd5b6101af600160a060020a03600435166024356103d3565b604051901515815260200160405180910390f35b34156101ce57600080fd5b6101e5600160a060020a0360043516602435610440565b005b34156101f257600080fd5b6101fa6104ef565b60405190815260200160405180910390f35b341561021757600080fd5b6101af600160a060020a03600435811690602435166044356104f5565b341561023f57600080fd5b6101fa600160a060020a0360043516610604565b341561025e57600080fd5b6101fa610616565b341561027157600080fd5b6101fa600160a060020a036004358116906024351661061c565b341561029657600080fd5b6101fa600160a060020a0360043516610639565b34156102b557600080fd5b6100e7610654565b34156102c857600080fd5b6101e5600160a060020a03600435166024356106bf565b34156102ea57600080fd5b6101af600160a060020a0360043516602435610794565b341561030c57600080fd5b6101fa600160a060020a0360043581169060243516610850565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103bc5780601f10610391576101008083540402835291602001916103bc565b820191906000526020600020905b81548152906001019060200180831161039f57829003601f168201915b505050505081565b600654600160a060020a031681565b600160a060020a03338116600081815260016020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60065433600160a060020a0390811691161461045b57600080fd5b600160a060020a03821660009081526020819052604090205461047e908261087b565b600160a060020a0383166000908152602081905260409020556002546104a4908261087b565b6002557fcc9018de05b5f497ee7618d8830568d8ac2d45d0671b73d8f71c67e824122ec78282604051600160a060020a03909216825260208201526040908101905180910390a15050565b60025481565b600160a060020a0383166000908152602081905260408120548290108015906105455750600160a060020a0380851660009081526001602090815260408083203390941683529290522054829010155b801561056a5750600160a060020a038316600090815260208190526040902054828101115b156105f957600160a060020a0380841660008181526020818152604080832080548801905588851680845281842080548990039055600183528184203390961684529490915290819020805486900390559091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060016105fd565b5060005b9392505050565b60006020819052908152604090205481565b60055481565b600160209081526000928352604080842090915290825290205481565b600160a060020a031660009081526020819052604090205490565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103bc5780601f10610391576101008083540402835291602001916103bc565b60065433600160a060020a039081169116146106da57600080fd5b600160a060020a0382166000908152602081905260409020548190101561070057600080fd5b600160a060020a038216600090815260208190526040902054610723908261089b565b600160a060020a038316600090815260208190526040902055600254610749908261089b565b6002557f81325e2a6c442af9d36e4ee9697f38d5f4bf0837ade0f6c411c6a40af7c057ee8282604051600160a060020a03909216825260208201526040908101905180910390a15050565b600160a060020a0333166000908152602081905260408120548290108015906107d65750600160a060020a038316600090815260208190526040902054828101115b1561084857600160a060020a033381166000818152602081905260408082208054879003905592861680825290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600161043a565b50600061043a565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60008282018381108015906108905750828110155b15156105fd57600080fd5b6000828211156108aa57600080fd5b509003905600a165627a7a7230582036a2b5bdfd2820686c67ce97354aaa7b85828548f58e415f44d3cc6616b41fa6002900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000f4669727374426c6f6f64546f6b656e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033153540000000000000000000000000000000000000000000000000000000000

    Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000f4669727374426c6f6f64546f6b656e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033153540000000000000000000000000000000000000000000000000000000000

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [3] : 4669727374426c6f6f64546f6b656e0000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [5] : 3153540000000000000000000000000000000000000000000000000000000000


   Swarm Source:
bzzr://36a2b5bdfd2820686c67ce97354aaa7b85828548f58e415f44d3cc6616b41fa6

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward