contract

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2018 License: LGPL-3.0 Imports: 7 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthContract = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowContract   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type ABI

type ABI struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Payment              int32    `protobuf:"varint,2,opt,name=payment,proto3" json:"payment,omitempty"`
	Limit                *Cost    `protobuf:"bytes,3,opt,name=limit" json:"limit,omitempty"`
	GasPrice             int64    `protobuf:"varint,4,opt,name=gas_price,json=gasPrice,proto3" json:"gas_price,omitempty"`
	Args                 []string `protobuf:"bytes,5,rep,name=args" json:"args,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ABI) Descriptor

func (*ABI) Descriptor() ([]byte, []int)

func (*ABI) GetArgs

func (m *ABI) GetArgs() []string

func (*ABI) GetGasPrice

func (m *ABI) GetGasPrice() int64

func (*ABI) GetLimit

func (m *ABI) GetLimit() *Cost

func (*ABI) GetName

func (m *ABI) GetName() string

func (*ABI) GetPayment

func (m *ABI) GetPayment() int32

func (*ABI) Marshal

func (m *ABI) Marshal() (dAtA []byte, err error)

func (*ABI) MarshalTo

func (m *ABI) MarshalTo(dAtA []byte) (int, error)

func (*ABI) ProtoMessage

func (*ABI) ProtoMessage()

func (*ABI) Reset

func (m *ABI) Reset()

func (*ABI) Size

func (m *ABI) Size() (n int)

func (*ABI) String

func (m *ABI) String() string

func (*ABI) Unmarshal

func (m *ABI) Unmarshal(dAtA []byte) error

func (*ABI) XXX_DiscardUnknown

func (m *ABI) XXX_DiscardUnknown()

func (*ABI) XXX_Marshal

func (m *ABI) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ABI) XXX_Merge

func (dst *ABI) XXX_Merge(src proto.Message)

func (*ABI) XXX_Size

func (m *ABI) XXX_Size() int

func (*ABI) XXX_Unmarshal

func (m *ABI) XXX_Unmarshal(b []byte) error

type Compiler

type Compiler struct {
}

Compiler parse contract from json string

func (*Compiler) Parse

func (c *Compiler) Parse(id, code, abi string) (*Contract, error)

Parse parse contract from json abi string, set code and id

type Contract

type Contract struct {
	ID                   string   `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Info                 *Info    `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"`
	Code                 string   `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func DecodeContract

func DecodeContract(str string) *Contract

DecodeContract static method to decode contract from string

func (*Contract) ABI

func (c *Contract) ABI(name string) *ABI

ABI get abi from contract with specific name

func (*Contract) B64Decode

func (c *Contract) B64Decode(str string) error

B64Decode decode contract from base64 string

func (*Contract) B64Encode

func (c *Contract) B64Encode() string

B64Encode encode contract to base64 string

func (*Contract) Decode

func (c *Contract) Decode(str string) error

Decode contract from string using proto buf

func (*Contract) Descriptor

func (*Contract) Descriptor() ([]byte, []int)

func (*Contract) Encode

func (c *Contract) Encode() string

Encode contract to string using proto buf

func (*Contract) GetCode

func (m *Contract) GetCode() string

func (*Contract) GetID

func (m *Contract) GetID() string

func (*Contract) GetInfo

func (m *Contract) GetInfo() *Info

func (*Contract) Marshal

func (m *Contract) Marshal() (dAtA []byte, err error)

func (*Contract) MarshalTo

func (m *Contract) MarshalTo(dAtA []byte) (int, error)

func (*Contract) ProtoMessage

func (*Contract) ProtoMessage()

func (*Contract) Reset

func (m *Contract) Reset()

func (*Contract) Size

func (m *Contract) Size() (n int)

func (*Contract) String

func (m *Contract) String() string

func (*Contract) Unmarshal

func (m *Contract) Unmarshal(dAtA []byte) error

func (*Contract) XXX_DiscardUnknown

func (m *Contract) XXX_DiscardUnknown()

func (*Contract) XXX_Marshal

func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Contract) XXX_Merge

func (dst *Contract) XXX_Merge(src proto.Message)

func (*Contract) XXX_Size

func (m *Contract) XXX_Size() int

func (*Contract) XXX_Unmarshal

func (m *Contract) XXX_Unmarshal(b []byte) error

type Cost

type Cost struct {
	Data                 int64    `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"`
	Net                  int64    `protobuf:"varint,2,opt,name=net,proto3" json:"net,omitempty"`
	CPU                  int64    `protobuf:"varint,3,opt,name=CPU,proto3" json:"CPU,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func Cost0

func Cost0() *Cost

Cost0 construct zero cost

func NewCost

func NewCost(data, net, cpu int64) *Cost

NewCost construct cost with specific data, net, cpu

func (*Cost) AddAssign

func (c *Cost) AddAssign(a *Cost)

AddAssign add cost to self

func (*Cost) Descriptor

func (*Cost) Descriptor() ([]byte, []int)

func (*Cost) GetCPU

func (m *Cost) GetCPU() int64

func (*Cost) GetData

func (m *Cost) GetData() int64

func (*Cost) GetNet

func (m *Cost) GetNet() int64

func (*Cost) IsOverflow

func (c *Cost) IsOverflow(limit *Cost) bool

IsOverflow decide if exceed limit

func (*Cost) Marshal

func (m *Cost) Marshal() (dAtA []byte, err error)

func (*Cost) MarshalTo

func (m *Cost) MarshalTo(dAtA []byte) (int, error)

func (*Cost) ProtoMessage

func (*Cost) ProtoMessage()

func (*Cost) Reset

func (m *Cost) Reset()

func (*Cost) Size

func (m *Cost) Size() (n int)

func (*Cost) String

func (m *Cost) String() string

func (Cost) ToGas

func (c Cost) ToGas() int64

ToGas convert cost to gas

func (*Cost) Unmarshal

func (m *Cost) Unmarshal(dAtA []byte) error

func (*Cost) XXX_DiscardUnknown

func (m *Cost) XXX_DiscardUnknown()

func (*Cost) XXX_Marshal

func (m *Cost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Cost) XXX_Merge

func (dst *Cost) XXX_Merge(src proto.Message)

func (*Cost) XXX_Size

func (m *Cost) XXX_Size() int

func (*Cost) XXX_Unmarshal

func (m *Cost) XXX_Unmarshal(b []byte) error

type Info

type Info struct {
	Lang                 string   `protobuf:"bytes,1,opt,name=lang,proto3" json:"lang,omitempty"`
	Version              string   `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Abi                  []*ABI   `protobuf:"bytes,3,rep,name=abi" json:"abi,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Info) Descriptor

func (*Info) Descriptor() ([]byte, []int)

func (*Info) GetAbi

func (m *Info) GetAbi() []*ABI

func (*Info) GetLang

func (m *Info) GetLang() string

func (*Info) GetVersion

func (m *Info) GetVersion() string

func (*Info) Marshal

func (m *Info) Marshal() (dAtA []byte, err error)

func (*Info) MarshalTo

func (m *Info) MarshalTo(dAtA []byte) (int, error)

func (*Info) ProtoMessage

func (*Info) ProtoMessage()

func (*Info) Reset

func (m *Info) Reset()

func (*Info) Size

func (m *Info) Size() (n int)

func (*Info) String

func (m *Info) String() string

func (*Info) Unmarshal

func (m *Info) Unmarshal(dAtA []byte) error

func (*Info) XXX_DiscardUnknown

func (m *Info) XXX_DiscardUnknown()

func (*Info) XXX_Marshal

func (m *Info) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Info) XXX_Merge

func (dst *Info) XXX_Merge(src proto.Message)

func (*Info) XXX_Size

func (m *Info) XXX_Size() int

func (*Info) XXX_Unmarshal

func (m *Info) XXX_Unmarshal(b []byte) error

type PaymentCode

type PaymentCode int32

PaymentCode payment mode of contract

const (
	SelfPay PaymentCode = iota
	ContractPay
)

Payment mode

type VersionCode

type VersionCode string

VersionCode version of contract

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL