Hot answers tagged

2 votes

What is the problem with structs having just arrays as its members?

See the docs When set A public a, it auto generate a defaut getter for a. And follow the docs, nothing is return in that default getter, so it raised the issue. But when you put 1 non-array member in ...
  • 123
1 vote

Why am I getting `undefined` when trying to access array elements in Truffle Console?

Truffle functions return a Future so you need to await for the result: > myArray = await myContract.getMyArray() [ BN { negative: 0, words: [ 0, <1 empty item> ], length: 1, ...
  • 30.2k
1 vote

Best practices for working around the lack of dynamically sized memory arrays in solidity

I think the most gas-efficient way is moving the check condition into someOtherFunction() and processing the whole array.

Only top scored, non community-wiki answers of a minimum length are eligible