1

As Ismael has mentioned, the solution is to when the meta mask window is poped up for your confiramtion of transaction, we can edit(increase) the gas limit there to get our expected result.


1

private in the context of solidity smart contracts doesn't mean the value is a secret. It just means the variable is incapsulated and another contract will not be able to reference it directly. However the value itself is always visible when the block is introspected, or the transaction that set the value is analyzed. It is also a best security practice to ...


1

Since you are passing value > 0 in: contract.methods.main(amount, guess).send({value: amountWei, ...}, ...) You need to declare function main as payable.


1

import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; function withdrawErc20(IERC20 token) public { token.transfer(msg.sender, token.balanceOf(address(this)); } See IERC20 for the interface code. Copy & paste it or install it via npm.


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