github.com/annchain/OG@v0.0.9/og/protocol/ogmessage/archive/token_tx_gen.go (about)

     1  package archive
     2  
     3  // Code generated by github.com/tinylib/msgp DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/annchain/OG/common"
     7  	"github.com/annchain/OG/common/math"
     8  	"github.com/tinylib/msgp/msgp"
     9  )
    10  
    11  // DecodeMsg implements msgp.Decodable
    12  func (z *ActionTx) DecodeMsg(dc *msgp.Reader) (err error) {
    13  	var zb0001 uint32
    14  	zb0001, err = dc.ReadArrayHeader()
    15  	if err != nil {
    16  		err = msgp.WrapError(err)
    17  		return
    18  	}
    19  	if zb0001 != 4 {
    20  		err = msgp.ArrayError{Wanted: 4, Got: zb0001}
    21  		return
    22  	}
    23  	err = TxBase.DecodeMsg(dc)
    24  	if err != nil {
    25  		err = msgp.WrapError(err, "TxBase")
    26  		return
    27  	}
    28  	z.Action, err = dc.ReadUint8()
    29  	if err != nil {
    30  		err = msgp.WrapError(err, "Action")
    31  		return
    32  	}
    33  	if dc.IsNil() {
    34  		err = dc.ReadNil()
    35  		if err != nil {
    36  			err = msgp.WrapError(err, "From")
    37  			return
    38  		}
    39  		z.From = nil
    40  	} else {
    41  		if z.From == nil {
    42  			z.From = new(common.Address)
    43  		}
    44  		err = z.From.DecodeMsg(dc)
    45  		if err != nil {
    46  			err = msgp.WrapError(err, "From")
    47  			return
    48  		}
    49  	}
    50  	err = z.ActionData.DecodeMsg(dc)
    51  	if err != nil {
    52  		err = msgp.WrapError(err, "ActionData")
    53  		return
    54  	}
    55  	return
    56  }
    57  
    58  // EncodeMsg implements msgp.Encodable
    59  func (z *ActionTx) EncodeMsg(en *msgp.Writer) (err error) {
    60  	// array header, size 4
    61  	err = en.Append(0x94)
    62  	if err != nil {
    63  		return
    64  	}
    65  	err = TxBase.EncodeMsg(en)
    66  	if err != nil {
    67  		err = msgp.WrapError(err, "TxBase")
    68  		return
    69  	}
    70  	err = en.WriteUint8(z.Action)
    71  	if err != nil {
    72  		err = msgp.WrapError(err, "Action")
    73  		return
    74  	}
    75  	if z.From == nil {
    76  		err = en.WriteNil()
    77  		if err != nil {
    78  			return
    79  		}
    80  	} else {
    81  		err = z.From.EncodeMsg(en)
    82  		if err != nil {
    83  			err = msgp.WrapError(err, "From")
    84  			return
    85  		}
    86  	}
    87  	err = z.ActionData.EncodeMsg(en)
    88  	if err != nil {
    89  		err = msgp.WrapError(err, "ActionData")
    90  		return
    91  	}
    92  	return
    93  }
    94  
    95  // MarshalMsg implements msgp.Marshaler
    96  func (z *ActionTx) MarshalMsg(b []byte) (o []byte, err error) {
    97  	o = msgp.Require(b, z.Msgsize())
    98  	// array header, size 4
    99  	o = append(o, 0x94)
   100  	o, err = TxBase.MarshalMsg(o)
   101  	if err != nil {
   102  		err = msgp.WrapError(err, "TxBase")
   103  		return
   104  	}
   105  	o = msgp.AppendUint8(o, z.Action)
   106  	if z.From == nil {
   107  		o = msgp.AppendNil(o)
   108  	} else {
   109  		o, err = z.From.MarshalMsg(o)
   110  		if err != nil {
   111  			err = msgp.WrapError(err, "From")
   112  			return
   113  		}
   114  	}
   115  	o, err = z.ActionData.MarshalMsg(o)
   116  	if err != nil {
   117  		err = msgp.WrapError(err, "ActionData")
   118  		return
   119  	}
   120  	return
   121  }
   122  
   123  // UnmarshalMsg implements msgp.Unmarshaler
   124  func (z *ActionTx) UnmarshalMsg(bts []byte) (o []byte, err error) {
   125  	var zb0001 uint32
   126  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
   127  	if err != nil {
   128  		err = msgp.WrapError(err)
   129  		return
   130  	}
   131  	if zb0001 != 4 {
   132  		err = msgp.ArrayError{Wanted: 4, Got: zb0001}
   133  		return
   134  	}
   135  	bts, err = TxBase.UnmarshalMsg(bts)
   136  	if err != nil {
   137  		err = msgp.WrapError(err, "TxBase")
   138  		return
   139  	}
   140  	z.Action, bts, err = msgp.ReadUint8Bytes(bts)
   141  	if err != nil {
   142  		err = msgp.WrapError(err, "Action")
   143  		return
   144  	}
   145  	if msgp.IsNil(bts) {
   146  		bts, err = msgp.ReadNilBytes(bts)
   147  		if err != nil {
   148  			return
   149  		}
   150  		z.From = nil
   151  	} else {
   152  		if z.From == nil {
   153  			z.From = new(common.Address)
   154  		}
   155  		bts, err = z.From.UnmarshalMsg(bts)
   156  		if err != nil {
   157  			err = msgp.WrapError(err, "From")
   158  			return
   159  		}
   160  	}
   161  	bts, err = z.ActionData.UnmarshalMsg(bts)
   162  	if err != nil {
   163  		err = msgp.WrapError(err, "ActionData")
   164  		return
   165  	}
   166  	o = bts
   167  	return
   168  }
   169  
   170  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   171  func (z *ActionTx) Msgsize() (s int) {
   172  	s = 1 + TxBase.Msgsize() + msgp.Uint8Size
   173  	if z.From == nil {
   174  		s += msgp.NilSize
   175  	} else {
   176  		s += z.From.Msgsize()
   177  	}
   178  	s += z.ActionData.Msgsize()
   179  	return
   180  }
   181  
   182  // DecodeMsg implements msgp.Decodable
   183  func (z *ActionTxs) DecodeMsg(dc *msgp.Reader) (err error) {
   184  	var zb0002 uint32
   185  	zb0002, err = dc.ReadArrayHeader()
   186  	if err != nil {
   187  		err = msgp.WrapError(err)
   188  		return
   189  	}
   190  	if cap((*z)) >= int(zb0002) {
   191  		(*z) = (*z)[:zb0002]
   192  	} else {
   193  		(*z) = make(ActionTxs, zb0002)
   194  	}
   195  	for zb0001 := range *z {
   196  		if dc.IsNil() {
   197  			err = dc.ReadNil()
   198  			if err != nil {
   199  				err = msgp.WrapError(err, zb0001)
   200  				return
   201  			}
   202  			(*z)[zb0001] = nil
   203  		} else {
   204  			if (*z)[zb0001] == nil {
   205  				(*z)[zb0001] = new(ActionTx)
   206  			}
   207  			err = (*z)[zb0001].DecodeMsg(dc)
   208  			if err != nil {
   209  				err = msgp.WrapError(err, zb0001)
   210  				return
   211  			}
   212  		}
   213  	}
   214  	return
   215  }
   216  
   217  // EncodeMsg implements msgp.Encodable
   218  func (z ActionTxs) EncodeMsg(en *msgp.Writer) (err error) {
   219  	err = en.WriteArrayHeader(uint32(len(z)))
   220  	if err != nil {
   221  		err = msgp.WrapError(err)
   222  		return
   223  	}
   224  	for zb0003 := range z {
   225  		if z[zb0003] == nil {
   226  			err = en.WriteNil()
   227  			if err != nil {
   228  				return
   229  			}
   230  		} else {
   231  			err = z[zb0003].EncodeMsg(en)
   232  			if err != nil {
   233  				err = msgp.WrapError(err, zb0003)
   234  				return
   235  			}
   236  		}
   237  	}
   238  	return
   239  }
   240  
   241  // MarshalMsg implements msgp.Marshaler
   242  func (z ActionTxs) MarshalMsg(b []byte) (o []byte, err error) {
   243  	o = msgp.Require(b, z.Msgsize())
   244  	o = msgp.AppendArrayHeader(o, uint32(len(z)))
   245  	for zb0003 := range z {
   246  		if z[zb0003] == nil {
   247  			o = msgp.AppendNil(o)
   248  		} else {
   249  			o, err = z[zb0003].MarshalMsg(o)
   250  			if err != nil {
   251  				err = msgp.WrapError(err, zb0003)
   252  				return
   253  			}
   254  		}
   255  	}
   256  	return
   257  }
   258  
   259  // UnmarshalMsg implements msgp.Unmarshaler
   260  func (z *ActionTxs) UnmarshalMsg(bts []byte) (o []byte, err error) {
   261  	var zb0002 uint32
   262  	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
   263  	if err != nil {
   264  		err = msgp.WrapError(err)
   265  		return
   266  	}
   267  	if cap((*z)) >= int(zb0002) {
   268  		(*z) = (*z)[:zb0002]
   269  	} else {
   270  		(*z) = make(ActionTxs, zb0002)
   271  	}
   272  	for zb0001 := range *z {
   273  		if msgp.IsNil(bts) {
   274  			bts, err = msgp.ReadNilBytes(bts)
   275  			if err != nil {
   276  				return
   277  			}
   278  			(*z)[zb0001] = nil
   279  		} else {
   280  			if (*z)[zb0001] == nil {
   281  				(*z)[zb0001] = new(ActionTx)
   282  			}
   283  			bts, err = (*z)[zb0001].UnmarshalMsg(bts)
   284  			if err != nil {
   285  				err = msgp.WrapError(err, zb0001)
   286  				return
   287  			}
   288  		}
   289  	}
   290  	o = bts
   291  	return
   292  }
   293  
   294  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   295  func (z ActionTxs) Msgsize() (s int) {
   296  	s = msgp.ArrayHeaderSize
   297  	for zb0003 := range z {
   298  		if z[zb0003] == nil {
   299  			s += msgp.NilSize
   300  		} else {
   301  			s += z[zb0003].Msgsize()
   302  		}
   303  	}
   304  	return
   305  }
   306  
   307  // DecodeMsg implements msgp.Decodable
   308  func (z *PublicOffering) DecodeMsg(dc *msgp.Reader) (err error) {
   309  	var zb0001 uint32
   310  	zb0001, err = dc.ReadArrayHeader()
   311  	if err != nil {
   312  		err = msgp.WrapError(err)
   313  		return
   314  	}
   315  	if zb0001 != 4 {
   316  		err = msgp.ArrayError{Wanted: 4, Got: zb0001}
   317  		return
   318  	}
   319  	z.TokenId, err = dc.ReadInt32()
   320  	if err != nil {
   321  		err = msgp.WrapError(err, "TokenId")
   322  		return
   323  	}
   324  	if dc.IsNil() {
   325  		err = dc.ReadNil()
   326  		if err != nil {
   327  			err = msgp.WrapError(err, "Value")
   328  			return
   329  		}
   330  		z.Value = nil
   331  	} else {
   332  		if z.Value == nil {
   333  			z.Value = new(math.BigInt)
   334  		}
   335  		err = z.Value.DecodeMsg(dc)
   336  		if err != nil {
   337  			err = msgp.WrapError(err, "Value")
   338  			return
   339  		}
   340  	}
   341  	z.EnableSPO, err = dc.ReadBool()
   342  	if err != nil {
   343  		err = msgp.WrapError(err, "EnableSPO")
   344  		return
   345  	}
   346  	z.TokenName, err = dc.ReadString()
   347  	if err != nil {
   348  		err = msgp.WrapError(err, "TokenName")
   349  		return
   350  	}
   351  	return
   352  }
   353  
   354  // EncodeMsg implements msgp.Encodable
   355  func (z *PublicOffering) EncodeMsg(en *msgp.Writer) (err error) {
   356  	// array header, size 4
   357  	err = en.Append(0x94)
   358  	if err != nil {
   359  		return
   360  	}
   361  	err = en.WriteInt32(z.TokenId)
   362  	if err != nil {
   363  		err = msgp.WrapError(err, "TokenId")
   364  		return
   365  	}
   366  	if z.Value == nil {
   367  		err = en.WriteNil()
   368  		if err != nil {
   369  			return
   370  		}
   371  	} else {
   372  		err = z.Value.EncodeMsg(en)
   373  		if err != nil {
   374  			err = msgp.WrapError(err, "Value")
   375  			return
   376  		}
   377  	}
   378  	err = en.WriteBool(z.EnableSPO)
   379  	if err != nil {
   380  		err = msgp.WrapError(err, "EnableSPO")
   381  		return
   382  	}
   383  	err = en.WriteString(z.TokenName)
   384  	if err != nil {
   385  		err = msgp.WrapError(err, "TokenName")
   386  		return
   387  	}
   388  	return
   389  }
   390  
   391  // MarshalMsg implements msgp.Marshaler
   392  func (z *PublicOffering) MarshalMsg(b []byte) (o []byte, err error) {
   393  	o = msgp.Require(b, z.Msgsize())
   394  	// array header, size 4
   395  	o = append(o, 0x94)
   396  	o = msgp.AppendInt32(o, z.TokenId)
   397  	if z.Value == nil {
   398  		o = msgp.AppendNil(o)
   399  	} else {
   400  		o, err = z.Value.MarshalMsg(o)
   401  		if err != nil {
   402  			err = msgp.WrapError(err, "Value")
   403  			return
   404  		}
   405  	}
   406  	o = msgp.AppendBool(o, z.EnableSPO)
   407  	o = msgp.AppendString(o, z.TokenName)
   408  	return
   409  }
   410  
   411  // UnmarshalMsg implements msgp.Unmarshaler
   412  func (z *PublicOffering) UnmarshalMsg(bts []byte) (o []byte, err error) {
   413  	var zb0001 uint32
   414  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
   415  	if err != nil {
   416  		err = msgp.WrapError(err)
   417  		return
   418  	}
   419  	if zb0001 != 4 {
   420  		err = msgp.ArrayError{Wanted: 4, Got: zb0001}
   421  		return
   422  	}
   423  	z.TokenId, bts, err = msgp.ReadInt32Bytes(bts)
   424  	if err != nil {
   425  		err = msgp.WrapError(err, "TokenId")
   426  		return
   427  	}
   428  	if msgp.IsNil(bts) {
   429  		bts, err = msgp.ReadNilBytes(bts)
   430  		if err != nil {
   431  			return
   432  		}
   433  		z.Value = nil
   434  	} else {
   435  		if z.Value == nil {
   436  			z.Value = new(math.BigInt)
   437  		}
   438  		bts, err = z.Value.UnmarshalMsg(bts)
   439  		if err != nil {
   440  			err = msgp.WrapError(err, "Value")
   441  			return
   442  		}
   443  	}
   444  	z.EnableSPO, bts, err = msgp.ReadBoolBytes(bts)
   445  	if err != nil {
   446  		err = msgp.WrapError(err, "EnableSPO")
   447  		return
   448  	}
   449  	z.TokenName, bts, err = msgp.ReadStringBytes(bts)
   450  	if err != nil {
   451  		err = msgp.WrapError(err, "TokenName")
   452  		return
   453  	}
   454  	o = bts
   455  	return
   456  }
   457  
   458  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   459  func (z *PublicOffering) Msgsize() (s int) {
   460  	s = 1 + msgp.Int32Size
   461  	if z.Value == nil {
   462  		s += msgp.NilSize
   463  	} else {
   464  		s += z.Value.Msgsize()
   465  	}
   466  	s += msgp.BoolSize + msgp.StringPrefixSize + len(z.TokenName)
   467  	return
   468  }
   469  
   470  // DecodeMsg implements msgp.Decodable
   471  func (z *RequestDomain) DecodeMsg(dc *msgp.Reader) (err error) {
   472  	var zb0001 uint32
   473  	zb0001, err = dc.ReadArrayHeader()
   474  	if err != nil {
   475  		err = msgp.WrapError(err)
   476  		return
   477  	}
   478  	if zb0001 != 1 {
   479  		err = msgp.ArrayError{Wanted: 1, Got: zb0001}
   480  		return
   481  	}
   482  	z.DomainName, err = dc.ReadString()
   483  	if err != nil {
   484  		err = msgp.WrapError(err, "DomainName")
   485  		return
   486  	}
   487  	return
   488  }
   489  
   490  // EncodeMsg implements msgp.Encodable
   491  func (z RequestDomain) EncodeMsg(en *msgp.Writer) (err error) {
   492  	// array header, size 1
   493  	err = en.Append(0x91)
   494  	if err != nil {
   495  		return
   496  	}
   497  	err = en.WriteString(z.DomainName)
   498  	if err != nil {
   499  		err = msgp.WrapError(err, "DomainName")
   500  		return
   501  	}
   502  	return
   503  }
   504  
   505  // MarshalMsg implements msgp.Marshaler
   506  func (z RequestDomain) MarshalMsg(b []byte) (o []byte, err error) {
   507  	o = msgp.Require(b, z.Msgsize())
   508  	// array header, size 1
   509  	o = append(o, 0x91)
   510  	o = msgp.AppendString(o, z.DomainName)
   511  	return
   512  }
   513  
   514  // UnmarshalMsg implements msgp.Unmarshaler
   515  func (z *RequestDomain) UnmarshalMsg(bts []byte) (o []byte, err error) {
   516  	var zb0001 uint32
   517  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
   518  	if err != nil {
   519  		err = msgp.WrapError(err)
   520  		return
   521  	}
   522  	if zb0001 != 1 {
   523  		err = msgp.ArrayError{Wanted: 1, Got: zb0001}
   524  		return
   525  	}
   526  	z.DomainName, bts, err = msgp.ReadStringBytes(bts)
   527  	if err != nil {
   528  		err = msgp.WrapError(err, "DomainName")
   529  		return
   530  	}
   531  	o = bts
   532  	return
   533  }
   534  
   535  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   536  func (z RequestDomain) Msgsize() (s int) {
   537  	s = 1 + msgp.StringPrefixSize + len(z.DomainName)
   538  	return
   539  }