New answers tagged

0

The original poster was almost definitely working on an exercise from the book, or Udemy course, "Ethereum and Solidity: The Complete Developer's Guide". The course is quite outdated by now and most users will struggle to test the examples in Remix using the examples provided. I'm working through the course myself and found this repo very useful: ...


0

The comment is right, removing the [] fixes it. stateStorageForNumbers_[tokenIDs[i]] = _numbers[i]; ^ This works.


0

Trying the Solidity code on my local environment running go-ethereum, it worked just fine. It may sound dumb but after you altered the smart contract code and re-deployed it, did you add files to the storage? Because it's a new smart contract, new address, new storage. Myself, I got rid of Ganache because it was acting different that the production network (...


1

You can delete an array to achieve your goal. See the following code as an example. pragma solidity 0.6.12; contract Test { uint256[] public bidderItemID; function setBidderItemID() public { bidderItemID = [1,2,3]; } function deleteBidderItemID() public { delete bidderItemID; } }


1

You haven't declared allowed as a 2D mapping, but you're trying to use it as one. You need: mapping (address => mapping (address => uint256)) private allowed;


0

Try this: struct Address { address[] addressList; } function createProposal() public { address[] memory emptyAddressList; Address memory _address = Address({ addressList: emptyAddressList }) }


0

If the element index is out of range from arrays length. It will revert. To push value to array, use amounts.push(x)


Top 50 recent answers are included