Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Controlling Contract

Using truffle and makes me use truffle console but I dont want to and wouldnt either. Is there any other way interact with contracts and controlling their propreties and everything with an app or ...
seojunchian's user avatar
0 votes
0 answers
27 views

Upgrade to Web3 Library Version 4.1.x Causing Contract Function Transaction Failures via Metamask

I am facing a very strange error and I am still unable to figure out after spending more than 2 days. I am using truffle framework and latest version of Web3 library which is version 4.1.2. I am ...
wolvorinePk's user avatar
0 votes
2 answers
41 views

Transaction gets reverted when using send web3 function

I have a basic smart contract that sets the hash of a string and retrieves it along with verification. The contract works perfectly fine, but the issue is with the .send method of web3 that reverts ...
Andrea Ross's user avatar
0 votes
0 answers
14 views

Truffle not finding any functions (uncaught TypeError) or acknowledging debug commands (uncaught referenceError) on WSL

I'm trying to get started with using Truffle but I keep running into issues with the SimpleStorage contract and getting Truffle to work. I'm able to deploy the basic SimpleStorage contract and do x = ...
birdbamboo's user avatar
1 vote
0 answers
22 views

Deactivate clean-room environment in truffle

Everything is in the question, does anyone have a way to prevent the redeployment of the contract every time you run a test and keep using the same "contract" feature ? Edit : I've found it, ...
Raphael's user avatar
  • 41
1 vote
0 answers
24 views

Uncaught (in promise) TypeError: ProposalsRegistrationEndedEvent.watch is not a function

I was following an old Ethereum dapp tutorial to make a voting dapp. It uses truffle contract, web3js and ganache and when i access the pages via localhost i get the following error in the console: ...
Frenzied2498's user avatar
2 votes
1 answer
646 views

why command Truffle init not creating Migrations.sol?

I created new folder in truffle with command truffle init version of truffle and others Truffle v5.5.30 (core: 5.5.30) Ganache v7.4.0 Solidity - 0.8.17 (solc-js) Node v16.16.0 Web3.js v1.7.4 but it ...
vishal's user avatar
  • 23
1 vote
0 answers
160 views

Error deploying contract via Truffle to Polygon mainnet

When I try deploying with command npx truffle migrate --config=truffle-config.js --network polygon, I get the following error. Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object]) at ...
P A S H's user avatar
  • 138
1 vote
1 answer
28 views

Issue with Array of fixed count

What is the difference between using mapping and without mapping? can I declare the tickets variable with mapping? Ticket[TOTAL_TICKETS] public tickets; Here is the solidity smartcontract pragma ...
B L Praveen's user avatar
0 votes
1 answer
37 views

Getting an Invalid Address error when trying to interact with smart contract in truffle express box

I have a function where I insert patient's info into a mapping and it works perfectly fine on remix and in the truffle console. function createPatient (uint _SecretNum, string memory _name, uint _dob, ...
youssef_tawfik11's user avatar
0 votes
1 answer
166 views

Verify that a method call is initiated from a specific Smart Contract

As my smart contract is >24k, I read that I need to break it into multiple (smaller) smart contracts. So, my current design is to have a Core contract that has all the data in arrays. This Core has ...
jlee88my's user avatar
  • 103
0 votes
0 answers
374 views

Uncaught (in promise) TypeError: myFunction.watch is not a function

I'm trying to develop my first DAPP based on this tutorial (https://livebook.manning.com/book/building-ethereum-dapps/chapter-12/) and I'm encountering some errors in the javascript part. In ...
Sandruz's user avatar
1 vote
1 answer
299 views

truffle installed but not working

I'm using node version 12.20.2 and npm version 6.14.11 and installed truffle with cmd as administrator, the truffle framework version 5.5.12 has been installed but when I run any command in the vs ...
Prabhat Dongare's user avatar
0 votes
1 answer
94 views

unable to install truffle

I'm trying to install truffle on node version 8.9.0 but it shows it has been installed and when I try to do anything on that, throws this error. C:\Users\com\AppData\Roaming\nvm\v8.9.0\node_modules\...
Prabhat Dongare's user avatar
0 votes
1 answer
428 views

ERC721 is being minted to null address

