New answers tagged

0

The deployed contract address is a function of the deployer's EOA and the nonce. contractAddress = keccak256(deployerAddress, deployerNonce) You could get the same address if you deploy the contract using the same wallet and the same transaction order (i.e., the contract creation TX is the 1st, 2nd, or 3rd, ... tx in that wallet on both chains).


0

One problem I find with abigen these days is that when you build a new project you will download the latest geth imports into that project. Your ABIGEN on the other hand tends comes from your installed GETH codebase which may be out of sync. Try downloading new GETH and make a new ABIGEN


0

It can be done with just one contract. Use Mapping and Struct to complete the definition of the data structure //user=>betId=>Bet mapping(address => mapping(uint256 => Bet)) bet; struct Bet { string content; string time; //Other relevant information }


0

Just make sure to instantiate web3 on the rpc of your private network and it should be working like a charm. For the remix, there's also an option connecting to the network which is running locally by under DEPLOY & RUN TRANSACTIONS tab selecting from Environment the Web3 Provider where remix will automatically recognize that.


0

you dont need an abi to deploy. deploying with just bytecodes is possible using etherjs


0

Fixed! The issue was that I used the mainnet PancakeSwapV2 router address, and not the testnet one. For anyone else encountering this issue, the mainnet router is: 0x10ED43C718714eb63d5aA57B78B54704E256024E and the testnet one is: 0xD99D1c33F9fC3444f8101754aBC46c52416550D1 Hopefully this helps someone else!


1

Think of a smart contract as a literal contract. It is arbitrary and can have whatever you put into the clauses. This analogy will serve you nicely as you develop. For example, a smart contract has no private information, everything is readable by all parties, pretty much as in most contracts. Moreover, a contract is agreed by all stakeholders. That is also ...


0

I don't think anyone could tell what's the difference in the expected and actual bytecodes without going into crazy compiler-level detail. Simple changes like adding a new line in the code could result in a different bytecode. Changing comments doesn't make a difference though. You change or remove any comment (remove the line entirely, reducing the number ...


0

There's no requirements to allocate to yourself the whole supply. You can distribute it whatever you want, even you can mint as you go. For a contract to be considered an ERC20 it has to follow EIP-20 - ERC-20 Token Standard.


2

You can change the gas price to be whatever you want - even 0. But the used gas price influences directly when your transaction gets included in a block. If you use too low gas price, the transaction will most likely not be included. Unfortunately, nobody can tell you what is the lowest price with which it will get included within, for example, a week. If ...


0

I wrote the deploy() in try/catch block: const deploy = async () => { try { const accounts = await web3.eth.getAccounts(); console.log("Attempting to deploy from account", accounts[0]); const result = await new web3.eth.Contract(JSON.parse(abi_string)) .deploy({ data: "0x" + bytecode }) .send({ from: ...


0

The obstacle: No one can create a contract that spends from someone else's wallet. This rule doesn't change when two contracts originate from the same author. The solution: There is a trust relationship between the two contracts. Domain cannot spend from Serial's money, but Serial can give Domain money for a specific purpose with an expectation that unused ...


1

you can't run const token twice. clear the truffle console, start again and this time run token as the next line


0

It's usual that projects would give their multisig wallet contract an ENS domain. You could assign one account as the registrant/controller (account with rights to control the ENS domain settings, usually an EOA), and another account to be the ETH record (the address the ENS domain routes to on Ethereum). As far as Metamask knows, an ENS domain is simply an ...


0

Your problem may come from the fact that, although you are specifying a specific amount of gas that can be used, you are not specifying an explicit gas price for your transaction. Gas price is higher on mainnet than on testnets. Here is a great answer explaining the two concepts. By default, testnet probably used a low gas price, so you got a cost of 13$. ...


0

https://opensea.io/blog/announcements/introducing-the-collection-manager/ The new collection manager allows creators to make NFTs without any upfront gas cost, as the NFT isn’t transferred on-chain until the first purchase or transfer is made. We call this lazy minting. Anytime a write happens to the blockchain gas fees have to be paid. There is nothing ...


0

You can try to estimate the gas needed by your transaction by using the method estimateGas() from web3.js (https://web3js.readthedocs.io/en/v1.2.5/web3-eth.html?highlight=estimategas#estimategas). Then multiply it by the current gas price (check https://etherscan.io/gastracker).


0

Replace users[luckyNumber].transfer(address(this).balance); with payable(users[luckyNumber]).transfer(address(this).balance);


2

But what role did he play (if any) in this contract deployment? He didn't. Just like all the other token deployments featuring his address. (I'm assuming this is for the token named SPAGINU&#127837, which I worked out from the timestamp.) Looking at the constructor of the contract: constructor (address payable FeeAddress, address payable ...


0

The transaction in your example is masked, so I can't really tell, but it does not look like a Contract Creation transaction. The first transaction that you see on a contract page is the Contract creation transaction. The to address is the contract's address. The from address is the address of whoever deployed it. Here is an example (the USDT contract ...


1

Partial answer: Why does OpenSea run gas free for sellers, They often wait until the gas prices are relatively low They use bundles, which combine multiple NFT listings into one transaction ... whereas alot of curated NFT platforms charge gas fees? Competition. They've probably done the sums and think they can make more this way. From the docs: Note ...


0

Solidity v0.8.0 includes a breaking change which requires address to be explicitly converted to the address payable type. Wrapping the returned msg.sender would solve the problem: function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); // explicit conversion }


1

You're right that not specifying decimals, would treat it as 0. It sounds tautological, but to answer your related questions, a totalSupply of 100 would be 100 tokens, and a transfer of 10, would transfer 10 tokens. When using decimals, make sure to see this question because it does affect the values for totalSupply and transfer amounts: Decimals on ERC20 ...


0

The transfer() function does not care if there are decimals or not. It is purely a cosmetic divisor for human display.


0

No. The contract size mainly depends on the source code. There are other factors like compiler version used, the EVM's opcode pricings, but they are minor variations. Remix in the "Deploy & Run transaction" tab has a "Gas Limit" input, with a default value of 3M gas.


0

You can just remove that file. If you have multiple contracts and you sometimes update only some of them, the initial migration is supposed to make sure that only the changed contracts are updated. In reality I haven't seen any serious project use the initial migrations. Some have the file still there, but have basically forgotten it's there and gain no ...


Top 50 recent answers are included