xevidence

package
v0.0.0-...-56f3d1a Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XEvidence = "$XEvidence"

	Success = 200

	Save = "Save"
	Get  = "Get"

	AddAdmins   = "AddAdmins"
	DelAdmins   = "DelAdmins"
	QueryAdmins = "QueryAdmins"
	SetFee      = "SetFee"
	GetFee      = "GetFee"
)
View Source
const (
	ConfigName = "engine.yaml"
)

Variables

This section is empty.

Functions

func KeyOfAdmins

func KeyOfAdmins() string

func KeyOfFee

func KeyOfFee(method string) string

Types

type Context

type Context struct {
	// 基础上下文
	xcontext.BaseCtx

	BcName string

	Contract contract.Manager
	ChainCtx *common.ChainCtx
}

func NewXEvidenceCtx

func NewXEvidenceCtx(cctx *common.ChainCtx) (*Context, error)

type Contract

type Contract struct {
	// contains filtered or unexported fields
}

Contract struct represents the Xuperos contract interface.

func NewContract

func NewContract(ctx *Context, cfg *XEvidenceConfig) *Contract

NewContract creates a new instance of the Xuperos contract.

func (*Contract) AddAdmins

func (c *Contract) AddAdmins(ctx contract.KContext) (*contract.Response, error)

func (*Contract) DelAdmins

func (c *Contract) DelAdmins(ctx contract.KContext) (*contract.Response, error)

func (*Contract) Get

func (c *Contract) Get(ctx contract.KContext) (*contract.Response, error)

Get get evidence by hash

func (*Contract) GetFee

func (c *Contract) GetFee(ctx contract.KContext) (*contract.Response, error)

func (*Contract) QueryAdmins

func (c *Contract) QueryAdmins(ctx contract.KContext) (*contract.Response, error)

func (*Contract) Save

func (c *Contract) Save(ctx contract.KContext) (*contract.Response, error)

Save check args and save evidence.

func (*Contract) SetFee

func (c *Contract) SetFee(ctx contract.KContext) (*contract.Response, error)

type Evidence

type Evidence struct {
	Hash    string `json:"hash,omitempty"`
	Content string `json:"content,omitempty"`
	Desc    string `json:"desc,omitempty"`
	Sender  string `json:"sender,omitempty"`
}

type Manager

type Manager struct {
	Ctx *Context
}

func NewManager

func NewManager(ctx *Context) (*Manager, error)

type SaveMethodFeeConfig

type SaveMethodFeeConfig struct {
	// content 字段长度阈值,小于此值手续费为 FeeForLengthThreshold
	LengthThreshold       int64 `json:"lengthThreshold"`
	FeeForLengthThreshold int64 `json:"feeForLengthThreshold"`

	// content 字段长度超过 LengthThreshold 时,长度每增加 LengthIncrement,手续费增加 FeeIncrement
	LengthIncrement int64 `json:"lengthIncrement"`
	FeeIncrement    int64 `json:"feeIncrement"`

	// content 字段最大长度
	MaxLength int64 `json:"maxLength"`
}

type XEvidenceConfig

type XEvidenceConfig struct {
	// 通过配置升级过程中,可以接受 LastSaveMethodFeeConfig
	// 网络升级结束后,使用 CurrentSaveMethodFeeConfig
	XEvidenceSaveMethodFeeConfig *SaveMethodFeeConfig
	XEvidenceAdmins              map[string]bool
	XEvidenceMethodFee           map[string]int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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