Skip to content

Instantly share code, notes, and snippets.

View KevinSmall's full-sized avatar

Kevin Small KevinSmall

View GitHub Profile
@KevinSmall
KevinSmall / Getting Revert Reasons From Solidity.md
Last active August 21, 2019 08:05
Getting Revert Reasons From Solidity

See also summary on issue with calls here: https://forum.openzeppelin.com/t/require-in-view-pure-functions-dont-revert-on-public-networks/1211

Getting Revert Reasons from the Solidity Require Statement

There is a test contract 0x6491eb4fb1269c7587451cf0102437a685897b78 you can interact with on etherscan Rinkeby. It has functions getWithCheck and setWithCheck to get and set a value. If you pass a parameter >=0 the function will be ok, if you pass a parameter <0 the function fails at the require statement.

1) Calls

For 'getWithCheck', the require statement triggers a Geth bug and you get back the mysterious value: 3963877391197344453575983046348115674221700746820753546331534351508065746944. This value in hex becomes 0x08c379a0 which is the function selector for Error(string), as described [in the solidity docs](https://solidity.readthedocs.io/en/v0.5.11/control-

### Keybase proof
I hereby claim:
* I am kevinsmall on github.
* I am kevinsmall (https://keybase.io/kevinsmall) on keybase.
* I have a public key ASAJ983oSCq_XBhTByjMPaAm-4P5iQ5zUdixTCBClQcd9go
To claim this, I am signing this object:
@KevinSmall
KevinSmall / Program.cs
Last active May 30, 2019 11:26
C# program to check ERC20 balance of an address using Nethereum
using Nethereum.StandardTokenEIP20;
using Nethereum.Web3;
using System;
using System.Threading.Tasks;
namespace TokenTok
{
class Program
{
static void Main(string[] args)
using Nethereum.Web3;
using System;
using System.Threading.Tasks;
using Nethereum.ABI.FunctionEncoding.Attributes;
using System.Numerics;
using Nethereum.RPC.Eth.DTOs;
namespace NethereumSample
{
class Program