Hot answers tagged

1

You can try this: function mint(uint256 _amount) public { //Now you call the internal mint function from your ERC20 token //You can find more about it here //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol _mint(msg.sender, _amount); }


1

The refresh of the page when you click a button is probably due to the submit event method not being prevented to happen. Example to prevent refresh onClick={(event) => Migration1(e)} function Migration1(e){ e.preventDefault() // <---- this prevent the form from being submited and run your code instead } The part you call ethers is not. It's ...


1

The fact that your asking this kind of question shows that you don't have the knowledge to perform such task at this moment. However, if you want to build a wallet as a standalone app that you sign so it does not get flag by AV and ppl know it's from you that is more accessible. What your asking is possible. I can connect metamask to my own provider. Set a ...


1

You can achieve this with OpenZeppelin using the following code: // SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract ERC20FixedSupply is ERC20 { constructor() ERC20("Fixed", "FIX") { _mint(msg.sender, 1000); // Mints 1000 tokens to your wallet ...


1

There are two types of interactions with the nodes: call used for functions that does not change the state of the EVM (does not cost gas) send used for functions that does change the state of the EVM (cost gas) You can't effect the blockchain with a call Edit: Check this article for further details


1

maxPriorityFeePerGas should normally be around 1.5 to 3.0 (2.5 is actually the setting that Web3js and Ethersjs use to account for 'MEV Heavy' blocks). This parameter is often incorrectly configured by metamask and will make the value the same as your maxFeePerGas, hence the crazy pricing. You can use this API if you would like: curl -sL api.txprice.com | jq ...


1

window.web3 is removed by metamask. now everything can be done with window.ethereum - web3 removal link by metamask Below is the new way of getting accounts. import detectEthereumProvider from '@metamask/detect-provider'; initialize ethereum provider async loadWeb3() { const provider = await detectEthereumProvider() if (provider) { console.log('Ethereum ...


1

Sorry for jumping on a very old post how ever came across it looking for something else. For those interested, the 24 confirmation events are being emitted due in fact to 24 being the default internal Web3 setting for number of acceptable confirmations. This setting can be set to a lower or higher confirmation count. To read the current setting: web3.eth....


Only top voted, non community-wiki answers of a minimum length are eligible