etgate

package
v0.0.0-...-df5a86c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ETGateTxTypeUpdateChain = byte(0x01)
	//ETGateTxTypeRegisterContract = byte(0x02)
	ETGateTxTypeWithdraw = byte(0x03)
	ETGateTxTypeDeposit  = byte(0x04)

	ETGateCodeConflictingChain     = abci.CodeType(1001)
	ETGateCodeMissingAncestor      = abci.CodeType(1002)
	ETGateCodeExistingHeader       = abci.CodeType(1003)
	ETGateCodeInvalidHeader        = abci.CodeType(1004)
	ETGateCodeInvalidLogProof      = abci.CodeType(1005)
	ETGateCodeLogHeaderNotFound    = abci.CodeType(1006)
	ETGateCodeDepositAlreadyExists = abci.CodeType(1007)
	ETGateCodeLogUnpackingError    = abci.CodeType(1008)
	ETGateCodeInvalidEventName     = abci.CodeType(1009)
	ETGateCodeAlreadyWithdrawn     = abci.CodeType(1010)
	ETGateCodeInvalidCoins         = abci.CodeType(1011)
	ETGateCodeInvalidSequence      = abci.CodeType(1012)
)

Variables

This section is empty.

Functions

func DecodeToken

func DecodeToken(token string) string

func EncodeToken

func EncodeToken(token string) string

func WithdrawValue

func WithdrawValue(tx ETGateWithdrawTx) ([]byte, error)

Types

type Contract

type Contract struct {
	Address common.Address
	Code    string
}

type Deposit

type Deposit struct {
	To    [20]byte
	Value uint64
	Token common.Address
	Chain []byte
	Seq   uint64
}

type ETGateDepositTx

type ETGateDepositTx struct {
	Proof LogProof
}
type ETGateRegisterContractTx struct {
    Contract
}
func (tx ETGateRegisterContractTx) Validate() abci.Result {
    codemap := GetCodemap()
    if _, exists := codemap[tx.Code]; !exists {
        return abci.ErrInternalError.AppendLog(cmn.Fmt("Invalid code"))
    }
    return abci.OK
}

func (ETGateDepositTx) Validate

func (tx ETGateDepositTx) Validate() abci.Result

type ETGatePlugin

type ETGatePlugin struct {
}

func New

func New() *ETGatePlugin

func (*ETGatePlugin) BeginBlock

func (gp *ETGatePlugin) BeginBlock(store types.KVStore, hash []byte, header *abci.Header)

func (*ETGatePlugin) EndBlock

func (gp *ETGatePlugin) EndBlock(store types.KVStore, height uint64) (res abci.ResponseEndBlock)

func (*ETGatePlugin) InitChain

func (gp *ETGatePlugin) InitChain(store types.KVStore, vals []*abci.Validator)

func (*ETGatePlugin) Name

func (gp *ETGatePlugin) Name() string

func (*ETGatePlugin) RunTx

func (gp *ETGatePlugin) RunTx(store types.KVStore, ctx types.CallContext, txBytes []byte) abci.Result

func (*ETGatePlugin) SetOption

func (gp *ETGatePlugin) SetOption(store types.KVStore, key string, value string) (log string)

type ETGatePluginState

type ETGatePluginState struct {
}

type ETGateStateMachine

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

type ETGateTx

type ETGateTx interface {
	Validate() abci.Result
}

type ETGateUpdateChainTx

type ETGateUpdateChainTx struct {
	Headers [][]byte
}

func (ETGateUpdateChainTx) Validate

func (tx ETGateUpdateChainTx) Validate() abci.Result

type ETGateWithdrawTx

type ETGateWithdrawTx struct {
	Height   uint
	To       [20]byte
	Value    uint64
	Token    string
	ChainID  string
	Sequence uint64
}

func (ETGateWithdrawTx) Validate

func (tx ETGateWithdrawTx) Validate() abci.Result
type Header struct {
	ParentHash  common.Hash
	Hash        common.Hash
	Number      uint64
	ReceiptHash common.Hash
	Time        uint64
}

type LogProof

type LogProof struct {
	Receipt []byte // rlp-encoded
	TxIndex uint
	//    Index uint // Assuming there is only one log in the receipt
	Proof  []rlp.RawValue
	Number uint64
}

func NewLogProof

func NewLogProof(receipts []*types.Receipt, txIndex uint, number uint64) (LogProof, error)

func (LogProof) IsValid

func (proof LogProof) IsValid(receiptHash common.Hash) bool

func (LogProof) Log

func (proof LogProof) Log() (types.Log, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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