官术网_书友最值得收藏!

  • Truffle Quick Start Guide
  • Nikhil Bhaskar
  • 84字
  • 2021-06-25 20:47:34

Adding a utility method

Utility methods help us get data from our contract without modifying the state.

   function getBalance(address addr) public view returns(uint) {
return balances[addr];
}

This function accepts an address and returns the balance of the passed-in address. Notice how it is marked with view. The view modifier signifies that this function does not modify the storage state of the contract. You will learn more about this in Chapter 2Web3 and Solidity in Truffle, where we will refresh Solidity fundamentals.

主站蜘蛛池模板: 绥宁县| 福安市| 阿城市| 嘉黎县| 正安县| 成都市| 寻乌县| 佛学| 区。| 莱芜市| 碌曲县| 十堰市| 张北县| 琼海市| 合肥市| 富民县| 威海市| 平山县| 汉源县| 西丰县| 大竹县| 中阳县| 高唐县| 广昌县| 彩票| 金堂县| 乐至县| 灌云县| 泗阳县| 林甸县| 康平县| 武川县| 山丹县| 贵阳市| 西充县| 万源市| 长丰县| 奎屯市| 马龙县| 正阳县| 英山县|