We changed our privacy policy. Read more.

Questions tagged [truffle]

Questions regarding the implementation and use of the Truffle development and testing environment.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

How to test clone contract functions?

I have a clonable contract which I'm passing to the clone factory contract and I'm trying to access the functions inside it but for some reason only the view functions work. this.nft = await NFT....
0
votes
2answers
13 views

sha256 works with string memory but doesn't work with bytes32

The problem occurs when generating a sha256 inside contract. This works fine: function SimpleHash(string memory val) public returns (bytes32) { bytes32 h = sha256(abi.encodePacked(val)); ...
0
votes
0answers
10 views

Truffle compile error. ParseError: Expected ';' but got '}'

I am trying to compile my contract but I get ParseError while compiling Migrations.sol. I got this error after running E:\blockchain-learning\hooks-truffle-ganache>truffle develop truffle(develop)&...
0
votes
0answers
10 views

Hit a require or revert statement somewhere in its constructor

I have created a contract which creates a new UniswapV3Factory contract in the TopLevelContract constructor. The code is below pragma solidity = 0.7.6; import './../v3-core/contracts/UniswapV3Factory....
0
votes
0answers
19 views

Interrogation about Truffle deployer.deploy function arguments

I have the following Truffle migration: module.exports = function (deployer, networks, accounts) { var receiver = accounts[1]; var balance = 50000000000000000000; deployer.deploy(MPC, receiver, {...
0
votes
0answers
6 views

can not install truffle?

truffle does not work after insall using (npm install -g truffle) command . this message appears "removed 5 packages, changed 1105 packages, and audited 1074 packages in 28m 81 packages are ...
0
votes
1answer
8 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
0answers
9 views

Truffle Pet Shop Parse Error

I keep getting an error when I try "truffle compile" on the truffle pet shop tutorial. Here is my code pragma solidity ^0.5.0; contract Adoption { address[16] public adopters; function ...
0
votes
1answer
22 views

How to test sending transaction from zero address in truffle

I have some smart contract which has this function: function someFunction() external returns (uint256) { require(msg.sender != address(0), "zero address"); //some code.... ...
0
votes
0answers
5 views

abi from ropsten.etherscan.io site vs Truffle abi

I have initially deployed an openzeppelin upgradeable Smart Contract (SC) on my local Ganache blockchain using Truffle, referring in my Dapp to the abi that is generated to a local file (everything ...
0
votes
1answer
14 views

I made the front end first

I'm creating my first app with truffle but I made the front end first... I wanted to replace the client folder with my existing react app but I noticed the App.js file has numerous functions that I ...
0
votes
0answers
10 views

dapp university youtube tutorial for a defi example

I was following along this tutorial but at this point, I tried to run: truffle compile and get this error that I tried fixing by installing via npm babel-runtime and core/js but the problem is still ...
0
votes
0answers
13 views

Saving migration to Binance smart chain testnet failed using truffle

I am trying to migrate my contracts to the BSC testnet but I constantly get an error message: Saving migration to chain.Error: PollingBlockTracker - encountered an error while attempting to update ...
0
votes
0answers
8 views

Truffle migration, how to get the deploy file on the previous migrate?

I have encountered the problem when I use truffle migration, it works fine so I deploy the contracts on the mainnet for actual use. After a while, I decided to make some changes and try to upgrade the ...
0
votes
1answer
10 views

Trouble sending correct amount of a token with web3

i'm trying to transfer a value of 1 of my erc20 token to my contract. In my front end I am using: tokenContract.methods.approve(contract_addr, 1).send({from: accounts[0]}); In my smart contract I am ...
0
votes
0answers
13 views

Cannot migrate contract to blockchain on Truffle's Pet Shop tutorial

I have completed Truffle's Pet Shop tutorial up to the point of migrating the Adoption.sol contract with 2_deploy_migration.js . This is the error that shows up in the terminal. Starting migrations... ...
1
vote
1answer
15 views

Testing address(this) generates exception, how to obtain the correct value for address(this)

I have modified the following code from a michalzalecki website https://michalzalecki.com/ethereum-test-driven-introduction-to-solidity/ to test address(this): pragma solidity 0.5.16; import "...
0
votes
1answer
6 views

compare uint from datestamp always return true

function testDate(uint date1,uint date2) public returns (bool) { require(date1 == date2,'not same date') return date1 == date2; } let res = await TestSol.testDate.call(‘1630972800’,‘1631145600’)...
0
votes
0answers
18 views

Eternal storage smart contracts

I am trying to make smart contracts with an eternal storage design. So lets say I have contract A and B: Contract A is Ownable { struct Item { uint256 id; uint256 price; address ...
0
votes
1answer
14 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(...
0
votes
1answer
12 views

Truffle develop exec cant exit [closed]

I am running exec with .js script and once it is finished I cant get out of it, cursor keeps blinking and all the ctrl+c or +d doesnt help. I cant get back to console, so need to open new tab for each ...
0
votes
0answers
9 views

How to test in local, a contract if call an AMM contract?

I'm trying to test a smart contract but i have inside of my contract a call to PancakeSwap and i would like to test it, but i dont find what is the good way to do it: i have to mock router´s contract?...
0
votes
0answers
20 views

Web3 from account question

Hello can anyone tell me why I would be getting an error when i type this in the Truffle develop console? app.setGreetings(“Hey Ladies!”, {from: web3eth.accounts[0]}) The error it is giving is... ...
0
votes
1answer
15 views

ERC721Burnable TypeError: Definition of base has to precede definition of derived contract

I'm getting an error due to Burnable but it's not even in my contract. @openzeppelin/contracts/token/ERC721/ERC721Burnable.sol:12:46: abstract contract ERC721Burnable is Context, ERC721 ...
0
votes
2answers
45 views

Issue while migrating to Ropsten network

I am trying to migrate the contract to ROPSTEN network. It fails for the following reason. Please advice. migrate command $env:MNEMONIC=' XX XX XX';truffle migrate --reset --network ropsten Error ...
0
votes
0answers
16 views

Problem adding custom rpc on metamask mobile

I'm trying to use metamask mobile for my android dapp development and I need to create truffle's custom rpc but it gives me this error:
0
votes
1answer
51 views

Do I need to front the cost of gas to sell a collection of NFTs

Forgive me if this has been asked before, if it has please provide any resources so I can learn more! I'm having trouble wrapping my head around the development process of creating an NFT.Say I want ...
0
votes
0answers
31 views

'Error: invalid arrayify value (argument="value", value="", code=INVALID_ARGUMENT, version=bytes/5.0.5)\n'

I have the following solidity function that I'm calling from truffle: function safeTransferFrom( address from, address to, uint256 id, uint256 amount, ...
0
votes
0answers
21 views

How to addLiquidityETH in truffle console?

I'm trying to addLiquidityETH in truffle console but keeps running into ds-math-sub-underflow error. The pool pair is created at contract constructor and the wallet has more than enough for myToken ...
0
votes
0answers
38 views

How to write Test case for Internal functions in solidity which inherits the ERC721

**This is my Smart Contract code which has inherited the ERC721 and I want to write the test case for _setTokenURI ** contract ProductNFT is ERC721 { constructor () public ERC721(_tokenName,...
0
votes
0answers
22 views

Truffle: Test contract creation from another contract

I have two contracts, Factory working as a factory for Business: // Factory.sol pragma solidity ^0.8.7; import "./Business.sol"; contract Factory { // Public only for debugging ...
0
votes
2answers
12 views

How can I return a array of string[5] from a function that returns a string[]?

I'm wondering why if my function is meant to return a string of indeterminate length, I can't return a string array of definite length. This function, for example doesn't compile function ...
2
votes
1answer
79 views

MetaMask (Web3) Inflates Transaction/Mint Price to Ridiculous Amount

I am writing a dApp/UI for my ERC721 smart contract and facing a recurring issue. My contract has been deployed to the Rinkeby test network and the contract has been verified on Etherscan, allowing me ...
0
votes
1answer
29 views

Truffle test in solidity with sending value

I have a simple contract with public function, that can receive value and do something based on that value: pragma solidity >= 0.8.0 < 0.9.0; contract ContractA { uint public boughtItems = ...
0
votes
1answer
55 views

Cancelling truffle migrate to mainnet. With previous pending transactions that have low gas prices

I am exporting my smart contract to the Ethereum mainnet and I am using Truffle to export my smart contract. However when deploying I was trying out multiple parameters and as a result have 11 ...
0
votes
0answers
21 views

Why does this function produce an error in truffle but not not in remix?

I have a string handling library, consisting of several functions, but only one of them produces an error when I run it in truffle test. (The other functions seems to work fine.). This function does ...
1
vote
0answers
13 views

Better way to access ABI using Truffle in Production?

I would like to know what would be the best way to access ABI.json to interact with the contract using web3.js on the front end? I create a route (example: /abi.json) pointing to the ABI generated in ...
0
votes
1answer
25 views

ERC-721 testing with JS - ReferenceError: use is not defined [closed]

I am following this tutorial: https://youtu.be/YPbgjPPC1d0 Got stuck at 34:47. This is the code I have written: const Color = artifacts.require('./Color.sol') require('chai') use(require('chai-as-...
0
votes
1answer
12 views

Truffle testing proxy contracts and delegation

I have a proxy contract ( Openzeppelin proxy ) and a custom Logic contract. the logic contract has a method function asd() public pure returns(uint256){ return 5; } since the proxy has a ...
0
votes
0answers
16 views

Truffle test fails with Error: Returned values aren't valid, did it run Out of Gas?

I created a string function library (using VS Code, Truffle and Ganache) which depends on another library, and one of the functions keeps failing with this error message when I run a truffle test as ...
1
vote
0answers
34 views

Compiling contract failes

I want to create crowdsale, but when compiling contracts i got: Compiling your contracts... =========================== > Compiling ./contracts/Migrations.sol > Compiling ./contracts/TubblySale....
0
votes
0answers
13 views

Truffle : Source code in build/contracts/HelloWorld.json doesn't change after first migrate

build/contracts/HelloWorld.json line 890: "source": "// SPDX-License-Identifier: MIT\r\npragma solidity 0.8.7;\r\n\r\ncontract HelloWorld{\r\n function hello() public pure returns(...
0
votes
0answers
9 views

Metamask Mobile does not recognize the id of the Truffle chain

I'm trying to connect my MM mobile to Truffle develop chain in PC but in Android appears: Could not capture string id. Is the RPC URL correct? Only on Android, I tested on iPhone with the same data ...
0
votes
1answer
17 views

Can't add more ETH to my object

there's something wrong with my code but I can't see what. I'm trying to create "pots" where you can add ETH inside. mapping(uint => Pot) public pots; mapping(uint => mapping(address =&...
0
votes
2answers
37 views

Error: *** Deployment Failed *** -- Invalid number of parameters for "undefined". Got 0 expected 1!

I am trying to deploy my smart contract. Upon deployment, I get this error message. Here is my contractToken.sol pragma solidity ^0.5.2; contract BPToken { uint256 public totalSupply; ...
-1
votes
1answer
28 views

BSC testnet seems to be not up to date at truffle

it looks like my truffle setup is far behind the actual testnet, resulting that I cant deploy anything (getting timeout) 🔢 Code to reproduce truffle-config.js bsctestnet: { provider: () => ...
0
votes
1answer
19 views

Stack too deep solution for struct having more properties fields

My struct struct UserIdea { string area; string path; string ideaType; string ideavalue; string amountValue; string ideaVerifiedThrough; ...
0
votes
0answers
8 views

Initialise struct with nested mappings in a truffle test

I am writing a test following the following examples: https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-solidity In the test I need to define a struct located in the storage. I wrote ...
0
votes
0answers
4 views

I am having problems migrating my contract to ganache(error: Invalid number of parameters for "undefined". Got 0 expected 3!)

My migration file looks like this: var BlindAuction = artifacts.require("BlindAuction"); module.exports = function (deployer) { deployer.deploy(BlindAuction); }; Ganache is running fine. ...
1
vote
1answer
34 views

How to assign an array inside a struct?

I'm trying to assign an array to a struct item.creators.push(_creators[i]);, but it's not being assigned. I don't receive any error from the compile, but the only attribute that is created inside &...

1
2 3 4 5
53