Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
28 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
1answer
30 views

Solidity ^0.6.10 returnBalance() returns “VM Exception while processing transaction: invalid opcode”

I am using Ganache and Truffle console. I compile and migrate the following contract: // SPDX-License-Identifier: MIT pragma solidity ^0.6.10; contract EthReceiver { address payable private owner;...
0
votes
0answers
16 views

Is there a way to get revert message by my client?

I have a smart contract with this simple function: function addUser( string memory _username, string memory _nome, string memory _cognome, string memory _email) public isOwner() { require(bytes(...
0
votes
1answer
47 views

Solidity Smart Contract withdrawal ETH with amount from contract address does not work

I have below smart contract and a test program to test transfer ETH out of contract address, but contract’s ETH balance not changed. I tested withdrawAmount(uint256 amount) but the assertion error ...
0
votes
1answer
22 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
0answers
5 views

MainNet Truffle Contract sendTransaction request not returning transaction receipt

I just deployed my smart contract to MainNet and starting to test my DAPP. I am running my own public Open Ethereum node where I send my transactions to. I am NOT mining in this node. From what I can ...
1
vote
2answers
39 views

Truffle migration deployment: Transaction was not mined within 50 blocks

I am running my own Ethereum client node (Open Ethereum 3.0.1). I am using Truffle migrate to deploy my smart contract to MainNet. However, the contract deployment is taking too long. The result from ...
0
votes
1answer
30 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
0answers
40 views

How to create an instance of the deployed contract in Truffle Console?

I am trying to learn Truffle tool using the tutorial at: Truffle tutorial I am writing the following command at Truffle console to create an instance of the deployed contract but I am getting the ...
0
votes
1answer
39 views

How to implement ether transfer from one EOA to another using a contract?

I am working on a private development network set up with geth with PoA consensus. Everything is working well from the geth console. I have written a Solidity contract to initiate some ether transfers ...
0
votes
0answers
30 views

Truffle stuck when deploy smart contract when using Ledger wallet

I have a little problem deploying smart contract with ledger nano s as provider on ropsten. The script just remain stuck at first migration Starting migrations... ====================== > Network ...
1
vote
1answer
30 views

How to call an overloaded function in Truffle with ABIEncoderV2?

How do you call an overloaded function in Truffle when passing a struct using pragma experimental ABIEncoderV2;? contract MyContract { struct MyStruct { address param1; address param2; ...
0
votes
0answers
43 views

Why is the compiler unable to generate Contract ByteCode and ABI when I try to Verify & Publish my contract?

Another dev no longer connected to our project deployed this contract, and I'm trying to Verify & Publish it on Etherscan now. What am I doing wrong? I do know that the dev who built this used ...
0
votes
1answer
33 views

Error in smart contract solidity [closed]

Hello i have some problem when i compile my smart contract with truffle i use the network of truffle develop Truffle v5.1.14-nodeLTS.0 (core: 5.1.13) Solidity - ^0.4.0 (solc-js) Node v13.1.0 Web3....
0
votes
1answer
19 views

looking for a start in solidity [duplicate]

I am totally new to the Solidity Programing. I was working on NodeJS, express and mongoDB. Few days ago I started working on blockchain. I have to write the API'S for contracts. We are using truffle ...
0
votes
1answer
24 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 ...
0
votes
1answer
49 views

How to act as another wallet when using Truffle exec scripts?

I am writing a seed to add data on the smart contract after I deploy it. I'm using ropsten network, setted up like this in truffle-config: ropsten: { provider: function () { return new ...
0
votes
1answer
29 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 ...
0
votes
0answers
46 views

Install py-solc-x using python, there is an error

I am using python to install py-solc-x, but there is an error during installation: [root@localhost ~]# python3 -m solcx.install v0.4.25 ERROR: Unknown option --version /usr/local/python3/lib/python3....
0
votes
1answer
29 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 ...
0
votes
1answer
46 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 { ...
0
votes
1answer
60 views

Error when deploying contract in geth with truffle ? --> Returned values aren't valid, did it run Out of Gas?

I have deployed a contract in a geth private network by using truffle. I can send transaction via my UI in html / nodejs but i am not able to do a call to retrieve informations. If I do, nothing ...
0
votes
2answers
30 views

How to prevent someone to replace our smart contract

I'm still learning to develop dApp and currently, I conduct some testing on my dApp. I found out that someone who is part of the blockchain network (miner and node) can replace our deployed smart ...
1
vote
3answers
63 views

Deploy smart contract with Node-js

I want to deploy a smart contract with Node-js. I followed this guide but an error occurs where i effort instantiate my smart contract. app.js: var Web3=require('web3'); var fs=require('fs'); var ...
0
votes
1answer
23 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 initialized null. A changes that state variable to Yerevan. After that, B sees that variable. Evaluating by A is successfull but B sees ...
0
votes
1answer
27 views

How to use older version of Solidity in Truffle suite

I've tried to migrate contract on an older version of solidity, I have modified the config.js to be as in the following and the smart contract solidity code I'm trying to deploy as follows The ...
0
votes
1answer
202 views

Calling function from existing truffle contract in node.js

This is probably a very simple problem to solve, but I am setting up a node.js backend using express for my Dapp and I can now deploy new contracts just fine. I now need to figure out how to make ...
1
vote
1answer
34 views

Fire transaction from contract

I have a contract holding a mapping like this: mapping (address => User) users. How can I get the contract to automatically fire a transaction/event when a certain condition is met? For example, ...
0
votes
0answers
41 views

Truffle - set or disable optimizer only for selected contracts

I have over 40 contracts in my project, for example: admin groups votings registry token In my truffle config I have optimizer enabled with 600 runs. compilers: { solc: { version: "0.5....
0
votes
0answers
35 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 ...
1
vote
2answers
181 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
45 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
278 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
32 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
1answer
743 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
176 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
21 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
62 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
724 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
146 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
170 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: ...
1
vote
1answer
21 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
277 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
364 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 ...
1
vote
0answers
103 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 ...
3
votes
3answers
379 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
140 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
377 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
103 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
54 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:...

1
2 3 4 5 6