Questions tagged [truffle-contract]

The tag has no usage guidance.

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

when to use MyContract.deployed()?

I was going through truffle-contract docs and came across this function MyContract.deployed() As mentioned in docs this function create an instance of contract abstraction(abi) representing the ...
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
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
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:...
2
votes
1answer
84 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
vote
1answer
59 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 ...
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 ...
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 --...
0
votes
1answer
73 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 ...
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 ...
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 ...
1
vote
1answer
229 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
130 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 ...
0
votes
1answer
100 views

Unable to deploy contract on ropsten

Firstly I installed geth and it's running I created an account and verified keystore file in the location: ~/Library/ethereum/testnet/keystore Then I used: Web3.personal.newAccount('password') ...
1
vote
1answer
247 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
159 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.
1
vote
3answers
430 views

How to transfer token to an address?

Im using truffle and openzeppelin for issuing my ERC20 token. I already can add and buying the token, but still cannot transfer the token to another. when i console.log the contract, it show me: and ...
1
vote
1answer
123 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 ...
0
votes
1answer
2k 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 ...
27
votes
13answers
24k 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
210 views

two issue about install web3.js through and invoke web3.eth.methods

First, I install type to the code like npm install web3 in the terminal while the first issue occurs (Environment1).Second, I change the version of node 、npm (like Envirnment 1=> Environment2) and ...
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. ...
2
votes
1answer
327 views

Pending transactions are not mined

Preconditions I'm running a private network with Geth, having custom smart contracts deployed by Truffle and a simple frontend which using Metamask as a provider to connect the network. Versions ...
0
votes
2answers
658 views

How to access Truffle deployed contracts with app's javascript code?

I have some smart contracts deployed with Truffle on the local Ganache network, but I don't know how to access it with the app's javascript in order to make function calls to the contract. How would I ...
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&...
1
vote
2answers
526 views

Out of gas when calling smart contract function from web3/Meteor Dapp

The following smart contract function works when called in the Remix-Solidity IDE and connected to testrpc. function submitAsset(string ownerName, string assetName, string assetDesc, string barcode, ...
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
2answers
399 views

How to detect what instruction caused “truffle test” to result in “invalid opcode” error?

I wrote a test for my contract and it returns invalid opcode as a result. Full output: 1) Contract: FPCoin1 One can purchase tokens for ether: Error: VM Exception while processing transaction: ...
2
votes
3answers
561 views

writing tests in solidity for functions returning multiple values

I have a function that returns multiple values function getInfo(string id) returns(string x,string y){ bytes32 _id= strToBytes(id); return (infostruct[_id].x,infostruct[_id].y) ; } Now i want ...
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 =...
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
1k views

Truffle Error : VM Exception while processing transaction: revert

I am trying to call following function of smart contract from App.js: function addCandidate(bytes32 _name, bytes32 _party) public{ //require(msg.sender == votingAdmin); //if(msg.sender != ...
0
votes
1answer
464 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
1answer
2k views

*contract* has not been deployed to detected network (network/artifact mismatch)

I'm trying to launch my first DApp using truffle and testrpc. I keep running into the above error once the web page loads. I looked at the Truffle Contract json object and the networks value is empty (...
0
votes
2answers
90 views

Solidity: uint parameter not being set properly

Testing my contract locally with truffle. I have a function with the signature: function purchase(address buyer, address seller, bytes16 bookId, uint tokens) public onlyOwner returns(bool success) ...
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
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
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
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
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
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: ...
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 ...
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, ...
0
votes
1answer
90 views

How to store the user activity in smart contract or can I use smart contract to track all user activity on my site?

New to blockchain and smart contracts. Been doing research and I am having a CRUD application in SQL Server. I want to use ethereum private blockchain to record all the user activity. Can I use for ...
0
votes
1answer
233 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 ...
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....