Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
3answers
1k 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 ...
0
votes
1answer
963 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 =...
3
votes
3answers
951 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 ...
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
48 views

How do i keep a contract's value changed by another one constant?

There are 3 contracts; A, B, and C. C has a state variable that with a default value. A changes that state variable to Yerevan. After that, B sees that variable. Evaluating by A is successful but B ...
0
votes
0answers
12 views

How to pass a blank bytes calldata into a solidity function call?

I have a function that looks like this: function foo(uint _someVar, bytes calldata _data) public { ... } Then I make a call to it from another function with "" as _data: foo(123, "&...
2
votes
2answers
138 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
1answer
196 views

Truffle Contract sendTransaction not immediately returning transaction hash

I am using Truffle Contract to call a Smart Contract method that writes to the ethereum blockchain. My web3 client is connected to my own Open Ethereum node. Below is the code (nodejs) that I am using ...
0
votes
1answer
2k 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
103 views

who has any idea about this error please?

Error: Returned error: VM Exception while processing transaction: revert SafeERC20: low-level call failed -- Reason given: SafeERC20: low-level call failed.
0
votes
0answers
10 views

error.message.indexOf is not a function truffle ganache

for truffle developers var Election = artifacts.require('./Election.sol'); contract("Election",function(accounts){ var electionInstance; it("throws an exception for double voting"...
0
votes
1answer
181 views

Why my contract binary does not set?

My project is in Truffle. I programmed a smart contract and want to deploy it with JavaScript. But the following error occurs: Error: Contract error: contract binary not set. Can't deploy new instance....
0
votes
1answer
599 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 ...
0
votes
1answer
216 views

My contract is deployed but instance is undefined

I have deployed a contract on the ganache blockchain successfully using truffle. In the truffle console, I can call the contract fine truffle(development)> MyCoin [Function: TruffleContract] { ...
0
votes
2answers
193 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
2answers
199 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) ...
1
vote
2answers
39 views

When i call a function: Error: Returned error: VM Exception while processing transaction: invalid opcode

I work on Truffle. My contract is A and its function is infoRep(). infoRep() returns some data. Whenever i call the function in Truffle console the below error occurs: Error: Returned error: VM ...
2
votes
1answer
21 views

Can I Specify gas fees in the smart contract?

Deploying my contract on rinkeby cost ~12 USD in gas fees (using truffle cli). Is it possible for me to specify gas fees/set a limit in the smart contract so it costs me 0.5 USD, but takes longer to ...
5
votes
2answers
675 views

Printing uint256 value to console while debugging with Truffle

I am trying to figure out how to print values to the console while doing truffle debug <txhash>. So far I have tried using an event called "TestValue", but I am not seeing the output in the ...
0
votes
1answer
95 views

How to save the contract instance on a mapping in solidity?

I have created an EnergyExchange contract in my React app.js that it is deployed in the network. Inside the EnergyExchange contract there is a function to create Agent contracts. What I am trying to ...
0
votes
0answers
27 views

Deployed truffle contract: Cannot create instance of <contract>; no code at address

I deployed my contract at 0xa518a732606baae1c72490313cb7bb42c62c7a50. Now, what I try to do is to interact with my functions.. I've created an node.js application over web3 and truffle/contract but I ...
0
votes
1answer
125 views

Im getting the following error: ParserError: Expected primary expression. struct ManagingOrder.Parking memory new_Parking = Parking({

Im using blockchain technology for the first time, for a college project. Im trying to run a smart contract from Github. After debugging the errors shown while compiling the smart contract (in ...
1
vote
1answer
36 views

Is it possible to use a smart contract without connecting to a wallet?

I've a web application where I have some structure with ids and a function to get prices by an id from an smart contract, and I've payable functions. I'm not able to show prices for each item if I don'...
1
vote
3answers
1k 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
358 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 --...
2
votes
1answer
632 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
93 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
0answers
29 views

How do I manipulate data in multiple contracts and output them

I am trying to manipulate data I retrieve from my contract, and then display it. Currently, I am running into 2 problems: 1- I am unable to manipulate the data correctly. 2- I am unable to display ...
0
votes
0answers
16 views

Received DeclarationError when calling other contracts file name and its function

So I created 2 contracts where the first one will be the app logic contract and the other one is the database contract. So I tried to "truffle compile" my contract but receive ...
0
votes
0answers
25 views

Truffle Mainnet - “No contracts deployed.”

I really need help! I created an ERC721 smart contract and deployed into the rinkeby test network. All was nice, after that I deployed into mainnet. I set the gas price to 65 Gwei. Now the contract is ...
0
votes
0answers
21 views

“No Contracts Deployed” TRUFFLE ERROR PLEASE HELP!

I really need help! [12:20 PM] i deployed an erc721 smart contract to testnet, it worked fine! Then i deployed it into the live network. It worked. But, i have an other script to mint my tokens. I ...
1
vote
1answer
438 views

connecting to Metamask using React.js and Next.js without having to refresh the page each time

StackShare question Hello, I am having a problem with connecting to Metamask dynamically. I created a voting website using React.js and Next.js, and was using UseEffect() to connect to Metamask. ...
1
vote
2answers
890 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, ...
0
votes
1answer
168 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
1answer
155 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
29 views

“Truffle Networks” spits out error and can't migrate to Mainnet

I'm trying to deploy to Mainnet (for the first time) but the initial migration (1_initial_migration) is getting stuck. Deploying to Kovan works fine and is super fast. I have enough Eth to deploy to ...
1
vote
1answer
297 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 ...
1
vote
1answer
123 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') ...
0
votes
1answer
4k 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 ...
2
votes
2answers
159 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
0answers
19 views

VM Exception when accessing mapping

I created a contract with a User struct than contains an age, a first name, and a last name. The function getUser() should return this information for an inputted address. But when I call my getUser() ...
0
votes
1answer
234 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
1answer
287 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
1answer
24 views

Create different contracts in run-time

I am new to solidity :) I try to create a general contract which its attributes are known at run-time. Suppose we have the following contract: contract Product{ string name; uint price; ...
0
votes
1answer
30 views

Contract of contracts

I am new to solidity :) and try to encapsulate array of contracts in one contract. Something like this: contract Item{ uint public blabla1; uint public blabla2; } contract Collection{ ...
0
votes
1answer
116 views

Solidity test fails when testing onlyOwner functions

I have a contract where some functions can be called only by the owner of the contract and I want to test it with a solidity test in truffle. The contract looks like this: contract owned { ...
2
votes
1answer
92 views

Why do my truffle tests get much slower as I run more of them?

So I am currently building up a test suite for a project, and I have quite a few tests at this point. I am running into a problem however that truffle seems to run tests later in its execution much ...
3
votes
1answer
550 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
445 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: ...
0
votes
1answer
374 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
2 3 4 5 6