models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contract

type Contract struct {
	Address    string               `gorm:"primaryKey"`
	Blockchain constants.Blockchain `gorm:"primaryKey" json:"blockchain"`
	CreatedAt  time.Time            `gorm:"autoCreateTime"`
	UpdatedAt  time.Time            `gorm:"autoUpdateTime"`
	DeletedAt  gorm.DeletedAt       `gorm:"index"`

	Name         string `json:"name"`
	Symbol       string `json:"symbol"`
	OfficialName string `json:"officialName"`
	Standard     string `json:"standard"`
	ABI          string `json:"abi"`
	Decimals     int32  `json:"decimals"`
}

func (*Contract) BeforeCreate

func (c *Contract) BeforeCreate(tx *gorm.DB) (err error)

func (*Contract) HasEvent

func (c *Contract) HasEvent(eventId string) (bool, error)

HasEvent checks if the event already exists

func (*Contract) HasMethod

func (c *Contract) HasMethod(methodId string) (bool, error)

HasMethod checks if the method already exists

type ContractData

type ContractData struct {
	Contracts []Contract
	Methods   []MethodFragment
	Events    []EventFragment
}

type DecodedFragment

type DecodedFragment struct {
	Type      string  `json:"type"`
	Name      string  `json:"name"`
	Inputs    []Input `json:"inputs"`
	Anonymous bool    `json:"anonymous"`
}

type DecodedMethodFragment

type DecodedMethodFragment struct {
	Type     string   `json:"type"`
	Name     string   `json:"name"`
	Inputs   []Input  `json:"inputs"`
	Outputs  []Output `json:"outputs"`
	Constant bool     `json:"constant"`
	Payable  bool     `json:"payable"`
}

type EventFragment

type EventFragment struct {
	CreatedAt         time.Time      `gorm:"autoCreateTime"`
	UpdatedAt         time.Time      `gorm:"autoUpdateTime"`
	DeletedAt         gorm.DeletedAt `gorm:"index"`
	EventId           string         `gorm:"primaryKey"`
	FullSignature     string         `gorm:"full_signature" json:"fullSignature"`
	ABI               string         `gorm:"abi"`
	HashableSignature string         `gorm:"hashable_signature"`
	IndexedTopics     int32          `gorm:"indexed_topics"`
	Name              string         `gorm:"name"`
}

func (*EventFragment) BeforeCreate

func (e *EventFragment) BeforeCreate(tx *gorm.DB) (err error)

func (*EventFragment) CountIndexedTopics

func (e *EventFragment) CountIndexedTopics() (int32, error)

CountIndexedTopics counts the number of indexed topics in the event ABI

type Input

type Input struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Indexed bool   `json:"indexed"`
}

type MethodFragment

type MethodFragment struct {
	CreatedAt         time.Time      `gorm:"autoCreateTime"`
	UpdatedAt         time.Time      `gorm:"autoUpdateTime"`
	DeletedAt         gorm.DeletedAt `gorm:"index"`
	MethodId          string         `gorm:"primaryKey"`
	FullSignature     string         `gorm:"full_signature"`
	ABI               string         `gorm:"abi"`
	HashableSignature string         `gorm:"hashable_signature"`
	Name              string         `gorm:"name"`
}

func (*MethodFragment) BeforeCreate

func (m *MethodFragment) BeforeCreate(tx *gorm.DB) (err error)

type Output

type Output struct {
	Name    string `json:"name,omitempty"`
	Type    string `json:"type"`
	Indexed bool   `json:"indexed,omitempty"`
}

Jump to

Keyboard shortcuts

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