metadata

package
v1.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	InvalidMeta = 1

	IssuingRequestMeta     = 24
	IssuingResponseMeta    = 25
	ContractingRequestMeta = 26
	IssuingETHRequestMeta  = 80
	IssuingETHResponseMeta = 81

	ShardBlockReward             = 36
	AcceptedBlockRewardInfoMeta  = 37
	ShardBlockSalaryResponseMeta = 38
	BeaconRewardRequestMeta      = 39
	BeaconSalaryResponseMeta     = 40
	ReturnStakingMeta            = 41
	IncDAORewardRequestMeta      = 42
	ShardBlockRewardRequestMeta  = 43
	WithDrawRewardRequestMeta    = 44
	WithDrawRewardResponseMeta   = 45

	ShardStakingMeta    = 63
	StopAutoStakingMeta = 127
	BeaconStakingMeta   = 64
	UnStakingMeta       = 210

	BeaconSwapConfirmMeta = 70
	BridgeSwapConfirmMeta = 71
	BurningRequestMeta    = 27
	BurningRequestMetaV2  = 240
	BurningConfirmMeta    = 72
	BurningConfirmMetaV2  = 241

	PDEContributionMeta                   = 90
	PDETradeRequestMeta                   = 91
	PDETradeResponseMeta                  = 92
	PDEWithdrawalRequestMeta              = 93
	PDEWithdrawalResponseMeta             = 94
	PDEContributionResponseMeta           = 95
	PDEPRVRequiredContributionRequestMeta = 204
	PDECrossPoolTradeRequestMeta          = 205
	PDECrossPoolTradeResponseMeta         = 206
	PDEFeeWithdrawalRequestMeta           = 207
	PDEFeeWithdrawalResponseMeta          = 208
	PDETradingFeesDistributionMeta        = 209

	PortalCustodianDepositMeta                  = 100
	PortalRequestPortingMeta                    = 101
	PortalUserRequestPTokenMeta                 = 102
	PortalCustodianDepositResponseMeta          = 103
	PortalUserRequestPTokenResponseMeta         = 104
	PortalExchangeRatesMeta                     = 105
	PortalRedeemRequestMeta                     = 106
	PortalRedeemRequestResponseMeta             = 107
	PortalRequestUnlockCollateralMeta           = 108
	PortalCustodianWithdrawRequestMeta          = 110
	PortalCustodianWithdrawResponseMeta         = 111
	PortalLiquidateCustodianMeta                = 112
	PortalLiquidateCustodianResponseMeta        = 113
	PortalLiquidateTPExchangeRatesMeta          = 114
	PortalExpiredWaitingPortingReqMeta          = 116
	PortalRewardMeta                            = 117
	PortalRequestWithdrawRewardMeta             = 118
	PortalRequestWithdrawRewardResponseMeta     = 119
	PortalRedeemFromLiquidationPoolMeta         = 120
	PortalRedeemFromLiquidationPoolResponseMeta = 121
	PortalCustodianTopUpMeta                    = 122
	PortalCustodianTopUpResponseMeta            = 123
	PortalTotalRewardCustodianMeta              = 124
	PortalPortingResponseMeta                   = 125
	PortalReqMatchingRedeemMeta                 = 126
	PortalPickMoreCustodianForRedeemMeta        = 128
	PortalCustodianTopUpMetaV2                  = 129
	PortalCustodianTopUpResponseMetaV2          = 130

	PortalCustodianDepositMetaV3                  = 131
	PortalCustodianWithdrawRequestMetaV3          = 132
	PortalRewardMetaV3                            = 133
	PortalRequestUnlockCollateralMetaV3           = 134
	PortalLiquidateCustodianMetaV3                = 135
	PortalLiquidateByRatesMetaV3                  = 136
	PortalRedeemFromLiquidationPoolMetaV3         = 137
	PortalRedeemFromLiquidationPoolResponseMetaV3 = 138
	PortalCustodianTopUpMetaV3                    = 139
	PortalTopUpWaitingPortingRequestMetaV3        = 140
	PortalRequestPortingMetaV3                    = 141
	PortalRedeemRequestMetaV3                     = 142
	PortalUnlockOverRateCollateralsMeta           = 143

	PortalCustodianWithdrawConfirmMetaV3         = 170
	PortalRedeemFromLiquidationPoolConfirmMetaV3 = 171
	PortalLiquidateRunAwayCustodianConfirmMetaV3 = 172

	PortalResetPortalDBMeta = 199

	RelayingBNBHeaderMeta = 200
	RelayingBTCHeaderMeta = 201

	PortalTopUpWaitingPortingRequestMeta  = 202
	PortalTopUpWaitingPortingResponseMeta = 203

	BurningForDepositToSCRequestMeta   = 96
	BurningForDepositToSCRequestMetaV2 = 242
	BurningConfirmForDepositToSCMeta   = 97
	BurningConfirmForDepositToSCMetaV2 = 243

	PortalV4ShieldingRequestMeta      = 260
	PortalV4ShieldingResponseMeta     = 261
	PortalV4UnshieldingRequestMeta    = 262
	PortalV4UnshieldingResponseMeta   = 263
	PortalV4UnshieldBatchingMeta      = 264
	PortalV4FeeReplacementRequestMeta = 265
	PortalV4SubmitConfirmedTxMeta     = 266
	PortalV4ConvertVaultRequestMeta   = 267

	InitTokenRequestMeta  = 244
	InitTokenResponseMeta = 245

	IssuingBSCRequestMeta  = 250
	IssuingBSCResponseMeta = 251
	BurningPBSCRequestMeta = 252
	BurningBSCConfirmMeta  = 253

	IssuingPRVERC20RequestMeta  = 270
	IssuingPRVERC20ResponseMeta = 271
	IssuingPRVBEP20RequestMeta  = 272
	IssuingPRVBEP20ResponseMeta = 273
	BurningPRVERC20RequestMeta  = 274
	BurningPRVERC20ConfirmMeta  = 150
	BurningPRVBEP20RequestMeta  = 275
	BurningPRVBEP20ConfirmMeta  = 151
)

Variables

View Source
var AcceptedWithdrawRewardRequestVersion = []int{0, 1}

Functions

This section is empty.

Types

type BurningRequest

type BurningRequest struct {
	BurnerAddress key.PaymentAddress
	BurningAmount uint64 // must be equal to vOut value
	TokenID       common.Hash
	TokenName     string
	RemoteAddress string
	MetadataBase
}

BurningRequest is a request to burn UTXOs (mostly to un-shield). Anyone can send this request.

func NewBurningRequest

func NewBurningRequest(
	burnerAddress key.PaymentAddress,
	burningAmount uint64,
	tokenID common.Hash,
	tokenName string,
	remoteAddress string,
	metaType int,
) (*BurningRequest, error)

NewBurningRequest creates a new BurningRequest.

func (*BurningRequest) CalculateSize

func (bReq *BurningRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (BurningRequest) Hash

func (bReq BurningRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (BurningRequest) HashWithoutSig

func (bReq BurningRequest) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

type ContractingRequest

type ContractingRequest struct {
	BurnerAddress key.PaymentAddress
	BurnedAmount  uint64
	TokenID       common.Hash
	MetadataBase
}

ContractingRequest is a request to burn centralized UTXOs (mostly to un-shield). Anyone can send this request.

func NewContractingRequest

func NewContractingRequest(
	burnerAddress key.PaymentAddress,
	burnedAmount uint64,
	tokenID common.Hash,
	metaType int,
) (*ContractingRequest, error)

NewContractingRequest creates a new ContractingRequest.

func (*ContractingRequest) CalculateSize

func (cReq *ContractingRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (ContractingRequest) Hash

func (cReq ContractingRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type InitTokenRequest

type InitTokenRequest struct {
	OTAStr      string
	TxRandomStr string
	Amount      uint64
	TokenName   string
	TokenSymbol string
	MetadataBase
}

InitTokenRequest represents a request to create a freshly new token. This metadata only comes with a PRV transaction v2.

func NewInitTokenRequest

func NewInitTokenRequest(otaStr string, txRandomStr string, amount uint64, tokenName, tokenSymbol string, metaType int) (*InitTokenRequest, error)

NewInitTokenRequest creates a new InitTokenRequest.

func (*InitTokenRequest) CalculateSize

func (iReq *InitTokenRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (InitTokenRequest) Hash

func (iReq InitTokenRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type InitTokenResponse

type InitTokenResponse struct {
	MetadataBase
	RequestedTxID common.Hash
}

InitTokenResponse is the response for a InitTokenRequest.

func (*InitTokenResponse) CalculateSize

func (iRes *InitTokenResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (InitTokenResponse) Hash

func (iRes InitTokenResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type IssuingEVMRequest

type IssuingEVMRequest struct {
	BlockHash  rCommon.Hash
	TxIndex    uint
	ProofStrs  []string
	IncTokenID common.Hash
	MetadataBase
}

IssuingEVMRequest is a request to mint an amount of an ETH/BSC token in the Incognito network after the same amount has been locked in the smart contracts.

func NewIssuingEVMRequest

func NewIssuingEVMRequest(
	blockHash rCommon.Hash,
	txIndex uint,
	proofs []string,
	incTokenID common.Hash,
	metaType int,
) (*IssuingEVMRequest, error)

NewIssuingEVMRequest creates a new IssuingEVMRequest.

func (*IssuingEVMRequest) CalculateSize

func (iReq *IssuingEVMRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (IssuingEVMRequest) Hash

func (iReq IssuingEVMRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type IssuingEVMResponse

type IssuingEVMResponse struct {
	MetadataBase
	RequestedTxID   common.Hash
	UniqETHTx       []byte
	ExternalTokenID []byte
	SharedRandom    []byte `json:"SharedRandom,omitempty"`
}

IssuingEVMResponse is the response for a IssuingEVMRequest.

func (*IssuingEVMResponse) CalculateSize

func (iRes *IssuingEVMResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (IssuingEVMResponse) Hash

func (iRes IssuingEVMResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type IssuingRequest

type IssuingRequest struct {
	ReceiverAddress key.PaymentAddress
	DepositedAmount uint64
	TokenID         common.Hash
	TokenName       string
	MetadataBaseWithSignature
}

IssuingRequest is a request to shield a centralized token into the Incognito network. Only centralized website can send this metadata, and authorization is required.

func NewIssuingRequest

func NewIssuingRequest(
	receiverAddress key.PaymentAddress,
	depositedAmount uint64,
	tokenID common.Hash,
	tokenName string,
	metaType int,
) (*IssuingRequest, error)

NewIssuingRequest creates a new IssuingRequest.

func (*IssuingRequest) CalculateSize

func (iReq *IssuingRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (IssuingRequest) Hash

func (iReq IssuingRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (IssuingRequest) HashWithoutSig

func (iReq IssuingRequest) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

type IssuingResponse

type IssuingResponse struct {
	MetadataBase
	RequestedTxID common.Hash
	SharedRandom  []byte `json:"SharedRandom,omitempty"`
}

IssuingResponse is the response for a IssuingRequest.

func (*IssuingResponse) CalculateSize

func (iRes *IssuingResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (IssuingResponse) Hash

func (iRes IssuingResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type Metadata

type Metadata interface {
	// GetType returns the type of a Metadata
	GetType() int

	// Sign signs the metadata with the provided private key.
	Sign(*key.PrivateKey, Transaction) error

	// Hash calculates the hash of a metadata.
	Hash() *common.Hash

	// HashWithoutSig calculates the hash of a metadata without including its sig.
	HashWithoutSig() *common.Hash

	// CalculateSize returns the size of a metadata in bytes.
	CalculateSize() uint64
}

Metadata is an interface describing all common methods of a metadata. A Metadata is a special piece of information enclosed with a transaction to indicate additional purpose of the transaction.

func ParseMetadata

func ParseMetadata(metaInBytes []byte) (Metadata, error)

ParseMetadata parses raw-byte data into a proper Metadata. The input raw data is expected to be the JSON-marshalled data of a Metadata. Otherwise, this function will fail.

type MetadataBase

type MetadataBase struct {
	Type int
}

MetadataBase is the base field for a Metadata.

func NewMetadataBase

func NewMetadataBase(thisType int) *MetadataBase

NewMetadataBase creates a new MetadataBase with the given metadata type.

func (*MetadataBase) CalculateSize

func (mb *MetadataBase) CalculateSize() uint64

CalculateSize returns the size of a metadata in bytes.

func (MetadataBase) GetType

func (mb MetadataBase) GetType() int

GetType returns the type of a metadata.

func (MetadataBase) Hash

func (mb MetadataBase) Hash() *common.Hash

Hash calculates the hash of a metadata.

func (MetadataBase) HashWithoutSig

func (mb MetadataBase) HashWithoutSig() *common.Hash

HashWithoutSig calculates the hash of a metadata without including its sig.

func (*MetadataBase) Sign

func (mb *MetadataBase) Sign(_ *key.PrivateKey, _ Transaction) error

Sign does nothing.

type MetadataBaseWithSignature

type MetadataBaseWithSignature struct {
	MetadataBase
	Sig []byte `json:"Sig,omitempty"`
}

MetadataBaseWithSignature is the base field for a Metadata that requires authenticity (i.e, has a signature).

func NewMetadataBaseWithSignature

func NewMetadataBaseWithSignature(thisType int) *MetadataBaseWithSignature

NewMetadataBaseWithSignature creates a new MetadataBaseWithSignature with the given metadata type.

func (*MetadataBaseWithSignature) Sign

func (mbs *MetadataBaseWithSignature) Sign(privateKey *key.PrivateKey, tx Transaction) error

Sign signs a Metadata using the provided private key.

type PDEContribution

type PDEContribution struct {
	PDEContributionPairID string
	ContributorAddressStr string
	ContributedAmount     uint64
	TokenIDStr            string
	MetadataBase
}

PDEContribution is a request to contribute to a pool of the pDEX.

func NewPDEContribution

func NewPDEContribution(
	pdeContributionPairID string,
	contributorAddressStr string,
	contributedAmount uint64,
	tokenIDStr string,
	metaType int,
) (*PDEContribution, error)

NewPDEContribution creates a new PDEContribution.

func (*PDEContribution) CalculateSize

func (pc *PDEContribution) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDEContribution) Hash

func (pc PDEContribution) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PDEContributionResponse

type PDEContributionResponse struct {
	MetadataBase
	ContributionStatus string
	RequestedTxID      common.Hash
	TokenIDStr         string
	SharedRandom       []byte `json:"SharedRandom,omitempty"`
}

PDEContributionResponse is the response for a PDEContributionRequest.

func (*PDEContributionResponse) CalculateSize

func (iRes *PDEContributionResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDEContributionResponse) Hash

func (iRes PDEContributionResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PDECrossPoolTradeRequest

type PDECrossPoolTradeRequest struct {
	TokenIDToBuyStr     string
	TokenIDToSellStr    string
	SellAmount          uint64
	MinAcceptableAmount uint64
	TradingFee          uint64
	TraderAddressStr    string
	TxRandomStr         string `json:"TxRandomStr,omitempty"`
	SubTraderAddressStr string `json:"SubTraderAddressStr,omitempty"`
	SubTxRandomStr      string `json:"SubTxRandomStr,omitempty"`
	MetadataBase
}

PDECrossPoolTradeRequest is a request to place a trade on the pDEX. It is the updated version of a PDETradeRequest.

func NewPDECrossPoolTradeRequest

func NewPDECrossPoolTradeRequest(
	tokenIDToBuyStr string,
	tokenIDToSellStr string,
	sellAmount uint64,
	minAcceptableAmount uint64,
	tradingFee uint64,
	traderAddressStr string,
	txRandomStr string,
	subTraderAddressStr string,
	subTxRandomStr string,
	metaType int,
) (*PDECrossPoolTradeRequest, error)

NewPDECrossPoolTradeRequest creates a new PDECrossPoolTradeRequest.

func (*PDECrossPoolTradeRequest) CalculateSize

func (pc *PDECrossPoolTradeRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDECrossPoolTradeRequest) Hash

Hash overrides MetadataBase.Hash().

type PDECrossPoolTradeResponse

type PDECrossPoolTradeResponse struct {
	MetadataBase
	TradeStatus   string
	RequestedTxID common.Hash
}

PDECrossPoolTradeResponse is the response for a PDECrossPoolTradeRequest.

func (*PDECrossPoolTradeResponse) CalculateSize

func (iRes *PDECrossPoolTradeResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDECrossPoolTradeResponse) Hash

func (iRes PDECrossPoolTradeResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PDEFeeWithdrawalRequest

type PDEFeeWithdrawalRequest struct {
	WithdrawerAddressStr  string
	WithdrawalToken1IDStr string
	WithdrawalToken2IDStr string
	WithdrawalFeeAmt      uint64
	MetadataBaseWithSignature
}

PDEFeeWithdrawalRequest is a request to withdraw trading fee rewards from the pDEX. The user needs to sign this request to make sure he/she is authorized to withdraw the rewards.

func (*PDEFeeWithdrawalRequest) CalculateSize

func (pc *PDEFeeWithdrawalRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDEFeeWithdrawalRequest) Hash

func (pc PDEFeeWithdrawalRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (PDEFeeWithdrawalRequest) HashWithoutSig

func (pc PDEFeeWithdrawalRequest) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

type PDEFeeWithdrawalResponse

type PDEFeeWithdrawalResponse struct {
	MetadataBase
	RequestedTxID common.Hash
	SharedRandom  []byte `json:"SharedRandom,omitempty"`
}

PDEFeeWithdrawalResponse is the response for a PDEFeeWithdrawalRequest.

func (*PDEFeeWithdrawalResponse) CalculateSize

func (iRes *PDEFeeWithdrawalResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDEFeeWithdrawalResponse) Hash

func (iRes PDEFeeWithdrawalResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (*PDEFeeWithdrawalResponse) SetSharedRandom

func (iRes *PDEFeeWithdrawalResponse) SetSharedRandom(v []byte)

SetSharedRandom sets v as the shared random of a PDEFeeWithdrawalResponse.

type PDETradeRequest

type PDETradeRequest struct {
	TokenIDToBuyStr     string
	TokenIDToSellStr    string
	SellAmount          uint64 // must be equal to vOut value
	MinAcceptableAmount uint64
	TradingFee          uint64
	TraderAddressStr    string
	TxRandomStr         string `json:"TxRandomStr,omitempty"`
	MetadataBase
}

PDETradeRequest is a request to place a trade on the pDEX.

deprecated: use PDECrossPoolTradeRequest instead.

func NewPDETradeRequest

func NewPDETradeRequest(
	tokenIDToBuyStr string,
	tokenIDToSellStr string,
	sellAmount uint64,
	minAcceptableAmount uint64,
	tradingFee uint64,
	traderAddressStr string,
	txRandomStr string,
	metaType int,
) (*PDETradeRequest, error)

NewPDETradeRequest creates a new PDETradeRequest.

func (*PDETradeRequest) CalculateSize

func (pc *PDETradeRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDETradeRequest) Hash

func (pc PDETradeRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PDETradeResponse

type PDETradeResponse struct {
	MetadataBase
	TradeStatus   string
	RequestedTxID common.Hash
}

PDETradeResponse is the response for a PDETradeRequest.

func (*PDETradeResponse) CalculateSize

func (iRes *PDETradeResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDETradeResponse) Hash

func (iRes PDETradeResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PDEWithdrawalRequest

type PDEWithdrawalRequest struct {
	WithdrawerAddressStr  string
	WithdrawalToken1IDStr string
	WithdrawalToken2IDStr string
	WithdrawalShareAmt    uint64
	MetadataBaseWithSignature
}

PDEWithdrawalRequest is a request to withdraw contribution shares from the pDEX. The user needs to sign this request to make sure he/she is authorized to withdraw the rewards.

func NewPDEWithdrawalRequest

func NewPDEWithdrawalRequest(
	withdrawerAddressStr string,
	withdrawalToken1IDStr string,
	withdrawalToken2IDStr string,
	withdrawalShareAmt uint64,
	metaType int,
) (*PDEWithdrawalRequest, error)

NewPDEWithdrawalRequest creates a new PDEWithdrawalRequest.

func (*PDEWithdrawalRequest) CalculateSize

func (pc *PDEWithdrawalRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDEWithdrawalRequest) Hash

func (pc PDEWithdrawalRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (PDEWithdrawalRequest) HashWithoutSig

func (pc PDEWithdrawalRequest) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

func (*PDEWithdrawalRequest) ShouldSignMetaData

func (*PDEWithdrawalRequest) ShouldSignMetaData() bool

type PDEWithdrawalResponse

type PDEWithdrawalResponse struct {
	MetadataBase
	RequestedTxID common.Hash
	TokenIDStr    string
	SharedRandom  []byte `json:"SharedRandom,omitempty"`
}

PDEWithdrawalResponse is the response for a PDEWithdrawalRequest.

func (*PDEWithdrawalResponse) CalculateSize

func (iRes *PDEWithdrawalResponse) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PDEWithdrawalResponse) Hash

func (iRes PDEWithdrawalResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PortalConvertVaultRequest

type PortalConvertVaultRequest struct {
	MetadataBaseWithSignature
	TokenID          string // pTokenID in incognito chain
	ConvertProof     string
	IncognitoAddress string
}

PortalConvertVaultRequest is a request to convert a centralized vault into a PortalV4 vault. This Metadata should ONLY be enclosed with a normal (PRV) transaction.

@@NOTE: This tx is created only one time when migrating centralized bridge to portal v4.

func NewPortalConvertVaultRequest

func NewPortalConvertVaultRequest(
	metaType int,
	tokenID string,
	convertingProof string,
	incognitoAddress string) (*PortalConvertVaultRequest, error)

NewPortalConvertVaultRequest creates a new PortalConvertVaultRequest.

func (*PortalConvertVaultRequest) CalculateSize

func (convertVaultReq *PortalConvertVaultRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PortalConvertVaultRequest) Hash

func (convertVaultReq PortalConvertVaultRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (PortalConvertVaultRequest) HashWithoutSig

func (convertVaultReq PortalConvertVaultRequest) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

type PortalReplacementFeeRequest

type PortalReplacementFeeRequest struct {
	MetadataBaseWithSignature
	TokenID string
	BatchID string
	Fee     uint
}

PortalReplacementFeeRequest is a request to replace the fee of existing un-shielding requests (via PortalV4).

func NewPortalReplacementFeeRequest

func NewPortalReplacementFeeRequest(metaType int, tokenID, batchID string, fee uint) (*PortalReplacementFeeRequest, error)

NewPortalReplacementFeeRequest creates a new PortalReplacementFeeRequest.

func (*PortalReplacementFeeRequest) CalculateSize

func (repl *PortalReplacementFeeRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PortalReplacementFeeRequest) Hash

Hash overrides MetadataBase.Hash().

func (PortalReplacementFeeRequest) HashWithoutSig

func (repl PortalReplacementFeeRequest) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

type PortalShieldingRequest

type PortalShieldingRequest struct {
	MetadataBase
	TokenID        string // pTokenID in incognito chain
	IncAddressStr  string `json:"IncogAddressStr"`
	ShieldingProof string
}

PortalShieldingRequest is a Metadata that a portal user requests to mint pToken (after sending public tokens to a multi-sig wallet) This Metadata should ONLY be enclosed with a normal (PRV) transaction.

func NewPortalShieldingRequest

func NewPortalShieldingRequest(
	metaType int,
	tokenID string,
	incAddressStr string,
	shieldingProof string) (*PortalShieldingRequest, error)

NewPortalShieldingRequest creates a new PortalShieldingRequest.

func (*PortalShieldingRequest) CalculateSize

func (shieldingReq *PortalShieldingRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PortalShieldingRequest) Hash

func (shieldingReq PortalShieldingRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PortalShieldingRequestStatus

type PortalShieldingRequestStatus struct {
	Status        byte
	Error         string
	TokenID       string
	IncAddressStr string `json:"IncogAddressStr"`
	ProofHash     string
	MintingAmount uint64
	TxReqID       common.Hash
	ExternalTxID  string
}

PortalShieldingRequestStatus represents the status of an un-shield request on the Portal.

type PortalShieldingResponse

type PortalShieldingResponse struct {
	MetadataBase
	RequestStatus    string
	ReqTxID          common.Hash
	RequesterAddrStr string
	MintingAmount    uint64
	IncTokenID       string
	SharedRandom     []byte
}

func NewPortalShieldingResponse

func NewPortalShieldingResponse(
	depositStatus string,
	reqTxID common.Hash,
	requesterAddressStr string,
	amount uint64,
	tokenID string,
	metaType int,
) *PortalShieldingResponse

func (*PortalShieldingResponse) CalculateSize

func (iRes *PortalShieldingResponse) CalculateSize() uint64

func (PortalShieldingResponse) Hash

func (iRes PortalShieldingResponse) Hash() *common.Hash

func (*PortalShieldingResponse) SetSharedRandom

func (iRes *PortalShieldingResponse) SetSharedRandom(r []byte)

type PortalSubmitConfirmedTxRequest

type PortalSubmitConfirmedTxRequest struct {
	MetadataBase
	TokenID       string // pTokenID in incognito chain
	UnshieldProof string
	BatchID       string
}

PortalSubmitConfirmedTxRequest is a request to submit a confirmed transaction in the PortalV4 protocol.

func NewPortalSubmitConfirmedTxRequest

func NewPortalSubmitConfirmedTxRequest(metaType int, unshieldProof, tokenID, batchID string) (*PortalSubmitConfirmedTxRequest, error)

NewPortalSubmitConfirmedTxRequest creates a new PortalSubmitConfirmedTxRequest.

func (*PortalSubmitConfirmedTxRequest) CalculateSize

func (r *PortalSubmitConfirmedTxRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PortalSubmitConfirmedTxRequest) Hash

Hash overrides MetadataBase.Hash().

type PortalUnshieldRequest

type PortalUnshieldRequest struct {
	MetadataBase
	OTAPubKeyStr   string
	TxRandomStr    string
	RemoteAddress  string
	TokenID        string
	UnshieldAmount uint64
}

PortalUnshieldRequest is a request to un-shield tokens using the PortalV4 protocol.

func NewPortalUnshieldRequest

func NewPortalUnshieldRequest(metaType int, otaPubKeyStr, txRandomStr string, tokenID, remoteAddress string, burnAmount uint64) (*PortalUnshieldRequest, error)

NewPortalUnshieldRequest creates a new PortalUnshieldRequest.

func (*PortalUnshieldRequest) CalculateSize

func (uReq *PortalUnshieldRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (PortalUnshieldRequest) Hash

func (uReq PortalUnshieldRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type PortalUnshieldRequestStatus

type PortalUnshieldRequestStatus struct {
	OTAPubKeyStr   string
	TxRandomStr    string
	RemoteAddress  string
	TokenID        string
	UnshieldAmount uint64
	UnshieldID     string
	ExternalTxID   string
	ExternalFee    uint64
	Status         int
}

PortalUnshieldRequestStatus represents the status of an un-shield request on the Portal.

type PortalUnshieldResponse

type PortalUnshieldResponse struct {
	MetadataBase
	RequestStatus  string
	ReqTxID        common.Hash
	OTAPubKeyStr   string
	TxRandomStr    string
	UnshieldAmount uint64
	IncTokenID     string
}

func NewPortalV4UnshieldResponse

func NewPortalV4UnshieldResponse(
	requestStatus string,
	reqTxID common.Hash,
	requesterAddressStr string,
	txRandomStr string,
	amount uint64,
	tokenID string,
	metaType int,
) *PortalUnshieldResponse

func (*PortalUnshieldResponse) CalculateSize

func (iRes *PortalUnshieldResponse) CalculateSize() uint64

func (PortalUnshieldResponse) Hash

func (iRes PortalUnshieldResponse) Hash() *common.Hash

type RelayingHeader

type RelayingHeader struct {
	MetadataBase
	IncAddressStr string `json:"IncogAddressStr"`
	Header        string
	BlockHeight   uint64
}

RelayingHeader is a relay request from other public blockchains.

func NewRelayingHeader

func NewRelayingHeader(
	metaType int,
	incognitoAddrStr string,
	header string,
	blockHeight uint64,
) (*RelayingHeader, error)

NewRelayingHeader creates a new RelayingHeader.

func (*RelayingHeader) CalculateSize

func (rh *RelayingHeader) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (RelayingHeader) Hash

func (rh RelayingHeader) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

type ReturnStakingMetadata

type ReturnStakingMetadata struct {
	MetadataBase
	TxID          string
	StakerAddress key.PaymentAddress
	SharedRandom  []byte `json:"SharedRandom,omitempty"`
}

ReturnStakingMetadata is a Metadata for returning the staking amount after a un-staking request.

func (ReturnStakingMetadata) Hash

func (sbsRes ReturnStakingMetadata) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (*ReturnStakingMetadata) SetSharedRandom

func (sbsRes *ReturnStakingMetadata) SetSharedRandom(v []byte)

SetSharedRandom sets v as the shared random of a ReturnStakingMetadata.

type StakingMetadata

type StakingMetadata struct {
	MetadataBase
	FunderPaymentAddress         string
	RewardReceiverPaymentAddress string
	StakingAmountShard           uint64
	AutoReStaking                bool
	CommitteePublicKey           string
}

StakingMetadata is a request to stake a node to beacon a validator. The user has to burn 1750 PRV to stake a node.

  • FunderPaymentAddress: the address of the user burning 1750 PRV.
  • CommitteePublicKey: the public key that is used in the consensus protocol.
  • RewardReceiverPaymentAddress: the address to which staking rewards will be paid.
  • AutoReStaking: the indicator of whether to stay staked after being swapped out of a committee.

func NewStakingMetadata

func NewStakingMetadata(
	stakingType int,
	funderPaymentAddress string,
	rewardReceiverPaymentAddress string,
	stakingAmountShard uint64,
	committeePublicKey string,
	autoReStaking bool,
) (
	*StakingMetadata,
	error,
)

NewStakingMetadata creates a new StakingMetadata.

func (*StakingMetadata) CalculateSize

func (stakingMetadata *StakingMetadata) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (StakingMetadata) GetType

func (stakingMetadata StakingMetadata) GetType() int

GetType overrides MetadataBase.GetType().

type StopAutoStakingMetadata

type StopAutoStakingMetadata struct {
	MetadataBaseWithSignature
	CommitteePublicKey string
}

StopAutoStakingMetadata is a request to stop staking for a staked node.

func NewStopAutoStakingMetadata

func NewStopAutoStakingMetadata(stopStakingType int, committeePublicKey string) (*StopAutoStakingMetadata, error)

NewStopAutoStakingMetadata creates a new StopAutoStakingMetadata.

func (*StopAutoStakingMetadata) CalculateSize

func (req *StopAutoStakingMetadata) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (StopAutoStakingMetadata) GetType

func (req StopAutoStakingMetadata) GetType() int

GetType overrides MetadataBase.GetType().

func (*StopAutoStakingMetadata) Hash

func (req *StopAutoStakingMetadata) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (*StopAutoStakingMetadata) HashWithoutSig

func (req *StopAutoStakingMetadata) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

func (*StopAutoStakingMetadata) ShouldSignMetaData

func (*StopAutoStakingMetadata) ShouldSignMetaData() bool

ShouldSignMetaData returns true

type Transaction

type Transaction interface {
	GetVersion() int8
	SetVersion(int8)
	GetMetadataType() int
	GetType() string
	SetType(string)
	GetLockTime() int64
	SetLockTime(int64)
	GetSenderAddrLastByte() byte
	SetGetSenderAddrLastByte(byte)
	GetTxFee() uint64
	SetTxFee(uint64)
	GetTxFeeToken() uint64
	GetInfo() []byte
	SetInfo([]byte)
	GetSigPubKey() []byte
	SetSigPubKey([]byte)
	GetSig() []byte
	SetSig([]byte)
	GetProof() privacy.Proof
	SetProof(privacy.Proof)
	GetTokenID() *common.Hash
	GetMetadata() Metadata
	SetMetadata(Metadata)

	GetTxActualSize() uint64
	GetReceivers() ([][]byte, []uint64)
	GetTransferData() (bool, []byte, uint64, *common.Hash)
	GetReceiverData() ([]coin.Coin, error)
	GetTxMintData() (bool, coin.Coin, *common.Hash, error)
	GetTxBurnData() (bool, coin.Coin, *common.Hash, error)
	GetTxFullBurnData() (bool, coin.Coin, coin.Coin, *common.Hash, error)
	ListOTAHashH() []common.Hash
	ListSerialNumbersHashH() []common.Hash
	String() string
	Hash() *common.Hash
	HashWithoutMetadataSig() *common.Hash
	CalculateTxValue() uint64

	CheckTxVersion(int8) bool
	IsSalaryTx() bool
	IsPrivacy() bool

	Init(interface{}) error
}

Transaction is an interface describing all common methods of a transaction.

type UnStakingMetadata

type UnStakingMetadata struct {
	MetadataBaseWithSignature
	CommitteePublicKey string
}

UnStakingMetadata is a request to un-stake a running validator. The node will un-stake faster when using this metadata compared to the StopAutoStakingMetadata.

func NewUnStakingMetadata

func NewUnStakingMetadata(committeePublicKey string) (*UnStakingMetadata, error)

NewUnStakingMetadata return a new UnStakingMetadata.

func (*UnStakingMetadata) CalculateSize

func (req *UnStakingMetadata) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (UnStakingMetadata) GetType

func (req UnStakingMetadata) GetType() int

GetType overrides MetadataBase.GetType().

func (*UnStakingMetadata) Hash

func (req *UnStakingMetadata) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (*UnStakingMetadata) HashWithoutSig

func (req *UnStakingMetadata) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

func (*UnStakingMetadata) ShouldSignMetaData

func (*UnStakingMetadata) ShouldSignMetaData() bool

ShouldSignMetaData returns true.

type WithDrawRewardRequest

type WithDrawRewardRequest struct {
	MetadataBaseWithSignature
	PaymentAddress key.PaymentAddress
	TokenID        common.Hash
	Version        int
}

WithDrawRewardRequest is a request to withdraw staking rewards of a user. The user needs to sign this request to make sure he/she is authorized to withdraw the rewards.

func NewWithDrawRewardRequest

func NewWithDrawRewardRequest(tokenIDStr string, paymentAddStr string, version float64, metaType int) (*WithDrawRewardRequest, error)

NewWithDrawRewardRequest creates a new WithDrawRewardRequest.

func (*WithDrawRewardRequest) CalculateSize

func (req *WithDrawRewardRequest) CalculateSize() uint64

CalculateSize overrides MetadataBase.CalculateSize().

func (WithDrawRewardRequest) GetType

func (req WithDrawRewardRequest) GetType() int

GetType overrides MetadataBase.GetType().

func (WithDrawRewardRequest) Hash

func (req WithDrawRewardRequest) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

func (WithDrawRewardRequest) HashWithoutSig

func (req WithDrawRewardRequest) HashWithoutSig() *common.Hash

HashWithoutSig overrides MetadataBase.HashWithoutSig().

func (*WithDrawRewardRequest) ShouldSignMetaData

func (*WithDrawRewardRequest) ShouldSignMetaData() bool

ShouldSignMetaData returns true.

func (*WithDrawRewardRequest) UnmarshalJSON

func (req *WithDrawRewardRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON does the JSON-unmarshalling operation for a WithDrawRewardRequest.

type WithDrawRewardResponse

type WithDrawRewardResponse struct {
	MetadataBase
	TxRequest       *common.Hash
	TokenID         common.Hash
	RewardPublicKey []byte
	SharedRandom    []byte
	Version         int
}

WithDrawRewardResponse is the response for a WithDrawRewardRequest.

func (WithDrawRewardResponse) Hash

func (resp WithDrawRewardResponse) Hash() *common.Hash

Hash overrides MetadataBase.Hash().

Jump to

Keyboard shortcuts

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