Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [truffle-contract]

The tag has no usage guidance.

1
vote
0answers
8 views

During gas-free transaction get an error “No relay responded! 4 attempted, 4 pinged”

I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless However, when I'm trying to write some tests it fails and provides me the following error Error:...
0
votes
0answers
6 views

DeclarationError: Identifier not found or not unique and Undeclared identifier

I am trying to create a crowdsale contract using zeppelin. But i am facing following errors. CrowdSale.sol:6:46: DeclarationError: Identifier not found or not unique. contract EdCoinCrowdSale is ...
0
votes
0answers
27 views

How to send a value from interface to smart contract function

I have the below contract to create document details: pragma solidity ^0.5.0; contract Documents { struct Document { uint256 creationDate; uint32 documentCreationTimestamp; ...
-1
votes
0answers
28 views

Smart contract truffle test fail - no events were emmitted

Here's my smart contract: pragma solidity 0.5.0; // Basic app of how to store and retrieve a document id for IPFS stored on Ethereum network contract BasaltStore { // struct of how a document ...
0
votes
1answer
18 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
1
vote
2answers
26 views

How use Truffle Framework [closed]

Anyone please help me to understand what is exactly Truffle & Ganache ? How to install & use Truffle ? Please reply who are know this.
0
votes
0answers
13 views

truffle migrate --network ropsten issues

When i run truffle migrate --network ropsten i don't see the contract deployment but just Compiling your contracts... =========================== > Everything is up to date, there is nothing to ...
1
vote
3answers
21 views

Issue deploying this contract

This is a contract im trying to deploy and i think its an abstract contract as most of the functions dont seem to be implemented... anyway the issue im facing is that truffle is telling me i cant ...
0
votes
0answers
31 views

I am working on a smart contract. I am getting the following error while running the smart contract in the browser console

Uncaught (in promise) ReferenceError: TruffleContract is not defined at Object.loadContract (app.js:55) at async Object.load (app.js:8) here is my code of app.js file App = { ...
0
votes
1answer
105 views

TypeError: Data location must be “memory” for parameter in function, but none was given

Contract fail to compile in IDE Remix.due to the following error: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given. version:0.5.6+commit....
0
votes
2answers
25 views

Getting error in truffle migrate

I am trying to compile a sample solidity contract,sampleapp.sol. The code is given below: pragma solidity >=0.4.21 <0.6.0; contract SimpleStorage { uint storedData; function set(uint ...
0
votes
1answer
15 views

Cannot retrieve data from smartcontract during tests

I am writing truffle tests for my smart contract solidity version 0.4.24. The tests are emitting events to write data to memory through smart contract. But I am unable to retrieve data from functions. ...
0
votes
1answer
53 views

Invalid type for argument in function call. Invalid implicit conversion from mapping

I have defined struct for saving data to ethereum blockchain. I am using uint to map the data stored with a unique ID. I am using truffle framework to write smart contracts with solidity version: 0.4....
0
votes
2answers
256 views

Truffle compile and migrate not working

I have a geth node running on my laptop. This is the command I used to start geth. geth --port 4321 --networkid 1234 --datadir=./dataDir --rpc --rpcport 8543 --rpcaddr 127.0.0.1 --rpcapi "eth,net,...
0
votes
0answers
101 views

Truffle: Error: Could not find a compiler version matching 0.5.0

I wonder why I get the error when I have v0.5.0 everywhere and do the following: In my Action.sol: pragma solidity ^0.5.0; In Migrations.sol: pragma solidity >=0.5.0 <0.6.0; When running truffle ...
1
vote
1answer
30 views

Truffle test failing

i am learning solidity contracts and ethereum dapps. I have created a smart contract for creating a ERC20 token on using truffle dev environment. pragma solidity ^0.5.0; contract LearnTokens { ...
0
votes
0answers
21 views

cannot retrieve token price

i am trying to code a decentralized application and what i am trying to do right now is to get the token price of 1000000000000000 and display it. but when i try to get token price i keep getting 0. ...
0
votes
0answers
82 views

How to call contract method from specific address and private key without Metamask check

Good morning, I need to known how call contract method in javascript from specific address(and relative private key) without the check of Metamask. I explain better. This is an example of js code, ...
2
votes
1answer
115 views

Cannot deploy contract on private network with truffle: gas required exceeds allowance or always failing transaction

I'm writing a contract based on the ring mixer contract from here https://ropsten.etherscan.io/address/0x5e10d764314040b04ac7d96610b9851c8bc02815 I've tested it with ganache. Everything worked fine ...
0
votes
2answers
118 views

solidity code compilation error?

pragma solidity ^0.5.0; contract Ballot { struct Voter { uint weight; bool voted; uint8 vote; // address delegate; } //modifer modifier onlyOwner () {...
1
vote
1answer
82 views

UnimplementedFeatureError: Encoding type “struct BiddingContract.Bidder memory” not yet implemented

The code is broken with the new upgrade v0.5, using Truffle v5.0.1 (core: 5.0.1) struct Bidder { address bidders_address; uint productId; uint bidValue; } struct Product { uint ...
0
votes
1answer
69 views

truffle-contract: Contract has not been deployed to detected network (network/artifact mismatch)

I am running a private network and would like to use truffle-contract to interact with the contracts. Unfortunately it gives me this error: Error: Contract has not been deployed to detected network (...
0
votes
1answer
174 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: ...
0
votes
1answer
55 views

How does truffle get the address of the contract only by it's name?

When executing the command truffle(develop)> let instance = await MetaCoin.deployed() How does truffle get the address of the contract that is deployed ?
0
votes
1answer
63 views

How to change the account that is interacting with the deployed smart contract on Ganache? [duplicate]

When I enter truffle console and start interacting with the deployed contract truffle uses the first address, how to change the address for testing ? user@user:~/workspace/smart-contract$ truffle ...
0
votes
0answers
44 views

Truffle-contract cannot find module 'debug'

I'm trying to connect my smart contracts to a frontend app using web3 and the truffle-contract node package. In my client-side javascript file, I am requiring the package as follows: import contract ...
0
votes
1answer
26 views

Unable to use call.value to send the ether to another contract

Block Builder! I create a bank and client contracts, in order to reproduce DAO attack event. The client can deposit, but can not withdraw. I enclose the repo from Github here: https://github.com/...
0
votes
0answers
42 views

Struct Mapping: DeclarationError: Identifier not found or not unique for

Using openzepplin version 2.0.0 and solc version 0.5. I am writing an ERC721 token contract on truffle. Truffle compiles with no error on solc 0.4.23. I had to upgrade to 0.5 due to openzepplin ...
1
vote
1answer
32 views

Scope in events in web3 1.0 [closed]

Inside the callback of an event, how do I get the scope outside the function? Specifically, in the following scenario, I want the web3 object: (using truffle-contracts and web3 1.0 here) ... const ...
2
votes
0answers
55 views

this.contract.deployed() is not a function

I'm working on making a React frontend for my smart contract, but I'm having problems connecting it into my React code. Here are the relevant portions of my code: import TruffleContract from '...
-1
votes
1answer
67 views

Problem with the compilation in the truffle framework

I made a smart contract in Remix-Solidity IDE, when I compiled it I had no errors and I was able to remove the contract but when I tried to use the truffle for my Dapp and compiled it it showed me ...
1
vote
0answers
101 views

How to use the latest version of Truffle Contract in a web page?

I'm trying to use version 4.0.0 of truffle-contract in a browser app, so no NodeJS, no require or anything. So I followed the instructions in the doc, downloaded truffle-contract in non-minified ...
-2
votes
1answer
74 views

ParserError compiling Smart Contract, what's wrong?

I'm getting this error when trying to compile a contract using cmd on windows: Error parsing C:/Users/alexa/Desktop/contracts/contracts/ApprovalContract.sol: ParsedContract.sol:6:37: ParserError: ...
2
votes
0answers
76 views

Installing Truffle without npm

I'm a student trying to install a truffle test RPC client (just for simple contract deployment in small scale). I am using a remote Ubuntu machine in my university, and i don't root privileges. ...
2
votes
1answer
62 views

TruffleContract At() function with Drizzle

I am learning the Drizzle framework after I did a project using TruffleContract abstractions in Javascript (DApp). I have multiple instances of a contract and I am not able to access at the instances ...
1
vote
1answer
84 views

Truffle-contract installed, but receiving error in Chrome console: Uncaught Error: Cannot find module 'truffle-contract'

I am working on my first end to end ethereum project. A problem that I am stuck on is that I have installed 'truffle-contract', but when I run my server and open the project in the Chrome browser, the ...
0
votes
1answer
80 views

Set up backup from private Ethereum (Ganache) [duplicate]

I have created an ethereum application with Ganache and truffle js. i have installed ganache in a server, and th application work. but when i stop the server i lose the the smart contract that i have ...
0
votes
1answer
117 views

Loading multiple truffle artifacts from a single sol file

Big picture: How do I get multiple contract instances from a single sol file using truffle-contract? I have two Contracts in my .sol file (it's more of a contract factory) const artifacts = require(...
0
votes
1answer
30 views

Ownership trasfer to crowdsale contract fails while deploying in truffle

I have created a "Token" and the "Crowdsale" contract as mentioned in the openzeppelin. Below is my deployment code in truffle. I am new to ICO related coding and solidity. The question may be very ...
0
votes
1answer
58 views

Deploying fails with different compile version

I'm trying to implement a simple card game. Actually, everything is working fine. Until I tried to move from 0.4.0 to 0.4.22. Any idea what is going wrong? Thanks a lot. And here the code: pragma ...
0
votes
1answer
91 views

Truffle Flattener creates empty flat file

Using trufffle-flattener, I am trying to create a flat file merging all the related solidity based codes. After executing the flattening scripts, I see only the empty flat file getting created. Could ...
0
votes
1answer
22 views

Deploying using Truffle unbox

The following code is taken from truffle unbox initContract: function() { $.getJSON("adding.json", function(addingdappfrontend) { App.contracts.Add = TruffleContract(...
0
votes
1answer
1k views

Uncaught ReferenceError: TruffleContract is not defined

I am working on a smart contract. When I try to serve my smart contract via lite-server I see following error in the browser console Here my app.js source code: https://pastebin.com/UjFuYCyQ I have ...
1
vote
1answer
41 views

How to process Smart Contracts payable functions in batch?

I am aware that metamask will enable effective security for processing via the web browser a payable function action to a smart contract. What happens in batch? I have an API service which then ...
2
votes
2answers
90 views

Truffle interaction with my smart contract getting Vm exception

pragma solidity ^0.4.23; contract Hotelbooking { event Transfer( address indexed _from, address indexed _to, uint256 _value ); mapping(address => uint256) public ...
1
vote
1answer
145 views

truffle-contract cannot deploy in node js

This is the error I get. internal/modules/cjs/loader.js:631 throw new ERR_INVALID_ARG_TYPE('id', 'string', id); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of ...
0
votes
1answer
40 views

How can I persist the chain state of Truffle develop? [duplicate]

Is it possible to persist the chain state of Truffle develop? If my truffle console crash, can I restore the chain state?
-1
votes
1answer
59 views

I have deployed my contract using truffle but to see my accounts i am using web3 can any one explain what is going inside my contract while deploying

web3.eth.accounts [ '0x5aad8308d0c45d2b9fc1c465316ba071d2eb6f9c', '0x9d73990623df116eb56d300773aa458a11b11e4b', '0x1ea4dc6c3ab6d9ddca32083e3d5313ee319abd29', '...
1
vote
1answer
113 views

Error: Web3ProviderEngine does not support synchronous requests

Error: Web3ProviderEngine does not support synchronous requests. I have an error when deploying contract to rinkeby provider const HDWalletProvider = require('truffle-hdwallet-provider') module....
2
votes
2answers
50 views

Working of Truffle

The following is my code in solidity pragma solidity ^0.4.2; contract DappToken { //Constructor // set no of Tokens // Read the total number of Tokens uint256 public totalSupply; ...