Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
106 views

Deploying contract to infura via @truffle/hdwallet-provider is hanging

I created a contract and deployed to Ganache test network successfully but it is not deploying to infura. //this section is clean. worked for Ganache var output = JSON.parse(solc.compile(JSON....
0
votes
3answers
147 views

Error in the truffle init command, quorum

i'm trying to truffle a project but each time it shows me this message, whereas, i'm sure i installed the truffle successfully. vagrant@ubuntu-xenial:~/quorum-examples$ cd project vagrant@ubuntu-...
0
votes
1answer
520 views

Sending string as address to smartcontract

I have trouble sending an address to a deployed contract, my function looks like this: function addNote(uint _value, address _owner) public { ... } and when I'm sending the parameters: contract....
2
votes
1answer
355 views

Passing one contract instance as an argument to the constructor of another contract

I need to use the functions of the ERC20 contract in another contract. The ERC20 contract is from the openZeppelin contract library. I found the following code on a website: import "../../...
0
votes
1answer
102 views

Nothing happens whe I run truffle test

I am new to solidity. Maybe I am missing something obvious in the setup. But when I run truffle test, I get nothing, the terminal just stays there forever. $ truffle test ... and I don't know why, ...
0
votes
1answer
17 views

What is the proper way to check if msg.sender is the contract owner?

I'm trying to make a function that returns true if msg.sender is the owner. This is my function; function isAdmin() public view returns (bool){ require(admin == msg.sender); return true; ...
1
vote
1answer
169 views

How can I configure node when I run truffle test?

How can I get truffle test to execute node with the --abort-on-uncaught-exception option? I'm guessing that I should probably add something in the Truffle's configuration file (truffle.js), but the ...
0
votes
1answer
66 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
1
vote
3answers
770 views

Can't compile old solidity contracts(version 0.4.17)

I'm new with blockchain development. I'm working on an old project which use solidity 0.4.17 and truffle ^4.0.0-beta.2; These versions were in the package.json file of the project. When I installed ...
5
votes
2answers
2k views

what is the role of Migrations.sol contract in truffle project?

I have started working with truffle since 4 months and I don't give importance to Migrations.sol, I thought it's just a "get started" contract. But when I removed it caused a problem. can anyone ...
0
votes
1answer
452 views

Truffle Migrate Error: Could not find built Migrations contract: Unexpected token in JSON at position 0

Running truffle migrate with valid contract code started causing this error for me: Writing artifacts to ./build/contracts Using network 'development'. Error: Could not find built Migrations ...
3
votes
1answer
89 views

Non-specific error from truffle debugger

I am testing a contract which is using ecrecover function of solidity. While its testing when i go with a failed test case while debugging, it doesn't go step by step and at the end return the same ...
0
votes
1answer
111 views

Truffle testing not reading contract

Here's my solidity: contract Oracle { mapping(uint => uint) oracle_values; modifier onlyOwner { require(msg.sender == owner); _; } function Oracle() public { owner = msg....
0
votes
2answers
188 views

Intracting with dapp using frontend truffle petbox

