Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. pragma solidity ^0.4.2;
  2. import "global_functions.sol";
  3. contract strtest
  4. {
  5. bool ib_equal;
  6. function test(string p1,string p2) returns(bool) {
  7. ib_equal = strcompare(p1,p2) ;
  8. return true;
  9. }
  10. }
  11.  
  12. function strcompare(string p_source,string p_target) external returns(bool) {
  13. bytes memory lbt_left;
  14. bytes memory lbt_right;
  15. lbt_left = bytes(p_source);
  16. lbt_right = bytes(p_target);
  17. bool lb_equal = true;
  18. uint li_length = lbt_right.length;
  19. for( uint p = 0 ;p < li_length;p++){
  20. if (lbt_left[p] == lbt_right[p] ) {
  21. continue;
  22. } else {
  23. lb_equal = false;
  24. break;
  25. }
  26. }
  27. return lb_equal;
  28. }
  29.  
  30. > var test1 = "pragma solidity ^0.4.2;import '/barkely/lend/global_functions.sol';contract strtest { bool ib_equal; function test(string p1,string p2) returns(bool) { return true; }}"
  31. undefined
  32. > var test1Compiled = web3.eth.compile.solidity(test1)
  33.  
  34. Error: solc: exit status 1
  35. /tmp/geth-compile-solidity119170518:1:24: Error: Source "/barkely/lend/global_functions.sol" not found: File not found.
  36. pragma solidity ^0.4.2;import '/barkely/lend/global_functions.sol';contract strtest { bool ib_equal; function test(string p1,string p2) returns(bool) { return true; }}
  37. ^------------------------------------------^
  38.  
  39. at web3.js:3119:20
  40. at web3.js:6023:15
  41. at web3.js:4995:36
  42. at <anonymous>:1:21
  43.  
  44. >
  45.  
  46. import '/barkely/lend/global_functions.sol' //absoulte path
  47.  
  48. import './global_functions.sol' //the same path with strtest.sol
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement