Documentation
¶
Index ¶
- Variables
- func GetEvent(pairs kv.Pairs, eventType string) []types.Event
- func RegisterTxType(value Type, name string)
- func ValidateBasic(data []byte, signerAddr []Address, signatures []Signature) error
- func ValidateFee(feeOpt *fees.FeeOption, fee Fee) error
- type Address
- type Amount
- type Balance
- type Context
- type Fee
- type FunctionBehaviour
- type Gas
- type GovernaceUpdateAndValidate
- type Msg
- type MsgData
- type RawTx
- type Response
- type Router
- type Signature
- type SignedTx
- type Tx
- type TxTypeDescribe
- type TxTypeMap
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingData = codes.ProtocolError{codes.TxErrMissingData, "missing data in transaction"} ErrUnserializable = codes.ProtocolError{codes.TxErrUnserializable, "unserializable tx"} ErrWrongTxType = codes.ProtocolError{codes.TxErrWrongTxType, "wrong tx type"} ErrInvalidAmount = codes.ProtocolError{codes.TxErrInvalidAmount, "invalid amount"} ErrInvalidPubkey = codes.ProtocolError{codes.TxErrInvalidPubKey, "invalid pubkey"} ErrUnmatchSigner = codes.ProtocolError{codes.TxErrUnmatchedSigner, "unmatch signers"} ErrInvalidSignature = codes.ProtocolError{codes.TxErrInvalidSignature, "invalid signatures"} ErrInvalidFeeCurrency = codes.ProtocolError{codes.TxErrInvalidFeeCurrency, "invalid fees currency"} ErrInvalidFeePrice = codes.ProtocolError{codes.TxErrInvalidFeePrice, "fee price is smaller than minimal fee"} ErrPoolDoesNotExist = codes.ProtocolError{codes.TxErrPoolDoesNotExist, "Pool does not exist"} ErrNotEnoughFund = codes.ProtocolError{codes.TxErrInsufficientFunds, "not enough fund"} ErrGasOverflow = codes.ProtocolError{codes.TxErrGasOverflow, "gas used exceed limit"} ErrInvalidExtTx = codes.ProtocolError{codes.TxErrInvalidExtTx, "invalid external tx"} ErrInvalidAddress = codes.ErrBadAddress ErrInvalidCurrency = codes.ProtocolError{codes.TxErrInvalidFeeCurrency, "invalid fee currency"} ErrTokenNotSupported = codes.ProtocolError{codes.ExternalErrTokenNotSuported, "Token not supported"} ErrTransactionNotSupported = codes.ProtocolError{codes.ExternalTransactionNotSupported, "TX not supported"} ErrGettingValidatorList = codes.ProtocolError{codes.GovErrGettingValidatorList, "fund proposal failed in getting validator list"} ErrGettingWitnessList = codes.ProtocolError{codes.GovErrGettingWitnessList, "failed in getting witness list"} ErrInvalidValidatorAddr = codes.ProtocolError{codes.GovErrInvalidValidatorAddr, "invalid validator address"} ErrStakeAddressInUse = codes.ProtocolError{codes.DelgErrStakeAddressInUse, "current stake address is in use"} ErrStakeAddressMismatch = codes.ProtocolError{codes.DelgErrStakeAddressMismatch, "stake address does not match"} )
Functions ¶
func RegisterTxType ¶ added in v0.16.1
func ValidateBasic ¶ added in v0.10.8
Types ¶
type Amount ¶
Amount is an easily serializable representation of coin. Nodes can create coin from the Amount object received over the network
func (Amount) IsValid ¶
func (a Amount) IsValid(list *balance.CurrencySet) bool
IsValid checks the validity of the currency and the amount string in the account object, which may be received over a network.
func (Amount) ToCoin ¶
func (a Amount) ToCoin(list *balance.CurrencySet) balance.Coin
ToCoin converts an easier to transport Amount object to a Coin object in Oneledger protocol. It takes the action context to determine the currency from which to create the coin.
func (Amount) ToCoinWithBase ¶ added in v0.14.3
func (a Amount) ToCoinWithBase(list *balance.CurrencySet) balance.Coin
type Context ¶
type Context struct {
Router Router
State *storage.State
Header *abci.Header
Accounts accounts.Wallet
Balances *balance.Store
Domains *ons.DomainStore
Delegators *delegation.DelegationStore
NetwkDelegators *netwkDeleg.MasterStore
EvidenceStore *evidence.EvidenceStore
FeePool *fees.Store
Currencies *balance.CurrencySet
FeeOpt *fees.FeeOption
Validators *identity.ValidatorStore
Witnesses *identity.WitnessStore
BTCTrackers *bitcoin.TrackerStore
ETHTrackers *ethereum.TrackerStore
Logger *log.Logger
JobStore *jobs.JobStore
LockScriptStore *bitcoin.LockScriptStore
ProposalMasterStore *governance.ProposalMasterStore
RewardMasterStore *rewards.RewardMasterStore
GovernanceStore *governance.Store
ExtStores data.Router
GovUpdate *GovernaceUpdateAndValidate
}
func NewContext ¶
func NewContext(r Router, header *abci.Header, state *storage.State, wallet accounts.Wallet, balances *balance.Store, currencies *balance.CurrencySet, feePool *fees.Store, validators *identity.ValidatorStore, witnesses *identity.WitnessStore, domains *ons.DomainStore, delegators *delegation.DelegationStore, netwkDelegators *netwkDeleg.MasterStore, evidenceStore *evidence.EvidenceStore, btcTrackers *bitcoin.TrackerStore, ethTrackers *ethereum.TrackerStore, jobStore *jobs.JobStore, lockScriptStore *bitcoin.LockScriptStore, logger *log.Logger, proposalmaster *governance.ProposalMasterStore, rewardmaster *rewards.RewardMasterStore, govern *governance.Store, extStores data.Router, govUpdate *GovernaceUpdateAndValidate) *Context
type FunctionBehaviour ¶ added in v0.15.1
type FunctionBehaviour int
const ( ValidateOnly FunctionBehaviour = 0 ValidateAndUpdate FunctionBehaviour = 1 )
type GovernaceUpdateAndValidate ¶ added in v0.15.1
type GovernaceUpdateAndValidate struct {
GovernanceUpdateFunction map[string]func(interface{}, *Context, FunctionBehaviour) (bool, error)
}
func NewGovUpdate ¶ added in v0.15.1
func NewGovUpdate() *GovernaceUpdateAndValidate
type RawTx ¶ added in v0.10.8
type Response ¶
type Response struct {
Data []byte
Events []types.Event
Log string
Info string
GasWanted int64
GasUsed int64
}
func BasicFeeHandling ¶ added in v0.12.0
type Router ¶
Router interface supplies functionality to add a handler function and Handle a request.
type SignedTx ¶ added in v0.10.8
func (*SignedTx) SignedBytes ¶ added in v0.10.8
type Tx ¶
type Tx interface {
//it should be able to validate a tx by itself, non-valid tx will be reject by the node directly
//without going to node process
Validate(ctx *Context, signedTx SignedTx) (bool, error)
//check tx on the first node who receives it, if process check failed, the tx will not be broadcast
//could store a version of checked value in storage, but not implemented now
ProcessCheck(ctx *Context, tx RawTx) (bool, Response)
//deliver tx on the chain by changing the storage values, which should only be committed at Application
//commit stage
ProcessDeliver(ctx *Context, tx RawTx) (bool, Response)
//process the charge of fees
ProcessFee(ctx *Context, signedTx SignedTx, start Gas, size Gas) (bool, Response)
}
type TxTypeDescribe ¶ added in v0.14.0
type Type ¶
type Type int
const ( SEND Type = 0x01 SENDPOOL Type = 0x02 //staking related transaction STAKE Type = 0x11 UNSTAKE Type = 0x12 WITHDRAW Type = 0x13 //network network_delegation ADD_NETWORK_DELEGATE Type = 0x51 NETWORK_UNDELEGATE Type = 0x52 REWARDS_WITHDRAW_NETWORK_DELEGATE Type = 0x53 REWARDS_REINVEST_NETWORK_DELEGATE Type = 0x54 //Evidence ALLEGATION Type = 0x61 ALLEGATION_VOTE Type = 0x62 RELEASE Type = 0x63 //ons related transaction DOMAIN_CREATE Type = 0x21 DOMAIN_UPDATE Type = 0x22 DOMAIN_SELL Type = 0x23 DOMAIN_PURCHASE Type = 0x24 DOMAIN_SEND Type = 0x25 DOMAIN_DELETE_SUB Type = 0x26 DOMAIN_RENEW Type = 0x27 BTC_LOCK Type = 0x81 BTC_ADD_SIGNATURE Type = 0x82 BTC_BROADCAST_SUCCESS Type = 0x83 BTC_REPORT_FINALITY_MINT Type = 0x84 BTC_EXT_MINT Type = 0x85 BTC_REDEEM Type = 0x86 BTC_FAILED_BROADCAST_RESET Type = 0x87 //Ethereum Actions ETH_LOCK Type = 0x91 ETH_REPORT_FINALITY_MINT Type = 0x92 ETH_REDEEM Type = 0x93 ERC20_LOCK Type = 0x94 ERC20_REDEEM Type = 0x95 //Governance Action PROPOSAL_CREATE Type = 0x30 PROPOSAL_CANCEL Type = 0x31 PROPOSAL_FUND Type = 0x32 PROPOSAL_VOTE Type = 0x33 PROPOSAL_FINALIZE Type = 0x34 EXPIRE_VOTES Type = 0x35 PROPOSAL_WITHDRAW_FUNDS Type = 0x36 //Rewards WITHDRAW_REWARD Type = 0x41 //EOF here Only used as a marker to mark the end of Type list //So that the query for Types can return all Types dynamically //, when there is a change made in Type list //This value should be manually set as the largest among the list EOF Type = 0xFF )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem
|
Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem |
Click to show internal directories.
Click to hide internal directories.