Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
0answers
69 views
+100

Simple Contract to supply eth to aave

I'm working on a simple contract which will supply eth to aave. // SPDX-License-Identifier: MIT pragma solidity >= 0.4.22 < 0.8.7; import "@openzeppelin/contracts/access/Ownable.sol"; ...
0
votes
1answer
17 views

The second contract is not getting deployed in migration

const Input = artifacts.require("Input"); const Register = artifacts.require("Register"); module.exports = function (deployer) { deployer.deploy(Input, "test_name") ....
1
vote
0answers
22 views

Truffle incompatible with ESMs (ES5 / ES6 modules with “type”: “module” in package.json)?

is it possible to execute truffle commands inside a folder in "ESM mode", i.e. package.json contains "type": "module", uses import instead of require etc.? Here is what I ...
0
votes
0answers
29 views

Truffle compiler version error

I keep getting an error that my truffle is currently running version 0.5.16. Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity >=0.8.4&...
0
votes
0answers
20 views

Best way to Deploy smart contracts without Infura

I'm wondering what will be the best way to deploy our smart contracts. If i use Infura API, they are only serving 100 thousand requests per day.Due to that our team lost a client while performing a ...
0
votes
0answers
47 views

How do I create a crowdsale smart contract that has maximum buy amount

I wrote a code for a crowdsale smart contract. Code is below: // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.8.0; contract Context { constructor () internal { } // solhint-...
0
votes
0answers
26 views

solidity compiler hashing function

What hashing function or encoding scheme does solidity default compiler use to encode or hash the data of smart contracts in remix ide?
0
votes
1answer
33 views

ParserError: Expected '{' but got reserved keyword 'override' .solidity

Can someone please help me in understanding why i am getting this error I am new to solidity and unable to resolve this have tried the way written in documentation too and getting the same error. ...
1
vote
1answer
22 views

Accidentally deployed two identical contracts on blockchain. How can I pick the one I wish to interact with?

I deployed two identical contracts on the same blockchain. contract V1 address:0x48A2a37fF1Cff6eB1984aCA7fCA4cAa25B1C9287 contract V2 address:0xdfaDE9c110eBD5C00243Ca0b3AdCf5B73A8f0e42 However I ...
0
votes
1answer
58 views

Time locked wallet contract withdraw revert

I have a time locked wallet code which withdraws the fund after some period: // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; ...
0
votes
0answers
144 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, "&...
0
votes
0answers
23 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"...
2
votes
1answer
27 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 ...
1
vote
0answers
98 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
111 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
32 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
17 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
26 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
30 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
1k 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
64 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
21 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
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
39 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
167 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
68 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
32 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
26 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
47 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
15 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
116 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
47 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 &...
2
votes
0answers
95 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
132 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
61 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
25 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(...
1
vote
1answer
2k 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
226 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 ...
1
vote
2answers
654 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
309 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
89 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
221 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
306 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
103 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
1k 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
91 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
26 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
42 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
273 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 ...

1
2 3 4 5 6