Questions tagged [truffle]

Questions regarding the implementation and use of the Truffle development and testing environment.

Filter by
Sorted by
Tagged with
0
votes
1answer
574 views

Truffle console error “Error: Returned error: VM Exception while processing transaction: revert”

I compiled and migrated my solidity codes of erc20 token to development networks on truffle, and use it on truffle console. truffle(development)> let instance = await XToken.deployed() truffle(...
0
votes
0answers
19 views

Windows: command “npm install drizzle” give me an ERR!

npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ `tar.gz module has been deprecated and your application is ...
7
votes
1answer
1k views

How to unit test contract private and internal functions?

How can we unit test contract private functions using the Truffle framework? Since Solidity doesn't have package access or reflection language features, standard private testing approaches don't work....
0
votes
2answers
140 views

Solidity & truffle: get elements from strings array

i'm glad to follow this forum, it is very helpful. I'm using truffle to develop contracts and i just found that dynamic arrays are not yet suported, for that reason i was using string arrays with a ...
1
vote
0answers
36 views

Truffle vs. Embark [closed]

Say a programmer developer a web front-end using Truffle/Drizzle. The developer moved on and a new developer, who only knows JavaScript comes along to manage and extend the Dapp. Someone told me that ...
1
vote
1answer
69 views

How to test contract interaction with mainnet contract via Truffle

I'm writing a contract via Truffle and my understanding is that running truffle test will run my tests in a clean-room environment. E.g. a fresh deployment blockchain run on my local machine How can ...
1
vote
1answer
38 views

Windows: “npm install drizzle” command don't work, Why? [closed]

when i try to run the command "npm install drizzle" on my machine it don't work. i install drizzle-react and drizzle-react-components without problem but "npm install drizzle" don't work. Any ideas?
0
votes
1answer
46 views

Migration 2_deploy_contracts invalid or does not take any parameters at Object.run()

I am trying to compile my smart contracts using truffle pet-shop. I have the following contract in directory election/contracts/election.sol ; pragma solidity >=0.4.0 <0.6.0; contract Election{ ...
0
votes
0answers
14 views

truffle - toUtf8 on Migrations not working

I'm deploying my contracts via migrations and would like to show some info on the console about them just by getting data from these contracts and displaying it. I'm sending a deployed contract to the ...
0
votes
1answer
34 views

Function input is contract - How to interact

I'm going through Maker's OTC contract and they have this: function isTokenPairWhitelisted( ERC20 baseToken, ERC20 quoteToken ) public constant returns (bool) { return (_menu[...
2
votes
1answer
131 views

how to test overloaded function in truffle?

I recently upgraded truffle to the newest version. Now it does not automatically detect overloaded functions anymore. Before, I could just do the following: await contract.function({ from: accounts[...
1
vote
2answers
175 views

How to inherit an interface?

This code works - taken from Wiki - pragma solidity ^0.4.18; contract ERC20Interface { function transfer(address to, uint tokens) public returns (bool success); } contract FixedSupplyToken is ...
0
votes
1answer
44 views

Execution gas cost

I use web3 and truffle to get info about my testnet transactions. There are few fields about gas used per transaction, such as: gasPrice, gas, gasUsed. But how to get field 'execution cost'?
0
votes
1answer
89 views

Invalid JSON Response while connecting DApp, Metamask and Backend

I am getting some error(picture below) while trying to connect DApp with a backend. One day ago, everything worked fine, now I got an error: "basic auth failure". Contracts are deployed on Ropsten ...
0
votes
1answer
13 views

How to get an instance for a previously migrated contract with truffle?

Scenario: Token contract migration file Dapp contract migration file I want to interact with the already deployed token contract in the dapp contract migration file.
0
votes
0answers
7 views

truffle exec scripts/seed-exchange.js --network kovan

I've been running into an error when I attempt to seed my exchange/contracts on the kovan test network. Any help would be appreciated. Using network 'kovan'. Token fetched ...
0
votes
2answers
46 views

Truffle migrate --network ropsten always runs development network

I am trying to deploy a simple contract to the Ropsten network using Truffle and Infura. I have set up the Ropsten network in the truffle-confug.js file but it seems truffle always uses the ...
0
votes
1answer
295 views

Build failed SyntaxError: Unexpected token: name (length)

I setup truffle unbox react-auth and add few libraries as shown in my package.json below. I have no problem running npm run start but failed to compile npm run build with the following error: ...
2
votes
1answer
275 views

How to debug transaction from truffle test on development network

I am trying to debug a failing solidity function, which I am calling from the JS test files with truffle. When I run my test, I am successfully able to get a transaction id. However, my solidity ...
2
votes
1answer
742 views

Metamask transaction confirmed but “Internal JSON RPC error”

I am using getWeb3() to instantiate a contract and make calls with, the transaction says that is confirmed but when I open up developer tools there is the following error MetaMask - RPC Error: ...
1
vote
1answer
46 views

Truffle - call migration file multiple times

I would like to execute migration file "6_deploy_and_register_group.js" every time when I need to create a new group. Is this a proper way to use migrations? If yes, how can I make it working? ...
4
votes
2answers
1k views

how to check if an event was added to the log in a contract constructor

when executing a transaction in truffle tests, the return value is the transaction receipt and one can check for the presence of a particular event in the logs. this is not possible when the ...
0
votes
1answer
53 views

Confusion around Truffle, Ganache and Meta Mask

I am building a simple contract. In truffle when I give 'truffle develop' command, I get following information: On the Ganache, I have this: And finally on Meta Mask, I see this: here, Shikhar is ...
0
votes
2answers
119 views

when to use MyContract.deployed()?

I was going through truffle-contract docs and came across this function MyContract.deployed() As mentioned in docs this function create an instance of contract abstraction(abi) representing the ...
0
votes
2answers
217 views

invalid number value (arg=“_goal”, coderType=“uint256”, value=2000000000000000000)

i am following a tutorial from here. And upon running truffle test. It produces following error. 2_HashnodeCrowdsale.js ====================== Deploying 'HashnodeCrowdsale' ------...
7
votes
1answer
497 views

Truffle unbox drizzle not working properly

truffle version = 4.1.4 truffle unbox drizzle truffle compile truffle migrate npm run build npm run start this gets me this error: Truffle Drizzle-box fails with TypeError: (0 , _drizzle....
0
votes
1answer
36 views

InterfaceImp constract defined success,but interface function called failed

I'm trying to call a interface function for testing, but it can't work. Here is my test contract: pragma solidity ^0.4.24; interface InterfaceTest{ function testInterface() external pure ...
0
votes
1answer
303 views

web3 Uncaught TypeError: Cannot read property 'createBox' of undefined

i'm trying to create simple application by using solidity 5.0.0 , Truffle v5.0.0 and web3 web3@1.0.0-beta.34. but i've gotten Uncaught TypeError: Cannot read property 'createBox' of undefined. ...
0
votes
0answers
15 views

Ganache does not show the transferred amount.but it shows theme in account section

as shown in the picture the amount of value which is transferred to contract is shown in the transaction section of Ganache. I mean it shows the amount which is transacted to the address. in the my ...
0
votes
1answer
23 views

In up gradable design pattern how to set the allowed contracts or owner during deployment of smart contracts

Functional Background: Contracts for upgradable design pattern: ProofDB.sol : contract to store the data. Proof.sol : contract that contains the business logic. Registry.sol: contract that ...
2
votes
1answer
25 views

Truffle: how to override compiler settings via the CLI?

This is a highly specific bottleneck encountered when using Truffle. In my normal truffle-config.js file, I have the optimizer enabled. I run a CI pipeline which has a coverage job. I use 0x/sol-...
0
votes
1answer
294 views

How can i connect external AWS server's truffle in browser?

I have deployed geth, truffle, testrpc whichever needed in live AWS server. All the configurations are working properly. I have initiated 'truffle develop' and 'npm run dev'. Both are working fine. ...
0
votes
1answer
25 views

If the contract deploy was recorded as successful on etherscan does that mean the constructor executed?

I've got multiple large contracts. I've been able to deploy to Rinkeby with truffle fine after about 2 or 3 tries with 2 gwei. I tried two times now to deploy to the mainnet. Each time I get invalid ...
0
votes
2answers
73 views

promise chaining in test.js file

it("should throw an exception if you try to buy an article that does not exist", function() { return ChainList.deployed().then(function(instance) { chainListInstance = instance; ...
2
votes
1answer
24 views

Truffle configuration, server.js instead of lite-server

As it seems lite-server is only good for development. I decided to use server.js for production but I have no idea how to configure it for truffle?
0
votes
2answers
247 views

How to access in JavaScript multiple return values returned from a solidity function

My contract function returns two values. How to access the multiple return values in JavaScript from a mocha testcase? contract X { function a() pure public returns(uint,uint) { uint p=10; ...
1
vote
2answers
851 views

How to call my contract's function using sendRawTransaction?

I am trying to call my contract's method using sendRawTransaction. I have a function in my contract updateReading(address consumerAddress, uint32 consumerMeterId, uint64 ...
0
votes
1answer
55 views

I want a to write a function to get user data by giving the id of the user

pragma solidity ^0.4.23; contract ChainList { struct data { uint ownernumber; uint id; } uint value; mapping (uint256 => data) public datamatching; function storedata (...
0
votes
2answers
258 views

Truffle: Error: Could not find a compiler version matching 0.5.0

I wonder why I get the error when I have v0.5.0 everywhere and do the following: In my Action.sol: pragma solidity ^0.5.0; In Migrations.sol: pragma solidity >=0.5.0 <0.6.0; When running truffle ...
0
votes
1answer
323 views

truffle migrate does not return anything

I am following the tutorial from Truffle to create a "pet shop" contract. I can follow everything until he tells me to truffle migrate. Here is the contract: pragma solidity ^0.5.0; contract ...
0
votes
1answer
67 views

Contract [Contract's name] not found on network ID: 5777

I am using truffle with drizzle. In the contract folder I provide a file that includes two contracts A that is a factory contract and B that is created through one of A's functions After compiling ...
0
votes
1answer
37 views

Why is gasestimate coming as “infinite” when I'm trying to return a dynamic array in solidity?

I understand, that as the list grows it is going to cost infinite gas. I'm making a temp array in memory of size of our dynamic array at present size and then returning that array. But does that make ...
1
vote
1answer
80 views

Solidity Error:Running Out of Gas / selfdestruct problem

I've been going through 'Building Cryptocurrency and its ICO' by DappUniversity. I know many have questioned this issue and I've been through all the post but couldn't resolve it. The problem is self-...
1
vote
1answer
39 views

What are the inputs to the truffle Txn?

I am testing truffle now and I want to know more about what it deploys and how. It seems to use two txns. I have some results - Running migration: 2_deploy_contracts.js Deploying CA12... ... ...
0
votes
2answers
33 views

Deploy contract dynamically based on user request

Inspired by this blog: https://medium.com/coinmonks/escrow-service-as-a-smart-contract-the-business-logic-5b678ebe1955 I want to deploy contract once a buyer want to purchase a service. However, I ...
0
votes
1answer
64 views

Solidity Test - which are the variables and keywords over here

Can anyone help me in understanding what is happening over here? I understand that the contract name is TestAdoption, but after that - what is the first word "Adoption"? The second word "adoption". I ...
1
vote
3answers
71 views

How do I determine the network within a truffle exec script?

I'm writing a script to be executed with truffle exec and I need to add some logic conditional on the network we're calling truffle exec with. This is (roughly) what I want in my script: const ...
0
votes
1answer
233 views

Unhandled Rejection (Error): invalid string value (arg=“x”, coderType=“string”, value=5)

Using Truffle unbox react to unbox a boilerplate. received the following error from running npm run start Changes: Addition of "memory" parameters in the simpleStorage.sol Changed unit to string in ...
1
vote
1answer
83 views

truffle deploy live | transaction not mined within 750 seconds

I'm trying to deploy my smart contract to the live ETH network. I've done the same process on rinkeby and it works fine. However during the block mining phase it times out and gives the error: " ...
0
votes
1answer
43 views

problem with sequence deployment

I followed this way of deploying contracts using truffle. // Deploy A, then deploy B, passing in A's newly deployed address deployer.deploy(A).then(function() { return deployer.deploy(B, A.address)...