App = { web3Provider: null, contracts: {}, account: '0x0', init: function() { // Load pets. return App.initWeb3(); }, initWeb3: function() { if (typeof web3 !== 'undefined') {...
0
votes
1answer
167 views

The contract code couldn't be stored, please check your gas amount while deploying contract

I'm trying to deploy 3 contract in 2_deploy_contract (I deploy all 3) but after the first is deployed I get the following error : The contract code couldn't be stored, please check your gas amount.
5
votes
1answer
392 views

Truffle error “Don't set config.from directly”

I have parity running on my mac and I can start it with parity --rpcaddr 0.0.0.0 --rpcport 8547 --port 30305 --rpccorsdomain '*' --rpcapi "eth,net,web3" Once It's all sync'd up I then make a new ...
0
votes
1answer
356 views

Truffle migrate code with library, interface and contract

Suppose that I have a token contract as follow. How can i write the new migration.js file in truffle to deploy the contract? TestCoin.sol import "openzeppelin-solidity/contracts/math/SafeMath.sol"; ...
0
votes
0answers
17 views

Why does this function work in truffle tests and fail through metamask?

I have the following function and it has been working perfectly in truffle tests as I was developing the smart contracts and now that I am implementing it in the front end I have been getting a error ...
0
votes
2answers
220 views

How can I use truffle to deploy my contract to a local testnet (not testrpc)?

I followed the steps in the following link to create a local Ethereum testnet, but now I want to deploy a contract to "MyTestNetNode": https://medium.com/@WWWillems/how-to-set-up-a-private-ethereum-...
0
votes
2answers
83 views

Truffle best practices - unit vs integration tests

Think about having two contracts: MockToken Faucet (which takes token address as constructor parameter) To unit test Faucet I would create two new instances: const token = await MockToken.new() ...
0
votes
2answers
65 views

how to use import “@openzeppelin” in remix or import “https://github…” in truffle?

I can do import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; in truffle and import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20....
0
votes
0answers
25 views

Copying ABI Code in Truffle

In Remix, one can directly copy the ABI code from the utility without having to do any manipulation. I was wondering if there is a built-in method in Truffle to do the same. I am aware that this ...
0
votes
2answers
49 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
47 views

Function stopped working? No check is being done now on transfer function

I created a function to deposit and transfer ether and it was working great until i tried to deploy again and now the transfer function is not working anymore No errors are being thrown, the transfer ...
1
vote
1answer
25 views

Error: Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. Even after updating truffle

I am getting the Error: Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. If you believe this is an error, please contact Truffle support. Even after updating of truffle to ...
0
votes
0answers
12 views

How can I get intellisense to work when writing javascript tests in truffle?

Truffle injects a global web3 instance into your tests and also seems to set up some mocha functions in the global scope (contract, describe and it). When I open the test file for a truffle project in ...
0
votes
1answer
354 views

SenTransaction can't send Ether to a contract address

I am using openzeppelin, Ganache and truffle, here's a very simple smart contract for fundraising: pragma solidity 0.4.24; import 'openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol'; contract ...
0
votes
0answers
30 views

throw new Error(“Could not find artifacts for ” + import_path + “ from any sources”);

I’m receiving then ex error: C:\Users\xxxxx\AppData\Roaming\npm\node_modules\truffle\build\commands.bundled.js:455204 throw new Error("Could not find artifacts for " + import_path + " ...
1
vote
1answer
186 views

How to interact with my Rinkeby contract via truffle console?

I've been using truffle console to interact with a contract which I developed locally with Ganache. I'd like to be able to call the contract's methods using the console once deployed to the Rinkeby ...
0
votes
1answer
230 views

Vyper: Truffle test read mapping value inside struct

I have the following struct inside my vyper file: races: public({ start: timestamp, end: timestamp, racersBetHash: bytes32[address], racersBetAmount: wei_value[address] }[int128]) Then I ...
0
votes
1answer
19 views

How to access a public function in solidity?

I have a smart contract deployed on the Testnet here - https://ropsten.etherscan.io/address/0xD99ea28F24317F28291556754edd24AA1352c26e This contract has a public function triggerAgeCount function ...
0
votes
0answers
16 views

Truffle Test Error Revert in Contract Factory

I'm trying to create a contract factory that creates "Oracles". Oracles have state variables that are initialized in the contract constructor, and I'm trying to use Truffle Test to verify ...
0
votes
0answers
13 views

Im learning course on Udemy but I dont understand some functions, pls help me [closed]

This is my code: require('dotenv').config({ path: '../.env' }); const MyToken = artifacts.require('MyToken.sol'); const MyTokenSale = artifacts.require('MyTokenSale.sol'); const { assert } = require('...
0
votes
1answer
21 views

Deploying Smart Contract to Rinkeby

I'm getting the following error when I try to deploy my smart contract to Rinkeby using Truffle: Error: Unknown arguments format passed to new HDWalletProvider. Please check your configuration and try ...
0
votes
1answer
142 views

Error npm installing consensys diligence takehome bignumber util

``` /sudo npm install Password: Unhandled rejection Error: Command failed: /usr/local/bin/git clone --depth=1 -q -b master https://github.com/debris/bignumber.js.git /Users/quantum/.npm/_cacache/tmp/...
0
votes
1answer
9 views

Uncaught ReferenceError: TruffleContract is not defined 2

Firstly, I have viewed (Uncaught ReferenceError: TruffleContract is not defined) and am getting the same error for my smart contract: However, I received this error while having the contract script ...
0
votes
2answers
49 views

Installation of openzeppelin/contracts Library

I have created a node.js project, within which I have created a truffle directory and initialised its project. I have installed the openzeppelin (npm install @openzeppelin/contracts) library in this ...
0
votes
1answer
185 views

why i get a lot of errors when i use truffle?

Seems that i have a lot of lost dependencies for example installing sha3 errors: > node-gyp rebuild C:\Windows\system32\node_modules\sha3>if not defined npm_config_node_gyp (node " C:\Program ...
0
votes
1answer
196 views

Loading truffle library in remix browser IDE

Besides writing smart contracts in the browser, I would also like to write my test in this IDE. Any suggestions how to load the truffle files in http://remix.ethereum.org? I appreciate your help!
1
vote
1answer
15 views

How to set time based function in solidity? [duplicate]

I want to run a function after every 365 days in Solidity. I have tried to use the now keyword, but it is not working (I tried in Remix). How can I get the time?
0
votes
1answer
34 views

How to use truffle-assertions to verify parameters of an emit?

I have not been able to find any resources with usage instruction besides github and blog post by the author On github an example is show as such: truffleAssert.eventEmitted(result, 'TestEvent', (...
0
votes
1answer
217 views

How to chain functions in truffle framework?

I am wondering how to chain functions in truffle testing framework to avoid writing the same code twice. To give an example, I am experimenting with the old version of King of the Ether Throne ...
1
vote
1answer
328 views

I tried to deploy a contract on Ropsten, but always get the following error

PS D:\nodejs\rff\metacoin> truffle --network ropsten migrate Using network 'ropsten'. Running migration: 1_initial_migration.js Deploying Migrations... Error encountered, bailing. Network state ...
0
votes
2answers
178 views

How is gas price too low corrected (truffle deploy)?

truffle.js module.exports = { networks: { development: { host: "127.0.0.1", port: 8540, network_id: "*", gas: 4600000, gasPrice: 4000000 // Match any network id } ...
0
votes
0answers
22 views

Compatible versions of npm, truffle, node and web3 for Solidity 0.7.2

I'm using: Solidity 0.7.2, Node v12.18.4, Truffle v5.1.49 (core: 5.1.49), npm 6.14.8, web3 1.3.0 I want to know what versions are compatible with solidity 0.7.2. Many thanks and have a nice weekend.
4
votes
3answers
4k views

Truffle develop get new contract instance from contract address

From a truffle develop console, is there a way I can get the contract instance from the contract's address? I have a remote ec2 with truffle/geth installed and truffle develop instance running. From ...
0
votes
1answer
1k views

Error: Truffle is currently using solc 0.5.8,

i run migrate in the terminalbut it shows Error: Truffle is currently using solc 0.5.8, but one or more of your contracts specify "pragma solidity ^0.4.27". Please update your truffle config or ...
0
votes
0answers
12 views

How to work with MythX in a Truffle project to analyze a contract?

I work with Truffle and Windows Powershell. I have a smart contract. Now, I want to analyze the contract's security with Mythx. For that, I installed pip3 to install MythX CLI after that. Now, I have ...
4
votes
2answers
327 views

Truffle hangs forever with parity with PoA

I'm trying to create a private chain using parity (PoA) and truffle but when I do truffle migrate it hangs forever with the following output: > [ > { > "jsonrpc": "2.0", &...
1
vote
1answer
132 views

passing defaultBlock “pending” param to a truffle-contract call

I need the pending balance of my contract. As far as I understand I could do it with web3: web3.eth.call(callObject [, defaultBlock] [, callback]) Can I pass defaultBlock to truffle-contract ...

1
2 3 4 5
45