contract

package
v0.0.0-...-3eec7cb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstantRepository

type ConstantRepository interface {
	Get(ctx context.Context, address string) (GlobalConstant, error)
	All(ctx context.Context, addresses ...string) ([]GlobalConstant, error)
	List(ctx context.Context, size, offset int64, orderBy, sort string) ([]ListGlobalConstantItem, error)
	ForContract(ctx context.Context, address string, size, offset int64) ([]GlobalConstant, error)
	ContractList(ctx context.Context, address string, size, offset int64) ([]Contract, error)
}

type Contract

type Contract struct {
	bun.BaseModel `bun:"contracts"`

	ID        int64     `bun:"id,pk,notnull,autoincrement"`
	Level     int64     `bun:"level"`
	Timestamp time.Time `bun:"timestamp,pk,notnull"`

	AccountID  int64
	Account    account.Account `bun:"rel:belongs-to"`
	ManagerID  int64
	Manager    account.Account `bun:"rel:belongs-to"`
	DelegateID int64
	Delegate   account.Account `bun:"rel:belongs-to"`

	Tags types.Tags

	AlphaID   int64
	Alpha     Script `bun:"rel:belongs-to"`
	BabylonID int64
	Babylon   Script `bun:"rel:belongs-to"`
	JakartaID int64
	Jakarta   Script `bun:"rel:belongs-to"`
}

Contract - entity for contract

func (*Contract) CurrentScript

func (c *Contract) CurrentScript() *Script

CurrentScript -

func (*Contract) GetID

func (c *Contract) GetID() int64

GetID -

func (*Contract) LogFields

func (c *Contract) LogFields() map[string]interface{}

LogFields -

func (Contract) TableName

func (Contract) TableName() string

type GlobalConstant

type GlobalConstant struct {
	bun.BaseModel `bun:"global_constants"`

	ID        int64     `bun:"id,pk,notnull,autoincrement"`
	Timestamp time.Time `json:"timestamp"`
	Level     int64     `json:"level"`
	Address   string    `bun:"address,type:text"`
	Value     []byte

	Scripts []Script `bun:"m2m:script_constants,join:GlobalConstant=Script"`
}

GlobalConstant -

func (*GlobalConstant) GetID

func (m *GlobalConstant) GetID() int64

GetID -

func (*GlobalConstant) LogFields

func (m *GlobalConstant) LogFields() map[string]interface{}

LogFields -

func (GlobalConstant) PartitionBy

func (GlobalConstant) PartitionBy() string

func (GlobalConstant) TableName

func (GlobalConstant) TableName() string

type ListGlobalConstantItem

type ListGlobalConstantItem struct {
	Timestamp  time.Time `bun:"timestamp"`
	Level      int64     `bun:"level"`
	Address    string    `bun:"address"`
	LinksCount uint64    `bun:"links_count"`
}

ListGlobalConstantItem -

type Repository

type Repository interface {
	Get(ctx context.Context, address string) (Contract, error)
	Script(ctx context.Context, address string, symLink string) (Script, error)

	// ScriptPart - returns part of script type. Part can be `storage`, `parameter` or `code`.
	ScriptPart(ctx context.Context, address string, symLink, part string) ([]byte, error)
	FindOne(ctx context.Context, tags types.Tags) (Contract, error)
	AllExceptDelegators(ctx context.Context) ([]Contract, error)
}

type Script

type Script struct {
	bun.BaseModel `bun:"scripts"`

	ID          int64          `bun:"id,pk,notnull,autoincrement"`
	Level       int64          `bun:"level"`
	Hash        string         `bun:"hash,type:text"`
	Code        []byte         `bun:",type:bytea"`
	Parameter   []byte         `bun:",type:bytea"`
	Storage     []byte         `bun:",type:bytea"`
	Views       []byte         `bun:",type:bytea"`
	Entrypoints pq.StringArray `bun:",type:text[]"`
	FailStrings pq.StringArray `bun:",type:text[]"`
	Annotations pq.StringArray `bun:",type:text[]"`
	Hardcoded   pq.StringArray `bun:",type:text[]"`
	Tags        types.Tags

	Constants []GlobalConstant `bun:"m2m:script_constants,join:Script=GlobalConstant"`
}

Scripts -

func (*Script) Full

func (s *Script) Full() ([]byte, error)

Full -

func (*Script) GetID

func (s *Script) GetID() int64

GetID -

func (Script) TableName

func (Script) TableName() string

type ScriptConstants

type ScriptConstants struct {
	bun.BaseModel `bun:"script_constants"`

	ScriptId         int64
	Script           Script `bun:"rel:belongs-to,join:script_id=id"`
	GlobalConstantId int64
	GlobalConstant   GlobalConstant `bun:"rel:belongs-to,join:global_constant_id=id"`
}

ScriptConstants -

func (ScriptConstants) GetID

func (ScriptConstants) GetID() int64

GetID -

func (ScriptConstants) Save

func (ScriptConstants) Save(ctx context.Context, tx bun.IDB) error

Save -

func (ScriptConstants) TableName

func (ScriptConstants) TableName() string

type ScriptRepository

type ScriptRepository interface {
	ByHash(ctx context.Context, hash string) (Script, error)
	Code(ctx context.Context, id int64) ([]byte, error)
	Parameter(ctx context.Context, id int64) ([]byte, error)
	Storage(ctx context.Context, id int64) ([]byte, error)
	Views(ctx context.Context, id int64) ([]byte, error)
}

type Sections

type Sections struct {
	Parameter  stdJSON.RawMessage `json:"parameter"`
	ReturnType stdJSON.RawMessage `json:"returnType"`
	Code       stdJSON.RawMessage `json:"code"`
}

Sections -

func (Sections) Empty

func (s Sections) Empty() bool

Empty -

func (Sections) IsParameterEmpty

func (s Sections) IsParameterEmpty() bool

IsParameterEmpty -

type Update

type Update struct {
	bun.BaseModel `bun:"contracts"`

	AccountID  int64
	LastAction time.Time
	TxCount    uint64
}

type View

type View struct {
	Name            string               `json:"name"`
	Description     string               `json:"description"`
	Implementations []ViewImplementation `json:"implementations"`
}

View -

type ViewImplementation

type ViewImplementation struct {
	MichelsonStorageView Sections `json:"michelsonStorageView"`
}

ViewImplementation -

type Views

type Views []View

Views -

Jump to

Keyboard shortcuts

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