Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
17 views

No response from live networks except ganache when interacting with truffle-contract

I am developing a Web3 app for a private Ethereum network. Throughout the development I used ganache-cli and now I wanted to test in the private live network. I can successfully interact with the ...
0
votes
1answer
13 views

Truffle Error: ContractName has no network configuration for its current network id (1575203139857)

Im doing the tutorial at https://github.com/ConsenSys-Academy/proof-of-existence-exercise and running into the following error: $ truffle console truffle(development)> var poe = await ...
0
votes
0answers
21 views

How to build a P2P wager contract with Solidity

I am looking to build a contract with Solidity that will take wagers on a football game between a bunch of friends. Each user should be able to place a bet on either team, with each bet to be added to ...
1
vote
1answer
57 views

Pass arrays to solidity's function from truffle

I am getting ALERT: Transaction Error. Exception thrown in contract code in metamask when calling addBet function from truffle. The function works without any errors when called from remix. The ...
0
votes
0answers
17 views

Can't migrate, ropsten randomly throws out of gas

I have the following migration files with 50 contracts' deployment and their setup (calling each other functions like privileges, access and so on): On the development network everything works fine. ...
0
votes
0answers
240 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
1answer
58 views

Cannot Find Module Error for Truffle-contract

Error:- Uncaught Error: Cannot find module './truffle-contract.min.js' at c (web3.min.js:1) at c (web3.min.js:1) at index.html:27 <!DOCTYPE html> <html lang="en"> <head&...
0
votes
1answer
16 views

How to get an instance for a previously migrated contract with truffle?

Scenario: Token contract migration file Dapp contract migration file I want to interact with the already deployed token contract in the dapp contract migration file.
0
votes
0answers
19 views

Ganache does not show the transferred amount.but it shows theme in account section

as shown in the picture the amount of value which is transferred to contract is shown in the transaction section of Ganache. I mean it shows the amount which is transacted to the address. in the my ...
0
votes
0answers
42 views

Can I use a truffle-contract instance in the data field of web3.eth.sendSignedTransaction?

I use truffle-contract for contract abstraction. const myContract = TruffleContract(MyContractArtifact); myContract.setProvider(web3.currentProvider); I'm using Infura as the web3 provider so need ...
0
votes
1answer
309 views

error: VM Exception while processing transaction: revert SafeMath: subtraction overflow on migrating crowdsale conract

I am developing the token sale Dapp using openzepplin-solidity version 2.3. While migrating, I got the following error. Returned error: VM Exception while processing transaction: revert SafeMath:...
0
votes
1answer
75 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
54 views

Contract function call error “TypeError: Cannot read property 'isMinter' of undefined” using Truffle tool

I deployed a ERC20Mintable token in truffle env(the .sol file is ERC20Mintable.sol). 2_mintable.js ============= Deploying 'ERC20Mintable' ------------------------- > transaction hash: ...
0
votes
0answers
41 views

How to Access Value of Drizzle ContractData Method

I would like to access the value of a Drizzle ContractData method: this outputs: 1000000000: <ContractData contract={name} method="getValue" /> Now, ...
1
vote
1answer
15 views

Doubt regarding gas cost

Consider im having to deal with 3 uint8 values each of which are to be stored for each user. Is the gas cost the same if i use 3 different arrays or if i use a structure array which contains the 3 ...
0
votes
0answers
142 views

Hoiw to convert string to address with web3

I am getting address value with html input as string value how do we convert the string to address for parsing with truffle-contract. Here's the method I am using: registerAirline : async() => {...
0
votes
1answer
168 views

Why Could not find artifacts for contract from any sources

I am using windows 10 with truffle and ganache-cli. I have 2 contracts file to be deployed contain interfaces of other contracts defined within the contract: Contracts: ERC721Mintable.sol Ownable ...
0
votes
0answers
68 views

Contract has no network id set, cannot lookup artifact data

I am using web3 v1.0.0-beta.37 and truffle contract for server.js configuration. I have defined two contracts FlightSuretyData.sol and FlightSuretyApp.sol FlightSuretyApp contract access functions ...
1
vote
3answers
130 views

How do I determine the network within a truffle exec script?

I'm writing a script to be executed with truffle exec and I need to add some logic conditional on the network we're calling truffle exec with. This is (roughly) what I want in my script: const ...
0
votes
0answers
75 views

Invalid number of arguments in Solidity function

Why am I getting Uncaught (in promise) Error: Invalid number of arguments to Solidity function sol file: uint id = 1; struct Multihash { bytes32 digest; uint8 hashFunction; ...
0
votes
1answer
91 views

async handleSubmit(event) not working

This is the full code of App.js import SimpleStorageContract from "./contracts/SimpleStorage.json"; import getWeb3 from "./utils/getWeb3"; import "./App.css"; class App extends Component { state =...
1
vote
1answer
67 views

ParserError: Expected token Semicolon

I got this particular Parser error and can you help me how to fix this issue:while using this code pragma solidity ^0.4.17; import "../node_modules/zeppelin-solidity/contracts/token/ERC20/...
1
vote
1answer
38 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
1answer
38 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
31 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; ...
0
votes
1answer
104 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
107 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
2answers
223 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
4answers
51 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
56 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 = { ...
1
vote
2answers
498 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....
1
vote
2answers
189 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
33 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
188 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
1k 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
2answers
335 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
69 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
38 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
162 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, ...
3
votes
1answer
555 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
343 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
271 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
221 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 (...
1
vote
2answers
450 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
163 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
198 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
104 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
32 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
112 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
40 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 ...