/*
	This file is part of solidity.

	solidity is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	solidity is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with solidity.  If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0

syntax = "proto2";

// bool
message BoolType {}

// uint8...256, int8...256
message IntegerType {
    required bool is_signed = 1;
    required uint32 width = 2;
}

// bytes1, bytes2,..., bytes32
message FixedByteType {
    required uint32 width = 1;
}

// address
message AddressType {}

message ValueType {
    oneof value_type_oneof {
        IntegerType inty = 1;
        FixedByteType byty = 2;
        AddressType adty = 3;
        BoolType boolty = 4;
    }
}

// bytes
message DynamicByteArrayType {}

message ArrayType {
    required Type t = 1;
    required uint32 length = 2;
    required bool is_static = 3;
}

message StructType {
    repeated Type t = 1;
}

message NonValueType {
    oneof nonvalue_type_oneof {
        DynamicByteArrayType dynbytearray = 1;
        ArrayType arrtype = 2;
        StructType stype = 3;
    }
}

// TODO: Add more types
// See https://github.com/ethereum/solidity/issues/6749
message Type {
    oneof type_oneof {
        ValueType vtype = 1;
        NonValueType nvtype = 2;
    }
}

message VarDecl {
    required Type type = 1;
}

message TestFunction {
    required VarDecl local_vars = 1;
    // Length of invalid encoding
    required uint64 invalid_encoding_length = 2;
}

message Contract {
    enum Test {
        CALLDATA_CODER = 1;
        RETURNDATA_CODER = 2;
    }
    required VarDecl state_vars = 1;
    required TestFunction testfunction = 2;
    required Test test = 3;
    required uint32 seed = 4;
}

package solidity.test.abiv2fuzzer;
