Questions tagged [truffle-console]

53 questions
4
votes
2 answers

Function "is not a function" in Truffle dev

I am not sure why I am being told my function is not a function. I am doing calls as I always do from the Truffle console. pragma solidity >=0.4.22 <0.6.0; contract store { string public storage_; function store_it(string memory s) public…
0TTT0
  • 672
  • 2
  • 10
  • 20
3
votes
1 answer

Truffle Console: Estimate Gas Cost of a function

I checked the following link: how to estimate gas cost? My contract is: pragma solidity ^0.5.1; contract TransferGC{ uint public testVal = 97 ether; function testFunc(address payable addr) public returns (uint) { addr.transfer(testVal); …
zak100
  • 1,406
  • 1
  • 13
  • 37
1
vote
0 answers

Truffle Console: How to specify SCs entire balance?

I am testing following contract on Truffle console: MyContract: contract MyContract { address owner; constructor() public { owner = msg.sender; } function sendTo(address payable receiver, uint amount) public { …
zak100
  • 1,406
  • 1
  • 13
  • 37
1
vote
0 answers

Truffle Console Script giving Error: Cannot find module

I am trying to run the following script: const messageBuild = require('./build/contracts/MyContract.json') const MyContract = require('~/Truffle_programs/script_transfer_Eth_thr_Truffle/contracts/MyContract.sol'); const MyContractTester =…
zak100
  • 1,406
  • 1
  • 13
  • 37
0
votes
1 answer

Truffle console: Accessing contract using an account other than owner

I have the following contract: pragma solidity >= 0.5.0 < 0.7.0; contract SimpleContract { string public name; address private owner; constructor() public { name = 'abs'; owner = msg.sender; } function getName() public view…
zak100
  • 1,406
  • 1
  • 13
  • 37
0
votes
2 answers

Changing the format of numeric output in Truffle Console

When I return a Big Number in the Truffle Console, the format of my results is something like: truffle(development)> tokenInstance.balanceOf(accounts[2]) However, in one of the video tutorials that I'm using, the output that the video…
Eric
  • 153
  • 1
  • 8