Skip to content
Verified contractPartial

Escrow

Address0x0d3cab9bccd590a49cf84ccf63889ea05e034822
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.1.6

 

Same code

1 more contract

 

Details

Compiler
solc 0.1.6+commit.d41f8b7c
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
494,700
Creation transaction
0xf6f6208ad3…1c22263720

Escrow.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract OraclizeI {
    function query(uint timestamp, string datasource, string arg) returns (bytes32 id);
    function getPrice(string datasource) returns (uint dsprice);
    function cbAddress() returns (address);
}

contract OraclizeAddrResolverI {
    function getAddress() returns (address addr);
}

contract usingOraclize {
    uint day = 60*60*24;
    uint week = 60*60*24*7;
    uint month = 60*60*24*30;
    OraclizeI oraclize;

    modifier oraclizeAPI {
        OraclizeAddrResolverI OAR = OraclizeAddrResolverI(0x1d11e5eae3112dbd44f99266872ff1d07c77dce8);
        oraclize = OraclizeI(OAR.getAddress());
        _
    }

    modifier coupon(string code) {
        _
    }

    function oraclize_query(string datasource, string arg) oraclizeAPI returns (bytes32 id) {
        return oraclize.query.value(oraclize.getPrice(datasource))(0, datasource, arg);
    }

    function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id) {
        return oraclize.query.value(oraclize.getPrice(datasource))(timestamp, datasource, arg);
    }

    function oraclize_cbAddress() oraclizeAPI internal returns (address) {
        return oraclize.cbAddress();
    }

    function parseInt(string _a) internal returns (uint) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        for (uint i = 0; i < bresult.length; i++) {
            if ((bresult[i] >= 48) && (bresult[i] <= 57)) {
                mint *= 10;
                mint += uint(bresult[i]) - 48;
            }
        }
        return mint;
    }

    function strConcat(string _a, string _b) internal returns (string) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory bab = "                                                                                                                                                                                                                              ";
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) {
            bab[k] = _ba[i];
            k++;
        }
        for (i = 0; i < _bb.length; i++) {
            bab[k] = _bb[i];
            k++;
        }
        for (i = k; i < bab.length; i++) bab[i] = 0;
        return string(bab);
    }
}

contract Escrow is usingOraclize {
    string btcAddr;
    uint amount;
    address recipient;
    address depositor;

    function escrow(uint _amount, string btcAddress, address _recipient, uint timestamp) coupon("DEVCON1") {
        btcAddr = btcAddress;
        amount = _amount;
        recipient = _recipient;
        depositor = msg.sender;
        oraclize_query(timestamp, "URL", strConcat(strConcat("    https://insight.bitpay.com/api/addr/", btcAddress), "/balance"));
    }

    function __callback(bytes32 myid, string result) {
        if (msg.sender != oraclize_cbAddress()) throw;
        if (parseInt(result) / 1000 >= amount) recipient.send(this.balance);
        else depositor.send(this.balance);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.