New answers tagged

0 votes

TypeError: Cannot read property 'length' of undefined - While deploying using hardhat

Thank you Patrick and Sharma. I struggled last few days with the above issue. Now it's resolved. By the way, the video course created by Partick is awesome. Thank you again @PatrickAlphaC.
user avatar
0 votes

Hardhat - How to interact with a deployed contract?

Both getContractAt and attach work for me: I will share the code. this.CollectionMinter = await ethers.getContractFactory("CollectionMinter") this.CollectionMinter = await this....
user avatar
0 votes

Using "hardhat deploy" plugin, and it is not getting the deployed contracts

Are you sure, you ran your node bevor running this and deployed your contracts on the correct chain? so before getting the contract you need to run your node like yarn hardhat node depending on the ...
user avatar
0 votes

Safely deploying a contract with the same address in different chains

Take a look at CREATE2 https://docs.openzeppelin.com/cli/2.8/deploying-with-create2 The CREATE2 opcode gives us the ability predict the address where a contract will be deployed, without ever having ...
user avatar
0 votes

Truffle migrate: store deployed contract address in variable

in 2020, (truffle version 5.x) , once you deploy the contract, you may get its address in the json file: also you can list all the contracts you deployed via this command: $ truffle networks Network:...
user avatar
  • 161
0 votes

Create an ownerOnly function in a contract B that can only be called through another contract A by setting B's owner to be the A contract

My question is totally wrong, I have made the assumption that a contract may be the initiator of a transaction (tx.origin being a contract) which obviously can't be true. I don't know how to delete ...
user avatar
0 votes

how can library change state?

Libraries are stateless, they can store only 'constant' values. So even if delegatecall is used on library it wont be able to change the state of caller contract. For example when i tried to create ...
user avatar
1 vote

Interacting with contracts – automaticly setting an address on deployment

yes. deploy bar from ContractFoo and you have an object for the deployed contract. something like pragma solidity ^0.8.14; //if bar in another file import "./Bar.sol" contract ContractFoo {...
user avatar
  • 194
2 votes

Upgradeable proxy contracts- Seperating logic, functionality, & storage contracts. Examples? Resources?

you are describing: upgradable storage proxy contracts ... The proxy contract, as well as the logic contract, will inherit the same storage contract so that their storage references align in the EVM. ...
user avatar
0 votes
Accepted

Is A New Instance of an Already Verified Contract Considered Already Verified

In many cases, Etherscan is able to match the newly deployed bytecode to contracts that were verified earlier (if the contract code didn't change). They do this "auto-verification" to expand ...
user avatar
  • 1,967
0 votes

Smart contract is not available on the blockchain during the constructor call

it does'nt make any point of using IERC20 token = IERC20(address(this));, This can be only use where you use interface.
user avatar
  • 13
1 vote

Smart contract is not available on the blockchain during the constructor call

If I modify the contract as follows: // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/...
user avatar
0 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.
user avatar
2 votes

Downsides of using ERC721A over ERC721?

There's no "functional" downside to using ERC721A over ERC721 if you are going for sequential mints anyhow. The same differences between ERC721 <-> ERC721Enumerable pretty much apply ...
user avatar
  • 1,089
0 votes

EIP-2612: Why doesn't it use `_transfer` instead of approvals

This is a very interesting question, and I've been pondering it for a while now. Reading the EIP (https://eips.ethereum.org/EIPS/eip-2612), it talks about "paying gas fee with tokens" and &...
user avatar
1 vote

How to find error from the return of function call?

You are setting the listener for the event "_meBid" after awaiting the call to be mined. In order to listen for it setup the listener beforehand. //postContract is the contract and is valid ...
user avatar
  • 29.1k
3 votes
Accepted

New contract deployment pattern (0x60c06040)?

I've been monitoring new contract deployments simply by looking for leading 0x60806040 (truncated keccak signature) in a transaction's data field (example). This is not a signature, but the memory ...
user avatar
  • 5,359
0 votes

Mınt Gas Fee Problem

There's nothing you can do. It depends how busy the network is and when lots of NFT drops happen at the same time it gas gets expensive. Assuming you're on Ethereum mainnet. Whether your contract ...
user avatar
  • 194
0 votes

When we redeploy a smart contract , Is the smart contract updated on the same block of the blockchain or a new block is created?

from wikipedia A blockchain is a growing list of records, called blocks, that are securely linked together. Each block contains a cryptographic hash of the previous block, a timestamp, and ...
user avatar
0 votes

When we redeploy a smart contract , Is the smart contract updated on the same block of the blockchain or a new block is created?

Blocks once created can not be modified, hence the new deployment is stored on a new block.
user avatar
0 votes

How to make a web page button that invokes MetaMask to mint an NFT to Ethereum mainnet?

There are many ways to do that but the one I've found the easyest is using a js library called useDapp. Patrick Collins python video has a section of how to use the library, and you can go from there. ...
user avatar
2 votes

TypeError: Cannot read property 'length' of undefined - While deploying using hardhat

I got the answer from the MASTER himself, @PatrickAlphaC. When we call await getNamedAccounts in the above code, hardhat looks for the length of the named accounts in our hardhat.config.js We have to ...
user avatar
0 votes
Accepted

How do I remove a Royalty address from my nft contract?

Ouch. It's impossible to change the code on the blockchain, so yes, your options are to accept it or to start again with a new contract. Have a look into unit testing, as you'd probably have caught ...
user avatar
  • 194
1 vote

I can't deploy large contracts with Optimizer enabled

Optimizer is supposed to help your large code achieve maximum efficiency so it runs and can be deployed. Increasing the runs value from 20 to 500 may work.
user avatar
0 votes

hardhat fork, unable to call balanceOf

I encountered this error and what solved it for me is that i reset my Metamask setting -> Advance-> Reset account
user avatar

Top 50 recent answers are included