Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
226 views

Error on Truffle console - “missing ) after argument list”

while declaring a variable in truffle console error popped up. Code:- var ss undefined truffle(development)> ScoreStore.deployed().then(function(deployd){ss=deployed;}); SyntaxError: missing ) ...
5
votes
4answers
4k views

How to access the deployed contract's address from Truffle JS tests?

I've written a test that involves returning the token balance that the contract itself holds. In the contract source file I would access the balance using the function getBalanceOf(this). However, ...
-1
votes
1answer
620 views

How to copy bytes of two input strings and concatenate them in Solidity? [duplicate]

I read on a few other posts with solutions similar to my question but none of them seemed to work when I compiled them on solidity. I am trying to simply add two strings and return the value. ...
0
votes
1answer
2k views

How to connect to contract via javascript deployed using truffle

I have deployed a contract using truffle on the testrpc network. I need to write a Javascript code that can connect to the contract and run the functions of the contract but I can't figure out how to ...
2
votes
0answers
286 views

Truffle Contract transaction doesn't wait to be mined

I have a thing that has been annoying me when using truffle-contract, ever since updating from Truffle 2 to Truffle 3. I am no longer able to run transactions synchronously - even though it is stated ...
2
votes
2answers
268 views

Difference of behavior between Metamask and direct connection to testrpc

I’m guessing there is an obvious answer to this question but I’m just completely missing the point. I have a very simple contract with 2 functions: a setter that changes a bunch of fields, and a ...
2
votes
2answers
2k views

How to generate truffle artifact for already deployed contract for use with web3

I'm building a dapp and would like to interact with an already existing contract. Previously working with Truffle I was writing my own contract, compiling it and deploying it. This process generated ...
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.
0
votes
1answer
525 views

Call not working on declared variable in a contract with truffle

I have created a simple contract with Truffle to test things out. I am using testrpc with this. pragma solidity ^0.4.11; contract HelloSystem { address owner; function HelloSystem() { ...
12
votes
3answers
3k views

Truffle & Web3 1.0.0-beta : does it work for anyone?

I'm trying to make the latest Truffle (3.4.3) and Web3 (1.0.0-beta11) to work together in a React app. It fails when I try to call myContractInstance.deployed() import { default as Eth} from 'web3-...
0
votes
1answer
294 views

Solidity contract functions not returning correctly with Truffle, but working on Remix

I'm testing my contracts using Truffle, but my functions are not returning the correct uint, despite doing so when testing in Remix. This is my Test.js code: var EventContract = artifacts.require("./...
1
vote
0answers
146 views

What is the ether-pudding / truffle-artifactor front end?

I am trying to figure out how to interact with a smart contract deployed through truffle. I am looking at the truffle documentation here. They are describing how to call a function in a deployed ...
5
votes
1answer
1k views

Contract migration error: The contract code couldn't be stored, please check your gas amount

I am trying to deploy my simple ERC20 token with locally installed Truffle, but received this error: truffle migrate --reset Using network 'development'. Running migration: 1_initial_migration.js ...
1
vote
1answer
373 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 ...
2
votes
2answers
354 views

What is the {from: account_one} third parameter in metacoin.js test example

When working through the MetaCoin sample project; within the MetaCoin.sol file we have this method: function sendCoin(address receiver, uint amount) returns(bool sufficient) { if (balances[msg....
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.
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
0
votes
1answer
452 views

Pass address[] array to Truffle deployer (MultisigWallet)

I am trying to deploy the MultisigWallet contract on testrpc. However, I can't figure out how to provide the address[] _owners constructor parameter in the deployment command. I've tried several ...
1
vote
0answers
275 views

How does Truffle Deployer translate arguments from JavaScript to Solidity?

I have a Truffle migration that looks something like this; var MyContract = artifacts.require("./MyContract.sol"); module.exports = function(deployer) { deployer.deploy(MyContract,[ { "...
1
vote
0answers
30 views

Accessing other contract variables(address)

I'm creating a marketplace, which will have two token contracts representing currencyToken and assetToken. I've set separate owner's for both of the token contracts, in their constructor. But when I'm ...
1
vote
1answer
604 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?
1
vote
1answer
1k views

Invalid JSON RPC response error when using truffle migrate + geth

I have been able to successfully deploy contracts on the ethereumjs testrpc with truffle without any issues. Now I wanted to do the same on a remote node running geth 1.6.1 but it gives me a JSON RPC ...
2
votes
1answer
98 views

Ethereum Contract testing

I'm trying to test one of my functions in a contract which returns a bool value, and in the process of debugging I tried to retrieve the output using console log and I get the following hash: ...
5
votes
3answers
2k views

accessing truffle contract abstractions from external JS script

When writing tests in truffle (v3.2.1) I can forget about things like a contract's ABI and address and just use ContractName.deployed() to interact with a contract on my testrpc chain. How can I mimic ...
1
vote
1answer
220 views

Best practices for truffle app

Hi I'm wondering what are some best practices in terms of directory and file structure when building a truffle application, specifically within the app directory. I'm building a Dapp with too many ...
2
votes
1answer
718 views

Truffle and contract with an Address type constructor parameter

When I add new contract (testrpc) with truffle with parameter of type "address" the reading value of this property seems wrong (always 0x0000000000000000000000000000000000000000), I do not find the ...
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
1answer
609 views

truffle test - not able to understand why the control jumps to different test case

I am trying to write unit test cases in truffle framework.I am able to write and execute them. However, whenever I have 2 or more test cases the control jumps from 1 test case to another. For ex: In ...
1
vote
1answer
247 views

Cannot access variables in contract

This is my contract- pragma solidity ^0.4.0; contract helloworld { uint public balance; function helloworld(){ balance = 1000; } function getBalance() returns(uint) { ...
1
vote
1answer
404 views

Design principles for a file sharing contract

I'm building a file sharing solution, which can benefit from the public ledger. I picture, that each file would have its own contract with an owner, and list of Addresses and their permissions on the ...
1
vote
1answer
168 views

Deploy contract without losing database

I have implemented improved token at: https://ethereum.org/token#full-coin-code I use truffle to test and use migrations to deploy contract. When I want to deploy a new version of MyAdvancedToken, I ...
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 ...
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 ...
2
votes
2answers
1k views

Truffle - Migrate Contract to a private network in Azure

I try to migrate a Smart Contract to a private network running in Azure. It works fine with testrpc but when I try to migrate it to the (remote) private network I always get the following error: ...
1
vote
1answer
581 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 { ...