daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Feb 14th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.4.8;
  2.  
  3. contract A {
  4.  
  5. function A() payable {
  6. }
  7.  
  8.     function getBal() returns(uint a){
  9.         return (10);
  10.     }
  11.  
  12. }
  13.    
  14. A.deployed().then(function(instance) { test = instance; return test.getBal();}).then(function(result){});
  15.    
  16. function getBal()
  17.   public
  18.   constant   <--- Important
  19.   returns(uint a)
  20. {
  21.   return (10);
  22. }
  23.    
  24. > A.deployed()
  25.     .then(function(instance) {
  26.       return instance.getBal();
  27.     })
  28.     .then(function(balance) {
  29.       console.log("got balance", balance.toString(10));
  30.     });
  31.    
  32. truffle(develop)> A.at("0x842c27notcopyablescreenshot4bf7dd").getBal()
  33.    
  34. $ truffle networks
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top