The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
18
votes
1answer
14k views

Steps to deploy a contract using MetaMask and Truffle [closed]

i'm noob, I want to deploy my contract on Ropsten network with MetaMask & Truffle, plz explain to me the steps to deploy it.
26
votes
13answers
23k views

How to upgrade solidity compiler in truffle

I couldn't find a way to upgrade a version of truffle solidity compiler. Also curious how to see that information for deployed contracts in truffle console
25
votes
4answers
4k views

what does `deploy.link` exactly do in `truffle`

Please explain use cases for deploy.link() function in migrations in truffle framework. How would you use it and for what.
7
votes
2answers
1k views

Debugging JS unit tests with truffle framework in VS code

Is there a way to debug JS unit tests for smart contracts? I use VS Code for development, and when I try to run a Mocha debugger it complains that artifacts is not defined. I briefly looked at truffle ...
1
vote
1answer
606 views

What is the suggested way to pass in large amounts of data into solidity contract?

If a Member(struct) has 10 fields, the contract stores an array of Members, how would I pass 100 Members worth of data into the contract?
11
votes
3answers
6k views

Truffle invalid address

With Truffle 3.0 when I call one of my contract's function, in console I have this error: Uncaught (in promise) Error: invalid address I found this workaround, and in my code I try this with no ...
1
vote
2answers
1k views

how to call contract method using sendRawTransaction

const privateKeyStr = ""; const privateKey = new Buffer(privateKeyStr, 'hex'); const contractAddress = '0x'; const COO = '0x'; let contractAddress = '0x'; let myContract = ...; //some other articles ...
5
votes
4answers
905 views

Unhandled promise rejection(gas limit) when deploying Contract to rinkeby using truffle-hdwallet-provider

I am trying to Deploy a beginners contract onto the rinkeby test network through Infura node. It is throwing the following error. (node:35183) UnhandledPromiseRejectionWarning: Unhandled promise ...
1
vote
4answers
2k views

Module not found: Can't resolve './contracts/SimpleStorage.json'

I am new to solidity, truffle and i tried react-box from Truffle and i get the following error. I am using Macos. Here is the basic steps npm install -g truffle truffle develop compile ...
1
vote
1answer
263 views

Implementation of an Allowance Crowdsale. Token Interface / _prevalidatePurchase-/_delivertokens-function

I am new to solidity coding and after I created some basic contracts as well as a ERC20 token contract I wanted to create a crowdsale contract. Now I am stuck and I have a question regarding the ...
5
votes
1answer
436 views

Best practice for sharing truffle build files between developers

I am working on a few projects using truffle, as you know truffle compiles and migrates contracts to various ethereum networks e.g. MyContract.sol produces MyContract.json which contains a reference ...
3
votes
1answer
2k views

Truffle error: Cannot read property 'call' of undefined [duplicate]

I am trying to run the following contract in truffle, which is pretty much the same HelloWorld but I kept the name MetaCoin from the truffle example. I have read this, this, and this posts related to ...
3
votes
2answers
1k views

Truffle on Windows 10: how to unlock an account for migration to a private network

I try to migrate a smart contract to a private network via truffle on Windows 10. I specify a certain account in truffle.js and so far I get the following error: Error encountered, bailing. Network ...
1
vote
0answers
107 views

Can't call another contract constant function in Remix in Web3 provider mode, but it works in Javascript VM

Remix behaves differently when running Javascript VM and web3 provider mode. I have two contracts: contract ERC20Basic { function totalSupply() public view returns (uint256){} function ...
0
votes
2answers
390 views

truffle-contract error: Number can only safely store up to 53 bits

I am using truffle-contract with a local quorum node and try to execute a smart contract method, but getting this error: Error: Number can only safely store up to 53 bits That's the way I do it: ...
4
votes
1answer
8k views

how to know the contract address which truffle is deploying with

I am using truffle migrate --reset --compile-all to deploy the contract to local network but in order to use new web3.eth.Contract(jsonInterface[, address][, options]), i should be able to know ...
1
vote
1answer
583 views

Undefined in truffle-contract initialization

why I always have undefined from contract(_contract).setProvider(this.web3Provided); Component: import React, {Component, PropTypes} from 'react'; import { default as Web3 } from 'web3'; import { ...
1
vote
1answer
374 views

Accessing/Modifying Options Parameters in Contract

I'm using truffle and metamask to deploy a very simple contract that enables the transfer of ether from one test account to another. How do I use my JavaScript file to access the options parameters ...
1
vote
1answer
35 views

Truffle Javascript tests won't change Contract State (Contract State won't Change)

I reviewed a similar answer but it didn't work. Right now I'm starting with an Example trying truffle, I did a small Echo project based on the Pet Store Box from Truffle. And i'm having some problems: ...
0
votes
1answer
126 views

truffle-contract: cannot test method before real consume ether method

I am using truffle-contract for connecting between frontend and smart contract. Currently, I can call method on smart contract and can consume ether successfully. const result = await instance....
0
votes
1answer
59 views

How to use function modifier to control contract function access right?

I deployed a ERC20Mintable token in truffle environment(the source file is ERC20Mintable.sol). The mint function is declared with onlyMinter modifer: contract ERC20Mintable is ERC20, MinterRole { ...
0
votes
1answer
111 views

Truffle: how to setup some smart contract's attributes before writing test

For example I have a smart contract with 2 attributes: contract SimpleSmartContract { uint256 currentPrices; mapping(uint8 => uint256) public priceIncrements; } When I write test, I want ...
0
votes
0answers
186 views

Truffle Drizzle: Passing String address results in Invalid Number of Parameters

I have a view function in my contract that takes an address as a parameter and returns a uint: function getNumber(address _address) public view returns (uint) { require(_address != 0x0); ...
0
votes
1answer
147 views

Error linking library when deploying with via Infura (ropsten)

I'm trying to deploy via Infura to ropsten and get this error. The local deployment works without a hitch. Linking SafeMath to contracts Error encountered, bailing. Network state unknown. Review ...
0
votes
1answer
404 views

Truffle Exec Gets Stuck [closed]

I want to exec a script in the truffle console. script const artifacts = require('./build/contracts/Message.json') const contract = require('truffle-contract') const Message = contract(artifacts); ...
0
votes
1answer
360 views

“instance.at(addr) is not a function” in truffle console (access to non-migrated contracts)

I have a setup with one contract that is a singleton and is migrated to e.g. a testnet through the truffle console. This contract "creates" new contracts, which I want to access in the truffle console....