New answers tagged

1

Ethereum requires to upfront gas * gasPrice for the transaction fee, it will return unused gas but the gas has to be paid in advance. The config has gas = 4M and gasPrice = 65 gwei so for every transaction you have to have 4 * 10^6 * 65 * 10^9 = 26 * 10^16 wei = 0.26 ether. Set gasPrice low enough in truffle-config (200k gas) and individually set the gas for ...


0

You might need to remove the truffle build in your directory rm -R build/


1

I'm no expert but all you need is a compatible wallet that can hold ERC20 Token, there are many wallets out there compatible to ERC-20 tokens, most popular ones Trust, Metamask.. you deploy the smart contract and connect wallet, and that's it, your tokens are send to your wallet... there is no need to create a hard wallet such specifically for Android, Ios, ...


0

You can try this: // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Credentials { uint256 _numberOfProviders; mapping(address => bool) public _owners; uint256 _numberOfOwners; constructor(address[] memory owners) payable{ _owners[msg.sender] = true; _numberOfOwners = 1; for (uint ...


0

I will not recommend this, because features change from verion to version. But if you wanna compile your whole project from a single version of solidity, you can set the pragmas in your solidity files as following: // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0;


0

ok, this is not a solution but just adding a bit of information that may help in solving this. Apologies for writing an answer but I can't write comments so this is the only way. The error body that is too long to fit is actually the whole file soljson.js from the solc package in your node-modules. It may be a versioning issue between the packages. Given ...


0

Let's consider the test contract in which the constructor accepts two params: // SPDX-License-Identifier: MIT pragma solidity ^0.8.3; contract Test { address public owner; address public user1; address public user2; constructor (address _user1, address _user2) { owner = msg.sender; user1 = _user1; user2 = _user2; ...


0

This is how I use to instantiate contract at a specific address in Hardhat: const accounts = await hre.ethers.getSigners() const MyContract = await ethers.getContractFactory("MyContract"); const myContract = new ethers.Contract(MyContract, MyContract.interface, accounts[0]); Hope it helps! :)


1

Yes, the private key is required to sign a transaction. That's the only way to make sure that your account is really the sender of the transaction. And that's part of the reason why private key should stay safe and never be revealed. Also, the public address is derived deterministically from the private key, so there doesn't need to be connection between ...


0

Here's a couple more to add to Majd TL's answer: "max code size exceeded" - (ErrMaxCodeSizeExceeded) - Contracts are limited to 24kB (24576 B) in size, so if you try to deploy something larger, it'll fail. "contract address collision" - (ErrContractAddressCollision) - If there's already a contract at the deployment address. This will ...


1

Some of errors for deploying smart contract or just send a tx Out of gas > The "out of gas" error occurs when all the gas you allotted for the transaction is consumed before the transaction could complete1. This could happen when the developer underestimated the gas amount used in the contract, or just forgot to change it, or forgot to enable ...


0

No it does not work. Your contract is empty. A real contract would have a lot of data in the field shown in your screenshot.


0

You can do that, but you should remove the function contractName(...) in .sol and also change the deployment script to deployer.deploy(contractName). You have this function in your contract which is not correct function contractName(address _contractOwner, address _withdrawWallet) it can be called by anyone and changes the contract owner and the ...


0

This is a known bug and has been reported as Issue #410. There is also a list of open issues for the web3 crate.


0

Fresh off the press via Daily Ape: https://twitter.com/AndreCronjeTech/status/1373197364656242690 https://andrecronje.medium.com/deploying-your-own-cross-chain-token-101-240420efd0d9 I would need to copy-paste the entire article, it's very detailed.


0

This would seem like a wrong chain issue. Are you sure that Hardhat is pointed at the same chain as the contract? You can change the chain Hardhat runs on by either changing the value of defaultNetwork in hardhat.config or by running with the --network flag (for example --network rinkeby), provided there is a corresponding object in networks in hardhat....


0

Uniswap and MakerDAO has announced their official support for Optimism so network effect wise there is hard to beat that.


0

A DEX essentially allows you to swap tokens and create liquidity pools, which means that you don't create (mint) new tokens in general. Only if the DEX has the possibility of staking, then you may create LP tokens (Liquidity Pool tokens) and send them to the stakers in exchange of their standard tokens. If the contract is verified in etherscan.io, you can ...


0

Just proceed with >loadScript("Simple.bin") >miner.start(1) (wait for miner, will mine 1 block) >simple.function(inputs) It will still work, as documented in https://gus-tavo-guim.medium.com/deploying-a-smart-contract-the-hard-way-8aae778d4f2a. What I get is >loadScript("Simple.abi") undefined >loadScript("Simple.bin&...


2

I think the question is too general in nature so the only possible answer is "it depends." The right way to structure the contract depends on what the contract is supposed to do. Deployment is a specific step in the lifecycle of the contract. What needs to happen at that stage? For example, it might be unacceptable to have an instance of the ...


0

In the case you have pending transactions there are two fast options to solve the issue: Increase the Gas you spend for the transaction with the same account (do this in your truffle configuration or in your deployment code). Especially when the reason are pending transactions with the same nonce. Change the account for the deployment. Pending transactions ...


Top 50 recent answers are included