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