Documentation ¶
Index ¶
- Constants
- Variables
- func ClassifyActions(actions []SealedEnvelope) ([]*Transfer, []*Execution)
- func IsExperimentalAction(action Action) bool
- func Verify(sealed SealedEnvelope) error
- type AbstractAction
- func (act *AbstractAction) BasicActionSize() uint32
- func (act *AbstractAction) GasLimit() uint64
- func (act *AbstractAction) GasPrice() *big.Int
- func (act *AbstractAction) Hash() hash.Hash256
- func (act *AbstractAction) Nonce() uint64
- func (act *AbstractAction) SetEnvelopeContext(selp SealedEnvelope)
- func (act *AbstractAction) SrcPubkey() crypto.PublicKey
- func (act *AbstractAction) Version() uint32
- type Action
- type Builder
- func (b *Builder) Build() AbstractAction
- func (b *Builder) SetGasLimit(l uint64) *Builder
- func (b *Builder) SetGasPrice(p *big.Int) *Builder
- func (b *Builder) SetGasPriceByBytes(buf []byte) *Builder
- func (b *Builder) SetNonce(n uint64) *Builder
- func (b *Builder) SetSourcePublicKey(key crypto.PublicKey) *Builder
- func (b *Builder) SetVersion(v uint32) *Builder
- type ClaimFromRewardingFund
- func (c *ClaimFromRewardingFund) Amount() *big.Int
- func (c *ClaimFromRewardingFund) ByteStream() []byte
- func (c *ClaimFromRewardingFund) Cost() (*big.Int, error)
- func (c *ClaimFromRewardingFund) Data() []byte
- func (c *ClaimFromRewardingFund) IntrinsicGas() (uint64, error)
- func (c *ClaimFromRewardingFund) LoadProto(claim *iotextypes.ClaimFromRewardingFund) error
- func (c *ClaimFromRewardingFund) Proto() *iotextypes.ClaimFromRewardingFund
- type ClaimFromRewardingFundBuilder
- type CreateDeposit
- func (d *CreateDeposit) Amount() *big.Int
- func (d *CreateDeposit) ByteStream() []byte
- func (d *CreateDeposit) ChainID() uint32
- func (d *CreateDeposit) Cost() (*big.Int, error)
- func (d *CreateDeposit) Destination() string
- func (d *CreateDeposit) IntrinsicGas() (uint64, error)
- func (d *CreateDeposit) LoadProto(pbDpst *iotextypes.CreateDeposit) error
- func (d *CreateDeposit) Proto() *iotextypes.CreateDeposit
- func (d *CreateDeposit) Recipient() string
- func (d *CreateDeposit) SenderPublicKey() crypto.PublicKey
- type DepositToRewardingFund
- func (d *DepositToRewardingFund) Amount() *big.Int
- func (d *DepositToRewardingFund) ByteStream() []byte
- func (d *DepositToRewardingFund) Cost() (*big.Int, error)
- func (d *DepositToRewardingFund) Data() []byte
- func (d *DepositToRewardingFund) IntrinsicGas() (uint64, error)
- func (d *DepositToRewardingFund) LoadProto(deposit *iotextypes.DepositToRewardingFund) error
- func (d *DepositToRewardingFund) Proto() *iotextypes.DepositToRewardingFund
- type DepositToRewardingFundBuilder
- type Envelope
- func (elp *Envelope) Action() Action
- func (elp *Envelope) ByteStream() []byte
- func (elp *Envelope) Cost() (*big.Int, error)
- func (elp *Envelope) Destination() (string, bool)
- func (elp *Envelope) GasLimit() uint64
- func (elp *Envelope) GasPrice() *big.Int
- func (elp *Envelope) Hash() hash.Hash256
- func (elp *Envelope) IntrinsicGas() (uint64, error)
- func (elp *Envelope) LoadProto(pbAct *iotextypes.ActionCore) error
- func (elp *Envelope) Nonce() uint64
- func (elp *Envelope) Proto() *iotextypes.ActionCore
- func (elp *Envelope) Version() uint32
- type EnvelopeBuilder
- func (b *EnvelopeBuilder) Build() Envelope
- func (b *EnvelopeBuilder) SetAction(action actionPayload) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetGasLimit(l uint64) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetGasPrice(p *big.Int) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetGasPriceByBytes(buf []byte) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetNonce(n uint64) *EnvelopeBuilder
- func (b *EnvelopeBuilder) SetVersion(v uint32) *EnvelopeBuilder
- type Execution
- func (ex *Execution) Amount() *big.Int
- func (ex *Execution) ByteStream() []byte
- func (ex *Execution) Contract() string
- func (ex *Execution) Cost() (*big.Int, error)
- func (ex *Execution) Data() []byte
- func (ex *Execution) Destination() string
- func (ex *Execution) ExecutorPublicKey() crypto.PublicKey
- func (ex *Execution) IntrinsicGas() (uint64, error)
- func (ex *Execution) LoadProto(pbAct *iotextypes.Execution) error
- func (ex *Execution) Proto() *iotextypes.Execution
- func (ex *Execution) TotalSize() uint32
- type GrantReward
- func (g *GrantReward) ByteStream() []byte
- func (*GrantReward) Cost() (*big.Int, error)
- func (g *GrantReward) Height() uint64
- func (*GrantReward) IntrinsicGas() (uint64, error)
- func (g *GrantReward) LoadProto(gProto *iotextypes.GrantReward) error
- func (g *GrantReward) Proto() *iotextypes.GrantReward
- func (g *GrantReward) RewardType() int
- type GrantRewardBuilder
- type Log
- type PutBlock
- func (pb *PutBlock) ByteStream() []byte
- func (pb *PutBlock) Cost() (*big.Int, error)
- func (pb *PutBlock) Destination() string
- func (pb *PutBlock) Height() uint64
- func (pb *PutBlock) IntrinsicGas() (uint64, error)
- func (pb *PutBlock) LoadProto(putBlockPb *iotextypes.PutBlock) error
- func (pb *PutBlock) ProducerPublicKey() crypto.PublicKey
- func (pb *PutBlock) Proto() *iotextypes.PutBlock
- func (pb *PutBlock) Roots() map[string]hash.Hash256
- func (pb *PutBlock) SubChainAddress() string
- type PutPollResult
- func (r *PutPollResult) ByteStream() []byte
- func (r *PutPollResult) Candidates() state.CandidateList
- func (r *PutPollResult) Cost() (*big.Int, error)
- func (r *PutPollResult) Height() uint64
- func (r *PutPollResult) IntrinsicGas() (uint64, error)
- func (r *PutPollResult) LoadProto(putPollResultPb *iotextypes.PutPollResult) error
- func (r *PutPollResult) ProducerPublicKey() crypto.PublicKey
- func (r *PutPollResult) Proto() *iotextypes.PutPollResult
- type Receipt
- type SealedEnvelope
- type SettleDeposit
- func (sd *SettleDeposit) Amount() *big.Int
- func (sd *SettleDeposit) ByteStream() []byte
- func (sd *SettleDeposit) Cost() (*big.Int, error)
- func (sd *SettleDeposit) Destination() string
- func (sd *SettleDeposit) Index() uint64
- func (sd *SettleDeposit) IntrinsicGas() (uint64, error)
- func (sd *SettleDeposit) LoadProto(pbDpst *iotextypes.SettleDeposit) error
- func (sd *SettleDeposit) Proto() *iotextypes.SettleDeposit
- func (sd *SettleDeposit) Recipient() string
- func (sd *SettleDeposit) SenderPublicKey() crypto.PublicKey
- type StartSubChain
- func (start *StartSubChain) ByteStream() []byte
- func (start *StartSubChain) ChainID() uint32
- func (start *StartSubChain) Cost() (*big.Int, error)
- func (start *StartSubChain) IntrinsicGas() (uint64, error)
- func (start *StartSubChain) LoadProto(startPb *iotextypes.StartSubChain) error
- func (start *StartSubChain) OperationDeposit() *big.Int
- func (start *StartSubChain) OwnerPublicKey() crypto.PublicKey
- func (start *StartSubChain) ParentHeightOffset() uint64
- func (start *StartSubChain) Proto() *iotextypes.StartSubChain
- func (start *StartSubChain) SecurityDeposit() *big.Int
- func (start *StartSubChain) StartHeight() uint64
- type StopSubChain
- func (ssc *StopSubChain) ByteStream() []byte
- func (ssc *StopSubChain) ChainAddress() string
- func (ssc *StopSubChain) Cost() (*big.Int, error)
- func (ssc *StopSubChain) Destination() string
- func (ssc *StopSubChain) IntrinsicGas() (uint64, error)
- func (ssc *StopSubChain) LoadProto(pbSSC *iotextypes.StopSubChain) error
- func (ssc *StopSubChain) Proto() *iotextypes.StopSubChain
- func (ssc *StopSubChain) StopHeight() uint64
- func (ssc *StopSubChain) TotalSize() uint32
- type Transfer
- func (tsf *Transfer) Amount() *big.Int
- func (tsf *Transfer) ByteStream() []byte
- func (tsf *Transfer) Cost() (*big.Int, error)
- func (tsf *Transfer) Destination() string
- func (tsf *Transfer) IntrinsicGas() (uint64, error)
- func (tsf *Transfer) LoadProto(pbAct *iotextypes.Transfer) error
- func (tsf *Transfer) Payload() []byte
- func (tsf *Transfer) Proto() *iotextypes.Transfer
- func (tsf *Transfer) Recipient() string
- func (tsf *Transfer) SenderPublicKey() crypto.PublicKey
- func (tsf *Transfer) TotalSize() uint32
Constants ¶
const ( // EmptyAddress is the empty string EmptyAddress = "" // ExecutionDataGas represents the execution data gas per uint ExecutionDataGas = uint64(100) // ExecutionBaseIntrinsicGas represents the base intrinsic gas for execution ExecutionBaseIntrinsicGas = uint64(10000) )
const ( // BlockReward indicates that the action is to grant block reward BlockReward = iota // EpochReward indicates that the action is to grant epoch reward EpochReward )
const ( // FailureReceiptStatus is the status that contract execution failed FailureReceiptStatus = uint64(0) // SuccessReceiptStatus is the status that contract execution success SuccessReceiptStatus = uint64(1) )
const ( // TransferPayloadGas represents the transfer payload gas per uint TransferPayloadGas = uint64(100) // TransferBaseIntrinsicGas represents the base intrinsic gas for transfer TransferBaseIntrinsicGas = uint64(10000) )
const ( // CreateDepositIntrinsicGas represents the intrinsic gas for the deposit action CreateDepositIntrinsicGas = uint64(10000) )
const PutBlockIntrinsicGas = uint64(1000)
PutBlockIntrinsicGas is the instrinsic gas for put block action.
const ( // SettleDepositIntrinsicGas represents the intrinsic gas for the deposit action SettleDepositIntrinsicGas = uint64(10000) )
const SignatureLength = 65
SignatureLength indicates the length of signature generated by SECP256K1 crypto library
const ( // StartSubChainIntrinsicGas is the instrinsic gas for start sub chain action StartSubChainIntrinsicGas = uint64(1000) )
const ( // StopSubChainIntrinsicGas is the instrinsic gas for stop sub chain action StopSubChainIntrinsicGas = uint64(1000) )
Variables ¶
var ( // ErrAction indicates error for an action ErrAction = errors.New("action error") // ErrAddress indicates error of address ErrAddress = errors.New("address error") )
var ( // ClaimFromRewardingFundBaseGas represents the base intrinsic gas for claimFromRewardingFund ClaimFromRewardingFundBaseGas = uint64(10000) // ClaimFromRewardingFundGasPerByte represents the claimFromRewardingFund payload gas per uint ClaimFromRewardingFundGasPerByte = uint64(100) )
var ( // ErrActPool indicates the error of actpool ErrActPool = errors.New("invalid actpool") // ErrHitGasLimit is the error when hit gas limit ErrHitGasLimit = errors.New("Hit Gas Limit") // ErrInsufficientBalanceForGas is the error that the balance in executor account is lower than gas ErrInsufficientBalanceForGas = errors.New("Insufficient balance for gas") // ErrOutOfGas is the error when running out of gas ErrOutOfGas = errors.New("Out of gas") // ErrGasHigherThanLimit indicates the error of gas value ErrGasHigherThanLimit = errors.New("invalid gas for action") // ErrTransfer indicates the error of transfer ErrTransfer = errors.New("invalid transfer") // ErrNonce indicates the error of nonce ErrNonce = errors.New("invalid nonce") // ErrBalance indicates the error of balance ErrBalance = errors.New("invalid balance") // ErrGasPrice indicates the error of gas price ErrGasPrice = errors.New("invalid gas price") // ErrVotee indicates the error of votee ErrVotee = errors.New("votee is not a candidate") // ErrHash indicates the error of action's hash ErrHash = errors.New("invalid hash") )
var ( // DepositToRewardingFundBaseGas represents the base intrinsic gas for depositToRewardingFund DepositToRewardingFundBaseGas = uint64(10000) // DepositToRewardingFundGasPerByte represents the depositToRewardingFund payload gas per uint DepositToRewardingFundGasPerByte = uint64(100) )
Functions ¶
func ClassifyActions ¶
func ClassifyActions(actions []SealedEnvelope) ([]*Transfer, []*Execution)
ClassifyActions classfies actions
func IsExperimentalAction ¶ added in v0.5.0
IsExperimentalAction test it the action is experimental
func Verify ¶
func Verify(sealed SealedEnvelope) error
Verify verifies the action using sender's public key
Types ¶
type AbstractAction ¶
type AbstractAction struct {
// contains filtered or unexported fields
}
AbstractAction is an abstract implementation of Action interface
func (*AbstractAction) BasicActionSize ¶
func (act *AbstractAction) BasicActionSize() uint32
BasicActionSize returns the basic size of action
func (*AbstractAction) GasLimit ¶
func (act *AbstractAction) GasLimit() uint64
GasLimit returns the gas limit
func (*AbstractAction) GasPrice ¶
func (act *AbstractAction) GasPrice() *big.Int
GasPrice returns the gas price
func (*AbstractAction) Hash ¶ added in v0.4.4
func (act *AbstractAction) Hash() hash.Hash256
Hash returns the hash value of referred SealedActionEnvelope hash.
func (*AbstractAction) SetEnvelopeContext ¶ added in v0.4.4
func (act *AbstractAction) SetEnvelopeContext(selp SealedEnvelope)
SetEnvelopeContext sets the SealedEnvelope context to action context.
func (*AbstractAction) SrcPubkey ¶
func (act *AbstractAction) SrcPubkey() crypto.PublicKey
SrcPubkey returns the source public key
func (*AbstractAction) Version ¶
func (act *AbstractAction) Version() uint32
Version returns the version
type Action ¶
type Action interface {
SetEnvelopeContext(SealedEnvelope)
}
Action is the action can be Executed in protocols. The method is added to avoid mistakenly used empty interface as action.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is used to build an action.
func (*Builder) SetGasLimit ¶
SetGasLimit sets action's gas limit.
func (*Builder) SetGasPrice ¶
SetGasPrice sets action's gas price.
func (*Builder) SetGasPriceByBytes ¶ added in v0.4.4
SetGasPriceByBytes sets action's gas price from a byte slice source.
func (*Builder) SetSourcePublicKey ¶
SetSourcePublicKey sets action's source's public key.
func (*Builder) SetVersion ¶
SetVersion sets action's version.
type ClaimFromRewardingFund ¶ added in v0.5.0
type ClaimFromRewardingFund struct { AbstractAction // contains filtered or unexported fields }
ClaimFromRewardingFund is the action to claim reward from the rewarding fund
func (*ClaimFromRewardingFund) Amount ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Amount() *big.Int
Amount returns the amount to claim
func (*ClaimFromRewardingFund) ByteStream ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) ByteStream() []byte
ByteStream returns a raw byte stream of a claim action
func (*ClaimFromRewardingFund) Cost ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Cost() (*big.Int, error)
Cost returns the total cost of a claim action
func (*ClaimFromRewardingFund) Data ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Data() []byte
Data returns the additional data
func (*ClaimFromRewardingFund) IntrinsicGas ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a claim action
func (*ClaimFromRewardingFund) LoadProto ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) LoadProto(claim *iotextypes.ClaimFromRewardingFund) error
LoadProto converts a claim action protobuf to a claim action struct
func (*ClaimFromRewardingFund) Proto ¶ added in v0.5.0
func (c *ClaimFromRewardingFund) Proto() *iotextypes.ClaimFromRewardingFund
Proto converts a claim action struct to a claim action protobuf
type ClaimFromRewardingFundBuilder ¶ added in v0.5.0
type ClaimFromRewardingFundBuilder struct { Builder // contains filtered or unexported fields }
ClaimFromRewardingFundBuilder is the struct to build ClaimFromRewardingFund
func (*ClaimFromRewardingFundBuilder) Build ¶ added in v0.5.0
func (b *ClaimFromRewardingFundBuilder) Build() ClaimFromRewardingFund
Build builds a new claim from rewarding fund action
func (*ClaimFromRewardingFundBuilder) SetAmount ¶ added in v0.5.0
func (b *ClaimFromRewardingFundBuilder) SetAmount(amount *big.Int) *ClaimFromRewardingFundBuilder
SetAmount sets the amount to claim
func (*ClaimFromRewardingFundBuilder) SetData ¶ added in v0.5.0
func (b *ClaimFromRewardingFundBuilder) SetData(data []byte) *ClaimFromRewardingFundBuilder
SetData sets the additional data
type CreateDeposit ¶
type CreateDeposit struct { AbstractAction // contains filtered or unexported fields }
CreateDeposit represents the action to deposit the token from main-chain to sub-chain. The recipient address must be a sub-chain address, but it doesn'rewardType need to be owned by the sender.
func NewCreateDeposit ¶
func NewCreateDeposit( nonce uint64, chainID uint32, amount *big.Int, recipient string, gasLimit uint64, gasPrice *big.Int, ) *CreateDeposit
NewCreateDeposit instantiates a deposit creation to sub-chain action struct
func (*CreateDeposit) ByteStream ¶
func (d *CreateDeposit) ByteStream() []byte
ByteStream returns a raw byte stream of the deposit action
func (*CreateDeposit) ChainID ¶ added in v0.4.4
func (d *CreateDeposit) ChainID() uint32
ChainID returns chain ID
func (*CreateDeposit) Cost ¶
func (d *CreateDeposit) Cost() (*big.Int, error)
Cost returns the total cost of a create deposit
func (*CreateDeposit) Destination ¶ added in v0.5.0
func (d *CreateDeposit) Destination() string
Destination returns the recipient address. The recipient should be an address on the sub-chain
func (*CreateDeposit) IntrinsicGas ¶
func (d *CreateDeposit) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a create deposit
func (*CreateDeposit) LoadProto ¶
func (d *CreateDeposit) LoadProto(pbDpst *iotextypes.CreateDeposit) error
LoadProto converts a protobuf's ActionPb to CreateDeposit
func (*CreateDeposit) Proto ¶
func (d *CreateDeposit) Proto() *iotextypes.CreateDeposit
Proto converts CreateDeposit to protobuf's ActionPb
func (*CreateDeposit) Recipient ¶
func (d *CreateDeposit) Recipient() string
Recipient returns the recipient address. The recipient should be an address on the sub-chain
func (*CreateDeposit) SenderPublicKey ¶
func (d *CreateDeposit) SenderPublicKey() crypto.PublicKey
SenderPublicKey returns the sender public key. It's the wrapper of Action.SrcPubkey
type DepositToRewardingFund ¶ added in v0.5.0
type DepositToRewardingFund struct { AbstractAction // contains filtered or unexported fields }
DepositToRewardingFund is the action to deposit to the rewarding fund
func (*DepositToRewardingFund) Amount ¶ added in v0.5.0
func (d *DepositToRewardingFund) Amount() *big.Int
Amount returns the amount to deposit
func (*DepositToRewardingFund) ByteStream ¶ added in v0.5.0
func (d *DepositToRewardingFund) ByteStream() []byte
ByteStream returns a raw byte stream of a deposit action
func (*DepositToRewardingFund) Cost ¶ added in v0.5.0
func (d *DepositToRewardingFund) Cost() (*big.Int, error)
Cost returns the total cost of a deposit action
func (*DepositToRewardingFund) Data ¶ added in v0.5.0
func (d *DepositToRewardingFund) Data() []byte
Data returns the additional data
func (*DepositToRewardingFund) IntrinsicGas ¶ added in v0.5.0
func (d *DepositToRewardingFund) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a deposit action
func (*DepositToRewardingFund) LoadProto ¶ added in v0.5.0
func (d *DepositToRewardingFund) LoadProto(deposit *iotextypes.DepositToRewardingFund) error
LoadProto converts a deposit action protobuf to a deposit action struct
func (*DepositToRewardingFund) Proto ¶ added in v0.5.0
func (d *DepositToRewardingFund) Proto() *iotextypes.DepositToRewardingFund
Proto converts a deposit action struct to a deposit action protobuf
type DepositToRewardingFundBuilder ¶ added in v0.5.0
type DepositToRewardingFundBuilder struct { Builder // contains filtered or unexported fields }
DepositToRewardingFundBuilder is the struct to build DepositToRewardingFund
func (*DepositToRewardingFundBuilder) Build ¶ added in v0.5.0
func (b *DepositToRewardingFundBuilder) Build() DepositToRewardingFund
Build builds a new deposit to rewarding fund action
func (*DepositToRewardingFundBuilder) SetAmount ¶ added in v0.5.0
func (b *DepositToRewardingFundBuilder) SetAmount(amount *big.Int) *DepositToRewardingFundBuilder
SetAmount sets the amount to deposit
func (*DepositToRewardingFundBuilder) SetData ¶ added in v0.5.0
func (b *DepositToRewardingFundBuilder) SetData(data []byte) *DepositToRewardingFundBuilder
SetData sets the additional data
type Envelope ¶ added in v0.4.4
type Envelope struct {
// contains filtered or unexported fields
}
Envelope defines an envelope wrapped on action with some envelope metadata.
func (*Envelope) ByteStream ¶ added in v0.4.4
ByteStream returns encoded binary.
func (*Envelope) Destination ¶ added in v0.5.0
Destination returns the destination address
func (*Envelope) IntrinsicGas ¶ added in v0.4.4
IntrinsicGas returns intrinsic gas of action.
func (*Envelope) LoadProto ¶ added in v0.5.0
func (elp *Envelope) LoadProto(pbAct *iotextypes.ActionCore) error
LoadProto loads fields from protobuf format.
func (*Envelope) Proto ¶ added in v0.5.0
func (elp *Envelope) Proto() *iotextypes.ActionCore
Proto convert Envelope to protobuf format.
type EnvelopeBuilder ¶ added in v0.4.4
type EnvelopeBuilder struct {
// contains filtered or unexported fields
}
EnvelopeBuilder is the builder to build Envelope.
func (*EnvelopeBuilder) Build ¶ added in v0.4.4
func (b *EnvelopeBuilder) Build() Envelope
Build builds a new action.
func (*EnvelopeBuilder) SetAction ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetAction(action actionPayload) *EnvelopeBuilder
SetAction sets the action payload for the Envelope Builder is building.
func (*EnvelopeBuilder) SetGasLimit ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetGasLimit(l uint64) *EnvelopeBuilder
SetGasLimit sets action's gas limit.
func (*EnvelopeBuilder) SetGasPrice ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetGasPrice(p *big.Int) *EnvelopeBuilder
SetGasPrice sets action's gas price.
func (*EnvelopeBuilder) SetGasPriceByBytes ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetGasPriceByBytes(buf []byte) *EnvelopeBuilder
SetGasPriceByBytes sets action's gas price from a byte slice source.
func (*EnvelopeBuilder) SetNonce ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetNonce(n uint64) *EnvelopeBuilder
SetNonce sets action's nonce.
func (*EnvelopeBuilder) SetVersion ¶ added in v0.4.4
func (b *EnvelopeBuilder) SetVersion(v uint32) *EnvelopeBuilder
SetVersion sets action's version.
type Execution ¶
type Execution struct { AbstractAction // contains filtered or unexported fields }
Execution defines the struct of account-based contract execution
func NewExecution ¶
func NewExecution( contractAddress string, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, ) (*Execution, error)
NewExecution returns a Execution instance
func (*Execution) ByteStream ¶
ByteStream returns a raw byte stream of this Transfer
func (*Execution) Destination ¶ added in v0.5.0
Destination returns a contract address
func (*Execution) ExecutorPublicKey ¶
ExecutorPublicKey returns the executor's public key
func (*Execution) IntrinsicGas ¶
IntrinsicGas returns the intrinsic gas of an execution
func (*Execution) LoadProto ¶
func (ex *Execution) LoadProto(pbAct *iotextypes.Execution) error
LoadProto converts a protobuf's Execution to Execution
func (*Execution) Proto ¶
func (ex *Execution) Proto() *iotextypes.Execution
Proto converts Execution to protobuf's Execution
type GrantReward ¶ added in v0.5.0
type GrantReward struct { AbstractAction // contains filtered or unexported fields }
GrantReward is the action to grant either block or epoch reward
func (*GrantReward) ByteStream ¶ added in v0.5.0
func (g *GrantReward) ByteStream() []byte
ByteStream returns a raw byte stream of a grant reward action
func (*GrantReward) Cost ¶ added in v0.5.0
func (*GrantReward) Cost() (*big.Int, error)
Cost returns the total cost of a grant reward action
func (*GrantReward) Height ¶ added in v0.5.0
func (g *GrantReward) Height() uint64
Height returns the block height to grant reward
func (*GrantReward) IntrinsicGas ¶ added in v0.5.0
func (*GrantReward) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a grant reward action, which is 0
func (*GrantReward) LoadProto ¶ added in v0.5.0
func (g *GrantReward) LoadProto(gProto *iotextypes.GrantReward) error
LoadProto converts a grant reward action protobuf to a grant reward action struct
func (*GrantReward) Proto ¶ added in v0.5.0
func (g *GrantReward) Proto() *iotextypes.GrantReward
Proto converts a grant reward action struct to a grant reward action protobuf
func (*GrantReward) RewardType ¶ added in v0.5.0
func (g *GrantReward) RewardType() int
RewardType returns the grant reward type
type GrantRewardBuilder ¶ added in v0.5.0
type GrantRewardBuilder struct { Builder // contains filtered or unexported fields }
GrantRewardBuilder is the struct to build GrantReward
func (*GrantRewardBuilder) Build ¶ added in v0.5.0
func (b *GrantRewardBuilder) Build() GrantReward
Build builds a new grant reward action
func (*GrantRewardBuilder) SetHeight ¶ added in v0.5.0
func (b *GrantRewardBuilder) SetHeight(height uint64) *GrantRewardBuilder
SetHeight sets the grant reward block height
func (*GrantRewardBuilder) SetRewardType ¶ added in v0.5.0
func (b *GrantRewardBuilder) SetRewardType(t int) *GrantRewardBuilder
SetRewardType sets the grant reward type
type Log ¶
type Log struct { Address string Topics []hash.Hash256 Data []byte BlockHeight uint64 ActionHash hash.Hash256 Index uint }
Log stores an evm contract event
func (*Log) ConvertFromLogPb ¶
func (log *Log) ConvertFromLogPb(pbLog *iotextypes.Log)
ConvertFromLogPb converts a protobuf's LogPb to Log
func (*Log) ConvertToLogPb ¶
func (log *Log) ConvertToLogPb() *iotextypes.Log
ConvertToLogPb converts a Log to protobuf's Log
func (*Log) Deserialize ¶
Deserialize parse the byte stream into Log
type PutBlock ¶
type PutBlock struct { AbstractAction // contains filtered or unexported fields }
PutBlock represents put a sub-chain block message.
func NewPutBlock ¶
func NewPutBlock( nonce uint64, subChainAddress string, height uint64, roots map[string]hash.Hash256, gasLimit uint64, gasPrice *big.Int, ) *PutBlock
NewPutBlock instantiates a putting sub-chain block action struct.
func (*PutBlock) ByteStream ¶
ByteStream returns the byte representation of put block action.
func (*PutBlock) Destination ¶ added in v0.5.0
Destination returns sub chain address.
func (*PutBlock) IntrinsicGas ¶
IntrinsicGas returns the intrinsic gas of a put block action
func (*PutBlock) LoadProto ¶
func (pb *PutBlock) LoadProto(putBlockPb *iotextypes.PutBlock) error
LoadProto converts a proto message into put block action.
func (*PutBlock) ProducerPublicKey ¶
ProducerPublicKey return producer public key.
func (*PutBlock) Proto ¶
func (pb *PutBlock) Proto() *iotextypes.PutBlock
Proto converts put sub-chain block action into a proto message.
func (*PutBlock) SubChainAddress ¶
SubChainAddress returns sub chain address.
type PutPollResult ¶ added in v0.5.0
type PutPollResult struct { AbstractAction // contains filtered or unexported fields }
PutPollResult represents put the poll result from gravity chain.
func NewPutPollResult ¶ added in v0.5.0
func NewPutPollResult( nonce uint64, height uint64, candidates state.CandidateList, ) *PutPollResult
NewPutPollResult instantiates a putting poll result action struct.
func (*PutPollResult) ByteStream ¶ added in v0.5.0
func (r *PutPollResult) ByteStream() []byte
ByteStream returns the byte representation of put poll result action.
func (*PutPollResult) Candidates ¶ added in v0.5.0
func (r *PutPollResult) Candidates() state.CandidateList
Candidates returns the list of candidates.
func (*PutPollResult) Cost ¶ added in v0.5.0
func (r *PutPollResult) Cost() (*big.Int, error)
Cost returns the total cost of a put poll result action
func (*PutPollResult) Height ¶ added in v0.5.0
func (r *PutPollResult) Height() uint64
Height returns put poll result height.
func (*PutPollResult) IntrinsicGas ¶ added in v0.5.0
func (r *PutPollResult) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a put poll result action
func (*PutPollResult) LoadProto ¶ added in v0.5.0
func (r *PutPollResult) LoadProto(putPollResultPb *iotextypes.PutPollResult) error
LoadProto converts a proto message into put block action.
func (*PutPollResult) ProducerPublicKey ¶ added in v0.5.0
func (r *PutPollResult) ProducerPublicKey() crypto.PublicKey
ProducerPublicKey return producer public key.
func (*PutPollResult) Proto ¶ added in v0.5.0
func (r *PutPollResult) Proto() *iotextypes.PutPollResult
Proto converts put poll result action into a proto message.
type Receipt ¶
type Receipt struct { Status uint64 BlockHeight uint64 ActionHash hash.Hash256 GasConsumed uint64 ContractAddress string Logs []*Log }
Receipt represents the result of a contract
func (*Receipt) ConvertFromReceiptPb ¶
func (receipt *Receipt) ConvertFromReceiptPb(pbReceipt *iotextypes.Receipt)
ConvertFromReceiptPb converts a protobuf's Receipt to Receipt
func (*Receipt) ConvertToReceiptPb ¶
func (receipt *Receipt) ConvertToReceiptPb() *iotextypes.Receipt
ConvertToReceiptPb converts a Receipt to protobuf's Receipt
func (*Receipt) Deserialize ¶
Deserialize parse the byte stream into Receipt
type SealedEnvelope ¶ added in v0.4.4
type SealedEnvelope struct { Envelope // contains filtered or unexported fields }
SealedEnvelope is a signed action envelope.
func AssembleSealedEnvelope ¶ added in v0.4.4
func AssembleSealedEnvelope(act Envelope, pk crypto.PublicKey, sig []byte) SealedEnvelope
AssembleSealedEnvelope assembles a SealedEnvelope use Envelope, Sender Address and Signature. This method should be only used in tests.
func FakeSeal ¶ added in v0.4.4
func FakeSeal(act Envelope, pubk crypto.PublicKey) SealedEnvelope
FakeSeal creates a SealedActionEnvelope without signature. This method should be only used in tests.
func Sign ¶
func Sign(act Envelope, sk crypto.PrivateKey) (SealedEnvelope, error)
Sign signs the action using sender's private key
func (*SealedEnvelope) Hash ¶ added in v0.4.4
func (sealed *SealedEnvelope) Hash() hash.Hash256
Hash returns the hash value of SealedEnvelope.
func (*SealedEnvelope) LoadProto ¶ added in v0.4.4
func (sealed *SealedEnvelope) LoadProto(pbAct *iotextypes.Action) error
LoadProto loads from proto scheme.
func (SealedEnvelope) Proto ¶ added in v0.4.4
func (sealed SealedEnvelope) Proto() *iotextypes.Action
Proto converts it to it's proto scheme.
func (*SealedEnvelope) Signature ¶ added in v0.4.4
func (sealed *SealedEnvelope) Signature() []byte
Signature returns signature bytes
func (*SealedEnvelope) SrcPubkey ¶ added in v0.4.4
func (sealed *SealedEnvelope) SrcPubkey() crypto.PublicKey
SrcPubkey returns the source public key
type SettleDeposit ¶
type SettleDeposit struct { AbstractAction // contains filtered or unexported fields }
SettleDeposit represents the action to settle a deposit on the sub-chain
func NewSettleDeposit ¶
func NewSettleDeposit( nonce uint64, amount *big.Int, index uint64, recipient string, gasLimit uint64, gasPrice *big.Int, ) *SettleDeposit
NewSettleDeposit instantiates a deposit settlement to sub-chain action struct
func (*SettleDeposit) ByteStream ¶
func (sd *SettleDeposit) ByteStream() []byte
ByteStream returns a raw byte stream of the settle deposit action
func (*SettleDeposit) Cost ¶
func (sd *SettleDeposit) Cost() (*big.Int, error)
Cost returns the total cost of a settle deposit
func (*SettleDeposit) Destination ¶ added in v0.5.0
func (sd *SettleDeposit) Destination() string
Destination returns the recipient address. The recipient should be an address on the sub-chain
func (*SettleDeposit) Index ¶
func (sd *SettleDeposit) Index() uint64
Index returns the index of the deposit on main-chain's sub-chain account
func (*SettleDeposit) IntrinsicGas ¶
func (sd *SettleDeposit) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a settle deposit
func (*SettleDeposit) LoadProto ¶
func (sd *SettleDeposit) LoadProto(pbDpst *iotextypes.SettleDeposit) error
LoadProto converts a protobuf's Action to SettleDeposit
func (*SettleDeposit) Proto ¶
func (sd *SettleDeposit) Proto() *iotextypes.SettleDeposit
Proto converts SettleDeposit to protobuf's Action
func (*SettleDeposit) Recipient ¶
func (sd *SettleDeposit) Recipient() string
Recipient returns the recipient address. The recipient should be an address on the sub-chain
func (*SettleDeposit) SenderPublicKey ¶
func (sd *SettleDeposit) SenderPublicKey() crypto.PublicKey
SenderPublicKey returns the sender public key. It's the wrapper of Action.SrcPubkey
type StartSubChain ¶
type StartSubChain struct { AbstractAction // contains filtered or unexported fields }
StartSubChain represents start sub-chain message
func NewStartSubChain ¶
func NewStartSubChain( nonce uint64, chainID uint32, securityDeposit *big.Int, operationDeposit *big.Int, startHeight uint64, parentHeightOffset uint64, gasLimit uint64, gasPrice *big.Int, ) *StartSubChain
NewStartSubChain instantiates a start sub-chain action struct
func (*StartSubChain) ByteStream ¶
func (start *StartSubChain) ByteStream() []byte
ByteStream returns the byte representation of sub-chain action
func (*StartSubChain) ChainID ¶
func (start *StartSubChain) ChainID() uint32
ChainID returns chain ID
func (*StartSubChain) Cost ¶
func (start *StartSubChain) Cost() (*big.Int, error)
Cost returns the total cost of a start sub-chain action
func (*StartSubChain) IntrinsicGas ¶
func (start *StartSubChain) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a start sub-chain action
func (*StartSubChain) LoadProto ¶
func (start *StartSubChain) LoadProto(startPb *iotextypes.StartSubChain) error
LoadProto converts a proto message into start sub-chain action
func (*StartSubChain) OperationDeposit ¶
func (start *StartSubChain) OperationDeposit() *big.Int
OperationDeposit returns operation deposit
func (*StartSubChain) OwnerPublicKey ¶
func (start *StartSubChain) OwnerPublicKey() crypto.PublicKey
OwnerPublicKey returns the owner public key, which is the wrapper of SrcPubkey
func (*StartSubChain) ParentHeightOffset ¶
func (start *StartSubChain) ParentHeightOffset() uint64
ParentHeightOffset returns parent height offset
func (*StartSubChain) Proto ¶
func (start *StartSubChain) Proto() *iotextypes.StartSubChain
Proto converts start sub-chain action into a proto message
func (*StartSubChain) SecurityDeposit ¶
func (start *StartSubChain) SecurityDeposit() *big.Int
SecurityDeposit returns security deposit
func (*StartSubChain) StartHeight ¶
func (start *StartSubChain) StartHeight() uint64
StartHeight returns start height
type StopSubChain ¶
type StopSubChain struct { AbstractAction // contains filtered or unexported fields }
StopSubChain defines the action to stop sub chain
func NewStopSubChain ¶
func NewStopSubChain( nonce uint64, chainAddress string, stopHeight uint64, gasLimit uint64, gasPrice *big.Int, ) *StopSubChain
NewStopSubChain returns a StopSubChain instance
func (*StopSubChain) ByteStream ¶
func (ssc *StopSubChain) ByteStream() []byte
ByteStream returns a raw byte stream of this instance
func (*StopSubChain) ChainAddress ¶
func (ssc *StopSubChain) ChainAddress() string
ChainAddress returns the address of the sub chain
func (*StopSubChain) Cost ¶
func (ssc *StopSubChain) Cost() (*big.Int, error)
Cost returns the total cost of a StopSubChain
func (*StopSubChain) Destination ¶ added in v0.5.0
func (ssc *StopSubChain) Destination() string
Destination returns the address of the sub chain
func (*StopSubChain) IntrinsicGas ¶
func (ssc *StopSubChain) IntrinsicGas() (uint64, error)
IntrinsicGas returns the intrinsic gas of a StopSubChain
func (*StopSubChain) LoadProto ¶
func (ssc *StopSubChain) LoadProto(pbSSC *iotextypes.StopSubChain) error
LoadProto converts a protobuf's Action to StopSubChain
func (*StopSubChain) Proto ¶
func (ssc *StopSubChain) Proto() *iotextypes.StopSubChain
Proto converts StopSubChain to protobuf's Action
func (*StopSubChain) StopHeight ¶
func (ssc *StopSubChain) StopHeight() uint64
StopHeight returns the height to stop the sub chain
func (*StopSubChain) TotalSize ¶
func (ssc *StopSubChain) TotalSize() uint32
TotalSize returns the total size of this instance
type Transfer ¶
type Transfer struct { AbstractAction // contains filtered or unexported fields }
Transfer defines the struct of account-based transfer
func NewTransfer ¶
func NewTransfer( nonce uint64, amount *big.Int, recipient string, payload []byte, gasLimit uint64, gasPrice *big.Int, ) (*Transfer, error)
NewTransfer returns a Transfer instance
func (*Transfer) ByteStream ¶
ByteStream returns a raw byte stream of this Transfer
func (*Transfer) Destination ¶ added in v0.5.0
Destination returns the recipient address as destination.
func (*Transfer) IntrinsicGas ¶
IntrinsicGas returns the intrinsic gas of a transfer
func (*Transfer) LoadProto ¶
func (tsf *Transfer) LoadProto(pbAct *iotextypes.Transfer) error
LoadProto converts a protobuf's Action to Transfer
func (*Transfer) Proto ¶
func (tsf *Transfer) Proto() *iotextypes.Transfer
Proto converts Transfer to protobuf's Action
func (*Transfer) Recipient ¶
Recipient returns the recipient address. It's the wrapper of Action.DstAddr
func (*Transfer) SenderPublicKey ¶
SenderPublicKey returns the sender public key. It's the wrapper of Action.SrcPubkey