5
votes
Accepted
What is the use of Truffle/Hardhat?
I had used both Truffle, Brownie && Hardhat for SmartContract development. All of them are good, and they serve their purpose.
The reason you need these tools comes down to the fact that ...
4
votes
Error : transaction underpriced
I solved this error by manually setting the gas from here: https://polygonscan.com/gastracker I'm deploying to Mumbai testnet. The reason is as stated in the answers the gasPrice is too low.
4
votes
Source File requires different compiler version
What worked for me is the following:
Type ctrl+SHIFT+p
Select solidity:Change Global compiler version (Remote)
Select your desired solidity version
Additionally, I needed to change in the setting of ...
4
votes
Accepted
Why if-condition fails to protect selfdestruct?
For both the victim deployment and the call to kill you don’t define what address you are using so in both case you are using the default address. So the déployer and the caller are the same, so the ...
4
votes
Where can Developers get Sepolia Testnet ETH?
You can get 1 Sepolia Eth here for free, its the largest Sepolia Faucet available:
https://sepoliafaucet.com
3
votes
Unused function parameter. Remove or comment out the variable name to silence this warning
Sometimes you will want to override a function provided by a library e.g. this ERC721._beforeTokenTransfer hook.
Suppose that you want to override this hook to prevent a specific token 12345 from ...
3
votes
Truffle vs Hardhat vs Ethers vs Web3 what to choose for a beginner?
There are use-cases for each one.
Il try give you some simplifications how to understand each one of them.
Truffle: Use it to setup a project that will interact with smart contracts and blockchain. It ...
2
votes
How can I retrieve transaction hashes using web3 batch requests?
You can use web3.batchRequest() to create and execute batch requests (after waiting for a transaction receipt) and you will get the transaction hash as a return value from the callback provided by the ...
2
votes
Accepted
How to turn off specific warnings for the solidity compiler?
With Foundry, there is a neat way to ignore Solidity compiler warnings, and that is to use the ignored_error_codes config option:
# ignore solc warnings for missing license and exceeded contract size
#...
2
votes
Truffle test, how to get address(0)?
Don't know about web3.js, but in ethers.js ethers.constants.AddressZero will do the work.
Example:
Suppose you have a transfer function in your contract like this:
function transfer(address to, ...
2
votes
Setup Ganache with Metamask. What and where is a Chain ID?
I think your Metamask already has a local network so delete that network first and then try it.
it works for me.
2
votes
Error : transaction underpriced
For me resetting my metamask account did the trick. My accounts -> Settings -Advanced -> Reset Account
2
votes
Does anyone know how to use TimeLockController.sol from openzeppelin
The TimelockController contract has a simple but powerful design, in order to enable an address (Proposer) to schedule an operation, that will be executed by another address (Executor), after some ...
2
votes
Accepted
VM Exception while processing transaction: revert — Transferring ether from EOA to contract account
I see 2 possible issues:
flightSuretyData.fund(msg.value, msg.sender); I guess this call should send eth (based on the name and the args, you should therefore pass the value to send, like this: ...
2
votes
How can I figure out why the transaction is reverted()
The transaction callback returned by contract call should have more information for you. However, tenderly is a really useful website for debugging on-chain transactions. It shows that your call ran ...
2
votes
Accepted
Polygon Mumbai Testnet Not Working
The issue can be Linked to either :
1- the RPC url
2- the provider
3- THE WALLET ADDRESS, this has happened to me on the mumbai testnet alot and to solve it, i switched the wallet address to a brand ...
2
votes
Accepted
Truffle test is failing with "the tx doesn't have the correct nonce" error
As a suggestion, you should have said that you were taking the "6 Figure Blockchain Developer" course from Eat The Blocks. By the way, I'm taking that course and I ran into the same issue ...
2
votes
What is the use of Truffle/Hardhat?
Assuming the last line of your question is "when we can't actually build anything such as a Dapp"
So, in Blockchain development, testing on real environments can be costly. Since you ...
2
votes
Accepted
solidity contract creation factory contract method is being called, but new contract is not getting created
you need to use new keywork in your addNewUser function:
User newUser;
function addNewUser(address adminAddress) public restricted returns(address) {
newUser= new User(adminAddress)
...
2
votes
Accepted
SQL Querying ability using Blockchain
Using IPFS and blockchain to store medical data sounds like a dangerous idea. Because all of the patient's data will be publicly viewable.🤔
Technically you can just store the records in a smart ...
2
votes
Accepted
error when working with arrays: DeclarationError: Undeclared identifier
The error you're seeing is because you haven't declared a global variable called recipientsList. To fix this, you can declare a global array at the beginning of your contract like this:
address[] ...
2
votes
Accepted
Security and Performance of Solidity Contract
There is a few things you should change for security and performance.
First you are vulnerable to areentrancy attacks because the .transfer() function is used inside a loop, then you should use a for ...
1
vote
Accepted
How to debug a contract binary without source code?
There is none, so I made one: https://github.com/aj3423/edb
1
vote
Does anyone know how to use TimeLockController.sol from openzeppelin
So, should I also set the prosper and executor(I think they are already implemented in TimelockController.sol)
To answer your first question -- YES, you should absolutely set the proposer and ...
1
vote
How do I set required gas fee to zero for localhost on Metamask?
I got around this another way. When you type "truffle development" into a terminal it will output 10 accounts (along with 10 keys which correspond to those accounts). Take one of those keys ...
1
vote
How to initialize and assign value to constant in constructor?
For assigning a constant variable to the constructor,
Use immutable. It is a variant of constructor.
It also runs once when deploying the smart contract, no one can change that variable value after ...
1
vote
How to pass a blank bytes calldata into a solidity function call?
bytes memory data = new bytes(0);
1
vote
Undeclared identifier _setTokenURI in ERC721
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
and then inherit the contract with ERC721URIStorage
contract myNFT is ERC721URIStorage{
}
hope ...
1
vote
UniswapV2 addLiquidity revert ds-math-sub-underflow
you should change 500, 250 to 1001 +
look pair docs https://docs.uniswap.org/protocol/V2/reference/smart-contracts/pair
MINIMUM_LIQUIDITY
function MINIMUM_LIQUIDITY() external pure returns (uint);
...
1
vote
UniswapV2 addLiquidity revert ds-math-sub-underflow
Underflow usually only occurs from math operations, in this case the underflow error looks to be from the parameters you passed in as amountA and amountB. The same issue occurs when working with ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
truffle × 2931solidity × 1219
web3js × 477
truffle-migration × 335
contract-development × 235
ganache × 218
go-ethereum × 214
truffle-test × 208
truffle-contract × 202
testing × 188
contract-deployment × 181
testrpc × 181
javascript × 144
metamask × 140
truffle-deployment × 116
blockchain × 106
remix × 84
nodejs × 78
react × 78
truffle-compile × 75
dapps × 66
ropsten × 64
dapp-development × 59
infura × 59
contract-debugging × 56