Learning Truffle

Hi,

I am having trouble installing Truffle on Mac OS. I have a screenshot of my terminal. Usual problem is access denial. I have tried searching online and youtube but I’m continually receiving the same errors. Not sure if this is the right thread but any assistance is greatly appreciated.

This is after I attempted to run npm install -g truffle

I have downloaded latest node.js and brew.

Screen Shot 2021-05-23 at 4.39.48 pm

1 Like

Hey @John_Rambo, hope you are ok.

Although you receive some warnings, at the end of the console it shows that the packages has been installed properly. The warning messages are to update some packages that the version you are downloading is deprecated or there a new one, nothing to worry about to be honest.

Try run this command: truffle -v it should return the version of your installed truffle package and the commands that you can use on truffle.

Carlos Z

Hey Carlos,

Thank you for your response. I ran truffle -v and truffle version and here is what I got back.

I think I’m going to watch a couple of vids setting up an ethereum dev environment on mac and see how I go with that. Maybe I missed a crucial step or something went awry.

Andrew

Screen Shot 2021-05-24 at 11.09.13 pm

1 Like

I also got this message in the terminal after compiling hello world for the first time:

Compilation warnings encountered:

    Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> /C/Users/kamil/Documents/Ethereum-201/hello world/contracts/helloworld.sol
1 Like

you might have to run the same commands but with admin (sudo)

https://www.wikihow.com/Open-Applications-With-Root-Privileges-on-a-Mac

Carlos Z

1 Like

That’s a warning message that can be avoid by adding this line at the start of each contract:

"SPDX-License-Identifier: UNLICENSED"
Although is just a warning, not an error from your contract logic.

You can research about the SPDX Licenses to get an idea of what they are.

Carlos Z

I think I’m in. I ran it as sudo and received a list of commands and truffle version also.

Many thanks, Carlos.

1 Like

@dan-i was everything fine with the code, because this error is coming up?

Hey @inzhagey

Would be amazing if you could push your project to github and share the link, I will be happy to take a look :slight_smile:

Cheers,
Dani

https://github.com/Tagi17/truffle.git

I’m not clear about one thing. Setter vs getter functions or calls vs transactions. I understand that the keywords pure or view make a difference between setter and getter, but why Filip add there also keyword payable, he doesn’t comment on that at all? does it need to be there? I was testing it in VS without payable it also makes a transaction if there is no view or pure keyword. Obviously I know what payable does from previous lessons but why Filip adds it there and not mention it?

Hi @inzhagey

I was able to deploy your code, however there are errors in the repository you pushed to github.

  • The migration file were missing the extension (".js")
  • The truffle config file name was wrong (“trufflecongif.js”)
  • In some files you are importing contract from node_modules, in other you are importing the files as if you have saved them locally but these file were missing.
import "./IERC20.sol";
import "../../utils/Context.sol";
import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol";



  • Fix the import statements in ‘erc20.sol’:
import "../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../node_modules/@openzeppelin/contracts/utils/Context.sol";
  • Fix the migration file name ‘2_tokenmigrate’

  • Fix the truffle-config.js file name

Run the migration again.

Cheers,
Dani

Hey guys,

I’ve just migrated the multisig wallet I wrote earlier to VS Code and am playing around with it in the terminal. It mostly works, but I have a question:

Here is a printout of one of the events:

{
      logIndex: 0,
      transactionIndex: 0,
      transactionHash: '0x67cc5b4a6482b2274b1e5a1d2c963d5741448e6655ef3cf9cb8d6735c35620cc',
      blockHash: '0x415d1fc7c6d6ffe8ce76a829722aa3b6fcd0e4b339268a5b57c74822a97fb04b',
      blockNumber: 18,
      address: '0x77D87CA0A19bc212C34F147a227a56a31fC6EFf1',
      type: 'mined',
      id: 'log_2d5773d4',
      event: 'approvalMade',
      args: [Result]
    }

I can obviously see that the event has been emitted, but how do I see the actual information? I think I need to access the “args: [Result]”, but how do I do that?

Also, I’m having a bit of difficulty reading this function. It is an extra function meant to show which requests still need to be approved:

function getPendingRequests() public returns(Request[] memory) {
        reset();
        for(uint counter = 0; counter < requests.length; counter++) {
           if(requests[counter].numberOfApprovals < 2) {
               pendingRequests.push(requests[counter]);
           }
        } 
        return pendingRequests;
    }

