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
48 views

Truffle Contract and nodejs

I want to send a data to a function created in a smart contract. function notarizeHash(uint256 id, bytes32 documentHash) public onlyOwner noHashExistsYet(id) { hashesById[id] = documentHash; ...
1
vote
1answer
41 views

How to call an overloaded function in Truffle with ABIEncoderV2?

How do you call an overloaded function in Truffle when passing a struct using pragma experimental ABIEncoderV2;? contract MyContract { struct MyStruct { address param1; address param2; ...
0
votes
1answer
36 views

address(this) in solidity is returning wrong contract address

This is my cantract code which I was using in truffle pragma solidity 0.5.16; contract Test { function getAdd() public view returns(address){ address add = address(this); return ...
0
votes
0answers
88 views

My is metamask returning RPC Error: Error: [ethjs-rpc] rpc error with payload, metamask shows failed [object, object]

My metamask shows ALERT: Transaction Error. Exception thrown in contract code. When I am about to transfer using truffle, open zeppelin and ganache on localhost:7545 after confirming the transaction ...
0
votes
1answer
37 views

Error in smart contract solidity [closed]

Hello i have some problem when i compile my smart contract with truffle i use the network of truffle develop Truffle v5.1.14-nodeLTS.0 (core: 5.1.13) Solidity - ^0.4.0 (solc-js) Node v13.1.0 Web3....
0
votes
0answers
19 views

TypeError: Different number of arguments in return statement than in returns declaration

function _execute(Proposal memory p, bytes memory transactionBytecode) internal returns (bool) { ProposalType proposalType = p.proposalType; uint childID = p.childID; ...
0
votes
1answer
59 views

why web3.eth.getBlockNumber().then(console.log) returns 0

I have build a Ethereum Full Node in Ubuntu 18.04. geth is running through the following command: nohup geth --rpcaddr 127.0.0.1 -rpcport 8545 --rpc -rpcapi "wb3,admin,eth,personal,net" --ws --wsaddr ...
0
votes
1answer
48 views

Sending transaction to a Web3 contract object in Truffle test produces 'file import callback not supported'

I need to send a state-changing transaction to a Web3 contract object in my Truffle tests, which is hitting a fork of Kovan in my local ganache chain (ganache-cli --fork https://kovan.infura.io/v3/[...
0
votes
0answers
14 views

CheckMarx Docker based Example: Installing the ganache and Truffle again

I am trying to work on an example provided at: CheckMarx Example $ ./ddenv Pulling ganache (trufflesuite/ganache-cli:latest)... ERROR: Get https://registry-1.docker.io/v2/: net/http: request ...
0
votes
0answers
15 views

Creating Multiple ERC721 Tokens

Imagine you wright your own token following the ERC721 standard. Now you want to create 10,000 tokens of this type. Do you need one contract to manage each token? Do you have to deploy 10,000 token ...
0
votes
0answers
24 views

Using a bash script containing truffle commands to connect with multiple network in order to send transactions

Context: I have created a local Ethereum test net. I am using truffle to send transactions to EVM nodes. I have created a bash script that looks as follows (send_transactions.sh): sudo truffle ...
0
votes
0answers
20 views

How can I listen for Truffle Actions such as TX_BROADCASTED, TX_ERROR via the Drizzle Vue Plugin?

In my Vue JS Dapp, which uses Drizzle Vue Plugin, I listen for contract events using $drizzleEvents like so: this.$drizzleEvents.$on('drizzle/contractEvent', (payload) => { this....
0
votes
1answer
51 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
25 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
68 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
17 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
30 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
15 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
2answers
40 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
38 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
127 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 ...
1
vote
0answers
29 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
28 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
12 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
38 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
62 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
37 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
59 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; ...
2
votes
1answer
112 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
22 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
29 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
39 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
48 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
26 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
63 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
105 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
25 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
48 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
237 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
37 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
20 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 ...
1
vote
1answer
622 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
21 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
52 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
27 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
41 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
15 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
45 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
446 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 * "KJToken&...
0
votes
1answer
18 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?

1 2
3
4 5
45