Skip to content

Instantly share code, notes, and snippets.

@amitkumarj441
Created August 23, 2018 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitkumarj441/f2e5050987e34f065dbe501c5032fa67 to your computer and use it in GitHub Desktop.
Save amitkumarj441/f2e5050987e34f065dbe501c5032fa67 to your computer and use it in GitHub Desktop.
Testing contract
```
ith@ith-ThinkPad-W520:~/Practice/BCP2P$ truffle compile
Compiling ./contracts/Admin.sol...
Compiling ./contracts/FlightInsurance.sol...
Compiling ./contracts/FlightInterface.sol...
Compiling ./contracts/InsuranceInterface.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/OraclizeTest.sol...
Compiling installed_contracts/SafeMath.sol...
Compiling installed_contracts/StringUtils.sol...
Compiling installed_contracts/oraclize-api/contracts/usingOraclize.sol...
Compilation warnings encountered:
/home/ith/Practice/BCP2P/contracts/OraclizeTest.sol:14:5: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function OraclizeTest()
^ (Relevant source part starts here and spans across multiple lines).
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:803:50: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
oraclize_randomDS_setCommitment(queryId, keccak256(delay_bytes8_left, args[1], sha256(args[0]), args[2]));
^-------------------------------------------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:915:47: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false;
^---------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:915:37: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false;
^--------------------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:915:37: Warning: The provided argument of type bytes32 is not implicitly convertible to expected type bytes memory.
if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false;
^--------------------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:933:48: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
if (oraclize_randomDS_args[queryId] == keccak256(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match
^--------------------------------------------^
/home/ith/Practice/BCP2P/contracts/OraclizeTest.sol:14:5: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function OraclizeTest()
^ (Relevant source part starts here and spans across multiple lines).
,DocstringParsingError: Doc tag @Constructor not valid for functions.
,DocstringParsingError: Doc tag @Deposit not valid for functions.
,DocstringParsingError: Doc tag @To not valid for functions.
,DocstringParsingError: Doc tag @Calls not valid for functions.
,DocstringParsingError: Doc tag @Create not valid for functions.
,DocstringParsingError: Doc tag @Approve not valid for functions.
,DocstringParsingError: Doc tag @Claim not valid for functions.
,DocstringParsingError: Doc tag @Also not valid for functions.
,DocstringParsingError: Doc tag @Set not valid for functions.
,DocstringParsingError: Doc tag @Calls not valid for functions.
,DocstringParsingError: Doc tag @FinalStatus not valid for functions.
,DocstringParsingError: Doc tag @Set not valid for functions.
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:803:50: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
oraclize_randomDS_setCommitment(queryId, keccak256(delay_bytes8_left, args[1], sha256(args[0]), args[2]));
^-------------------------------------------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:915:47: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false;
^---------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:915:37: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false;
^--------------------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:915:37: Warning: The provided argument of type bytes32 is not implicitly convertible to expected type bytes memory.
if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false;
^--------------------------------------^
,installed_contracts/oraclize-api/contracts/usingOraclize.sol:933:48: Warning: This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
if (oraclize_randomDS_args[queryId] == keccak256(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match
^--------------------------------------------^
,/home/ith/Practice/BCP2P/contracts/FlightInsurance.sol:111:5: TypeError: Overriding function visibility differs.
function approveClaim() {
^ (Relevant source part starts here and spans across multiple lines).
/home/ith/Practice/BCP2P/contracts/InsuranceInterface.sol:6:5: Overriden function is here:
function approveClaim() external;
^-------------------------------^
,/home/ith/Practice/BCP2P/contracts/FlightInsurance.sol:116:48: TypeError: Member "FinalStatus" not found or not visible after argument-dependent lookup in struct FlightInsurance.Policy storage ref
int _statuscheck = StringUtils.compare(policies[_policyid].FinalStatus, "0");
^-----------------------------^
Compilation failed. See above.
```
```
ith@ith-ThinkPad-W520:~/Practice/ethereum-bridge$ node bridge -a 9
Please wait...
[2018-08-23T20:14:28.783Z] INFO you are running ethereum-bridge - version: 0.6.1
[2018-08-23T20:14:28.783Z] INFO saving logs to: ./bridge.log
[2018-08-23T20:14:28.784Z] INFO using active mode
[2018-08-23T20:14:28.784Z] INFO Connecting to eth node http://localhost:8545
[2018-08-23T20:14:30.188Z] ERROR http://localhost:8545 ethereum node not found, are you sure is it running?
if you are using:
* geth, append: --rpc --rpccorsdomain="*" --rpcaddr="127.0.0.1" --rpcport="8545"
* parity, append: --geth --jsonrpc-hosts all --rpcaddr 127.0.0.1 --rpcport 8545
* ethereumjs-testrpc, try: testrpc -h 127.0.0.1 -p 8545
check also if your node or this machine is allowed to connect (firewall, port, etc..)
Exiting...
ith@ith-ThinkPad-W520:~/Practice/ethereum-bridge$ node bridge -a 9 -H 127.0.0.1 -p 9545 --dev
Please wait...
[2018-08-23T20:16:10.825Z] WARN --dev mode active, contract myid checks and pending queries are skipped, use this only when testing, not in production
[2018-08-23T20:16:10.826Z] INFO you are running ethereum-bridge - version: 0.6.1
[2018-08-23T20:16:10.827Z] INFO saving logs to: ./bridge.log
[2018-08-23T20:16:10.827Z] INFO using active mode
[2018-08-23T20:16:10.827Z] INFO Connecting to eth node http://127.0.0.1:9545
[2018-08-23T20:16:12.562Z] ERROR http://127.0.0.1:9545 ethereum node not found, are you sure is it running?
if you are using:
* geth, append: --rpc --rpccorsdomain="*" --rpcaddr="127.0.0.1" --rpcport="9545"
* parity, append: --geth --jsonrpc-hosts all --rpcaddr 127.0.0.1 --rpcport 9545
* ethereumjs-testrpc, try: testrpc -h 127.0.0.1 -p 9545
check also if your node or this machine is allowed to connect (firewall, port, etc..)
Exiting...
ith@ith-ThinkPad-W520:~/Practice/ethereum-bridge$ node bridge -a 9 -H 127.0.0.1 -p 9545 --dev
Please wait...
[2018-08-23T20:16:34.558Z] WARN --dev mode active, contract myid checks and pending queries are skipped, use this only when testing, not in production
[2018-08-23T20:16:34.558Z] INFO you are running ethereum-bridge - version: 0.6.1
[2018-08-23T20:16:34.559Z] INFO saving logs to: ./bridge.log
[2018-08-23T20:16:34.559Z] INFO using active mode
[2018-08-23T20:16:34.559Z] INFO Connecting to eth node http://127.0.0.1:9545
[2018-08-23T20:16:36.614Z] INFO connected to node type EthereumJS TestRPC/v2.1.0-beta.7/ethereum-js
[2018-08-23T20:16:37.899Z] WARN Using 0x5aeda56215b167893e80b4fe645ba6d5bab767de to query contracts on your blockchain, make sure it is unlocked and do not use the same address to deploy your contracts
[2018-08-23T20:16:38.226Z] INFO deploying the oraclize connector contract...
[2018-08-23T20:16:49.119Z] INFO connector deployed to: 0xf7e3e47e06f1bddecb1b2f3a7f60b6b25fd2e233
[2018-08-23T20:16:49.469Z] INFO deploying the address resolver with a deterministic address...
[2018-08-23T20:17:12.783Z] INFO address resolver (OAR) deployed to: 0x6f485c8bf6fc43ea212e93bbf8ce046c7f1cb475
[2018-08-23T20:17:12.783Z] INFO updating connector pricing...
[2018-08-23T20:17:24.211Z] INFO successfully deployed all contracts
[2018-08-23T20:17:24.215Z] INFO instance configuration file saved to /home/ith/Practice/ethereum-bridge/config/instance/oracle_instance_20180824T014724.json
Please add this line to your contract constructor:
OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
[2018-08-23T20:17:24.223Z] WARN re-org block listen is disabled
[2018-08-23T20:17:24.223Z] INFO Listening @ 0xf7e3e47e06f1bddecb1b2f3a7f60b6b25fd2e233 (Oraclize Connector)
(Ctrl+C to exit)
```
check this: https://medium.com/coinmonks/how-to-create-a-dapp-using-truffle-oraclize-ethereum-bridge-and-webpack-9cb84b8f6bcb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment