kas

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxTableName             = "klay_transfers"
	KctTransferTableName    = "kct_transfers"
	RevertedTxTableName     = "reverted_transactions"
	MetadataTableName       = "fetcher_metadata"
	ContractTableName       = "contract"
	KctFtMetadataTableName  = "kct_ft_metadata"
	KctNftMetadataTableName = "kct_nft_metadata"
)
View Source
const (
	DBRetryInterval = 1 * time.Second
)
View Source
const DefaultDBPort = "3306"

Variables

View Source
var (
	// KIP 13: Interface Query Standard - https://kips.klaytn.com/KIPs/kip-13
	IKIP13Id  = [4]byte{0x01, 0xff, 0xc9, 0xa7}
	InvalidId = [4]byte{0xff, 0xff, 0xff, 0xff}

	// KIP 7: Fungible Token Standard - https://kips.klaytn.com/KIPs/kip-7
	IKIP7Id         = [4]byte{0x65, 0x78, 0x73, 0x71}
	IKIP7MetadataId = [4]byte{0xa2, 0x19, 0xa0, 0x25}

	// KIP 17: Non-fungible Token Standard - https://kips.klaytn.com/KIPs/kip-17
	IKIP17Id         = [4]byte{0x80, 0xac, 0x58, 0xcd}
	IKIP17MetadataId = [4]byte{0x5b, 0x5e, 0x13, 0x9f}
)
View Source
var DefaultKASConfig = &KASConfig{
	DBPort:   DefaultDBPort,
	CacheUse: false,
}

TxFilteringTypes filters types which are only stored in KAS database.

Functions

func NewRepository

func NewRepository(config *KASConfig) (*repository, error)

Types

type BlockchainAPI

