github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/models/contract_create_tx.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  	utils "github.com/aeternity/aepp-sdk-go/utils"
    15  )
    16  
    17  // ContractCreateTx contract create tx
    18  // swagger:model ContractCreateTx
    19  type ContractCreateTx struct {
    20  
    21  	// ABI version
    22  	// Required: true
    23  	AbiVersion Uint16 `json:"abi_version"`
    24  
    25  	// amount
    26  	// Required: true
    27  	Amount utils.BigInt `json:"amount"`
    28  
    29  	// Contract call data
    30  	// Required: true
    31  	CallData EncodedByteArray `json:"call_data"`
    32  
    33  	// Contract's code
    34  	// Required: true
    35  	Code EncodedByteArray `json:"code"`
    36  
    37  	// deposit
    38  	// Required: true
    39  	Deposit utils.BigInt `json:"deposit"`
    40  
    41  	// fee
    42  	// Required: true
    43  	Fee utils.BigInt `json:"fee"`
    44  
    45  	// gas
    46  	// Required: true
    47  	Gas Uint64 `json:"gas"`
    48  
    49  	// gas price
    50  	// Required: true
    51  	GasPrice utils.BigInt `json:"gas_price"`
    52  
    53  	// Owner's nonce
    54  	Nonce Uint64 `json:"nonce,omitempty"`
    55  
    56  	// Contract owner pub_key
    57  	// Required: true
    58  	OwnerID EncodedPubkey `json:"owner_id"`
    59  
    60  	// ttl
    61  	TTL Uint64 `json:"ttl,omitempty"`
    62  
    63  	// Virtual machine's version
    64  	// Required: true
    65  	VMVersion Uint16 `json:"vm_version"`
    66  }
    67  
    68  // Validate validates this contract create tx
    69  func (m *ContractCreateTx) Validate(formats strfmt.Registry) error {
    70  	var res []error
    71  
    72  	if err := m.validateAbiVersion(formats); err != nil {
    73  		res = append(res, err)
    74  	}
    75  
    76  	if err := m.validateAmount(formats); err != nil {
    77  		res = append(res, err)
    78  	}
    79  
    80  	if err := m.validateCallData(formats); err != nil {
    81  		res = append(res, err)
    82  	}
    83  
    84  	if err := m.validateCode(formats); err != nil {
    85  		res = append(res, err)
    86  	}
    87  
    88  	if err := m.validateDeposit(formats); err != nil {
    89  		res = append(res, err)
    90  	}
    91  
    92  	if err := m.validateFee(formats); err != nil {
    93  		res = append(res, err)
    94  	}
    95  
    96  	if err := m.validateGas(formats); err != nil {
    97  		res = append(res, err)
    98  	}
    99  
   100  	if err := m.validateGasPrice(formats); err != nil {
   101  		res = append(res, err)
   102  	}
   103  
   104  	if err := m.validateNonce(formats); err != nil {
   105  		res = append(res, err)
   106  	}
   107  
   108  	if err := m.validateOwnerID(formats); err != nil {
   109  		res = append(res, err)
   110  	}
   111  
   112  	if err := m.validateTTL(formats); err != nil {
   113  		res = append(res, err)
   114  	}
   115  
   116  	if err := m.validateVMVersion(formats); err != nil {
   117  		res = append(res, err)
   118  	}
   119  
   120  	if len(res) > 0 {
   121  		return errors.CompositeValidationError(res...)
   122  	}
   123  	return nil
   124  }
   125  
   126  func (m *ContractCreateTx) validateAbiVersion(formats strfmt.Registry) error {
   127  
   128  	if err := m.AbiVersion.Validate(formats); err != nil {
   129  		if ve, ok := err.(*errors.Validation); ok {
   130  			return ve.ValidateName("abi_version")
   131  		}
   132  		return err
   133  	}
   134  
   135  	return nil
   136  }
   137  
   138  func (m *ContractCreateTx) validateAmount(formats strfmt.Registry) error {
   139  
   140  	if err := m.Amount.Validate(formats); err != nil {
   141  		if ve, ok := err.(*errors.Validation); ok {
   142  			return ve.ValidateName("amount")
   143  		}
   144  		return err
   145  	}
   146  
   147  	return nil
   148  }
   149  
   150  func (m *ContractCreateTx) validateCallData(formats strfmt.Registry) error {
   151  
   152  	if err := m.CallData.Validate(formats); err != nil {
   153  		if ve, ok := err.(*errors.Validation); ok {
   154  			return ve.ValidateName("call_data")
   155  		}
   156  		return err
   157  	}
   158  
   159  	return nil
   160  }
   161  
   162  func (m *ContractCreateTx) validateCode(formats strfmt.Registry) error {
   163  
   164  	if err := m.Code.Validate(formats); err != nil {
   165  		if ve, ok := err.(*errors.Validation); ok {
   166  			return ve.ValidateName("code")
   167  		}
   168  		return err
   169  	}
   170  
   171  	return nil
   172  }
   173  
   174  func (m *ContractCreateTx) validateDeposit(formats strfmt.Registry) error {
   175  
   176  	if err := m.Deposit.Validate(formats); err != nil {
   177  		if ve, ok := err.(*errors.Validation); ok {
   178  			return ve.ValidateName("deposit")
   179  		}
   180  		return err
   181  	}
   182  
   183  	return nil
   184  }
   185  
   186  func (m *ContractCreateTx) validateFee(formats strfmt.Registry) error {
   187  
   188  	if err := m.Fee.Validate(formats); err != nil {
   189  		if ve, ok := err.(*errors.Validation); ok {
   190  			return ve.ValidateName("fee")
   191  		}
   192  		return err
   193  	}
   194  
   195  	return nil
   196  }
   197  
   198  func (m *ContractCreateTx) validateGas(formats strfmt.Registry) error {
   199  
   200  	if err := m.Gas.Validate(formats); err != nil {
   201  		if ve, ok := err.(*errors.Validation); ok {
   202  			return ve.ValidateName("gas")
   203  		}
   204  		return err
   205  	}
   206  
   207  	return nil
   208  }
   209  
   210  func (m *ContractCreateTx) validateGasPrice(formats strfmt.Registry) error {
   211  
   212  	if err := m.GasPrice.Validate(formats); err != nil {
   213  		if ve, ok := err.(*errors.Validation); ok {
   214  			return ve.ValidateName("gas_price")
   215  		}
   216  		return err
   217  	}
   218  
   219  	return nil
   220  }
   221  
   222  func (m *ContractCreateTx) validateNonce(formats strfmt.Registry) error {
   223  
   224  	if swag.IsZero(m.Nonce) { // not required
   225  		return nil
   226  	}
   227  
   228  	if err := m.Nonce.Validate(formats); err != nil {
   229  		if ve, ok := err.(*errors.Validation); ok {
   230  			return ve.ValidateName("nonce")
   231  		}
   232  		return err
   233  	}
   234  
   235  	return nil
   236  }
   237  
   238  func (m *ContractCreateTx) validateOwnerID(formats strfmt.Registry) error {
   239  
   240  	if err := m.OwnerID.Validate(formats); err != nil {
   241  		if ve, ok := err.(*errors.Validation); ok {
   242  			return ve.ValidateName("owner_id")
   243  		}
   244  		return err
   245  	}
   246  
   247  	return nil
   248  }
   249  
   250  func (m *ContractCreateTx) validateTTL(formats strfmt.Registry) error {
   251  
   252  	if swag.IsZero(m.TTL) { // not required
   253  		return nil
   254  	}
   255  
   256  	if err := m.TTL.Validate(formats); err != nil {
   257  		if ve, ok := err.(*errors.Validation); ok {
   258  			return ve.ValidateName("ttl")
   259  		}
   260  		return err
   261  	}
   262  
   263  	return nil
   264  }
   265  
   266  func (m *ContractCreateTx) validateVMVersion(formats strfmt.Registry) error {
   267  
   268  	if err := m.VMVersion.Validate(formats); err != nil {
   269  		if ve, ok := err.(*errors.Validation); ok {
   270  			return ve.ValidateName("vm_version")
   271  		}
   272  		return err
   273  	}
   274  
   275  	return nil
   276  }
   277  
   278  // MarshalBinary interface implementation
   279  func (m *ContractCreateTx) MarshalBinary() ([]byte, error) {
   280  	if m == nil {
   281  		return nil, nil
   282  	}
   283  	return swag.WriteJSON(m)
   284  }
   285  
   286  // UnmarshalBinary interface implementation
   287  func (m *ContractCreateTx) UnmarshalBinary(b []byte) error {
   288  	var res ContractCreateTx
   289  	if err := swag.ReadJSON(b, &res); err != nil {
   290  		return err
   291  	}
   292  	*m = res
   293  	return nil
   294  }