0 passing (2ms) 2 pending

wallettest.js

const Dex = artifacts.require("Dex")
const Link = artifacts.require("Link")
const truffleAssert = require('truffle-assertions');

contract.skip("Dex", accounts => {
    it("should only be possible for owner to add tokens", async () => {
        let dex = await Dex.deployed()
        let link = await Link.deployed()
        await truffleAssert.passes(
            dex.addToken(web3.utils.fromUtf8("LINK"), link.address, { from: accounts[0] })
        )
        await truffleAssert.reverts(
            dex.addToken(web3.utils.fromUtf8("LINK"), link.address, { from: accounts[1] })
        )
    })
    it("should handle deposit correctly", async () => {
        let dex = await Dex.deployed()
        let link = await Link.deployed()
        await link.approve(dex.address, 100);
        await dex.deposit(100, web.utils.fromUtf8("LINK"))
        let balance = await dex.balances(accounts[0], web3.utils.fromUtf8("LINK"))
        assert.equal(balance.toNubmer(), 100)
    })
})```



* Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15792-M2zwOeGlPvIm
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 499, <1 empty item> ],
  length: 1,
  red: null
}


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (9ms)
  2 pending

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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15808-wZ3WafcEFVxi
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 499, <1 empty item> ],
  length: 1,
  red: null
}


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (10ms)
  2 pending

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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15821-qKA3eO3yX19F
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 499, <1 empty item> ],
  length: 1,
  red: null
}


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (8ms)
  2 pending

truffle(develop)> truffle compile

Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /Users/mubashirhussain/Desktop/dex/build/contracts
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
truffle(develop)> test
Using network 'develop'.


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15894-ZziUexctCwaU
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Error: Returned error: VM Exception while processing transaction: the tx doesn't have the correct nonce. account has nonce of: 137 tx has nonce of: 136 (vm hf=london -> block -> tx)
    at module.exports (/Users/mubashirhussain/Desktop/dex/migrations/3_MUBDEX_migration.js:11:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:72:1)
    at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:54:1)
    at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:202:1)
    at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:152:1)
    at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:117:1)
    at Object.runAll (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:121:1)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:86:1)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/testing/Test.js:114:1)
    at Object.module.exports [as run] (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/test/run.js:139:1)
    at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:189:1)
truffle(develop)> test
Using network 'develop'.


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15912-9qdPAqjlQN2G
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 100, <1 empty item> ],
  length: 1,
  red: null
}


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (11ms)
  2 pending

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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15930-C9hCSqR34joD
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 100, <1 empty item> ],
  length: 1,
  red: null
}


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (8ms)
  2 pending

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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15948-K4tV8BvmmCnD
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Transaction: 0xae63d1a1adf4d2c73ee89ea25d17b35190b761ab669f89c9c41452f519d92fa7 exited with an error (status 0). Reason given: token does not exist.
     Please check that the transaction:
     - satisfies all conditions set by Solidity `require` statements.
     - does not trigger a Solidity `revert` statement.

truffle(develop)> migrate --reset

Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /Users/mubashirhussain/Desktop/dex/build/contracts
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang


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


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

   Replacing 'Migrations'
   ----------------------
   > transaction hash:    0xd8005f01df46ec2f6b7bbbeaba04b7f30c7cb2a9e7db3d6dd94ebffbfd74e042
   > Blocks: 0            Seconds: 0
   > contract address:    0x10170627e0183A67748fF8A6F581EeD84a0DEE09
   > block number:        167
   > block timestamp:     1652115419
   > account:             0x336AfD4551F45F13d8A4F1CFAf8bCB39DCFFa47A
   > balance:             99.826904705831243246
   > gas used:            248204 (0x3c98c)
   > gas price:           2.500000008 gwei
   > value sent:          0 ETH
   > total cost:          0.000620510001985632 ETH

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


2_dex_migration.js
==================

   Replacing 'Dex'
   ---------------
   > transaction hash:    0x20fecc8ff62a5439516ad8e1d1075b99702f1d7852e214a8c85edecefc40f2a5
   > Blocks: 0            Seconds: 0
   > contract address:    0x4DdDd14cb43C2798d1Dbdf4CDE19E4C9753A3679
   > block number:        169
   > block timestamp:     1652115419
   > account:             0x336AfD4551F45F13d8A4F1CFAf8bCB39DCFFa47A
   > balance:             99.82285160081827331
   > gas used:            1575329 (0x1809a1)
   > gas price:           2.500000008 gwei
   > value sent:          0 ETH
   > total cost:          0.003938322512602632 ETH

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


3_MUBDEX_migration.js
=====================

   Replacing 'Link'
   ----------------
   > transaction hash:    0xe0790a71dc81acc492c9773df16e87476b790e4ba7cb2d43bc02e8a1c6116c47
   > Blocks: 0            Seconds: 0
   > contract address:    0x6fa9c8a0783BEA342f9c79E1c6B6464d41756520
   > block number:        171
   > block timestamp:     1652115419
   > account:             0x336AfD4551F45F13d8A4F1CFAf8bCB39DCFFa47A
   > balance:             99.819608645807895854
   > gas used:            1268369 (0x135a91)
   > gas price:           2.500000008 gwei
   > value sent:          0 ETH
   > total cost:          0.003170922510146952 ETH

Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 100, <1 empty item> ],
  length: 1,
  red: null
}
   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:     0.003170922510146952 ETH

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


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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15972-2ytR2WDFNm7I
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 100, <1 empty item> ],
  length: 1,
  red: null
}


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (8ms)
  2 pending

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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--15989-zSTz3uq4dNfZ
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang
Current Chainlink Balance:  BN {
  negative: 0,
  words: [ 100, <1 empty item> ],
  length: 1,
  red: null
}


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (5ms)
  2 pending

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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--16010-qWNTyy5bF2wC
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (1ms)
  2 pending

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


Compiling your contracts...
===========================
> Compiling ./contracts/token.sol
> Compiling ./contracts/wallet.sol
> Artifacts written to /var/folders/_y/l0gy9qfn2m717ll0y0dcr4980000gn/T/test--16059-974DaK7q3zKJ
> Compiled successfully using:
   - solc: 0.8.4+commit.c7e474f2.Emscripten.clang


  Contract: Dex
    - should only be possible for owner to add tokens
    - should handle deposit correctly


  0 passing (2ms)
  2 pending

truffle(develop)> *

You are skiping the test when using .skip

Carlos Z

thanks :slightly_smiling_face:

1 Like