Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

Compiled solidity contract run out of gas on deployment

I have a solidity contract that compiles ok (0.5.1 compiler version), but it runs out of gas if I deploy the whole of it. If I comment some of the external methods of the contract, it compiles and ...
0
votes
0answers
8 views

How to keep track of deployed versions and implement a CD strategy with truffle?

My original question on SO here didn't had much success... so I copy/paste it here, hoping for more interest. Thanks in advance! I'm working on a dapp project which includes a main smart contract, ...
0
votes
1answer
13 views

TypeError: … is not a function

I'm trying to test my contract functions in Truffle v5+ but getting TypeError: myContract.methods.register is not a function. Contract MyContract { function register(uint256 amount) external {...}...
0
votes
1answer
11 views

Event filter not returning correct events web3js

I am trying to filter certain events emitted in the past based on the value of a certain field. The code I have used corresponds to the method specified on the web3js documentation page. However, the ...
0
votes
1answer
12 views

Truffle testing a contract against an already-deployed external contract

Let's say I'm writing an escrow contract. The conditions of this escrow are based on the properties of a second already-deployed contract on Kovan and mainnet. Should I skip testing my escrow contract ...
0
votes
1answer
6 views

How is data sent to the front-end by a View function?

I am required to send some data from a view-only function to the front-end. I tried using the standard approach by emitting an event with the required fields. However, when the emit call is placed ...
0
votes
1answer
13 views

Do I have to create a custom ERC20 to test transfers in Truffle?

I have a smart contract that escrows and transfers a specific ERC20 token to and from users (with their approval). I'm a bit confused as to how to test transfers of existing tokens. Do I have to copy+...
0
votes
1answer
14 views

ParserError: Expected ',' but got ';'