type BlockchainAPI interface {
	GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
	Call(ctx context.Context, args api.CallArgs, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
}

BlockchainAPI interface is for testing purpose.

type Contract

type Contract struct {
	Id      int    `gorm:"column:id;type:INT AUTO_INCREMENT;PRIMARY_KEY"`
	Address []byte `gorm:"column:address;type:VARBINARY(20);UNIQUE_INDEX;NOT NULL"`
}

func (Contract) TableName

func (Contract) TableName() string

type FT

type FT struct {
	Id          int        `gorm:"column:id;type:INT AUTO_INCREMENT;PRIMARY_KEY"`
	Address     []byte     `gorm:"column:address;type:VARBINARY(20);UNIQUE_INDEX;NOT NULL"`
	Name        string     `gorm:"column:name;type:VARCHAR(30)"`
	Symbol      string     `gorm:"column:symbol;type:VARCHAR(20)"`
	Decimal     int        `gorm:"column:decimal;type:TINYINT"`
	TotalSupply string     `gorm:"column:totalSupply;type:VARCHAR(80)"`
	SiteUrl     string     `gorm:"column:siteUrl;type:VARCHAR(200)"`
	IconUrl     string     `gorm:"column:iconUrl;type:VARCHAR(200)"`
	Disable     bool       `gorm:"column:disable;type:TINYINT(1);DEFAULT:0"`
	Type        int        `gorm:"column:type;type:TINYINT;DEFAULT:0"`
	Status      int        `gorm:"column:status;type:TINYINT;DEFAULT:0"`
	ErrorLog    string     `gorm:"column:errorLog;type:VARCHAR(255);"`
	CreatedAt   *time.Time `gorm:"column:createdAt;type:DATETIME;DEFAULT:NULL"`
	UpdatedAt   *time.Time `gorm:"column:updatedAt;type:DATETIME;DEFAULT:NULL"`
	DeletedAt   *time.Time `gorm:"column:deletedAt;type:DATETIME;DEFAULT:NULL"`
}

func (FT) TableName

func (FT) TableName() string

type FetcherMetadata

type FetcherMetadata struct {
	Key   string `gorm:"column:key;type:VARCHAR(30);PRIMARY_KEY"`
	Value int64  `gorm:"column:value;type:BIGINT"`
}

func (FetcherMetadata) TableName

func (FetcherMetadata) TableName() string

type KASConfig

type KASConfig struct {
	DBHost     string
	DBPort     string
	DBName     string
	DBUser     string
	DBPassword string

	CacheUse             bool
	XChainId             string
	BasicAuthParam       string
	CacheInvalidationURL string
}

type KCTTransfer

type KCTTransfer struct {
	ContractAddress  []byte `gorm:"column:contractAddress;type:VARBINARY(20);INDEX:ttFromCompIdx,ttToCompIdx;NOT NULL"`
	From             []byte `gorm:"column:fromAddr;type:VARBINARY(20);INDEX:ttFromCompIdx,ttFromIdx"`
	To               []byte `gorm:"column:toAddr;type:VARBINARY(20);INDEX:ttToCompIdx,ttToIdx"`
	TransactionLogId int64  `gorm:"column:transactionLogId;type:BIGINT;PRIMARY_KEY;INDEX:ttFromCompIdx,ttToCompIdx"`
	Value            string `gorm:"column:value;type:VARCHAR(80)"`
	TransactionHash  []byte `gorm:"column:transactionHash;type:VARBINARY(32);INDEX:ttHashIdx;NOT NULL"`
	Timestamp        int64  `gorm:"column:timestamp;type:INT(11)"`
}

func (KCTTransfer) TableName

func (KCTTransfer) TableName() string

type NFT

type NFT struct {
	Id          int        `gorm:"column:id;type:INT AUTO_INCREMENT;PRIMARY_KEY"`
	Address     []byte     `gorm:"column:address;type:VARBINARY(20);UNIQUE_INDEX;NOT NULL"`
	Name        string     `gorm:"column:name;type:VARCHAR(30)"`
	Symbol      string     `gorm:"column:symbol;type:VARCHAR(20)"`
	TotalSupply string     `gorm:"column:totalSupply;type:VARCHAR(80)"`
	Disable     bool       `gorm:"column:disable;type:TINYINT(1);DEFAULT:0"`
	Type        int        `gorm:"column:type;type:TINYINT;DEFAULT:0"`
	Status      int        `gorm:"column:status;type:TINYINT;DEFAULT:0"`
	ErrorLog    string     `gorm:"column:errorLog;type:VARCHAR(255);"`
	CreatedAt   *time.Time `gorm:"column:createdAt;type:DATETIME;DEFAULT:NULL"`
	UpdatedAt   *time.Time `gorm:"column:updatedAt;type:DATETIME;DEFAULT:NULL"`
	DeletedAt   *time.Time `gorm:"column:deletedAt;type:DATETIME;DEFAULT:NULL"`
}

func (NFT) TableName

func (NFT) TableName() string

type RevertedTx

type RevertedTx struct {
	TransactionHash []byte `gorm:"column:transactionHash;type:VARBINARY(32);NOT NULL;PRIMARY_KEY"`
	BlockNumber     int64  `gorm:"column:blockNumber;type:BIGINT"`
	RevertMessage   string `gorm:"column:revertMessage;type:VARCHAR(1024)"`
	ContractAddress []byte `gorm:"column:contractAddress;type:VARBINARY(20);NOT NULL"`
	Timestamp       int64  `gorm:"column:timestamp;type:INT(11)"`
}

func (RevertedTx) TableName

func (RevertedTx) TableName() string

type Tx

type Tx struct {
	TransactionId   int64  `gorm:"column:transactionId;type:BIGINT;INDEX:idIdx;NOT NULL;PRIMARY_KEY"`
	FromAddr        []byte `gorm:"column:fromAddr;type:VARBINARY(20);INDEX:txFromAddrIdx"`
	ToAddr          []byte `gorm:"column:toAddr;type:VARBINARY(20);INDEX:txToAddrIdx"`
	Value           string `gorm:"column:value;type:VARCHAR(80)"`
	TransactionHash []byte `gorm:"column:transactionHash;type:VARBINARY(32);INDEX:tHashIdx;NOT NULL"`
	Status          int    `gorm:"column:status;type:SMALLINT"`
	Timestamp       int64  `gorm:"column:timestamp;type:INT(11)"`
	TypeInt         int    `gorm:"column:typeInt;INDEX:tTypeIdx;NOT NULL"`
	GasPrice        uint64 `gorm:"column:gasPrice;type:BIGINT"`
	GasUsed         uint64 `gorm:"column:gasUsed;type:BIGINT"`
	FeePayer        []byte `gorm:"column:feePayer;type:VARBINARY(20)"`
	FeeRatio        uint   `gorm:"column:feeRatio;type:INT"`
	Internal        bool   `gorm:"column:internal;type:TINYINT(1);DEFAULT:0"`
}

func (Tx) TableName

func (Tx) TableName() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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