github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/compiler/models/decode_calldata_bytecode.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package models
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	strfmt "github.com/go-openapi/strfmt"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/swag"
    13  )
    14  
    15  // DecodeCalldataBytecode decode calldata bytecode
    16  // swagger:model DecodeCalldataBytecode
    17  type DecodeCalldataBytecode struct {
    18  
    19  	// Compiled contract
    20  	// Required: true
    21  	Bytecode EncodedByteArray `json:"bytecode"`
    22  
    23  	// Calldata to dissect
    24  	// Required: true
    25  	Calldata EncodedByteArray `json:"calldata"`
    26  }
    27  
    28  // Validate validates this decode calldata bytecode
    29  func (m *DecodeCalldataBytecode) Validate(formats strfmt.Registry) error {
    30  	var res []error
    31  
    32  	if err := m.validateBytecode(formats); err != nil {
    33  		res = append(res, err)
    34  	}
    35  
    36  	if err := m.validateCalldata(formats); err != nil {
    37  		res = append(res, err)
    38  	}
    39  
    40  	if len(res) > 0 {
    41  		return errors.CompositeValidationError(res...)
    42  	}
    43  	return nil
    44  }
    45  
    46  func (m *DecodeCalldataBytecode) validateBytecode(formats strfmt.Registry) error {
    47  
    48  	if err := m.Bytecode.Validate(formats); err != nil {
    49  		if ve, ok := err.(*errors.Validation); ok {
    50  			return ve.ValidateName("bytecode")
    51  		}
    52  		return err
    53  	}
    54  
    55  	return nil
    56  }
    57  
    58  func (m *DecodeCalldataBytecode) validateCalldata(formats strfmt.Registry) error {
    59  
    60  	if err := m.Calldata.Validate(formats); err != nil {
    61  		if ve, ok := err.(*errors.Validation); ok {
    62  			return ve.ValidateName("calldata")
    63  		}
    64  		return err
    65  	}
    66  
    67  	return nil
    68  }
    69  
    70  // MarshalBinary interface implementation
    71  func (m *DecodeCalldataBytecode) MarshalBinary() ([]byte, error) {
    72  	if m == nil {
    73  		return nil, nil
    74  	}
    75  	return swag.WriteJSON(m)
    76  }
    77  
    78  // UnmarshalBinary interface implementation
    79  func (m *DecodeCalldataBytecode) UnmarshalBinary(b []byte) error {
    80  	var res DecodeCalldataBytecode
    81  	if err := swag.ReadJSON(b, &res); err != nil {
    82  		return err
    83  	}
    84  	*m = res
    85  	return nil
    86  }