Questions tagged [truffle-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
29 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 ...
  • 11
1 vote
0 answers
16 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 ...
  • 138
1 vote
1 answer
17 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 ...
0 votes
0 answers
18 views

Truffle Migrate: Solidity SyntaxError: Unexpected identifier

Here's my initial_migration importing LinkToken and and Oracle libraries to deploy. const Migrations = artifacts.require("Migrations"); const { LinkToken } = require('../node_modules/@...
0 votes
0 answers
8 views

Smart Contract interaction with drizzle cacheCall() returning undefined

I have an existing contract and want to integrate drizzle to read data using drizzle cacheCall() I have setup my drizzle options as seen below (saw this method in drizzle doc) const options = { ...
  • 11
0 votes
1 answer
25 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, ...
0 votes
1 answer
23 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 ...
0 votes
0 answers
51 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 ...
1 vote
0 answers
73 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 ...
0 votes
1 answer
52 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\...
0 votes
1 answer
198 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; ...
0 votes
1 answer
45 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 ...
0 votes
2 answers
134 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 ...
0 votes
1 answer
100 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/...
  • 105
0 votes
1 answer
117 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; ...
0 votes
2 answers
277 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 ...
0 votes
0 answers
10 views

"NFT" -- Invalid number of parameters for "undefined". Got 0 expected 1! [duplicate]

Here is my NFT.sol contract //SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // we will bring in the openzeppelin ERC721 NFT functionality import '@openzeppelin/contracts/token/ERC721/ERC721....
0 votes
0 answers
51 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 "./...
0 votes
0 answers
117 views

Can't add liquidity pool for my ERC-20 token on uniswap

I created an ERC-20 token, tested it in truffle and remix, and deployed it to the Rinkeby testnet. I went to uniswap and connected my metamask (after verifying the contract on etherscan and adding my ...
  • 21
0 votes
1 answer
14 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. ...
1 vote
2 answers
373 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 ...
0 votes
0 answers
26 views

Should I test the flattened ERC20 contract in truffle?

I have an ERC-20 contract that I have deployed successfully on the Rinkeby testnet. I have also successfully verified the contract so that I can interact with it on Etherscan. I am learning Truffle ...
  • 21
0 votes
0 answers
86 views

Problem with the truffle compile command

I have an issue with truffle compile command, when i run it the build folder is created but it is empty, there is no abi/bytecode inside. I tried to reinstall truffle but it doesnt help. In the ...
0 votes
0 answers
229 views

Verify that your constructor params satisfy all require conditions

Smartcontract requires two addresses to be passed while deploying contract via truffle. I am deploying this contract on Ganache locally. Here's the smartcontract constructor. constructor (address ...
0 votes
0 answers
61 views

How to connect a wallet to a smart contract and deploy the application to ethereum blockchain?

I have made a smart contract that will get some money. But most people recommend not to store money on a smart contract. So how do I connect a wallet to a smart contract? And how do I deploy the ...
  • 1
0 votes
0 answers
66 views

Cannot deploy ERC721 contract to Rinkeby network - address is not whitelisted. How can that be fixed?

I cannot deploy to Rinkeby because the address of my future contract ERC721 is not whitelisted..... How can I fix it? I am specifically using the OpenSea template for the contract which supposedly ...
0 votes
1 answer
100 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'...
  • 133
0 votes
1 answer
59 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 ...
  • 131
0 votes
1 answer
65 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 } = ...
  • 247
0 votes
0 answers
167 views

Truffle: Error: Returned values aren't valid, did it run Out of Gas? for trying to return uint

I have a very simple contract which i fully expected to work. event FlagChanged(uint newFlag); uint private flag; function storeFlag(uint newFlag) public payable{ flag = newFlag; emit ...
1 vote
1 answer
227 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 ...
0 votes
1 answer
38 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 ...
0 votes
1 answer
88 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(...
  • 1
0 votes
1 answer
60 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.
0 votes
0 answers
121 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 { ...
  • 1
0 votes
2 answers
766 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.
2 votes
0 answers
305 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, ...
  • 232
0 votes
1 answer
28 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") ....
  • 23
2 votes
1 answer
553 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 ...
  • 153
0 votes
0 answers
158 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&...
  • 1
0 votes
0 answers
162 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
0 answers
162 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
0 answers
95 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?
  • 1
0 votes
1 answer
463 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
1 answer
58 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 ...
  • 843
0 votes
1 answer
395 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'; ...
3 votes
2 answers
2k 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, "&...
  • 131
0 votes
0 answers
113 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
1 answer
118 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
0 answers
309 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 ...
  • 11

1
2 3 4 5
7