New answers tagged

0

You should not run anything in the receive function. You want to make sure that the contract can receive ether without running out of gas. Sending ether is probably the cheapest operation to do with an floor gas of 21000 unit. This function should remain empty and just allow your contract to receive ether.You should use a function like this. function ...


2

Check out this function I modified from the openzepplin's Address.sol. function _delegatecall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); if (!success) { if (returndata.length == 0) revert(); assembly { revert(add(32, returndata), ...


1

Normally a call or a delegatecall doesn't revert while calling a function that reverts. (bool success, bytes memory result) = to.call/delegatecall{value,gas,etc}(data). The success variable will determine if the call was successful true or unsuccessful false. So if you call: error Unauthorized(string reason); function withdraw() public { revert ...


0

ONe thing that maybe causing this issue The front sends 1 ether contractInstance.methods.betxc(x).send({value: web3.utils.toWei("1", "ether")}) and the contract when winning send twice that amount msg.sender.transfer(msg.value*2); For the transfer to succeed the contract needs to have a balance greater than 2 ether. Note: block....


1

I had same errors and I solved it now by raising the gas limit when sending transaction! I recommend you raise your gas limit and try it again.


Top 50 recent answers are included