New answers tagged

0

Here is a pure ethers.js implementation in TypeScript, returning a checksummed address. nonce is expected to be a regular number: import { ethers } from 'hardhat'; static getContractAddress(address: string, nonce: number): string { const rlp_encoded = ethers.utils.RLP.encode( [address, ethers.BigNumber.from(nonce.toString()).toHexString()] );...


0

Deploying a single contract will be cheaper than deploying multiple contracts with the same functions. There are many costs associated with a transaction and the creation of a contract. To start, every Ethereum transaction costs 21,000 gas, no matter what the transaction is. Additionally, contract creations use a number of different opcodes, which all have ...


1

The first option is close. Before execution the transaction gasLimit * gasPrice are removed from the sender account Transaction is executed unusedGas * gasPrice is returned to sender usedGas * gasPrice is send to miner The state changes in 1, 3 and 4 are unusual in that there's only one part involved. See here https://github.com/ethereum/go-ethereum/blob/...


0

Seems, this is the solution - verification https://medium.com/etherscan-blog/and-finally-proxy-contract-support-on-etherscan-693e3da0714b


1

There's a cap to the maximum refundable gas. Only half of the total used gas can be refunded. (*) In the example at most you can refund (21000 + 5000) / 2 = 13000 gas. So it will be at 21000 + 5000 - min(13000, 15000) = 26000 - 13000 = 13000. Very close to the measured amount. (*) The exact details are in Ethereum's Yellow Paper Section 6.2 Execution.


0

Nothing is free. Processing instructions cost gas, just much much less than a transaction that changes state. It may not cost gas when the EVM is run in popular IDEs, which can lead to the false belief that pure functions cost nothing. This basic function: function bigLoop(uint max) public pure returns (uint) { uint n; for(n = 0; n < ...


2

The ("official") Solidity compiler and associated utilities are written in C++. But Solidity is its own language with its own grammar. does that mean that smart contracts require some level of C++ programming skills to get by? No. You could write a Solidity compiler in any language you like as long as the output of compilation is valid EVM ...


0

Can anyone in simple terms explain what expansion cost means? When your contract writes to memory, you pay for the costs associated with the number of bytes written. However, if you are writing to an area of memory that hasn't been written to before, there is an associated additional cost with using it for the first time. Think of it as an additional tax ...


1

__$de3f906ec3d3531c3d498f8b283d7f02e6$__ is a placeholder for library address. The deployment process of smart contracts look somewhat like this Library is compiled Library is deployed, gets an address Contract using library is compiled Contract is "linked" - all placeholders in the bytecode are replaced with the library address Contract is ...


0

Here's the fix. I just ran into this issue today. // truffle-config.js const regeneratorRuntime = require("regenerator-runtime"); Then install the NPM package: npm install regenerator-runtime


0

Root cause of the issue identified: When I deployed FVP_Tokel.sol on Ropsten via Truffle/Infura it migrated and worked just fine; but when I started experiencing issues while deploying on Mainnet (the prompt would just sit there for hours after compiling) I decided to try Remix (granted, the new fancy version) which in fact I do not recall there was an area ...


0

I got the answer by referring to How do Proxy Upgraded Logic Contracts Share Data This suggests we have proxy contracts


0

My wallet 0xbC57B9bb80DD02c882fcE8cf5700f8A2a003838E is the creator wallet ; See the Contract ; Therefore I should be the ONLY one able to see and execute the MINT function. I am still waiting for an answer from the Ethereum Team...


1

Well, since you didn't provide high enough of a gas price miners don't mine the transactions. So you can either wait or replace the transaction. (I don't know how replacing a transaction works in Remix). If you want to wait it may take days, months or forever. Or at some point the transaction may simply disappear when nodes' mempools get full and they delete ...


0

The more important difference is that if funcName reverts then for case 2 bla will also revert. For case 2 calls returns a boolean indicating if the call has failed, and have the posibility to ignore the failure. Using raw call is low level and discouraged because it is easy to make mistakes. Since solc 0.6 you can use try/catch try myContract.funcName(...


0

One solution would be to have an initial zero supply and when someone deposits ETH into your contract then the contract will mint an appropriate number of tokens and transfer them to the caller. Later when they return the tokens to get their ETH back you can destroy the tokens so that they no longer exist. The other alternative would be to create an initial ...


1

Although I was unable to deploy/migrate via Truffle/Infura with plenty ETH, the contract was finally deployed/migrated via Remix/Metamask by setting GAS LIMIT=800000 and VALUE=0 at a non-peak time. See https://etherscan.io/tx/0xde603058609d800d0ee2ccc5cf4cfa086a7161a25b9ce774cabae52a7514282c


1

Solidity has a StackTooDeepException. This means that you can only have 16 local variables at any given time. Scoping, in this sense, allows the contract to create local variables within a specific scope (for example, within brackets {...}), and then destroy them within that scope. The reason this is important is because the newly created/destroyed variable ...


-1

Effectively, there is no difference. Using an interface provides compile time safety checks on arguments used. And simplifies the usage of return values the same way. This is a quick, simple example, but basically these code lines are equivalent. <Type> returnTuple = address.call( <payload as byyes> ); <Type> returnTuple = address.call( ...


0

Referncing the documentation: web3.js v1.3.1 solc version: 0.8.0 web3.js version: 1.3.1 Suppose following is your smart contract: contract myContract{ constructor(int a, string memory str){ // Some code using the arguments. } } Following is how you deploy the contract: var intObj = 10; var strObj = 'Hello'; contract = await new web3.eth....


0

The contract you are trying to deploy has a non-payable constructor and you are sending a 0.00000008 Ethers. From the transaction trace [1] 0 PUSH1 238732 3 1 [2] 2 PUSH1 238729 3 1 [3] 4 MSTORE 238726 12 1 [4] 5 CALLVALUE 238714 2 1 [5] 6 DUP1 238712 3 1 [6] 7 ISZERO 238709 3 ...


Top 50 recent answers are included