diff --git a/.gitignore b/.gitignore index 69b5c9b..73a4d43 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ keys.json *.log *.tmp *.swp -*.lock .node* config/db.json database/* diff --git a/README.md b/README.md index 2ae1a0e..9bc963d 100644 --- a/README.md +++ b/README.md @@ -123,4 +123,9 @@ If a new version is detected you can run `npm run update` to automatically donwl * `--loglevel` : change the default log level (available: 'error', 'warn', 'info', 'verbose', 'debug', 'stats') default: 'info' * `--non-interactive` : disable the interactive mode * `--no-hints` : disable logs hints - * `--gasprice` : set custom gas price + * `--gasprice` : set custom gas price for contracts deployment + interactions + + ##### Advanced/Internal + * `--minimum-gas-price` : set minimum gas price to accept for queries, else ignore them. + * `--connector-gas-price` : set detault gas price to set in connector state. + * `--disable-address-watcher` : disable the address watcher because low RSK gas prices allow much lower balances for the callback address(es). diff --git a/bridge.js b/bridge.js index 1f3dd3c..aa9ab5f 100644 --- a/bridge.js +++ b/bridge.js @@ -145,7 +145,7 @@ logger.info('you are running ' + BRIDGE_NAME, '- version: ' + BRIDGE_VERSION) logger.info('saving logs to:', cliConfiguration.logFilePath) var oraclizeConfiguration = { - 'context_name': bridgeUtil.getContext({'prefix': BLOCKCHAIN_ABBRV, 'random': true}), + 'context_name': cliConfiguration.context || bridgeUtil.getContext({'prefix': BLOCKCHAIN_ABBRV, 'random': true}), 'latest_block_number': -1, 'oar': cliConfiguration.oar, 'node': { @@ -414,7 +414,11 @@ function importConfigFile (instanceToLoad) { function loadConfigFile (file) { var configFile = bridgeUtil.loadLocalJson(file) if (typeof configFile.mode !== 'undefined' && typeof configFile.account !== 'undefined' && typeof configFile.oar !== 'undefined' && typeof configFile.node !== 'undefined') { - oraclizeConfiguration = configFile + oraclizeConfiguration = Object.assign({}, oraclizeConfiguration, configFile) + if (cliConfiguration.context) + oraclizeConfiguration.context_name = cliConfiguration.context + if (cliConfiguration.gasprice) + oraclizeConfiguration.gas_price = parseInt(cliConfiguration.gasprice) mode = configFile.mode cliConfiguration.defaultnode = configFile.node.main startUpLog(false, configFile) @@ -532,7 +536,7 @@ function deployOraclize () { async.waterfall([ function (callback) { var accountBalance = activeOracleInstance.checkAccountBalance() - var amountToPay = 500000000000000000 - accountBalance + var amountToPay = oraclizeConfiguration['gas_price'] * 20e6 - accountBalance if (amountToPay > 0) { logger.warn(activeOracleInstance.account, 'doesn\'t have enough funds to cover transaction costs, please send at least ' + parseFloat(amountToPay / 1e19) + ' ' + BLOCKCHAIN_BASE_UNIT) if (isTestRpc && cliConfiguration['non-interactive'] === false) { @@ -648,6 +652,14 @@ function checkVersion () { } function runLog () { + // if gas price cli set, set it in contract + if (cliConfiguration.conGasPrice) { + activeOracleInstance.setGasPriceInGwei(activeOracleInstance.connector, cliConfiguration.conGasPrice, function (err, res) { + if (err) return logger.error('update connector gas price error', err) + else logger.info('connector gas price updated to', cliConfiguration.conGasPrice, 'gwei') + }) + } + if (officialOar.length === 1 && cliConfiguration['no-hints'] === false) logger.info('an "official" Oraclize address resolver was found on your blockchain:', officialOar[0], 'you can use that instead and quit the bridge') var checksumOar = bridgeCore.ethUtil.toChecksumAddress(activeOracleInstance.oar) @@ -711,7 +723,7 @@ function runLog () { if (!isTestRpc && !cliConfiguration.dev) checkCallbackTxs() AddressWatcher({'address': activeOracleInstance.account, 'logger': logger, 'balance_limit': 10000000000000000}) - AddressWatcher().init() + if (!cliConfiguration['disable-address-watcher']) AddressWatcher().init() } function fetchPlatform () { diff --git a/contracts/abi/oraclizeConnector.json b/contracts/abi/oraclizeConnector.json index 3b7752d..a512209 100644 --- a/contracts/abi/oraclizeConnector.json +++ b/contracts/abi/oraclizeConnector.json @@ -1 +1,1321 @@ -[{"constant":false,"inputs":[{"name":"_code","type":"string"}],"name":"deleteCoupon","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"}],"name":"query1","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_datasource","type":"string"},{"name":"_gaslimit","type":"uint256"}],"name":"getPrice","outputs":[{"name":"_dsprice","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"}],"name":"query1","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"baseprice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newSessionPubKeysHash","type":"bytes32[]"}],"name":"randomDS_updateSessionPubKeysHash","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_datasource","type":"string"}],"name":"getPrice","outputs":[{"name":"_dsprice","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"},{"name":"_gaslimit","type":"uint256"}],"name":"query1","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_coupon","type":"string"}],"name":"useCoupon","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_code","type":"string"}],"name":"createCoupon","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"}],"name":"withdrawFunds","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_proofType","type":"bytes1"}],"name":"setProofType","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"dsHash","type":"bytes32[]"},{"name":"multiplier","type":"uint256[]"}],"name":"multiAddDSource","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"},{"name":"_gaslimit","type":"uint256"}],"name":"query1_withGasLimit","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg1","type":"string"},{"name":"_arg2","type":"string"}],"name":"query2","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"new_baseprice","type":"uint256"},{"name":"proofID","type":"bytes"}],"name":"setBasePrice","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg1","type":"string"},{"name":"_arg2","type":"string"},{"name":"_gaslimit","type":"uint256"}],"name":"query2","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_args","type":"bytes"},{"name":"_gaslimit","type":"uint256"}],"name":"queryN","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"}],"name":"query","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_args","type":"bytes"}],"name":"queryN","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg1","type":"string"},{"name":"_arg2","type":"string"},{"name":"_gaslimit","type":"uint256"}],"name":"query2_withGasLimit","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_datasource","type":"string"},{"name":"_args","type":"bytes"}],"name":"queryN","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"newCbaddress","type":"address"}],"name":"setCBaddress","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"dsname","type":"string"},{"name":"multiplier","type":"uint256"}],"name":"addDSource","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"randomDS_getSessionPubKeyHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"}],"name":"query","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"},{"name":"_gaslimit","type":"uint256"}],"name":"query","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"dsname","type":"string"},{"name":"proofType","type":"bytes1"},{"name":"multiplier","type":"uint256"}],"name":"addDSource","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newgasprice","type":"uint256"}],"name":"setGasPrice","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"cbAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_arg","type":"string"},{"name":"_gaslimit","type":"uint256"}],"name":"query_withGasLimit","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_timestamp","type":"uint256"},{"name":"_datasource","type":"string"},{"name":"_args","type":"bytes"},{"name":"_gaslimit","type":"uint256"}],"name":"queryN_withGasLimit","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_gasPrice","type":"uint256"}],"name":"setCustomGasPrice","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_gasPrice","type":"uint256[]"},{"name":"_addr","type":"address[]"}],"name":"multisetCustomGasPrice","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_proofType","type":"uint256[]"},{"name":"_addr","type":"address[]"}],"name":"multisetProofType","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"new_baseprice","type":"uint256"}],"name":"setBasePrice","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"randomDS_sessionPubKeysHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_datasource","type":"string"},{"name":"_arg1","type":"string"},{"name":"_arg2","type":"string"}],"name":"query2","outputs":[{"name":"_id","type":"bytes32"}],"payable":true,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"payable":false,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"cid","type":"bytes32"},{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":false,"name":"datasource","type":"string"},{"indexed":false,"name":"arg","type":"string"},{"indexed":false,"name":"gaslimit","type":"uint256"},{"indexed":false,"name":"proofType","type":"bytes1"},{"indexed":false,"name":"gasPrice","type":"uint256"}],"name":"Log1","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"cid","type":"bytes32"},{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":false,"name":"datasource","type":"string"},{"indexed":false,"name":"arg1","type":"string"},{"indexed":false,"name":"arg2","type":"string"},{"indexed":false,"name":"gaslimit","type":"uint256"},{"indexed":false,"name":"proofType","type":"bytes1"},{"indexed":false,"name":"gasPrice","type":"uint256"}],"name":"Log2","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"cid","type":"bytes32"},{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":false,"name":"datasource","type":"string"},{"indexed":false,"name":"args","type":"bytes"},{"indexed":false,"name":"gaslimit","type":"uint256"},{"indexed":false,"name":"proofType","type":"bytes1"},{"indexed":false,"name":"gasPrice","type":"uint256"}],"name":"LogN","type":"event"}] \ No newline at end of file +[ + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + } + ], + "name": "query1", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "getPrice", + "outputs": [ + { + "name": "_dsprice", + "type": "uint256" + } + ], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + } + ], + "name": "query1", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": true, + "inputs": [], + "name": "baseprice", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" + }, + { + "constant": false, + "inputs": [ + { + "name": "newCbAddress", + "type": "address" + } + ], + "name": "removeCbAddress", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newSessionPubKeysHash", + "type": "bytes32[]" + } + ], + "name": "randomDS_updateSessionPubKeysHash", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_datasource", + "type": "string" + } + ], + "name": "getPrice", + "outputs": [ + { + "name": "_dsprice", + "type": "uint256" + } + ], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "query1", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "newCbAddress", + "type": "address" + }, + { + "name": "addressType", + "type": "bytes1" + } + ], + "name": "addCbAddress", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_addr", + "type": "address" + } + ], + "name": "withdrawFunds", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_proofType", + "type": "bytes1" + } + ], + "name": "setProofType", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "dsHash", + "type": "bytes32[]" + }, + { + "name": "multiplier", + "type": "uint256[]" + } + ], + "name": "multiAddDSource", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "query1_withGasLimit", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "newCbAddress", + "type": "address" + }, + { + "name": "addressType", + "type": "bytes1" + }, + { + "name": "proof", + "type": "bytes" + } + ], + "name": "addCbAddress", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg1", + "type": "string" + }, + { + "name": "_arg2", + "type": "string" + } + ], + "name": "query2", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "offchainPayment", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" + }, + { + "constant": false, + "inputs": [ + { + "name": "new_baseprice", + "type": "uint256" + }, + { + "name": "proofID", + "type": "bytes" + } + ], + "name": "setBasePrice", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg1", + "type": "string" + }, + { + "name": "_arg2", + "type": "string" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "query2", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newFlagger", + "type": "address" + } + ], + "name": "changePaymentFlagger", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_args", + "type": "bytes" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "queryN", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + } + ], + "name": "query", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_args", + "type": "bytes" + } + ], + "name": "queryN", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg1", + "type": "string" + }, + { + "name": "_arg2", + "type": "string" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "query2_withGasLimit", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_args", + "type": "bytes" + } + ], + "name": "queryN", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "dsname", + "type": "string" + }, + { + "name": "multiplier", + "type": "uint256" + } + ], + "name": "addDSource", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": true, + "inputs": [], + "name": "randomDS_getSessionPubKeyHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg1", + "type": "string" + }, + { + "name": "_arg2", + "type": "string" + }, + { + "name": "_fnc", + "type": "function" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "query2_fnc", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + } + ], + "name": "query", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "dsname", + "type": "string" + }, + { + "name": "proofType", + "type": "bytes1" + }, + { + "name": "multiplier", + "type": "uint256" + } + ], + "name": "addDSource", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "newgasprice", + "type": "uint256" + } + ], + "name": "setGasPrice", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": true, + "inputs": [], + "name": "cbAddress", + "outputs": [ + { + "name": "_cbAddress", + "type": "address" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "query_withGasLimit", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_args", + "type": "bytes" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "queryN_withGasLimit", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_gasPrice", + "type": "uint256" + } + ], + "name": "setCustomGasPrice", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_gasPrice", + "type": "uint256[]" + }, + { + "name": "_addr", + "type": "address[]" + } + ], + "name": "multisetCustomGasPrice", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "cbAddresses", + "outputs": [ + { + "name": "", + "type": "bytes1" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" + }, + { + "constant": false, + "inputs": [ + { + "name": "_proofType", + "type": "uint256[]" + }, + { + "name": "_addr", + "type": "address[]" + } + ], + "name": "multisetProofType", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg", + "type": "string" + }, + { + "name": "_fnc", + "type": "function" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "query1_fnc", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "new_baseprice", + "type": "uint256" + } + ], + "name": "setBasePrice", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "randomDS_sessionPubKeysHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" + }, + { + "constant": false, + "inputs": [ + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_arg1", + "type": "string" + }, + { + "name": "_arg2", + "type": "string" + } + ], + "name": "query2", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_addr", + "type": "address" + }, + { + "name": "_flag", + "type": "bool" + } + ], + "name": "setOffchainPayment", + "outputs": [], + "payable": false, + "type": "function", + "stateMutability": "nonpayable" + }, + { + "constant": false, + "inputs": [ + { + "name": "_timestamp", + "type": "uint256" + }, + { + "name": "_datasource", + "type": "string" + }, + { + "name": "_args", + "type": "bytes" + }, + { + "name": "_fnc", + "type": "function" + }, + { + "name": "_gaslimit", + "type": "uint256" + } + ], + "name": "queryN_fnc", + "outputs": [ + { + "name": "_id", + "type": "bytes32" + } + ], + "payable": true, + "type": "function", + "stateMutability": "payable" + }, + { + "inputs": [], + "payable": false, + "type": "constructor", + "stateMutability": "nonpayable" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "cid", + "type": "bytes32" + }, + { + "indexed": false, + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": false, + "name": "datasource", + "type": "string" + }, + { + "indexed": false, + "name": "arg", + "type": "string" + }, + { + "indexed": false, + "name": "gaslimit", + "type": "uint256" + }, + { + "indexed": false, + "name": "proofType", + "type": "bytes1" + }, + { + "indexed": false, + "name": "gasPrice", + "type": "uint256" + } + ], + "name": "Log1", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "cid", + "type": "bytes32" + }, + { + "indexed": false, + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": false, + "name": "datasource", + "type": "string" + }, + { + "indexed": false, + "name": "arg1", + "type": "string" + }, + { + "indexed": false, + "name": "arg2", + "type": "string" + }, + { + "indexed": false, + "name": "gaslimit", + "type": "uint256" + }, + { + "indexed": false, + "name": "proofType", + "type": "bytes1" + }, + { + "indexed": false, + "name": "gasPrice", + "type": "uint256" + } + ], + "name": "Log2", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "cid", + "type": "bytes32" + }, + { + "indexed": false, + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": false, + "name": "datasource", + "type": "string" + }, + { + "indexed": false, + "name": "args", + "type": "bytes" + }, + { + "indexed": false, + "name": "gaslimit", + "type": "uint256" + }, + { + "indexed": false, + "name": "proofType", + "type": "bytes1" + }, + { + "indexed": false, + "name": "gasPrice", + "type": "uint256" + } + ], + "name": "LogN", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "cid", + "type": "bytes32" + }, + { + "indexed": false, + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": false, + "name": "datasource", + "type": "string" + }, + { + "indexed": false, + "name": "arg", + "type": "string" + }, + { + "indexed": false, + "name": "callback", + "type": "function" + }, + { + "indexed": false, + "name": "gaslimit", + "type": "uint256" + }, + { + "indexed": false, + "name": "proofType", + "type": "bytes1" + }, + { + "indexed": false, + "name": "gasPrice", + "type": "uint256" + } + ], + "name": "Log1_fnc", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "cid", + "type": "bytes32" + }, + { + "indexed": false, + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": false, + "name": "datasource", + "type": "string" + }, + { + "indexed": false, + "name": "arg1", + "type": "string" + }, + { + "indexed": false, + "name": "arg2", + "type": "string" + }, + { + "indexed": false, + "name": "callback", + "type": "function" + }, + { + "indexed": false, + "name": "gaslimit", + "type": "uint256" + }, + { + "indexed": false, + "name": "proofType", + "type": "bytes1" + }, + { + "indexed": false, + "name": "gasPrice", + "type": "uint256" + } + ], + "name": "Log2_fnc", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "cid", + "type": "bytes32" + }, + { + "indexed": false, + "name": "timestamp", + "type": "uint256" + }, + { + "indexed": false, + "name": "datasource", + "type": "string" + }, + { + "indexed": false, + "name": "args", + "type": "bytes" + }, + { + "indexed": false, + "name": "callback", + "type": "function" + }, + { + "indexed": false, + "name": "gaslimit", + "type": "uint256" + }, + { + "indexed": false, + "name": "proofType", + "type": "bytes1" + }, + { + "indexed": false, + "name": "gasPrice", + "type": "uint256" + } + ], + "name": "LogN_fnc", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "idx_sender", + "type": "address" + }, + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "idx_flag", + "type": "bool" + }, + { + "indexed": false, + "name": "flag", + "type": "bool" + } + ], + "name": "Emit_OffchainPaymentFlag", + "type": "event" + } +] \ No newline at end of file diff --git a/contracts/binary/README.md b/contracts/binary/README.md index 92e5592..4a047b4 100644 --- a/contracts/binary/README.md +++ b/contracts/binary/README.md @@ -2,7 +2,7 @@ ### oraclizeConnector.binary -Compiler version: 0.4.11-68ef5810 +Compiler version: v0.4.15+commit.bbb8e64f (same as mainnet deployed as of 2018/3) Optimization: Enabled diff --git a/contracts/binary/oraclizeConnector.binary b/contracts/binary/oraclizeConnector.binary index c1a2c6b..26898fd 100644 --- a/contracts/binary/oraclizeConnector.binary +++ b/contracts/binary/oraclizeConnector.binary @@ -1 +1 @@ -606060405260018054600160a060020a0319167326588a9301b0428d95e6fc3a5024fce8bec12d511790556404a817c800600555341561003b57fe5b5b60028054600160a060020a03191633600160a060020a03161790555b5b612c31806100686000396000f300606060405236156101bc5763ffffffff60e060020a6000350416630f825673811461020757806323dc42e71461025f5780632ef3accc146102fd5780634536297814610367578063480a434d14610404578063512c0b9c14610426578063524f38891461047b5780635c242c59146104e357806360f667011461058357806362b3b833146105db57806368742da614610633578063688dcfd7146106515780636c0f7ee714610688578063757004371461071557806377228659146107b55780637d242ae5146108905780637e1c4205146108e957806380325b2d146109c657806381ade3071461036757806383eed3d514610b0357806385dee34c14610ba157806398cf6f2214610c7e5780639bb5148714610d1b578063a2ec191a14610d39578063abaa5f3e14610d93578063adf59f991461025f578063ae81584314610715578063b5bfdd7314610ef3578063bf1fe42014610f74578063c281d19e14610f89578063c51be90f14610fb5578063c55c1cb614611055578063ca6ad1e4146110f5578063d95970161461110a578063db37e42f14611197578063de4b326214611224578063e6c0e9e114611239578063e839e65e1461125e575b34156101c457fe5b6102055b60025433600160a060020a039081169116148015906101f6575060015433600160a060020a03908116911614155b156102015760006000fd5b5b5b565b005b341561020f57fe5b610205600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061133895505050505050565b005b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496506113f695505050505050565b60408051918252519081900360200190f35b341561030557fe5b6102eb600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650509335935061141192505050565b60408051918252519081900360200190f35b6102eb600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375094965061142795505050505050565b60408051918252519081900360200190f35b341561040c57fe5b6102eb611442565b60408051918252519081900360200190f35b341561042e57fe5b61020560048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061144895505050505050565b005b341561048357fe5b6102eb600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509496506114ec95505050505050565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b01803591820183900483028401830190945280835297999881019791965091820194509250829150840183828082843750949650509335935061150092505050565b60408051918252519081900360200190f35b341561058b57fe5b610205600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437509496506118c795505050505050565b005b34156105e357fe5b610205600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061192a95505050505050565b005b341561063b57fe5b610205600160a060020a03600435166119e8565b005b341561065957fe5b6102057fff0000000000000000000000000000000000000000000000000000000000000060043516611a4f565b005b341561069057fe5b610205600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750506040805187358901803560208181028481018201909552818452989a998901989297509082019550935083925085019084908082843750949650611a7b95505050505050565b005b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496505093359350611b5b92505050565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375050604080516020601f89358b01803591820183900483028401830190945280835297999881019791965091820194509250829150840183828082843750949650611b7495505050505050565b60408051918252519081900360200190f35b341561089857fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102059583359593946044949392909201918190840183828082843750949650611b9195505050505050565b005b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496505093359350611c6092505050565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b01803591820183900483028401830190945280835297999881019791965091820194509250829150840183828082843750949650509335935061209a92505050565b60408051918252519081900360200190f35b6102eb600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375094965061142795505050505050565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375094965061247c95505050505050565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375050604080516020601f89358b01803591820183900483028401830190945280835297999881019791965091820194509250829150840183828082843750949650509335935061249792505050565b60408051918252519081900360200190f35b6102eb600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496506124b295505050505050565b60408051918252519081900360200190f35b3415610d2357fe5b610205600160a060020a03600435166124cd565b005b3415610d4157fe5b610205600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650509335935061252992505050565b005b3415610d9b57fe5b6102eb61253a565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496506113f695505050505050565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496505093359350611b5b92505050565b60408051918252519081900360200190f35b3415610efb57fe5b610205600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650507fff00000000000000000000000000000000000000000000000000000000000000853516946020013593506125d192505050565b005b3415610f7c57fe5b6102056004356126d2565b005b3415610f9157fe5b610f99612715565b60408051600160a060020a039092168252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b01803591820183900483028401830190945280835297999881019791965091820194509250829150840183828082843750949650509335935061272492505050565b60408051918252519081900360200190f35b60408051602060046024803582810135601f81018590048502860185019096528585526102eb958335959394604494939290920191819084018382808284375050604080516020601f89358b01803591820183900483028401830190945280835297999881019791965091820194509250829150840183828082843750949650509335935061273d92505050565b60408051918252519081900360200190f35b34156110fd57fe5b610205600435612756565b005b341561111257fe5b610205600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750506040805187358901803560208181028481018201909552818452989a99890198929750908201955093508392508501908490808284375094965061277595505050505050565b005b341561119f57fe5b610205600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750506040805187358901803560208181028481018201909552818452989a99890198929750908201955093508392508501908490808284375094965061281b95505050505050565b005b341561122c57fe5b6102056004356128db565b005b341561124157fe5b6102eb6004356129a9565b60408051918252519081900360200190f35b6102eb600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979998810197919650918201945092508291508401838280828437509496506129cc95505050505050565b60408051918252519081900360200190f35b60025433600160a060020a03908116911614801590611366575060015433600160a060020a03908116911614155b156113715760006000fd5b600060036000836040518082805190602001908083835b602083106113a75780518252601f199092019160209182019101611388565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805460ff1916941515949094179093555050505b5b50565b600061140784848462030d40611500565b90505b9392505050565b600061141e8383336129e9565b90505b92915050565b600061141e6000848462030d40611500565b90505b92915050565b60085481565b60025460009033600160a060020a03908116911614801590611479575060015433600160a060020a03908116911614155b156114845760006000fd5b6000611491600c82612b90565b50600090505b81518110156114e657600c8054600181016114b28382612b90565b916000526020600020900160005b84848151811015156114ce57fe5b6020908102909101015190915550505b600101611497565b5b5b5050565b60006114f88233612b6f565b90505b919050565b600060008483600060006115158484336129e9565b9150348290106118b3578134039050600081111561155357604051600160a060020a0333169082156108fc029083906000818181858888f150505050505b42624f1a00018a118061156557504587115b156115705760006000fd5b600061158f732bd2326c993dfaef84f696526064ff22eba5b362612b88565b111561160757732bd2326c993dfaef84f696526064ff22eba5b362600160a060020a03166316c727216000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b15156115ef57fe5b6102c65a03f115156115fd57fe5b5050604051519550505b8430336000600033600160a060020a0316600160a060020a031681526020019081526020016000205460405180851515151560f860020a02815260010184600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140183600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401828152602001945050505050604051809103902095506000600033600160a060020a0316600160a060020a03168152602001908152602001600020600081548092919060010191905055507fb76d0edd90c6a07aa3ff7a222d7f5933e29c6acc660c059c97837f05c4ca1a8433878c8c8c8c6006600033600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460f860020a026007600033600160a060020a0316600160a060020a03168152602001908152602001600020546040518089600160a060020a0316600160a060020a031681526020018860001916600019168152602001878152602001806020018060200186815260200185600160f860020a031916600160f860020a0319168152602001848152602001838103835288818151815260200191508051906020019080838360008314611801575b80518252602083111561180157601f1990920191602091820191016117e1565b505050905090810190601f16801561182d5780820380516001836020036101000a031916815260200191505b508381038252875181528751602091820191890190808383821561186c575b80518252602083111561186c57601f19909201916020918201910161184c565b505050905090810190601f1680156118985780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390a15b6118b9565b60006000fd5b5b5050505050949350505050565b806040518082805190602001908083835b602083106118f75780518252601f1990920191602091820191016118d8565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091206004555050505b50565b60025433600160a060020a03908116911614801590611958575060015433600160a060020a03908116911614155b156119635760006000fd5b600160036000836040518082805190602001908083835b602083106113a75780518252601f199092019160209182019101611388565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805460ff1916941515949094179093555050505b5b50565b60025433600160a060020a03908116911614801590611a16575060015433600160a060020a03908116911614155b15611a215760006000fd5b604051600160a060020a0380831691309091163180156108fc02916000818181858888f150505050505b5b50565b33600160a060020a03166000908152600660205260409020805460ff191660f860020a83041790555b50565b60025460009033600160a060020a03908116911614801590611aac575060015433600160a060020a03908116911614155b15611ab75760006000fd5b5060005b8251811015611b54578281815181101515611ad257fe5b60209081029091010151600b8054611aed8260018301612b90565b81548110611af757fe5b906000526020600020900160005b50558151829082908110611b1557fe5b90602001906020020151600a60008584815181101515611b3157fe5b60209081029091018101518252810191909152604001600020555b600101611abb565b5b5b505050565b6000611b6985858585611500565b90505b949350505050565b6000611b698585858562030d40611c60565b90505b949350505050565b60025460009033600160a060020a03908116911614801590611bc2575060015433600160a060020a03908116911614155b15611bcd5760006000fd5b50600882905560005b600b54811015611b5457600a6000600b83815481101515611bf357fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002054830260096000600b84815481101515611c2f57fe5b906000526020600020900160005b505481526020810191909152604001600020555b600101611bd6565b5b5b505050565b60006000858360006000611c758484336129e9565b9150348290106118b35781340390506000811115611cb357604051600160a060020a0333169082156108fc029083906000818181858888f150505050505b42624f1a00018b1180611cc557504587115b15611cd05760006000fd5b6000611cef732bd2326c993dfaef84f696526064ff22eba5b362612b88565b1115611d6757732bd2326c993dfaef84f696526064ff22eba5b362600160a060020a03166316c727216000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b1515611d4f57fe5b6102c65a03f11515611d5d57fe5b5050604051519550505b8430336000600033600160a060020a0316600160a060020a031681526020019081526020016000205460405180851515151560f860020a02815260010184600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140183600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401828152602001945050505050604051809103902095506000600033600160a060020a0316600160a060020a03168152602001908152602001600020600081548092919060010191905055507faf30e4d66b2f1f23e63ef4591058a897f67e6867233e33ca3508b982dcc4129b33878d8d8d8d8d6006600033600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460f860020a026007600033600160a060020a0316600160a060020a0316815260200190815260200160002054604051808a600160a060020a0316600160a060020a03168152602001896000191660001916815260200188815260200180602001806020018060200187815260200186600160f860020a031916600160f860020a031916815260200185815260200184810384528a818151815260200191508051906020019080838360008314611f66575b805182526020831115611f6657601f199092019160209182019101611f46565b505050905090810190601f168015611f925780820380516001836020036101000a031916815260200191505b5084810383528951815289516020918201918b01908083838215611fd1575b805182526020831115611fd157601f199092019160209182019101611fb1565b505050905090810190601f168015611ffd5780820380516001836020036101000a031916815260200191505b5084810382528851815288516020918201918a0190808383821561203c575b80518252602083111561203c57601f19909201916020918201910161201c565b505050905090810190601f1680156120685780820380516001836020036101000a031916815260200191505b509c5050505050505050505050505060405180910390a15b61208b565b60006000fd5b5b505050505095945050505050565b600060008483600060006120af8484336129e9565b9150348290106118b357813403905060008111156120ed57604051600160a060020a0333169082156108fc029083906000818181858888f150505050505b42624f1a00018a11806120ff57504587115b1561210a5760006000fd5b6000612129732bd2326c993dfaef84f696526064ff22eba5b362612b88565b11156121a157732bd2326c993dfaef84f696526064ff22eba5b362600160a060020a03166316c727216000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b151561218957fe5b6102c65a03f1151561219757fe5b5050604051519550505b8430336000600033600160a060020a0316600160a060020a031681526020019081526020016000205460405180851515151560f860020a02815260010184600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140183600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401828152602001945050505050604051809103902095506000600033600160a060020a0316600160a060020a03168152602001908152602001600020600081548092919060010191905055507f3af7d71c651d8670228b02a0b636ffa73a7f759ef99ff9c024bc3b044a72443833878c8c8c8c6006600033600160a060020a0316600160a060020a0316815260200190815260200160002060009054906101000a900460f860020a026007600033600160a060020a0316600160a060020a03168152602001908152602001600020546040518089600160a060020a0316600160a060020a031681526020018860001916600019168152602001878152602001806020018060200186815260200185600160f860020a031916600160f860020a0319168152602001848152602001838103835288818151815260200191508051906020019080838360008314611801575b80518252602083111561180157601f1990920191602091820191016117e1565b505050905090810190601f16801561182d5780820380516001836020036101000a031916815260200191505b508381038252875181528751602091820191890190808383821561186c575b80518252602083111561186c57601f19909201916020918201910161184c565b505050905090810190601f1680156118985780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390a15b6118b9565b60006000fd5b5b5050505050949350505050565b600061141e6000848462030d40611500565b90505b92915050565b600061140784848462030d4061209a565b90505b9392505050565b60006124a68686868686611c60565b90505b95945050505050565b600061141e6000848462030d4061209a565b90505b92915050565b60025433600160a060020a0390811691161415806124f25750600160a060020a038116155b156124fd5760006000fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6114e6826000836125d1565b5b5050565b600c54600160a060020a03331660009081526020818152604080832054815190815290519081900390910190209091829181151561257457fe5b069050600c8181548110151561258657fe5b906000526020600020900160005b505491505b5090565b600061140784848462030d40611500565b90505b9392505050565b6000611b6985858585611500565b90505b949350505050565b60025460009033600160a060020a03908116911614801590612602575060015433600160a060020a03908116911614155b1561260d5760006000fd5b83836040518083805190602001908083835b6020831061263e5780518252601f19909201916020918201910161261f565b6001836020036101000a03801982511681845116808217855250505050505090500182600160f860020a031916600160f860020a0319168152600101925050506040518091039020905080600b600b805480919060010161269f9190612b90565b815481106126a957fe5b906000526020600020900160005b50556000818152600a602052604090208290555b5b50505050565b60025433600160a060020a03908116911614801590612700575060015433600160a060020a03908116911614155b1561270b5760006000fd5b60058190555b5b50565b600154600160a060020a031681565b6000611b6985858585611b5b565b90505b949350505050565b6000611b698585858561209a565b90505b949350505050565b600160a060020a03331660009081526007602052604090208190555b50565b60025460009033600160a060020a039081169116148015906127a6575060015433600160a060020a03908116911614155b156127b15760006000fd5b5060005b8151811015611b545782818151811015156127cc57fe5b906020019060200201516007600084848151811015156127e857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020555b6001016127b5565b5b5b505050565b60025460009033600160a060020a0390811691161480159061284c575060015433600160a060020a03908116911614155b156128575760006000fd5b5060005b8151811015611b5457828181518110151561287257fe5b9060200190602002015160f860020a0260066000848481518110151561289457fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff191660f860020a9092049190911790555b60010161285b565b5b5b505050565b60025460009033600160a060020a0390811691161480159061290c575060015433600160a060020a03908116911614155b156129175760006000fd5b50600881905560005b600b548110156114e657600a6000600b8381548110151561293d57fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002054820260096000600b8481548110151561297957fe5b906000526020600020900160005b505481526020810191909152604001600020555b600101612920565b5b5b5050565b600c8054829081106129b757fe5b906000526020600020900160005b5054905081565b6000611407600085858562030d40611c60565b90505b9392505050565b600160a060020a03811660009081526007602052604081205462030d408411801590612a2b5750600160a060020a038316600090815260208190526040902054155b8015612a3957506005548111155b8015612a54575060015432600160a060020a03908116911614155b15612a625760009150612b67565b801515612a6e57506005545b60045415801590612a95575060045460009081526003602052604090205460ff1615156001145b15612aa35760009150612b67565b600160a060020a03831660009081526006602090815260408083205490518851600994938a9360f860020a02929182918501908083835b60208310612af95780518252601f199092019160209182019101612ada565b51815160001960209485036101000a019081169019919091161790527fff000000000000000000000000000000000000000000000000000000000000009095169201918252506040805191829003600101909120855291840194909452919091016000205486840201935050505b509392505050565b600061141e8362030d40846129e9565b90505b92915050565b803b5b919050565b815481835581811511611b5457600083815260209020611b54918101908301612be4565b5b505050565b815481835581811511611b5457600083815260209020611b54918101908301612be4565b5b505050565b612c0291905b808211156125995760008155600101612bea565b5090565b905600a165627a7a723058207423ceb341d9a9bdbe32c6909b197b0dd05ca52f967b84604bfcb3119b89b3390029 \ No newline at end of file +60606040526404a817c800600555341561001857600080fd5b5b60038054600160a060020a03191633600160a060020a03161790555b5b612d49806100456000396000f300606060405236156102175763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166323dc42e7811461021c5780632ef3accc1461025157806345362978146102b6578063480a434d146102e75780634a64c23f1461030c578063512c0b9c1461032d578063524f38891461034d5780635c242c59146103b0578063627fd3bb1461045157806368742da61461047f578063688dcfd7146104a05780636c0f7ee7146104c257806375700437146104ee5780637653740f1461052657806377228659146105975780637bc9165b146105d85780637d242ae51461060b5780637e1c42051461062f578063801298fa1461071257806380325b2d1461073357806381ade307146102b657806383eed3d51461080557806385dee34c1461083a5780638f2839701461087e57806398cf6f221461089f578063a2ec191a146108d0578063abaa5f3e146108f4578063ad44d0ca14610919578063adf59f991461021c578063b5bfdd7314610a52578063bf1fe42014610ab6578063c281d19e14610ace578063c51be90f146104ee578063c55c1cb614610b35578063ca6ad1e414610b6d578063d959701614610b85578063db23995114610bb1578063db37e42f14610bed578063dba8fc6114610c19578063de4b326214610cdb578063e6c0e9e114610cf3578063e839e65e14610d1b578063e8be385314610d58578063f84072a514610d7e575b600080fd5b61023f600480359060248035808201929081013591604435908101910135610e40565b60405190815260200160405180910390f35b341561025c57600080fd5b61023f60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496505093359350610ebe92505050565b60405190815260200160405180910390f35b61023f6024600480358281019290820135918135918201910135610ed4565b60405190815260200160405180910390f35b34156102f257600080fd5b61023f610f52565b60405190815260200160405180910390f35b341561031757600080fd5b61032b600160a060020a0360043516610f58565b005b341561033857600080fd5b61032b6004803560248101910135610f84565b005b341561035857600080fd5b61023f60046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610ff295505050505050565b60405190815260200160405180910390f35b61023f600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650509335935061100692505050565b60405190815260200160405180910390f35b341561045c57600080fd5b61032b600160a060020a0360043516600160f860020a03196024351661121f565b005b341561048a57600080fd5b61032b600160a060020a0360043516611245565b005b34156104ab57600080fd5b61032b600160f860020a031960043516611283565b005b34156104cd57600080fd5b61032b60246004803582810192908201359181359182019101356112af565b005b61023f600480359060248035808201929081013591604435908101910135606435611359565b60405190815260200160405180910390f35b341561053157600080fd5b61032b60048035600160a060020a03169060248035600160f860020a031916919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506113d595505050505050565b005b61023f60048035906024803580820192908101359160443580820192908101359160643590810191013561140b565b60405190815260200160405180910390f35b34156105e357600080fd5b6105f7600160a060020a03600435166114bd565b604051901515815260200160405180910390f35b341561061657600080fd5b61032b6004803590602480359081019101356114d2565b005b61023f600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650509335935061156f92505050565b60405190815260200160405180910390f35b341561071d57600080fd5b61032b600160a060020a03600435166117f8565b005b61023f600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650509335935061182c92505050565b60405190815260200160405180910390f35b61023f6024600480358281019290820135918135918201910135610ed4565b60405190815260200160405180910390f35b61023f600480359060248035808201929081013591604435908101910135611ac3565b60405190815260200160405180910390f35b61023f600480359060248035808201929081013591604435808201929081013591606435908101910135608435611b41565b60405190815260200160405180910390f35b341561088957600080fd5b61032b600160a060020a0360043516611bf1565b005b61023f6024600480358281019290820135918135918201910135611c25565b60405190815260200160405180910390f35b34156108db57600080fd5b61032b602460048035828101929101359035611ca3565b005b34156108ff57600080fd5b61023f611ce6565b60405190815260200160405180910390f35b61023f600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965050606060020a8535908104956801000000000000000090910463ffffffff169450602001359250611d4b915050565b60405190815260200160405180910390f35b61023f600480359060248035808201929081013591604435908101910135610e40565b60405190815260200160405180910390f35b3415610a5d57600080fd5b61032b60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965050600160f860020a03198535169460200135935061209792505050565b005b3415610ac157600080fd5b61032b60043561215a565b005b3415610ad957600080fd5b610ae161216b565b604051600160a060020a03909116815260200160405180910390f35b61023f600480359060248035808201929081013591604435908101910135606435611359565b60405190815260200160405180910390f35b61023f60048035906024803580820192908101359160443590810191013560643561221c565b60405190815260200160405180910390f35b3415610b7857600080fd5b61032b600435612298565b005b3415610b9057600080fd5b61032b60246004803582810192908201359181359182019101356122b7565b005b3415610bbc57600080fd5b610bd0600160a060020a0360043516612337565b604051600160f860020a0319909116815260200160405180910390f35b3415610bf857600080fd5b61032b602460048035828101929082013591813591820191013561234f565b005b61023f600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965050606060020a8535908104956801000000000000000090910463ffffffff1694506020013592506123ed915050565b60405190815260200160405180910390f35b3415610ce657600080fd5b61032b60043561264d565b005b3415610cfe57600080fd5b61023f6004356126e8565b60405190815260200160405180910390f35b61023f602460048035828101929082013591813580830192908201359160443591820191013561270b565b60405190815260200160405180910390f35b3415610d6357600080fd5b61032b600160a060020a036004351660243515156127bd565b005b61023f600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965050606060020a8535908104956801000000000000000090910463ffffffff16945060200135925061284f915050565b60405190815260200160405180910390f35b6000610eb28686868080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505085858080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d4094506110069350505050565b90505b95945050505050565b6000610ecb838333612aaf565b90505b92915050565b6000610f47600086868080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505085858080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d4094506110069350505050565b90505b949350505050565b60085481565b610f60612c07565b600160a060020a0381166000908152600160205260409020805460ff191690555b50565b6000610f8e612c07565b6000610f9b600c82612ca8565b50600090505b81811015610fec57600c805460018101610fbb8382612ca8565b916000526020600020900160005b858585818110610fd557fe5b60200291909101359092555050505b600101610fa1565b5b505050565b6000610ffe8233612c25565b90505b919050565b60006110128483612c3e565b5042624f1a000185118061102557504582115b1561102f57600080fd5b303360008033600160a060020a0316600160a060020a0316815260200190815260200160002054604051606060020a600160a060020a0394851681028252929093169091026014830152602882015260480160405190819003902033600160a060020a038116600090815260208181526040808320805460010190556006825280832054600790925291829020549394507fb76d0edd90c6a07aa3ff7a222d7f5933e29c6acc660c059c97837f05c4ca1a849385928a928a928a928a9260f860020a02919051600160a060020a0389168152602081018890526040810187905260a08101849052600160f860020a0319831660c082015260e0810182905261010060608201818152906080830190830188818151815260200191508051906020019080838360005b838110156111705780820151818401525b602001611157565b50505050905090810190601f16801561119d5780820380516001836020036101000a031916815260200191505b50838103825287818151815260200191508051906020019080838360005b838110156111d45780820151818401525b6020016111bb565b50505050905090810190601f1680156112015780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390a15b949350505050565b611227612c07565b61124082826020604051908101604052600081526113d5565b5b5050565b61124d612c07565b80600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f150505050505b50565b33600160a060020a03166000908152600660205260409020805460ff191660f860020a83041790555b50565b60006112b9612c07565b5060005b83811015611351578484828181106112d157fe5b600b8054602090920293909301359291506112ef8260018301612ca8565b815481106112f957fe5b906000526020600020900160005b505582828281811061131557fe5b90506020020135600a6000878785818110151561132e57fe5b60209081029290920135835250810191909152604001600020555b6001016112bd565b5b5050505050565b60006113c88787878080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505086868080601f0160208091040260200160405190810160405281815292919060208401838380828437508a94506110069350505050565b90505b9695505050505050565b6113dd612c07565b600160a060020a0383166000908152600160205260409020805460ff191660f860020a84041790555b505050565b60006114af8888888080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505087878080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505086868080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d40945061156f9350505050565b90505b979650505050505050565b60026020526000908152604090205460ff1681565b60006114dc612c07565b50600883905560005b600b5481101561156857600a6000600b8381548110151561150257fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002054840260096000600b8481548110151561153e57fe5b906000526020600020900160005b505481526020810191909152604001600020555b6001016114e5565b5b50505050565b600061157b8583612c3e565b5042624f1a000186118061158e57504582115b1561159857600080fd5b303360008033600160a060020a0316600160a060020a0316815260200190815260200160002054604051606060020a600160a060020a0394851681028252929093169091026014830152602882015260480160405190819003902033600160a060020a038116600090815260208181526040808320805460010190556006825280832054600790925291829020549394507faf30e4d66b2f1f23e63ef4591058a897f67e6867233e33ca3508b982dcc4129b9385928b928b928b928b928b9260f860020a9091029151600160a060020a038a168152602081018990526040810188905260c08101849052600160f860020a0319831660e082015261010081018290526101206060820181815290608083019060a084019084018a818151815260200191508051906020019080838360005b838110156116e25780820151818401525b6020016116c9565b50505050905090810190601f16801561170f5780820380516001836020036101000a031916815260200191505b50848103835289818151815260200191508051906020019080838360005b838110156117465780820151818401525b60200161172d565b50505050905090810190601f1680156117735780820380516001836020036101000a031916815260200191505b50848103825288818151815260200191508051906020019080838360005b838110156117aa5780820151818401525b602001611791565b50505050905090810190601f1680156117d75780820380516001836020036101000a031916815260200191505b509c5050505050505050505050505060405180910390a15b95945050505050565b611800612c07565b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60006118388483612c3e565b5042624f1a000185118061184b57504582115b1561185557600080fd5b303360008033600160a060020a0316600160a060020a0316815260200190815260200160002054604051606060020a600160a060020a0394851681028252929093169091026014830152602882015260480160405190819003902033600160a060020a038116600090815260208181526040808320805460010190556006825280832054600790925291829020549394507f3af7d71c651d8670228b02a0b636ffa73a7f759ef99ff9c024bc3b044a7244389385928a928a928a928a9260f860020a02919051600160a060020a0389168152602081018890526040810187905260a08101849052600160f860020a0319831660c082015260e0810182905261010060608201818152906080830190830188818151815260200191508051906020019080838360005b838110156111705780820151818401525b602001611157565b50505050905090810190601f16801561119d5780820380516001836020036101000a031916815260200191505b50838103825287818151815260200191508051906020019080838360005b838110156111d45780820151818401525b6020016111bb565b50505050905090810190601f1680156112015780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390a15b949350505050565b6000610f47600086868080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505085858080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d4094506110069350505050565b90505b949350505050565b6000610eb28686868080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505085858080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d40945061182c9350505050565b90505b95945050505050565b6000611be28989898080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505088888080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505087878080601f0160208091040260200160405190810160405281815292919060208401838380828437508b945061156f9350505050565b90505b98975050505050505050565b611bf9612c07565b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000610f47600086868080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505085858080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d40945061182c9350505050565b90505b949350505050565b610fec83838080601f0160208091040260200160405190810160405281815292919060208401838380828437506000945087935061209792505050565b5b505050565b600c54600160a060020a0333166000908152602081905260408082205491928392909151908152602001604051908190039020811515611d2257fe5b069050600c81815481101515611d3457fe5b906000526020600020900160005b505491505b5090565b6000611d578783612c3e565b5042624f1a0001881180611d6a57504582115b80611d87575033600160a060020a031684600160a060020a031614155b15611d9157600080fd5b303360008033600160a060020a0316600160a060020a0316815260200190815260200160002054604051606060020a600160a060020a0394851681028252929093169091026014830152602882015260480160405190819003902033600160a060020a038116600090815260208181526040808320805460010190556006825280832054600790925291829020549394507fcc57f89a6a20799d672e6569d224340220a0891ad6efa3039e7728f0c88854b39385928d928d928d928d928d928d928d9260f860020a02919051600160a060020a038c168152602081018b9052604081018a905268010000000000000000640100000000870263ffffffff8716170260c082015260e08101849052600160f860020a0319831661010082015261012081018290526101406060820181815290608083019060a084019084018c818151815260200191508051906020019080838360005b83811015611eff5780820151818401525b602001611ee6565b50505050905090810190601f168015611f2c5780820380516001836020036101000a031916815260200191505b5084810383528b818151815260200191508051906020019080838360005b83811015611f635780820151818401525b602001611f4a565b50505050905090810190601f168015611f905780820380516001836020036101000a031916815260200191505b5084810382528a818151815260200191508051906020019080838360005b83811015611fc75780820151818401525b602001611fae565b50505050905090810190601f168015611ff45780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390a15b979650505050505050565b6000610eb28686868080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505085858080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d4094506110069350505050565b90505b95945050505050565b60006120a1612c07565b83836040518083805190602001908083835b602083106120d357805182525b601f1990920191602091820191016120b3565b6001836020036101000a0380198251168184511617909252505050600160f860020a0319909416919093019081526001019250604091505051908190039020600b805491925082916121288260018301612ca8565b8154811061213257fe5b906000526020600020900160005b50556000818152600a602052604090208290555b50505050565b612162612c07565b60058190555b50565b32600160a060020a031660009081526001602052604081205460f860020a02600160f860020a0319161561219c5750325b5b90565b60006113c88787878080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505086868080601f0160208091040260200160405190810160405281815292919060208401838380828437508a94506110069350505050565b90505b9695505050505050565b60006113c88787878080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505086868080601f0160208091040260200160405190810160405281815292919060208401838380828437508a945061182c9350505050565b90505b9695505050505050565b600160a060020a03331660009081526007602052604090208190555b50565b60006122c1612c07565b5060005b81811015611351578484828181106122d957fe5b905060200201356007600085858581811015156122f257fe5b90506020020135600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020819055505b6001016122c5565b5b5050505050565b60016020526000908152604090205460f860020a0281565b6000612359612c07565b5060005b818110156113515784848281811061237157fe5b9050602002013560f860020a0260066000858585818110151561239057fe5b90506020020135600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060006101000a81548160ff021916908360f860020a900402179055505b60010161235d565b5b5050505050565b60006123f98683612c3e565b5042624f1a000187118061240c57504582115b80612429575033600160a060020a031684600160a060020a031614155b1561243357600080fd5b303360008033600160a060020a0316600160a060020a0316815260200190815260200160002054604051606060020a600160a060020a0394851681028252929093169091026014830152602882015260480160405190819003902033600160a060020a038116600090815260208181526040808320805460010190556006825280832054600790925291829020549394507f5051eab4e301cef16e893db3c7a192f8cbf7bb44e1a92b928665c66170930a399385928c928c928c928c928c928c9260f860020a9092029151600160a060020a038b168152602081018a90526040810189905268010000000000000000640100000000870263ffffffff8716170260a082015260c08101849052600160f860020a0319831660e082015261010081018290526101206060820181815290608083019083018a818151815260200191508051906020019080838360005b8381101561259a5780820151818401525b602001612581565b50505050905090810190601f1680156125c75780820380516001836020036101000a031916815260200191505b50838103825289818151815260200191508051906020019080838360005b838110156125fe5780820151818401525b6020016125e5565b50505050905090810190601f16801561262b5780820380516001836020036101000a031916815260200191505b509c5050505050505050505050505060405180910390a15b9695505050505050565b6000612657612c07565b50600881905560005b600b5481101561124057600a6000600b8381548110151561267d57fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002054820260096000600b848154811015156126b957fe5b906000526020600020900160005b505481526020810191909152604001600020555b600101612660565b5b5050565b600c8054829081106126f657fe5b906000526020600020900160005b5054905081565b60006113c8600088888080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505087878080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505086868080601f01602080910402602001604051908101604052818152929190602084018383808284375062030d40945061156f9350505050565b90505b9695505050505050565b60045433600160a060020a039081169116146127d857600080fd5b600160a060020a03821660008181526002602052604090819020805460ff191684151590811790915591907f84feab93d65c19f28e91b26f8245938bf3a97dab7b8dafe3c8b028954e9ac934908590859051600160a060020a039092168252151560208201526040908101905180910390a35b5050565b600061285b8683612c3e565b5042624f1a000187118061286e57504582115b8061288b575033600160a060020a031684600160a060020a031614155b1561289557600080fd5b303360008033600160a060020a0316600160a060020a0316815260200190815260200160002054604051606060020a600160a060020a0394851681028252929093169091026014830152602882015260480160405190819003902033600160a060020a038116600090815260208181526040808320805460010190556006825280832054600790925291829020549394507f90552fb8e54d9a2aa4212413b16aa948c66cab32c9fe727ff74be1850bb0a8be9385928c928c928c928c928c928c9260f860020a9092029151600160a060020a038b168152602081018a90526040810189905268010000000000000000640100000000870263ffffffff8716170260a082015260c08101849052600160f860020a0319831660e082015261010081018290526101206060820181815290608083019083018a818151815260200191508051906020019080838360005b8381101561259a5780820151818401525b602001612581565b50505050905090810190601f1680156125c75780820380516001836020036101000a031916815260200191505b50838103825289818151815260200191508051906020019080838360005b838110156125fe5780820151818401525b6020016125e5565b50505050905090810190601f16801561262b5780820380516001836020036101000a031916815260200191505b509c5050505050505050505050505060405180910390a15b9695505050505050565b600160a060020a038116600090815260076020908152604080832054600290925282205460ff1680612b38575062030d408411158015612b055750600160a060020a038316600090815260208190526040902054155b8015612b1357506005548111155b8015612b385750612b2261216b565b600160a060020a031632600160a060020a031614155b5b15612b475760009150612bff565b801515612b5357506005545b600160a060020a0383166000908152600660205260408082205460099291889160f860020a0290518083805190602001908083835b60208310612ba857805182525b601f199092019160209182019101612b88565b6001836020036101000a0380198251168184511617909252505050600160f860020a031990941691909301908152600101925060409150505190819003902081526020810191909152604001600020548482020191505b509392505050565b60035433600160a060020a03908116911614612c2257600080fd5b5b565b6000610ecb8362030d4084612aaf565b90505b92915050565b600080612c4c848433612aaf565b9150348290106102175781340390506000811115612c9557600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515612c9557600080fd5b5b612ca0565b600080fd5b5b5092915050565b815481835581811511610fec57600083815260209020610fec918101908301612cfc565b5b505050565b815481835581811511610fec57600083815260209020610fec918101908301612cfc565b5b505050565b61219c91905b80821115611d475760008155600101612d02565b5090565b905600a165627a7a723058204a8139af1bf2a9591f800190ee829830157762d6342103f42e55424b288403ae0029 \ No newline at end of file diff --git a/contracts/ethereum-api/connectors/oraclizeConnector.sol b/contracts/ethereum-api/connectors/oraclizeConnector.sol index c61b5f5..7f98ee0 100644 --- a/contracts/ethereum-api/connectors/oraclizeConnector.sol +++ b/contracts/ethereum-api/connectors/oraclizeConnector.sol @@ -3,104 +3,187 @@ Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016-2017 Oraclize LTD */ -pragma solidity ^0.4.6; +/* +Oraclize Connector v1.2.0 +*/ -contract AmIOnTheFork{ - function forked() constant returns(bool); -} +// 'compressed' alternative, where all modifiers have been changed to FUNCTIONS +// which is cheaper for deployment, potentially cheaper execution + +pragma solidity ^0.4.11; contract Oraclize { mapping (address => uint) reqc; - address public cbAddress = 0x26588a9301b0428d95e6Fc3A5024fcE8BEc12D51; + mapping (address => byte) public cbAddresses; - address constant AmIOnTheForkAddress = 0x2BD2326c993DFaeF84f696526064FF22eba5b362; + mapping (address => bool) public offchainPayment; event Log1(address sender, bytes32 cid, uint timestamp, string datasource, string arg, uint gaslimit, byte proofType, uint gasPrice); event Log2(address sender, bytes32 cid, uint timestamp, string datasource, string arg1, string arg2, uint gaslimit, byte proofType, uint gasPrice); event LogN(address sender, bytes32 cid, uint timestamp, string datasource, bytes args, uint gaslimit, byte proofType, uint gasPrice); + event Log1_fnc(address sender, bytes32 cid, uint timestamp, string datasource, string arg, function() external callback, uint gaslimit, byte proofType, uint gasPrice); + event Log2_fnc(address sender, bytes32 cid, uint timestamp, string datasource, string arg1, string arg2, function() external callback, uint gaslimit, byte proofType, uint gasPrice); + event LogN_fnc(address sender, bytes32 cid, uint timestamp, string datasource, bytes args, function() external callback, uint gaslimit, byte proofType, uint gasPrice); + + event Emit_OffchainPaymentFlag(address indexed idx_sender, address sender, bool indexed idx_flag, bool flag); address owner; + address paymentFlagger; - modifier onlyadmin { - if ((msg.sender != owner)&&(msg.sender != cbAddress)) throw; - _; + function changeAdmin(address _newAdmin) + external + { + onlyadmin(); + owner = _newAdmin; } - function setCBaddress(address newCbaddress) { - if (msg.sender != owner || newCbaddress == 0) throw; - cbAddress = newCbaddress; + function changePaymentFlagger(address _newFlagger) + external + { + onlyadmin(); + paymentFlagger = _newFlagger; } - function addDSource(string dsname, uint multiplier) { + function addCbAddress(address newCbAddress, byte addressType) + external + { + onlyadmin(); + //bytes memory nil = ''; + addCbAddress(newCbAddress, addressType, hex''); + } + + // proof is currently a placeholder for when associated proof for addressType is added + function addCbAddress(address newCbAddress, byte addressType, bytes proof) + public + { + onlyadmin(); + cbAddresses[newCbAddress] = addressType; + } + + function removeCbAddress(address newCbAddress) + external + { + onlyadmin(); + delete cbAddresses[newCbAddress]; + } + + function cbAddress() + constant + returns (address _cbAddress) + { + if (cbAddresses[tx.origin] != 0) + _cbAddress = tx.origin; + } + + function addDSource(string dsname, uint multiplier) + external + { addDSource(dsname, 0x00, multiplier); } - function addDSource(string dsname, byte proofType, uint multiplier) onlyadmin { + function addDSource(string dsname, byte proofType, uint multiplier) + public + { + onlyadmin(); bytes32 dsname_hash = sha3(dsname, proofType); dsources[dsources.length++] = dsname_hash; price_multiplier[dsname_hash] = multiplier; } - function multiAddDSource(bytes32[] dsHash, uint256[] multiplier) onlyadmin { - // dsHash -> sha3(DATASOURCE_NAME, PROOF_TYPE); + // Utilized by bridge + function multiAddDSource(bytes32[] dsHash, uint256[] multiplier) + external + { + onlyadmin(); + // dsHash -> sha3(DATASOURCE_NAME, PROOF_TYPE); for (uint i=0; i bool) coupons; - bytes32 coupon; - - function createCoupon(string _code) onlyadmin { - coupons[sha3(_code)] = true; - } - - function deleteCoupon(string _code) onlyadmin { - coupons[sha3(_code)] = false; - } - - function multisetProofType(uint[] _proofType, address[] _addr) onlyadmin { + function multisetProofType(uint[] _proofType, address[] _addr) + external + { + onlyadmin(); for (uint i=0; i<_addr.length; i++) addr_proofType[_addr[i]] = byte(_proofType[i]); } - function multisetCustomGasPrice(uint[] _gasPrice, address[] _addr) onlyadmin { + function multisetCustomGasPrice(uint[] _gasPrice, address[] _addr) + external + { + onlyadmin(); for (uint i=0; i<_addr.length; i++) addr_gasPrice[_addr[i]] = _gasPrice[i]; } uint gasprice = 20000000000; - function setGasPrice(uint newgasprice) onlyadmin { + function setGasPrice(uint newgasprice) + external + { + onlyadmin(); gasprice = newgasprice; } - function setBasePrice(uint new_baseprice) onlyadmin { //0.001 usd in ether + function setBasePrice(uint new_baseprice) + external + { //0.001 usd in ether + onlyadmin(); baseprice = new_baseprice; for (uint i=0; i= price){ uint diff = msg.value - price; - if (diff > 0) msg.sender.send(diff); - _; + if (diff > 0) { + // added for correct query cost to be returned + if(!msg.sender.send(diff)) { + throw; + } + } } else throw; } @@ -113,141 +196,272 @@ contract Oraclize { bytes32[] public randomDS_sessionPubKeysHash; - function randomDS_updateSessionPubKeysHash(bytes32[] _newSessionPubKeysHash) onlyadmin { + function randomDS_updateSessionPubKeysHash(bytes32[] _newSessionPubKeysHash) + external + { + onlyadmin(); randomDS_sessionPubKeysHash.length = 0; for (uint i=0; i<_newSessionPubKeysHash.length; i++) randomDS_sessionPubKeysHash.push(_newSessionPubKeysHash[i]); } - function randomDS_getSessionPubKeyHash() constant returns (bytes32) { + function randomDS_getSessionPubKeyHash() + external + constant + returns (bytes32) { uint i = uint(sha3(reqc[msg.sender]))%randomDS_sessionPubKeysHash.length; return randomDS_sessionPubKeysHash[i]; } - function useCoupon(string _coupon) { - coupon = sha3(_coupon); - } - - function setProofType(byte _proofType) { + function setProofType(byte _proofType) + external + { addr_proofType[msg.sender] = _proofType; } - function setCustomGasPrice(uint _gasPrice) { + function setCustomGasPrice(uint _gasPrice) + external + { addr_gasPrice[msg.sender] = _gasPrice; } - function getPrice(string _datasource) public returns (uint _dsprice) { + function getPrice(string _datasource) + public + returns (uint _dsprice) + { return getPrice(_datasource, msg.sender); } - function getPrice(string _datasource, uint _gaslimit) public returns (uint _dsprice) { + function getPrice(string _datasource, uint _gaslimit) + public + returns (uint _dsprice) + { return getPrice(_datasource, _gaslimit, msg.sender); } - function getPrice(string _datasource, address _addr) private returns (uint _dsprice) { + function getPrice(string _datasource, address _addr) + private + returns (uint _dsprice) + { return getPrice(_datasource, 200000, _addr); } - function getPrice(string _datasource, uint _gaslimit, address _addr) private returns (uint _dsprice) { + function getPrice(string _datasource, uint _gaslimit, address _addr) + private + returns (uint _dsprice) + { uint gasprice_ = addr_gasPrice[_addr]; - if ((_gaslimit <= 200000)&&(reqc[_addr] == 0)&&(gasprice_ <= gasprice)&&(tx.origin != cbAddress)) return 0; + if ( + (offchainPayment[_addr]) + ||( + (_gaslimit <= 200000)&& + (reqc[_addr] == 0)&& + (gasprice_ <= gasprice)&& + (tx.origin != cbAddress()) + ) + ) return 0; + if (gasprice_ == 0) gasprice_ = gasprice; - if ((coupon != 0)&&(coupons[coupon] == true)) return 0; _dsprice = price[sha3(_datasource, addr_proofType[_addr])]; _dsprice += _gaslimit*gasprice_; return _dsprice; } - function getCodeSize(address _addr) constant internal returns(uint _size) { - assembly { - _size := extcodesize(_addr) + function getCodeSize(address _addr) + private + constant + returns(uint _size) + { + assembly { + _size := extcodesize(_addr) } } - function query(string _datasource, string _arg) payable returns (bytes32 _id) { + function query(string _datasource, string _arg) + payable + external + returns (bytes32 _id) + { return query1(0, _datasource, _arg, 200000); } - function query1(string _datasource, string _arg) payable returns (bytes32 _id) { + function query1(string _datasource, string _arg) + payable + external + returns (bytes32 _id) + { return query1(0, _datasource, _arg, 200000); } - function query2(string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id) { + function query2(string _datasource, string _arg1, string _arg2) + payable + external + returns (bytes32 _id) + { return query2(0, _datasource, _arg1, _arg2, 200000); } - function queryN(string _datasource, bytes _args) payable returns (bytes32 _id) { + function queryN(string _datasource, bytes _args) + payable + external + returns (bytes32 _id) + { return queryN(0, _datasource, _args, 200000); } - function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id) { + function query(uint _timestamp, string _datasource, string _arg) + payable + external + returns (bytes32 _id) + { return query1(_timestamp, _datasource, _arg, 200000); } - function query1(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id) { + function query1(uint _timestamp, string _datasource, string _arg) + payable + external + returns (bytes32 _id) + { return query1(_timestamp, _datasource, _arg, 200000); } - function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id) { + function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) + payable + external + returns (bytes32 _id) + { return query2(_timestamp, _datasource, _arg1, _arg2, 200000); } - function queryN(uint _timestamp, string _datasource, bytes _args) payable returns (bytes32 _id) { + function queryN(uint _timestamp, string _datasource, bytes _args) + payable + external + returns (bytes32 _id) + { return queryN(_timestamp, _datasource, _args, 200000); } - function query(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id) { +/* Needless? + function query(uint _timestamp, string _datasource, string _arg, uint _gaslimit) + payable + external + returns (bytes32 _id) + { + return query1(_timestamp, _datasource, _arg, _gaslimit); + } +*/ + function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) + payable + external + returns (bytes32 _id) + { + return query1(_timestamp, _datasource, _arg, _gaslimit); + } + + function query1_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) + payable + external + returns (bytes32 _id) + { return query1(_timestamp, _datasource, _arg, _gaslimit); } - function query1(uint _timestamp, string _datasource, string _arg, uint _gaslimit) costs(_datasource, _gaslimit) payable returns (bytes32 _id) { - if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)) throw; - bool forkFlag; - if (getCodeSize(AmIOnTheForkAddress) > 0) - forkFlag = AmIOnTheFork(AmIOnTheForkAddress).forked(); + function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) + payable + external + returns (bytes32 _id) + { + return query2(_timestamp, _datasource, _arg1, _arg2, _gaslimit); + } + + function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _args, uint _gaslimit) + payable + external + returns (bytes32 _id) + { + return queryN(_timestamp, _datasource, _args, _gaslimit); + } + + function query1(uint _timestamp, string _datasource, string _arg, uint _gaslimit) + payable + public + returns (bytes32 _id) + { + costs(_datasource, _gaslimit); + if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)) throw; - _id = sha3(forkFlag, this, msg.sender, reqc[msg.sender]); + _id = sha3(this, msg.sender, reqc[msg.sender]); reqc[msg.sender]++; Log1(msg.sender, _id, _timestamp, _datasource, _arg, _gaslimit, addr_proofType[msg.sender], addr_gasPrice[msg.sender]); return _id; } - function query2(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) costs(_datasource, _gaslimit) payable returns (bytes32 _id) { - if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)) throw; - bool forkFlag; - if (getCodeSize(AmIOnTheForkAddress) > 0) - forkFlag = AmIOnTheFork(AmIOnTheForkAddress).forked(); + function query2(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) + payable + public + returns (bytes32 _id) + { + costs(_datasource, _gaslimit); + if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)) throw; - _id = sha3(forkFlag, this, msg.sender, reqc[msg.sender]); + _id = sha3(this, msg.sender, reqc[msg.sender]); reqc[msg.sender]++; Log2(msg.sender, _id, _timestamp, _datasource, _arg1, _arg2, _gaslimit, addr_proofType[msg.sender], addr_gasPrice[msg.sender]); return _id; } - function queryN(uint _timestamp, string _datasource, bytes _args, uint _gaslimit) costs(_datasource, _gaslimit) payable returns (bytes32 _id) { - if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)) throw; - bool forkFlag; - if (getCodeSize(AmIOnTheForkAddress) > 0) - forkFlag = AmIOnTheFork(AmIOnTheForkAddress).forked(); + function queryN(uint _timestamp, string _datasource, bytes _args, uint _gaslimit) + payable + public + returns (bytes32 _id) + { + costs(_datasource, _gaslimit); + if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)) throw; - _id = sha3(forkFlag, this, msg.sender, reqc[msg.sender]); + _id = sha3(this, msg.sender, reqc[msg.sender]); reqc[msg.sender]++; LogN(msg.sender, _id, _timestamp, _datasource, _args, _gaslimit, addr_proofType[msg.sender], addr_gasPrice[msg.sender]); return _id; } - function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id) { - return query(_timestamp, _datasource, _arg, _gaslimit); - } + function query1_fnc(uint _timestamp, string _datasource, string _arg, function() external _fnc, uint _gaslimit) + payable + public + returns (bytes32 _id) + { + costs(_datasource, _gaslimit); + if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)||address(_fnc) != msg.sender) throw; - function query1_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id) { - return query1(_timestamp, _datasource, _arg, _gaslimit); + _id = sha3(this, msg.sender, reqc[msg.sender]); + reqc[msg.sender]++; + Log1_fnc(msg.sender, _id, _timestamp, _datasource, _arg, _fnc, _gaslimit, addr_proofType[msg.sender], addr_gasPrice[msg.sender]); + return _id; } - function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id) { - return query2(_timestamp, _datasource, _arg1, _arg2, _gaslimit); + function query2_fnc(uint _timestamp, string _datasource, string _arg1, string _arg2, function() external _fnc, uint _gaslimit) + payable + public + returns (bytes32 _id) + { + costs(_datasource, _gaslimit); + if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)||address(_fnc) != msg.sender) throw; + + _id = sha3(this, msg.sender, reqc[msg.sender]); + reqc[msg.sender]++; + Log2_fnc(msg.sender, _id, _timestamp, _datasource, _arg1, _arg2, _fnc, _gaslimit, addr_proofType[msg.sender], addr_gasPrice[msg.sender]); + return _id; } - function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _args, uint _gaslimit) payable returns (bytes32 _id) { - return queryN(_timestamp, _datasource, _args, _gaslimit); + function queryN_fnc(uint _timestamp, string _datasource, bytes _args, function() external _fnc, uint _gaslimit) + payable + public + returns (bytes32 _id) + { + costs(_datasource, _gaslimit); + if ((_timestamp > now+3600*24*60)||(_gaslimit > block.gaslimit)||address(_fnc) != msg.sender) throw; + + _id = sha3(this, msg.sender, reqc[msg.sender]); + reqc[msg.sender]++; + LogN_fnc(msg.sender, _id, _timestamp, _datasource, _args, _fnc, _gaslimit, addr_proofType[msg.sender], addr_gasPrice[msg.sender]); + return _id; } -} +} \ No newline at end of file diff --git a/lib/bridge-cli-parse.js b/lib/bridge-cli-parse.js index 2a4d709..9a00d93 100644 --- a/lib/bridge-cli-parse.js +++ b/lib/bridge-cli-parse.js @@ -86,13 +86,30 @@ BridgeCliParse.prototype.getConfiguration = function () { } if (ops.gas) { - if (ops.gas < 1970000) { + /*if (ops.gas < 1970000) { throw new Error('Gas amount lower than 1970000 is not allowed') } else if (ops.gas > 4700000) { throw new Error('Gas amount bigger than 4700000 is not allowed') - } else { - this.cliConfiguration.defaultGas = ops.gas - } + } else {*/ + // should return warnings rather than enforce these strict outdated values? + this.cliConfiguration.defaultGas = ops.gas + //} + } + + if (ops.context) { + // for Random expects one of + // eth_ropsten3 + // eth_rinkeby + // eth_kovan + this.cliConfiguration.context = ops.context + } + + if (ops['minimum-gas-price'] && Number.isInteger(parseInt(ops['minimum-gas-price']))) { + this.cliConfiguration.minGasPrice = parseInt(ops['minimum-gas-price']) + } + + if (ops['connector-gas-price'] && Number.isFinite(parseFloat(ops['connector-gas-price']))) { + this.cliConfiguration.conGasPrice = ops['connector-gas-price'] } return this.cliConfiguration @@ -137,7 +154,11 @@ BridgeCliParse.prototype.getOptions = function () { 'no-hints': {description: 'disable hints', default: false}, 'disable-reorg': {description: 'disable re-org log listen'}, 'connector-state': {args: 1, description: 'JSON file with the prevous connector state'}, - 'gasprice': {args: 1, description: 'Set gas price (wei)', default: 20000000000} + 'gasprice': {args: 1, description: 'Set gas price for contracts deployment (wei)', default: 20000000000}, + 'context': {args: 1, description: 'Context name (internal use)', default: null}, + 'minimum-gas-price': {args: 1, description: 'Minimum gas price in wei to process, queries lower than this are ignored', default: null}, + 'connector-gas-price': {args: 1, description: "Set connector default gas price (gwei), which will be the default amount used for callbacks on any contract's not using oraclize_setCustomGasPrice", default: null}, + 'disable-address-watcher': {description: 'disable address watcher, checking cb address bal, for 0 gas price networks such as RSK or certain private nets.'}, } } diff --git a/lib/bridge-core.js b/lib/bridge-core.js index 0819adf..5e4c7bf 100644 --- a/lib/bridge-core.js +++ b/lib/bridge-core.js @@ -63,10 +63,10 @@ OracleInstance.prototype.isOracleEvent = function (data) { else return false } -OracleInstance.prototype.getCbAddressByConnector = function (connector) { +OracleInstance.prototype.getCbAddressByConnector = function (connector, account) { if (ethUtil.isValidAddress(connector) === false) throw new Error('Address is not valid') const oraclizeConnector = ethUtil.addHexPrefix(connector) - const cbAddressFound = BlockchainInterface().inter.contract(this.oraclizeConnectorABI).at(oraclizeConnector).cbAddress() + const cbAddressFound = BlockchainInterface().inter.contract(this.oraclizeConnectorABI).at(oraclizeConnector).cbAddress.call({ from: account }) return ethUtil.addHexPrefix(cbAddressFound) } @@ -75,7 +75,7 @@ OracleInstance.prototype.getConnectorByOAR = function (oar) { const OAR = ethUtil.addHexPrefix(oar) const oraclizeConnector = BlockchainInterface().inter.contract(this.oraclizeAddressResolverABI).at(OAR).getAddress.call() if (oraclizeConnector === '0x' || oraclizeConnector === null) throw new Error('Oraclize Connector not found, make sure you entered the correct OAR') - const cbAddress = this.getCbAddressByConnector(oraclizeConnector) + const cbAddress = this.getCbAddressByConnector(oraclizeConnector, this.account) if (cbAddress === this.account) return ethUtil.addHexPrefix(oraclizeConnector) else throw new Error('The connector was deployed by another account,\n callback address of the deployed connector ' + cbAddress + " doesn't match with your current account " + this.account) } @@ -85,7 +85,7 @@ OracleInstance.prototype.isValidOracleInstance = function (oar, account) { oar = oar || this.oar account = account || this.account const connector = this.getConnectorByOAR(oar) - const cbAddress = this.getCbAddressByConnector(connector) + const cbAddress = this.getCbAddressByConnector(connector, account) if (cbAddress === account) return {'success': true, 'error': null} } catch (e) { return {'success': false, 'error': e.message} @@ -219,6 +219,14 @@ OracleInstance.prototype.updateGasPriceMapping = function (connector, addressLis }) } +OracleInstance.prototype.setGasPriceInGwei = function (connector, price, callback) { + BridgeTxManager().sendTx({'from': this.account, 'to': connector, 'data': bridgeTxEnc.setGasPriceTxEncode(price), 'gas': this.deployGas}, function (err, contract) { + if (err) return callback(new Error(err), null) + if (contract === null) return callback(new Error('setGasPriceInGwei error'), null) + return callback(null, {'success': true}) + }) +} + OracleInstance.prototype.setBasePrice = function (connector, price, callback) { BridgeTxManager().sendTx({'from': this.account, 'to': connector, 'data': bridgeTxEnc.setBasePriceTxEncode(price), 'gas': this.deployGas}, function (err, contract) { if (err) return callback(new Error(err), null) @@ -228,7 +236,7 @@ OracleInstance.prototype.setBasePrice = function (connector, price, callback) { } OracleInstance.prototype.setCbAddress = function (connector, cbAddress, callback) { - BridgeTxManager().sendTx({'from': this.account, 'to': connector, 'data': bridgeTxEnc.setCbAddressTxEncode(cbAddress), 'gas': this.deployGas}, function (err, contract) { + BridgeTxManager().sendTx({'from': this.account, 'to': connector, 'data': bridgeTxEnc.addCbAddressTxEncode(cbAddress), 'gas': this.deployGas}, function (err, contract) { if (err) return callback(new Error(err), null) if (contract === null) return callback(new Error('setCbAddress error'), null) return callback(null, {'success': true, 'connector': connector}) diff --git a/lib/bridge-log-manager.js b/lib/bridge-log-manager.js index f304b3a..b4c97ba 100644 --- a/lib/bridge-log-manager.js +++ b/lib/bridge-log-manager.js @@ -126,15 +126,25 @@ const parseLog = function (err, log) { logObj['parsed_log'].gaslimit = logArgs['gaslimit'].toNumber() logObj['parsed_log'].proofType = ethUtil.addHexPrefix(logArgs['proofType']) - if (logArgs['gasPrice']) logObj['parsed_log'].gasPrice = logArgs['gasPrice'].toNumber() + if (logArgs['gasPrice']) { + logObj['parsed_log'].gasPrice = logArgs['gasPrice'].toNumber() + if (cliConfiguration.minGasPrice && logObj['parsed_log'].gasPrice !== 0 && cliConfiguration.minGasPrice > logObj['parsed_log'].gasPrice) { + return emitsNewLog('Gas price requested below set minimum', null) + } + } try { logObj['block_timestamp'] = BlockchainInterface().inter.getBlock(log['blockHash']).timestamp } catch (e) { - // exception for dev chain resets (ganache) - if (e.message === 'Key not found in database' && - cliConfiguration.dev === true) return - else throw e + if (cliConfiguration.dev) { + return + } else { + console.error(`There was an issue contacting the node... +Node returned error message: ${e.message} +If key not found, the blockhash just seen is gone, indicating a re-org... +if running this on ganache or a dev chain, re-run bridge with --dev flag to suppress this error`) + return emitsNewLog('Error trying to get Block, node returned: ' + e.message, null) + } } emitsNewLog(null, logObj) diff --git a/lib/bridge-tx-encode.js b/lib/bridge-tx-encode.js index 92f4830..7d2c144 100644 --- a/lib/bridge-tx-encode.js +++ b/lib/bridge-tx-encode.js @@ -4,10 +4,22 @@ const ethUtil = require('ethereumjs-util') const ethAbi = require('ethereumjs-abi') const bridgeUtil = require('./bridge-util') -const setCbAddressTxEncode = function (address) { +const addCbAddressTxEncode = function (address) { address = ethUtil.addHexPrefix(address) if (ethUtil.isValidAddress(address) === false) throw new Error('Address provided is not valid') - return ethUtil.addHexPrefix(ethAbi.simpleEncode('setCBaddress(address)', address).toString('hex')) + return ethUtil.addHexPrefix(ethAbi.simpleEncode('addCbAddress(address,bytes1)', address, '0x01').toString('hex')) +} + +const addCbAddressTypeTxEncode = function (address, type) { + address = ethUtil.addHexPrefix(address) + if (ethUtil.isValidAddress(address) === false) throw new Error('Address provided is not valid') + return ethUtil.addHexPrefix(ethAbi.simpleEncode('addCbAddress(address,bytes1)', address, type).toString('hex')) +} + +const addCbAddressProofTxEncode = function (address, type, proof) { + address = ethUtil.addHexPrefix(address) + if (ethUtil.isValidAddress(address) === false) throw new Error('Address provided is not valid') + return ethUtil.addHexPrefix(ethAbi.simpleEncode('addCbAddress(address,bytes1,bytes)', address, type, proof).toString('hex')) } // 'amount' for a future implementation @@ -41,6 +53,13 @@ const multiAddDSourceTxEncode = function (dsObjList) { return '0x6C0F7EE7' + ethUtil.stripHexPrefix(ethAbi.rawEncode(['bytes32[]', 'uint256[]'], [datasourceHash, datasourceUnit]).toString('hex')) } +// default gas price in gwei +const setGasPriceTxEncode = function (price) { + price = bridgeUtil.normalizePrice(price) + price = bridgeUtil.web3.toWei(price, 'gwei') + return ethUtil.addHexPrefix(ethAbi.simpleEncode('setGasPrice(uint256)', price).toString('hex')) +} + // price in ether const setBasePriceTxEncode = function (price) { price = bridgeUtil.normalizePrice(price) @@ -48,6 +67,7 @@ const setBasePriceTxEncode = function (price) { return ethUtil.addHexPrefix(ethAbi.simpleEncode('setBasePrice(uint256)', price).toString('hex')) } +// OAR const setAddrTxEncode = function (address) { address = ethUtil.addHexPrefix(address) if (ethUtil.isValidAddress(address) === false) throw new Error('Address provided is not valid') @@ -60,6 +80,7 @@ const changeOwnerTxEncode = function (owner) { if (ethUtil.isValidAddress(owner) === false) throw new Error('Address provided is not valid') return ethUtil.addHexPrefix(ethAbi.simpleEncode('changeOwner(address)', owner).toString('hex')) } +// OAR END const callbackTxEncode = function (myid, result, proof, proofType) { myid = bridgeUtil.standardMyid(myid) @@ -89,11 +110,14 @@ const multisetCustomGasPriceTxEncode = function (gasPriceList, addressList) { module.exports = { callbackTxEncode, - setCbAddressTxEncode, + addCbAddressTxEncode, + addCbAddressTypeTxEncode, + addCbAddressProofTxEncode, setAddrTxEncode, withdrawFundsTxEncode, addDSourceTxEncode, setBasePriceTxEncode, + setGasPriceTxEncode, multiAddDSourceTxEncode, changeOwnerTxEncode, randDsUpdateHashTxEncode, diff --git a/package.json b/package.json index b74736f..f9c806e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-bridge", - "version": "0.6.2", + "version": "0.6.3-beta", "description": "Ethereum logs listener to connect Oraclize onchain events to the Oraclize offchain engine", "main": "bridge.js", "bin": { @@ -39,7 +39,7 @@ "tingodb": "^0.6.1", "underscore": "^1.8.3", "utf8": "^2.1.2", - "web3": "0.19.1", + "web3": "0.20.6", "winston": "^2.3.1" }, "devDependencies": {