Here is the contract code to mint ERC721 tokens: contract NFT is ERC721URIStorage, Ownable { mapping(uint256 => address) private _owners; mapping(address => uint256) private _balances; ...
Sagar Atalatti's user avatar
0 votes
1 answer
54 views

contract has not been deployed to detected network (network/artifact mismatch) when use truffle console --network kovan

i'm trying to call a function from contract that i deployed to kovan network, then when i used the truffle console --network kovan and tried to deploy my contract, it says that this contract has not ...
Seif Khédija's user avatar
0 votes
2 answers
403 views

Get a list of latest deposits to a contract address

I have a solidity contract that can receive ETH, how can I write a function in this contract with solidity to get the latest list of transactions that was made to it, for example I want to call this ...
ershad7's user avatar
0 votes
1 answer
182 views

Call a Solidity function and feed it with more arguments than what it is defined to accept?

I am following the tutorial on this page, especially this part of code // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC721/presets/...
keylogger's user avatar
  • 115
0 votes
1 answer
244 views

I'm getting: TypeError: Member "balanceOf" not found or not visible after argument-dependent lookup in contract

On the line where it says require(tokenContract.balanceOf(this) >= _numberOfTokens); is where I'm receiving the TypeError. Any suggestions on how to fix this? pragma solidity ^0.8.12; ...
CryptoSteez's user avatar
1 vote
2 answers
905 views

What is the best way to iterate through mapping in solidity

I have recently started working on solidity. I want to create a smart contract where users can mint and own the LAND (NFT) by clicking Buy Now button on UI and send LAND Coordinates(x and y) to the ...
Muhammad Usman's user avatar
0 votes
0 answers
97 views

Transaction Error on Creating a Smart Contract with a deployed Smart Contract in Web3

I am trying to create a Contr smart contract object with deployed SystemAPI contract, but I get a transaction revert error upon calling it. SystemAPI contract: pragma solidity ^0.8.0; import "./...
Shivam Akhouri's user avatar
0 votes
1 answer
16 views

How do I assert this properly?

Say I want to make a test for this sample contract: // assume we import OpenZeppelin's Ownable contract Metaverse extends Ownable, ... { ... // Assume this is just to experiment and learn. ...
Luis Masuelli's user avatar
1 vote
2 answers
587 views

How do I set required gas fee to zero for localhost on Metamask?

I'm doing a Solidity tutorial and trying to get a React example up and running. I've got Truffle running and when I run npm start and Chrome connects to localhost, Metamast says "Insufficient ...
DBWeinstein's user avatar
0 votes
1 answer
150 views

Why is "Methods" Always Empty When Building Solidity Smart Contract With Truffle?

When I the ABI for any smart contract it always creates "methods" as just an empty object... it should contain my public and external functions, but it doesn't. When I look at the ABI I don'...
Jim's user avatar
  • 173
0 votes
1 answer
83 views

Interface Oracle Contract

I am following the CryptoZombies tutorial to create an Oracle Interface. However, I am having an error in Smart Contract which will be my interface, according to the tutorial it is the same, 2 details ...
Crazy's user avatar
  • 151
0 votes
1 answer
88 views

UnhandledPromiseRejectionWarning: Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent

I am trying to run the below code: // Import modules var Web3 = require("web3"); const HDWalletProvider = require("truffle-hdwallet-provider"); const { interface, bytecode } = ...
Anonymous's user avatar
  • 287
2 votes
1 answer
587 views

EIP170 - Which contract features explain its size the most?

I was checking into EIP170 since while developing some contracts upon ERC1155 I came across the contract max size restriction of 0x6000 = 24576 bytes. As I later checked, the size of the artifacts ...
Augusto Caro's user avatar
0 votes
1 answer
46 views

Interacting with Deployed contract- Truffle develop

Hoping some of you may be able to help me. I have a very simple contract that i have deployed. I won't post the entire contract here, but i will post the one function i am having trouble calling from ...
Blockpain's user avatar
  • 143
0 votes
1 answer
133 views

How to fix error of compiling the smart contract: Invalid number of parameters for "undefined"?

I want to compile a simple smart contract using truffle. my smart contract SimpleStorage.sol pragma solidity >=0.4.16 <0.7.0; contract SimpleStorage { int public sensorData; constructor(...
Helo's user avatar
  • 1
0 votes
1 answer
76 views

Deployment of smart contract for research. Infura, Truffle or Metamask (which is more practical)?

Truffle, Infura, Metamask which is more practical way to deploy smart contracts for research purposes? Can someone explain? Thank you.
Farhana's user avatar
0 votes
0 answers
170 views

In my solidity file I have a parser Error but the line where truffle tells me the error has occurred is blank

I am building out a token and while testing using truffle my file failed to compile. pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract Token { ...
Devin's user avatar
  • 1
0 votes
2 answers
904 views

Alternatives to deploying smart contract with high gas fees?

I have a dApp contract that costs ~ 80 USD to deploy at 46 gwei. I just have 10 USD to do this. Is there any way I can do this in less? I don't mind deploying it to a network other than ETH Mainnet.
user78820's user avatar
2 votes
0 answers
424 views

Simple Contract to supply eth to aave

I'm trying programatically deposit using into Aave V2 Contract Aave's Code Examples // SPDX-License-Identifier: MIT pragma solidity >= 0.4.22 < 0.8.7; import { IERC20, ILendingPool, ...
johnny 5's user avatar
  • 292
0 votes
1 answer
30 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") ....
Ransika's user avatar
  • 23
2 votes
1 answer
889 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 ...
blitter's user avatar
  • 183
0 votes
0 answers
184 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&...
Thor's user avatar
  • 1
1 vote
0 answers
225 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 ...
MAHENDRAN KANAGARAJ's user avatar
0 votes
0 answers
178 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-...
Iammrjude1's user avatar
0 votes
0 answers
198 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?
nazya's user avatar
  • 1
1 vote
1 answer
564 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. ...
Sundaram Srivastava's user avatar
1 vote
1 answer
70 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 ...
Sky's user avatar
  • 2,204
0 votes
1 answer
446 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'; ...
user73476's user avatar
5 votes
2 answers
4k 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, "&...
Danil's user avatar
  • 151
0 votes
0 answers
147 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"...
Shubham Garg's user avatar
2 votes
1 answer
150 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 ...
nurkic23's user avatar
1 vote
0 answers
362 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 ...
Geov's user avatar
  • 11
4 votes
1 answer
2k 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'...
Loui's user avatar
  • 71
0 votes
0 answers
26 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 ...
Muhammad Raffiq Mohd Khalil's user avatar
2 votes
2 answers
6k 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. ...
TheWang's user avatar
  • 23
0 votes
1 answer
338 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 ...
GN.'s user avatar
  • 633

1
2 3 4 5
7