The function istelf works. I expect a struct as output, but instead get a bunch of gibberish that I cannot make sense of.

{
  tx: '0x2ed54d8cd0f01ed14d73fd88ed28e8358111a7b563fd9b2bf15201777fd13e73',
  receipt: {
    transactionHash: '0x2ed54d8cd0f01ed14d73fd88ed28e8358111a7b563fd9b2bf15201777fd13e73',
    transactionIndex: 0,
    blockHash: '0xfcaaa21714ddaf2d79a5f0af810f75ae37e3be1fb1cdc4f46caa599ea9d666f8',
    blockNumber: 29,
    from: '0x6e2dc94cf97c29e0a2260e81762627751a3d8cc8',
    to: '0x77d87ca0a19bc212c34f147a227a56a31fc6eff1',
    gasUsed: 93419,
    cumulativeGasUsed: 93419,
    contractAddress: null,
    logs: [],
    status: true,
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    rawLogs: []
  },
  logs: []
}

In Remix I can get the information in the “decoded output” of the transaction, but how can I access it with VS Code?

Thx in advance
Em

Hi Guys,

So I’m playing around with that MultiSigWallet on Truffle and I don’t understand some things for example deposit function how does it choose from and to addresses? I notice from is the address 1st on the list but to address is not on the list at all, also createTransfer function, when I enter _amount and _receiver on the actual transaction to address is not the address Ive entered but again the same to address that showed on deposit function, please see below

Microsoft Windows [Version 10.0.19041.985]
(c) Microsoft Corporation. All rights reserved.

C:\Users\kamil\Documents\Ethereum-201\hello world>truffle compile

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


C:\Users\kamil\Documents\Ethereum-201\hello world>truffle develop
Truffle Develop started at http://127.0.0.1:9545/

Accounts:
(0) 0x75c2a52aae64100540e5817106eb58f863b3dae5
(1) 0xea020f1f5923c19c0ad0f640997b9789bc874d9a
(2) 0x8e111d244070731e4fe97e536101ac913f63a137
(3) 0x3fd25ad2364528bfe77859d927ba5277f88a402a
(4) 0x6fd5846f0b82c90fcd11bd5c34d64c0fdb0d8fc2
(5) 0x76bf7b33d4adc604aa7baad22204bc711e3a3588
(6) 0xa0de05c1df5dcc0f2ca2b0fd6910ecc53f726560
(7) 0x8aaa1a0ed737463aafddebf59484cd7088696bb3
(8) 0x99b4dbf35c0ef2c80cc7f5b3726cc2c6c102beb8
(9) 0x0a09e412b986d00edd01ed75ff6ee6bcd8cc5958

Private Keys:
(0) c97bc8bf98d051fb2dadb9c38bbd85fda9f9f1643c423cb42f8eefa94ec41f7d
(1) 3d77927d36fe144ecc6de0d84e5de983592c49ce45c099318c06c6fa9c7ae6c3
(2) fa1e27efc2a141ac5bab3b1e506a8c36fccbdcee6df4d11a39b7abc1dcf1ffa6
(3) 63356eb22b57b5d1555cf457489118a0dd53f5a630809f48ec3dc907d1b31ff0
(4) a7598ee9636eb67436b75f33940295526e12a2dcb60e14511b6a6bc324e94525
(5) b4a2a5ef78c27e9136c6b239e073058fa3267647a8544d14c31b7d78c3f37a86
(6) 8c161db58cac3a3213e20211c23d03afb8e08ee11bc5fc6b898714ce8e91b922
(7) cccc6ea0516e4fef903f3a34af84d7052d88601f4422cd5b7d7ef652142ca4c4
(8) 1f48d42b208b4e8d9d9f4979afea7837e11a100cf99f635a180f9d4376361103
(9) 7d19a0fd8d3a4207c0867e6dc0a2b76c0be2909acbf885a078a29f3aaf1176dd

Mnemonic: census timber produce twist region stick flip effort flush owner keen number

⚠️  Important ⚠️  : This mnemonic was created for you by Truffle. It is not secure.
Ensure you do not use it on production blockchains, or else you risk losing funds.

truffle(develop)> migrate

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Starting migrations...
======================
> Network name:    'develop'
> Network id:      5777
> Block gas limit: 6721975 (0x6691b7)