I`m trying compilate this code and getting Parse error pragma solidity ^0.6.0; contract ZooFactory { event NewZoo(uint zooId, string name, uint dna); uint dnaDigits = 24; uint ...
0
votes
1answer
24 views

Ubuntu 18.04: Error during compilation using Truffle: How to install the updated version

I am working on Ubuntu 18.04. I have installed Truffle from the following site: Truffle for Linux I am trying to execute an application from the following site: Petshop Tutorial I am able to ...
0
votes
0answers
10 views

Drizzle problem: how to connect to infura direct when user has Metamask, but isn't connected?

I understand how to connect direct to infura if the user has no wallet at all (for displaying blockchain data when users don't have a wallet) the problem is that I don’t know how to connect to infura ...
0
votes
1answer
9 views

mnemonic.includes in not a function

I've been trying to compile my solidity smart contracts So I'd be able to deploy them on the Ropsten Test network when I run truffle compile I get this error : TypeError: mnemonic.includes is not a ...
0
votes
0answers
9 views

migrate error from new buffer(process.env)

I follow the book Ethereum from Gavin Wood and when i use truffle migrate --network ganache it gives me following error; TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type ...
0
votes
1answer
26 views

How to find the address of the contract owner?

I'm under the impression that the owner of the contract is simply referred to as accounts[0] in Truffle's testing environment, but I'm getting the error by the modifier that the caller of a certain ...
1
vote
1answer
26 views

Sending transaction from different addresses in truffle test case

I am having an admin in my contract who can do certain things. Here is the contract function changeAdmin(address admin_) public { if (msg.sender != admin) revert(); potentialAdmin = admin_; }...
0
votes
1answer
28 views

How do we access a contract that was deployed by another contract in Truffle?

I am trying to figure out how do we access Contract2's instance in Truffle's test if it was deployed by Contract1 in Truffle Develop? Can't seem to find a question that described my issue exactly so ...
3
votes
0answers
34 views

Unit testing a Solidity Library function with a struct memory argument

I am trying to unit test a Solidity Library contract function using truffle and web3. My simplified Library contract looks like this: pragma solidity >=0.5.16; pragma experimental ABIEncoderV2; ...
1
vote
1answer
27 views

Drizzle cacheSend outputs “cacheSend is not a function” error, but the tx works when using send

I'm using Drizzle and react-hooks in my new open source project, but cacheSend outputs always "cacheSend is not a function" This line of code with send works as expected const stackId = contract....
0
votes
0answers
16 views

Getting the “VM Exception while processing transaction: revert” error for a pay() function

I'm getting the following error during the testing in Truffle: Error: Returned error: VM Exception while processing transaction: revert It simply says "revert" without the contingency message, ...
0
votes
1answer
18 views

Couldn't get any accounts!, Ethereum client is not configured correctly

I'm running testrpc on the default port 7545. I run truffle console and test with: web3.eth.getAccounts().then( function (result) { return result[0] }); This works fine. According to docs the ...
0
votes
0answers
20 views

All truffle commands left segmentation fault (core dumped)

This is the output of truffle compile: > Compiling your contracts... =========================== > Compiling ./contracts/Lent.sol > Artifacts written to /home/supernozer/MyERC20/build/...
0
votes
1answer
21 views

print the smart contract balance using web3

I am trying to print the balance of the smart contracts using web3 but it doesn't show any error but on the client-side application it appears as follows: Your Balance: [object Promise] /contracts/...
0
votes
2answers
17 views

Does Truffle Test consume gas?

When I run the $truffle test command in the terminal does it consume any gas from my local blockchain(say Ganache)?
0
votes
1answer
25 views

What are the accounts generated by Truffle and Ganache? How is the Truffle migration done eactly?

I have a few question regarding Truffle, Ganache, and testing: When I execute truffle develop and get 10 accounts and 10 private keys, do those represent my accounts in my wallet or other users? For ...
0
votes
0answers
49 views

SOLVED - truffle develop command doesn't return anything

I updated my node and nvm version. Then I ran truffle develop command on my project folder, this command doesn't return anything.. why? it just stays... local blockchain dosen't start. Versions: ...
0
votes
2answers
15 views

Deploying App on Ropsten or any Test Network

I have a web3.js application which uses truffle and interacts with smart contracts deployed on Ganache. How do I deploy my smart contract on a Test Network and interact with it through my application?
0
votes
0answers
27 views

Truffle Error: invalid argument 0: hex string without 0x prefix

I'm trying to deploy and test the smart contracts on the Goerli network using Truffle. While migrating getting below error. Contract: Simple Storage Test suite Simple Storage Set ...
0
votes
2answers
29 views

“Migrations” could not deploy due to insufficient funds

I'm getting the error: "Migrations" could not deploy due to insufficient funds. Sender doesn't have enough funds to send tx. The upfront cost is: 45000000000000000 and the sender's account ...
0
votes
2answers
19 views

Decreasing the size of ABI files

I have some Truffle and Solidity produced ABI files that I am bundling with a JavaScript NPM package. 221.7kB esm5/lib/abi/IERC777.json Currently, the ABI files include full details, like ...
0
votes
1answer
17 views

set up 2 accounts

I am trying to implement a KYC system for banks. so for this, I will require the banks to have a respective account address so when the customer joins that bank he will pay to it. I have provided the ...
0
votes
1answer
46 views

Contract should be marked as abstract

I'm getting the error: Contract "StarNotary" should be marked as abstract. pragma solidity >=0.4.24; import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract ...
0
votes
1answer
16 views

Ganache, Truffle, Metamask, and Geth [closed]

Can someone please explain the uses of these things and how these things are different or similar to each other, and how and when they can be used interchangeably?
1
vote
1answer
14 views

Compiler version incompatibility nightmare

I'm new to Solidity and Truffle. I'm trying to compile my Solidity code within Truffle to create an ERC-20 token. I have @truffle/hdwallet-provider and @openzeppelin/contracts as my dependencies. Now,...
0
votes
0answers
19 views

Web3: call the solidity function with the address can't return the expected outcome! (everyone can help?)

solidity code: address public administrator; constructor() public { administrator = msg.sender; } function isAdministrator(address _address) public view returns (bool) { return _address ==...
0
votes
1answer
22 views

Truffle and Buidler are compiling to very different bytecodes despite having same compiler settings

Truffle is giving > 24kB and out of gas errors, but Buidler is not. I have checked the number of characters in the 'deployedBytecode' of the JSON: Buidler 33k characters (so 16.5kB) Truffle 55k ...
0
votes
0answers
10 views

Error while unboxing trufle react

gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess....
0
votes
2answers
29 views

“VM Exception while processing transaction: revert” in Truffle test and Truffle dev

this is my problem :) Issue "Error: Returned error: VM Exception while processing transaction: revert" when reaching the Transfer function. I think it is related to the fact that my Crowdsale smart ...
0
votes
1answer
37 views

Truffle Deployment Error: Invalid number of parameters for “undefined”. Got 1 expected 0!

I am trying to deploy my smart contract. When I run truffle compile everything works however when I run truffle migrate, I get this occurring error message: Error: * Deployment Failed * "...
0
votes
1answer
12 views

What does instance refer to in solidity/JavaScript

DToken.deployed().then(function(instance){ token = instance; }) This code I saw in truffle test. Can someone please tell what does this "instance" parameter refer to?
0
votes
2answers
17 views

How to specify custom test directory path in truffle-config.js

How do I specify a custom test directory path in truffle-config.js? My test directory is not present at the same level as truffle-config.js, it is residing in a different directory. Truffle has ...
0
votes
1answer
8 views

not able to deploy contract

I'm working on API'S for smart contract. I'm using tronbox to compile and migrate. Error is this contract constructor expected 1 arguments, received 0 I tried to add arguments in migrations like this ...
0
votes
0answers
20 views

Just not able to install Web3 through powershell

After reading a lot of articles about how to install Web3j in windows. I also tried following this article : https://kauri.io/generate-a-java-wrapper-from-your-smart-contract/...
0
votes
1answer
29 views

How can I make sense of solidity-coverage reports

I'm trying to check the coverage of an entire ERC20 set of openzeppelin tests. I'm using openzeppelin/test-environment and solidity-coverage v0.7.4 as plugins in truffle. The tests went fine but I get ...
0
votes
0answers
29 views

Out of gas error even for simple one string set

I have been struggling with this exception and am literally stuck in development: "Error: Returned error: VM Exception while processing transaction: out of gas" I removed all the code and just ...
0
votes
1answer
49 views

Truffle deployment error while deploying with Infura (Error: Callback was already called)

I am trying to deploy a token smart contract to Ropsten test network with Infura, but I am always getting an error as I am using truffle migrate --reset --network ropsten_infura Compiling your ...
0
votes
1answer
19 views

Timeout error on deploying to Rinkeby from truffle migrate

I have just finished the CryptoZombies tutorials, and was trying to deploy the file following their instructions to the Rinkeby network. But I keep getting this timeout error and am lost on how to ...
0
votes
0answers
24 views

Deployed Smart Contract doesn't work after Geth private node restart

i'm running my private node with Geth, v1.9.13, deployed my Smart Contract via truffle migrate and everything works fine. when i shutdown the machine and startup my node again, everything seems not ...
2
votes
1answer
52 views

Why do truffle test gives two different contract address for the same smart contract?

I was practising on a smart contract, and noticed that it gives out two different address for the same contract deployed while testing it. const Test = artifacts.require('./Test.sol'); contract('...
0
votes
0answers
31 views

Transaction halted with a RUNTIME ERROR

while debugging I encountered this error: There was no revert message. This may be due to an in intentional halting expression, such as assert(), revert(), or require(), or could be due to an ...
0
votes
1answer
35 views

Dice2Win Truffle test fails with the message Returned error: VM Exception while processing transaction: invalid opcode

As I was going through the test for the Dice2Win smart contract, It was required to verify few tests, which failed throwing invalid opcode error. The following is the error after running the truffle ...
0
votes
1answer
18 views

Truffle test fails while checking if the contract instance has the owner address

As I was going through the truffle test for the smart contract below to check if it has the owner address: pragma solidity >=0.4.21 <0.7.0; contract Owner { address public owner; ...

1
2 3 4 5
43