コード例 #1
0
        public override DecodedContainer DecodeIntoContainer(Web3 web, string address, BigInteger index, int offset)
        {
            string val = getStorageAt(web, address, index);
            string decode;

            if (offset > 0 || size < 32)
            {
                BigInteger num = SolidityUtils.getAtOffset(val, offset, size);
                val = num.ToString(); //TODO: test ouf small size strings
            }

            decode = new Bytes32TypeDecoder().Decode <string>(val);
            //testString test string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\u0018
            //clean this up
            string[] substrings = decode.Split('\0', 2);
            if (substrings.Length > 0) //if it is not null terminated for some reason leave it as is
            {
                decode = substrings[0];
            }

            return(new DecodedContainer
            {
                decodedValue = decode,
                rawValue = val,
                solidityVar = this
            });
        }
コード例 #2
0
        public override DecodedContainer DecodeIntoContainer(Web3 web, string address, BigInteger index, int offset)
        {
            string     val    = getStorageAt(web, address, index);
            BigInteger num    = SolidityUtils.getAtOffset(val, offset, getByteSize());
            string     decode = (num == 1).ToString(); //TODO: check if the boolean conversion works

            return(new DecodedContainer
            {
                decodedValue = decode,
                rawValue = num.ToString(),
                solidityVar = this
            });
        }
コード例 #3
0
        public override DecodedContainer DecodeIntoContainer(Web3 web, string address, BigInteger index, int offset)
        {
            string     val = getStorageAt(web, address, index);
            BigInteger num;

            if (offset == 0 && size == 32)
            {
                num = new Bytes32TypeDecoder().Decode <BigInteger>(val);
            }
            else
            {
                num = SolidityUtils.getAtOffset(val, offset, size);
            }
            string decode = num.ToString();

            return(new DecodedContainer
            {
                decodedValue = decode,
                rawValue = val,
                solidityVar = this
            });
        }