1_initial_migration.js
======================

   Replacing 'Migrations'
   ----------------------
   > transaction hash:    0xb961c95da6b20a5b70d42676fd9c2978b28c75593c164e4a7883bf18fdf3bbac
   > Blocks: 0            Seconds: 0
   > contract address:    0x9A9b44DF68a3111066745c26Ae07938115D3c21b
   > block number:        1
   > block timestamp:     1622576291
   > account:             0x75C2A52aAe64100540e5817106eb58f863b3daE5
   > balance:             99.995114
   > gas used:            244300 (0x3ba4c)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.004886 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:            0.004886 ETH


2_hello_world.js
================

   Replacing 'Helloworld'
   ----------------------
   > transaction hash:    0x898fc52e72a7ba9bf10287bd620e2a540a7bd26c3f26fc9617b070d49b15da6d
   > Blocks: 0            Seconds: 0
   > contract address:    0x10d963E6C777640067A5FCE931f8Aee7f53E1e2D
   > block number:        3
   > block timestamp:     1622576291
   > account:             0x75C2A52aAe64100540e5817106eb58f863b3daE5
   > balance:             99.98699134
   > gas used:            363620 (0x58c64)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.0072724 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:           0.0072724 ETH


3_MultiSigWallet.js
===================

C:\Users\kamil\Documents\Ethereum-201\hello world\migrations\3_MultiSigWallet.js:4
  deployer.deploy(Wallet, "_owners["0x75c2a52aae64100540e5817106eb58f863b3dae5, 0xea020f1f5923c19c0ad0f640997b9789bc874d9a, 0x8e111d244070731e4fe97e536101ac913f63a137]", 3);
                          ^^^^^^^^^^

SyntaxError: missing ) after argument list
    at new Script (node:vm:99:7)
    at Object.createScript (node:vm:260:10)
    at Object.file (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\require\require.js:93:1)
    at Migration._load (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\Migration.js:49:1)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Migration.run (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\Migration.js:212:1)
    at Object.runMigrations (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:150:1)
    at Object.runFrom (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:110:1)
    at Object.run (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:87:1)
    at runMigrations (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:258:1)
    at Object.run (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:223:1)
    at Command.run (C:\Users\kamil\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:147:1)
- Blocks: 0            Seconds: 0
- Saving migration to chain.
- Blocks: 0            Seconds: 0
- Saving migration to chain.

truffle(develop)> mitration --reset
evalmachine.<anonymous>:0
mitration --reset
            ^^^^^

Uncaught SyntaxError: Unexpected identifier
truffle(develop)> migration --reset
evalmachine.<anonymous>:0
migration --reset
            ^^^^^

Uncaught SyntaxError: Unexpected identifier
truffle(develop)> migrate --reset

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Starting migrations...
======================
> Network name:    'develop'
> Network id:      5777
> Block gas limit: 6721975 (0x6691b7)


1_initial_migration.js
======================

   Replacing 'Migrations'
   ----------------------
   > transaction hash:    0x821b20e35c8cefcdbbf45dd98682d02aae3a7a37f06ba3ce25988445a71153e8
   > Blocks: 0            Seconds: 0
   > contract address:    0x7f47802579fB3E6fEb04dbcef8f69eF15acF6979
   > block number:        5
   > block timestamp:     1622577028
   > account:             0x75C2A52aAe64100540e5817106eb58f863b3daE5
   > balance:             99.98155508
   > gas used:            244300 (0x3ba4c)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.004886 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:            0.004886 ETH


2_hello_world.js
================

   Replacing 'Helloworld'
   ----------------------
   > transaction hash:    0x2ea02831751779b14f5c120d0ee74ee97e7fd1f93682e2d9b80f4d854dda63ab
   > Blocks: 0            Seconds: 0
   > contract address:    0xEe196AB427738bCE65BE2a423A8e05F21B043378
   > block number:        7
   > block timestamp:     1622577029
   > account:             0x75C2A52aAe64100540e5817106eb58f863b3daE5
   > balance:             99.97343242
   > gas used:            363620 (0x58c64)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.0072724 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:           0.0072724 ETH


3_MultiSigWallet.js
===================

   Deploying 'Wallet'
   ------------------
   > transaction hash:    0xde5af2f17b29839bdf5cfc8941bbaad773afdbddf84590f9bd70166c5295d5c9
   > Blocks: 0            Seconds: 0
   > contract address:    0x3250d3DF90543625429d5D4cca40CAa54ccC768f
   > block number:        9
   > block timestamp:     1622577029
   > account:             0x75C2A52aAe64100540e5817106eb58f863b3daE5
   > balance:             99.95458788
   > gas used:            914714 (0xdf51a)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.01829428 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:          0.01829428 ETH


