Questions tagged [truffle-contract]
The truffle-contract tag has no usage guidance.
282
questions
2
votes
1answer
15 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 ...
0
votes
0answers
10 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 ...
1
vote
1answer
30 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'...
0
votes
0answers
27 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
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 ...
0
votes
0answers
22 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 ...
1
vote
1answer
211 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.
...
0
votes
1answer
26 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 ...
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
23 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
29 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{
...
2
votes
1answer
69 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 ...
0
votes
0answers
33 views
Unable to override web3.eth.transactionBlockTimeout using web3js when using with Truffle Contract instance
I want to override the default transactionBlockTimeout from 50 Blocks to 5 Blocks. However, it appears not to have any affect when using web3js with Truffle Contract.
A high level overview of my code ...
0
votes
0answers
21 views
truffle console: Can't execute function i.e., TypeError: SimpleContract.at(…).getName is not a function
I am trying to familiarize with 'truffle console' by doing the tutorial at:
https://medium.com/oli-systems/test-driven-solidity-with-truffle-e4beaa2bd194
$truffle migrate
Compiling your contracts...
...
0
votes
1answer
23 views
mapping not updated
I'm testing a very primitive contract using mapping.
contract PhysicalContract {
uint numContracts;
mapping (address => uint) contracts_test;
function newDeal(address adr, ...
1
vote
1answer
26 views
truffle - should I remember the results of previous calls?
I wrote a smart contract. now, I am writing tests in truffle .
the code is gonna look like this.
contract('contract', accounts => {
it("test1", () => {
})
it("test2", ...
0
votes
0answers
13 views
truffle deployer - addess is still there without deploy
First Question:
// Stage deploying A before B
deployer.deploy(A);
deployer.deploy(B);
This is found on the truffle website. It says stage deploying A before B. So this must mean that deploying B ...
0
votes
1answer
93 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
28 views
Empty Address when using Truffle Debug
I currently have a local chain with Ganache. Say I have two contracts written in Solidity:
Foo_v0_0_1.sol
Bar_v0_0_1.sol
In the code for my smart contract Foo_v0_0_1, I have the following:
import &...
1
vote
0answers
65 views
How to watch/wait for events in JavaScript + Truffle?
I'm learning to develop Oracles, and, like all of us, I've encountered a dated article. After fixing all the Solidity changes (version, adding emit to fire an event, changing constructor function to ...
0
votes
0answers
14 views
SyntaxError when setting instance of deployed contract to token variable
I'm following this tutorial: https://www.youtube.com/watch?v=044h0ZI-fDI
At 22:45, the following command is run: DappToken.deployed().then(function(i){token=i;})
In the video, after this command is ...
0
votes
1answer
84 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
55 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
23 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
910 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
185 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
21 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
382 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
185 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
70 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
133 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
204 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
78 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
291 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
74 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
22 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 ...
1
vote
2answers
37 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 ...
1
vote
1answer
170 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
161 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
1answer
98 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
96 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
84 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
58 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
170 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
38 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
47 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
510 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
38 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
58 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 ...