Most Popular
1500 questions
12
votes
3 answers
copy a struct from Contract A into a struct in Contract B using Contract C
I want to copy a struct from Contract A into a struct in Contract B using Contract C. Is it possible in solidity ??
We can do it for single variables.
Himanshu Pandey
- 160
- 1
- 11
12
votes
2 answers
How to bubble up a custom error when using DELEGATECALL?
Solidity v0.8.4 introduced custom errors:
error Unauthorized();
Say I have contract A which delegate calls to contract B. The latter reverts with the custom error defined above. How can I bubble that error up in contract A?
Paul Razvan Berg
- 17,902
- 6
- 73
- 143
12
votes
2 answers
What does ERC721URIStorage actually mean?
The official docs say
ERC721 token with storage based token URI management.
If someone could elaborate more on what exactly this means and when to use it, I'd be grateful.
Ape Toshi
- 311
- 2
- 10
12
votes
3 answers
How to send transaction with ethereumjs-tx?
I installed and used ethereumjs-tx, as explained here.
I ran the following commands:
var Tx = require('ethereumjs-tx')
var privateKey = new Buffer('xxxxxxxxx', 'hex')
var rawTx = {
nonce: '0x00',
gasPrice: '0x09184e72a000',
gasLimit:…
jeff
- 2,550
- 2
- 18
- 40
12
votes
2 answers
What is the difference between Ethereum and Eris?
When I first searched for Turing complete blockchains towards the end of 2015 Google returned both Eris and Ethereum at the top. My initial impression was that they are quite distinct. More recently though I read that Eris is a spinoff. What exactly…
hcvst
- 2,018
- 2
- 21
- 24
11
votes
4 answers
How to console log output in hardhat test?
I'm using running hardhat tests. When I add console logs to the test cases, nothing actually gets outputted to console. Why's that?
doctopus
- 315
- 2
- 9
11
votes
5 answers
Error: Transaction reverted: function call to a non-contract account
I've been trying to debug this for the past 2 days, it has driven me insane. I'm getting this error when testing my contract: Error: Transaction reverted: function call to a non-contract account. It's the simplest contract and simplest function…
Colin Steidtmann
- 213
- 1
- 2
- 5
11
votes
3 answers
Solidity error when encoding arguments to query public mapping
While developing a Smart Contract with Solidity on Remix , after creating the contract I'm trying to query a public mapping:
mapping (address => uint256) public balanceOf;
but when I call balanceOf for address…
Juan Ignacio Pérez Sacristán
- 3,550
- 9
- 43
- 73
11
votes
4 answers
What is the reason behind writing "using Counters for Counters.counters" when using the Counters openzeppelin library
While trying to understand the OpenZeppelin contracts that a contract inherited from, I stumbled upon the line using Counters for Counters.Counter; after the counters library of OpenZeppelin was imported:…
vadimpl
- 111
- 1
- 4
11
votes
6 answers
UniswapV2 addLiquidity revert ds-math-sub-underflow
I'm trying to use Uniswapv2Router with Truffle and Ganache, but haven't been able to identify what I'm doing wrong. I'm using addLiquidty method as follows:
await uniswapV2Router02.addLiquidity(token0.address, token1.address, 500, 250, 250 , 125,…
SergioGaitan
- 321
- 1
- 2
- 7
11
votes
1 answer
Does "delete" on mapping really frees the memory space?
I have the following mapping(uint => Foo[]) data structure. I have mapped 10 unique ids with 10 Foo structs, where each Foo is an arraylist of 10 items.
Step 1:
for(int i = 0; i < 10; i++)
for(int j = 0; j < 10; j++)
add(i, j);
Step 2:…
alper
- 8,395
- 11
- 63
- 152
11
votes
1 answer
How do I install solc on Mac Osx? Error encountered "Error: No formulae found in taps."
I'm trying to install a solidity compiler on my Mac.
I've followed the guide here: https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial
The error that I've gotten when installing ccp-ethereum is "Error: No formulae found in…
Ng Zhong Qin
- 305
- 1
- 2
- 7
11
votes
1 answer
How to fix "TypeError: Type address is not implicitly convertible to expected type address payable"? (Solidity 0.8.2)
I've switched from Solidity 0.7.2 to 0.8.2
And the addresses declared as payable (owner) are reporting they are "NOT payable" in the contract.
pragma solidity ^0.8.2;
contract MyContract {
address payable public owner;
constructor(address…
GN.
- 643
- 2
- 8
- 20
11
votes
2 answers
Explicit type conversion not allowed from "int_const -1" to "uint128"
I am compiling using sol 0.8.0 and the following line is producing the error in the title:
uint256 public constant MASK = uint128(~0);
Error:
Explicit type conversion not allowed from "int_const -1" to "uint128".
When changing the variable to…
Dylan Kilkenny
- 362
- 2
- 13
11
votes
1 answer
Web3: current best practice to connect Metamask to Chrome?
I am currently trying to connect my React front-end to Metamask on Chrome.
When using the following method, I get that ethereum.enable() is deprecated:
if (window.ethereum) {
window.web3 = new Web3(window.ethereum);
…
Thanh-Quy Nguyen
- 326
- 1
- 2
- 11