Summary
=======
> Total deployments:   3
> Final cost:          0.03045268 ETH


- Blocks: 0            Seconds: 0
- Saving migration to chain.
- Blocks: 0            Seconds: 0
- Saving migration to chain.
- Blocks: 0            Seconds: 0
- Saving migration to chain.

truffle(develop)> let instance = await Wallet.deployed()
undefined
truffle(develop)> truffle(develop)> await instance.deposit({value: web3.utils.toWei('1', 'ether') } )
evalmachine.<anonymous>:0
truffle(develop)> await instance.deposit({value: web3.utils.toWei('1', 'ether') } )
                  ^^^^^

Uncaught:
SyntaxError: await is only valid in async functions and the top level bodies of modules
truffle(develop)> await instance.deposit({value: web3.utils.toWei('1', 'ether') } )
{
  tx: '0x93a2e123974e19c482f16bd2758384b6d6959c459e5732a5bd67d6005439d664',
  receipt: {
    transactionHash: '0x93a2e123974e19c482f16bd2758384b6d6959c459e5732a5bd67d6005439d664',
    transactionIndex: 0,
    blockHash: '0xfb9c1faa157d42964982546facd52455e100ce751198bd9a42cae55dbabb8524',
    blockNumber: 11,
    from: '0x75c2a52aae64100540e5817106eb58f863b3dae5',
    to: '0x3250d3df90543625429d5d4cca40caa54ccc768f',
    gasUsed: 21250,
    cumulativeGasUsed: 21250,
    contractAddress: null,
    logs: [],
    status: true,
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    rawLogs: []
  },
  logs: []
}
truffle(develop)> await instance.createTransfer(1000, "0xea020f1f5923c19c0ad0f640997b9789bc874d9a")
{
  tx: '0xbad1b2c429756b04b95e71e22142598370591432e4bb8070138e29a863af53dd',
  receipt: {
    transactionHash: '0xbad1b2c429756b04b95e71e22142598370591432e4bb8070138e29a863af53dd',
    transactionIndex: 0,
    blockHash: '0x8f279ae3b5040274a036372af789345cc1fcf218ac10112956600f21be8523a2',
    blockNumber: 12,
    from: '0x75c2a52aae64100540e5817106eb58f863b3dae5',
    to: '0x3250d3df90543625429d5d4cca40caa54ccc768f',
    gasUsed: 100659,
    cumulativeGasUsed: 100659,
    contractAddress: null,
    logs: [ [Object] ],
    status: true,
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000080000000',
    rawLogs: [ [Object] ]
  },
  logs: [
    {
      logIndex: 0,
      transactionIndex: 0,
      transactionHash: '0xbad1b2c429756b04b95e71e22142598370591432e4bb8070138e29a863af53dd',       
      blockHash: '0x8f279ae3b5040274a036372af789345cc1fcf218ac10112956600f21be8523a2',
      blockNumber: 12,
      address: '0x3250d3DF90543625429d5D4cca40CAa54ccC768f',
      type: 'mined',
      id: 'log_f6292e3e',
      event: 'TransferRequestCreated',
      args: [Result]
    }
  ]
}
truffle(develop)>

Migrations

Below is the initial migrations code that we pretty much copy and paste whenever we create a new contract to deploy and then just change the name.

const Migrations = artifacts.require("Migrations");

module.exports = function (deployer) {
  deployer.deploy(Migrations);
};

My question is:
If I create a contract called MyContract and create its own migrations file (2_MyContract_migration.js), do I substitute every “Migrations” word for “MyContract” or only the one in artifacts.require(“Migrations”)?

The reason I’m confused is because in the one video Filip substituded all three words, and in a later one, only the one in artifacts.require(“Migrations”). Does it make a difference at all?

Thx in advance
Em

Hi @Kamil37

You can choose the sender of a transaction as follow (if you are using truffle).

await functioname(param1, param2, {from: accounts[0]})

The index that you use for the accounts array reflects the addresses you have listed above.

The second part of the question is not clear to me, can you please post your code and clarify with an example?

1 Like

It is not important how you call the constant, however it is important the artifacts that you require.
You can call your constant Migration as far as you require the right artifact.

Hello guys, I am up to the part about creating wallet tests for dex. (Video no 7)
I run the code below to install assertions. (video time: 5:00)

