Пример #1
0
        public override byte[] Encode(object?arg, bool packed)
        {
            if (arg is Array input)
            {
                byte[][] encodedItems = new byte[input.Length + 1][];
                int      i            = 0;
                encodedItems[i++] = UInt256.Encode((BigInteger)input.Length, packed);
                foreach (object?o in input)
                {
                    encodedItems[i++] = ElementType.Encode(o, packed);
                }

                return(Bytes.Concat(encodedItems));
            }

            throw new AbiException(AbiEncodingExceptionMessage);
        }