npm install truffle-assertions

However, when i run truffle-develop, and truffle-test, i get an error message saying it cannot find module truffle-assertions in the code below.
Do you guys have any ideas why I get this message?
By the way, the solidity compiler version i am using is >=0.4.22 <0.9.0
Appreciate if you have any suggestions.
Thanks you very much.

Using network 'develop'.


Compiling your contracts...
===========================
> Compiling ./contracts/dex.sol
> Compiling ./contracts/wallet.sol
> Compiling ./node_modules/@openzeppelin/contracts/maths/SafeMath.sol
> Artifacts written to /var/folders/gv/v115v1xs2gj6_hsz0p4_yjvw0000gn/T/test--15894-GrjEqpjuH51Q
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang

BN { negative: 0, words: [ 50, <1 empty item> ], length: 1, red: null }
Error: Cannot find module 'truffle-assertions'
Require stack:
- /Users/marcochu/Documents/truffle/dex/test/wallettest.js
- /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js
- /usr/local/lib/node_modules/truffle/node_modules/mocha/index.js
- /usr/local/lib/node_modules/truffle/build/consoleChild.bundled.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/marcochu/Documents/truffle/dex/test/wallettest.js:3:23)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:390:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:387:14)
    at Mocha.run (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:961:10)
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/testing/Test.js:151:1
    at new Promise (<anonymous>)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/testing/Test.js:150:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/test/index.js:160:1)
    at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:147:1)
- Fetching solc version list from solc-bin. Attempt #1
- Fetching solc version list from solc-bin. Attempt #1

truffle(develop)> truffle test
Using network 'develop'.


Compiling your contracts...
===========================
> Compiling ./contracts/dex.sol
> Compiling ./contracts/wallet.sol
> Compiling ./node_modules/@openzeppelin/contracts/maths/SafeMath.sol
> Artifacts written to /var/folders/gv/v115v1xs2gj6_hsz0p4_yjvw0000gn/T/test--15920-q5vaCmwRBrde
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang

BN { negative: 0, words: [ 50, <1 empty item> ], length: 1, red: null }
Error: Cannot find module 'truffle-assertions'
Require stack:
- /Users/marcochu/Documents/truffle/dex/test/wallettest.js
- /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js
- /usr/local/lib/node_modules/truffle/node_modules/mocha/index.js
- /usr/local/lib/node_modules/truffle/build/consoleChild.bundled.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/marcochu/Documents/truffle/dex/test/wallettest.js:3:23)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:390:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:387:14)
    at Mocha.run (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:961:10)
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/testing/Test.js:151:1
    at new Promise (<anonymous>)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/testing/Test.js:150:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/test/index.js:160:1)
    at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:147:1)
- Fetching solc version list from solc-bin. Attempt #1
- Fetching solc version list from solc-bin. Attempt #1

I think i fix it. :smiley:

  Contract: Dex
    ✓ should only be possible for owner to add tokens (569ms)
    ✓ should handle deposit correctly (209ms)
    ✓ should handle faulty withdrawn correctly (103ms)
    ✓ should handle correct withdrawn correctly (118ms)


  4 passing (1s)

- Fetching solc version list from solc-bin. Attempt #1
- Fetching solc version list from solc-bin. Attempt #1
1 Like

when i try to truffle migrate --reset on rinkeby
after it compile and migrate all of Migration and contract, then it produce this error:

truffle(rinkeby)>
C:\Users\saad\node_modules\request\request.js:816
          var e = new Error('ESOCKETTIMEDOUT')
                  ^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: ESOCKETTIMEDOUT
    at ClientRequest.<anonymous> (C:\Users\saad\node_modules\request\request.js:816:19)
    at Object.onceWrapper (events.js:421:28)
    at ClientRequest.emit (events.js:315:20)
    at ClientRequest.EventEmitter.emit (domain.js:467:12)
    at TLSSocket.emitRequestTimeout (_http_client.js:784:9)
    at Object.onceWrapper (events.js:421:28)
    at TLSSocket.emit (events.js:327:22)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at TLSSocket.Socket._onTimeout (net.js:483:8)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
    at PollingBlockTracker._performSync (C:\Users\saad\node_modules\eth-block-tracker\src\polling.js:51:24)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at runNextTicks (internal/process/task_queues.js:62:3)
    at listOnTimeout (internal/timers.js:523:9)
    at processTimers (internal/timers.js:497:7)

and then it exits truffle console

any thoughts, thanks