pdexv3

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const (
	BaseAmplifier                      = 10000
	MaxPoolPairWithdrawalReceiver      = 5
	MaxStakingRewardWithdrawalReceiver = 15
)
View Source
const (
	RequestAcceptedChainStatus = "accepted"
	RequestRejectedChainStatus = "rejected"

	ParamsModifyingFailedStatus  = 0
	ParamsModifyingSuccessStatus = 1

	WithdrawLPFeeFailedStatus  = 0
	WithdrawLPFeeSuccessStatus = 1

	WithdrawProtocolFeeFailedStatus  = 0
	WithdrawProtocolFeeSuccessStatus = 1

	WithdrawStakingRewardFailedStatus  = 0
	WithdrawStakingRewardSuccessStatus = 1
)
View Source
const (
	TradeAcceptedStatus         = 1
	TradeRefundedStatus         = 0
	OrderAcceptedStatus         = 1
	OrderRefundedStatus         = 0
	WithdrawOrderAcceptedStatus = 1
	WithdrawOrderRejectedStatus = 0

	MaxTradePathLength = 5
)

trade status

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptWithdrawLiquidity

type AcceptWithdrawLiquidity struct {
	PoolPairID  string      `json:"PoolPairID"`
	NftID       common.Hash `json:"NftID"`
	TokenID     common.Hash `json:"TokenID"`
	TokenAmount uint64      `json:"TokenAmount"`
	OtaReceiver string      `json:"OtaReceiver"`
	ShareAmount uint64      `json:"ShareAmount"`
	TxReqID     common.Hash `json:"TxReqID"`
	ShardID     byte        `json:"ShardID"`
}

type AcceptedAddOrder

type AcceptedAddOrder struct {
	PoolPairID     string      `json:"PoolPairID"`
	OrderID        string      `json:"OrderID"`
	NftID          common.Hash `json:"NftID"`
	Token0Rate     uint64      `json:"Token0Rate"`
	Token1Rate     uint64      `json:"Token1Rate"`
	Token0Balance  uint64      `json:"Token0Balance"`
	Token1Balance  uint64      `json:"Token1Balance"`
	TradeDirection byte        `json:"TradeDirection"`
	Receiver       [2]string   `json:"Receiver"`
}

AcceptedAddOrder is added as Content for produced beacon instruction after to handling an order successfully

func (AcceptedAddOrder) GetStatus

func (md AcceptedAddOrder) GetStatus() int

func (AcceptedAddOrder) GetType

func (md AcceptedAddOrder) GetType() int

type AcceptedTrade

type AcceptedTrade struct {
	Receiver     privacy.OTAReceiver      `json:"Receiver"`
	Amount       uint64                   `json:"Amount"`
	TradePath    []string                 `json:"TradePath"`
	TokenToBuy   common.Hash              `json:"TokenToBuy"`
	PairChanges  [][2]*big.Int            `json:"PairChanges"`
	RewardEarned []map[common.Hash]uint64 `json:"RewardEarned"`
	OrderChanges []map[string][2]*big.Int `json:"OrderChanges"`
}

AcceptedTrade is added as Content for produced beacon Instructions after handling a trade successfully

func (AcceptedTrade) GetStatus

func (md AcceptedTrade) GetStatus() int

func (AcceptedTrade) GetType

func (md AcceptedTrade) GetType() int

type AcceptedWithdrawOrder

type AcceptedWithdrawOrder struct {
	PoolPairID string              `json:"PoolPairID"`
	OrderID    string              `json:"OrderID"`
	TokenID    common.Hash         `json:"TokenID"`
	Receiver   privacy.OTAReceiver `json:"Receiver"`
	Amount     uint64              `json:"Amount"`
}

func (AcceptedWithdrawOrder) GetStatus

func (md AcceptedWithdrawOrder) GetStatus() int

func (AcceptedWithdrawOrder) GetType

func (md AcceptedWithdrawOrder) GetType() int

type AddLiquidityRequest

type AddLiquidityRequest struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewAddLiquidity

func NewAddLiquidity() *AddLiquidityRequest

func NewAddLiquidityRequestWithValue

func NewAddLiquidityRequestWithValue(
	poolPairID, pairHash, otaReceiver, tokenID, nftID string,
	tokenAmount uint64, amplifier uint,
) *AddLiquidityRequest

func (*AddLiquidityRequest) Amplifier

func (request *AddLiquidityRequest) Amplifier() uint

func (*AddLiquidityRequest) CalculateSize

func (request *AddLiquidityRequest) CalculateSize() uint64

func (*AddLiquidityRequest) GetOTADeclarations

func (request *AddLiquidityRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (*AddLiquidityRequest) Hash

func (request *AddLiquidityRequest) Hash() *common.Hash

func (*AddLiquidityRequest) MarshalJSON

func (request *AddLiquidityRequest) MarshalJSON() ([]byte, error)

func (*AddLiquidityRequest) NftID

func (request *AddLiquidityRequest) NftID() string

func (*AddLiquidityRequest) OtaReceiver

func (request *AddLiquidityRequest) OtaReceiver() string

func (*AddLiquidityRequest) PairHash

func (request *AddLiquidityRequest) PairHash() string

func (*AddLiquidityRequest) PoolPairID

func (request *AddLiquidityRequest) PoolPairID() string

func (*AddLiquidityRequest) TokenAmount

func (request *AddLiquidityRequest) TokenAmount() uint64

func (*AddLiquidityRequest) TokenID

func (request *AddLiquidityRequest) TokenID() string

func (*AddLiquidityRequest) UnmarshalJSON

func (request *AddLiquidityRequest) UnmarshalJSON(data []byte) error

func (*AddLiquidityRequest) ValidateMetadataByItself

func (request *AddLiquidityRequest) ValidateMetadataByItself() bool

func (*AddLiquidityRequest) ValidateSanityData

func (request *AddLiquidityRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*AddLiquidityRequest) ValidateTxWithBlockChain

func (request *AddLiquidityRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

type AddLiquidityResponse

type AddLiquidityResponse struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewAddLiquidityResponse

func NewAddLiquidityResponse() *AddLiquidityResponse

func NewAddLiquidityResponseWithValue

func NewAddLiquidityResponseWithValue(
	status, txReqID string,
) *AddLiquidityResponse

func NewStakingResponseWithValue

func NewStakingResponseWithValue(
	status, txReqID string,
) *AddLiquidityResponse

func (*AddLiquidityResponse) CalculateSize

func (response *AddLiquidityResponse) CalculateSize() uint64

func (*AddLiquidityResponse) CheckTransactionFee

func (response *AddLiquidityResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (*AddLiquidityResponse) Hash

func (response *AddLiquidityResponse) Hash() *common.Hash

func (*AddLiquidityResponse) MarshalJSON

func (response *AddLiquidityResponse) MarshalJSON() ([]byte, error)

func (*AddLiquidityResponse) Status

func (response *AddLiquidityResponse) Status() string

func (*AddLiquidityResponse) TxReqID

func (response *AddLiquidityResponse) TxReqID() string

func (*AddLiquidityResponse) UnmarshalJSON

func (response *AddLiquidityResponse) UnmarshalJSON(data []byte) error

func (*AddLiquidityResponse) ValidateMetadataByItself

func (response *AddLiquidityResponse) ValidateMetadataByItself() bool

func (*AddLiquidityResponse) ValidateSanityData

func (response *AddLiquidityResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*AddLiquidityResponse) ValidateTxWithBlockChain

func (response *AddLiquidityResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

func (*AddLiquidityResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (response *AddLiquidityResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte,
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type AddOrderRequest

type AddOrderRequest struct {
	TokenToSell         common.Hash                         `json:"TokenToSell"`
	PoolPairID          string                              `json:"PoolPairID"`
	SellAmount          uint64                              `json:"SellAmount"`
	MinAcceptableAmount uint64                              `json:"MinAcceptableAmount"`
	Receiver            map[common.Hash]privacy.OTAReceiver `json:"Receiver"`
	NftID               common.Hash                         `json:"NftID"`
	metadataCommon.MetadataBase
}

AddOrderRequest

func NewAddOrderRequest

func NewAddOrderRequest(
	tokenToSell common.Hash,
	pairID string,
	sellAmount uint64,
	minAcceptableAmount uint64,
	recv map[common.Hash]privacy.OTAReceiver,
	nftID common.Hash,
	metaType int,
) (*AddOrderRequest, error)

func (*AddOrderRequest) CalculateSize

func (req *AddOrderRequest) CalculateSize() uint64

func (*AddOrderRequest) GetOTADeclarations

func (req *AddOrderRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (AddOrderRequest) Hash

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

func (AddOrderRequest) ValidateMetadataByItself

func (req AddOrderRequest) ValidateMetadataByItself() bool

func (AddOrderRequest) ValidateSanityData

func (req AddOrderRequest) ValidateSanityData(chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, beaconHeight uint64, tx metadataCommon.Transaction) (bool, bool, error)

func (AddOrderRequest) ValidateTxWithBlockChain

func (req AddOrderRequest) ValidateTxWithBlockChain(tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, shardID byte, transactionStateDB *statedb.StateDB) (bool, error)

type AddOrderResponse

type AddOrderResponse struct {
	Status      int         `json:"Status"`
	RequestTxID common.Hash `json:"RequestTxID"`
	metadataCommon.MetadataBase
}

AddOrderResponse is the metadata inside response tx for `add order` (applicable for refunded case only)

func (*AddOrderResponse) CalculateSize

func (res *AddOrderResponse) CalculateSize() uint64

func (AddOrderResponse) CheckTransactionFee

func (res AddOrderResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (AddOrderResponse) Hash

func (res AddOrderResponse) Hash() *common.Hash

func (AddOrderResponse) ValidateMetadataByItself

func (res AddOrderResponse) ValidateMetadataByItself() bool

func (AddOrderResponse) ValidateSanityData

func (res AddOrderResponse) ValidateSanityData(chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, beaconHeight uint64, tx metadataCommon.Transaction) (bool, bool, error)

func (AddOrderResponse) ValidateTxWithBlockChain

func (res AddOrderResponse) ValidateTxWithBlockChain(tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, shardID byte, transactionStateDB *statedb.StateDB) (bool, error)

func (AddOrderResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (res AddOrderResponse) VerifyMinerCreatedTxBeforeGettingInBlock(mintData *metadataCommon.MintData, shardID byte, tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, ac *metadataCommon.AccumulatedValues, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever) (bool, error)

type AddOrderStatus

type AddOrderStatus struct {
	Status  int    `json:"Status"`
	OrderID string `json:"OrderID"`
}

AddOrderStatus containns the info tracked by feature statedb, which is then displayed in RPC status queries. For refunded `add order` requests, all fields except Status are ignored

type DistributeMiningOrderRewardContent

type DistributeMiningOrderRewardContent struct {
	PoolPairID    string      `json:"PoolPairID"`
	MakingTokenID common.Hash `json:"MakingTokenID"`
	Amount        uint64      `json:"Amount"`
	TokenID       common.Hash `json:"TokenID"`
}

type DistributeStakingRewardContent

type DistributeStakingRewardContent struct {
	StakingPoolID string                 `json:"StakingPoolID"`
	Rewards       map[common.Hash]uint64 `json:"Rewards"`
}

type MatchAndReturnAddLiquidity

type MatchAndReturnAddLiquidity struct {
	ShareAmount              uint64                           `json:"ShareAmount"`
	Contribution             *statedb.Pdexv3ContributionState `json:"Contribution"`
	ReturnAmount             uint64                           `json:"ReturnAmount"`
	ExistedTokenActualAmount uint64                           `json:"ExistedTokenActualAmount"`
	ExistedTokenReturnAmount uint64                           `json:"ExistedTokenReturnAmount"`
	ExistedTokenID           common.Hash                      `json:"ExistedTokenID"`
	NftID                    common.Hash                      `json:"NftID"`
}

type MintBlockRewardContent

type MintBlockRewardContent struct {
	PoolPairID string      `json:"PoolPairID"`
	Amount     uint64      `json:"Amount"`
	TokenID    common.Hash `json:"TokenID"`
}

type MintNftData

type MintNftData struct {
	NftID       common.Hash `json:"NftID"`
	OtaReceiver string      `json:"OtaReceiver"`
	ShardID     byte        `json:"ShardID"`
}

type MintNftResponse

type MintNftResponse struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewMintNftResponse

func NewMintNftResponse() *MintNftResponse

func NewMintNftResponseWithValue

func NewMintNftResponseWithValue(nftID, otaReceiver string) *MintNftResponse

func (*MintNftResponse) CalculateSize

func (response *MintNftResponse) CalculateSize() uint64

func (*MintNftResponse) CheckTransactionFee

func (response *MintNftResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (*MintNftResponse) Hash

func (response *MintNftResponse) Hash() *common.Hash

func (*MintNftResponse) MarshalJSON

func (response *MintNftResponse) MarshalJSON() ([]byte, error)

func (*MintNftResponse) NftID

func (response *MintNftResponse) NftID() string

func (*MintNftResponse) OtaReceiver

func (response *MintNftResponse) OtaReceiver() string

func (*MintNftResponse) UnmarshalJSON

func (response *MintNftResponse) UnmarshalJSON(data []byte) error

func (*MintNftResponse) ValidateMetadataByItself

func (response *MintNftResponse) ValidateMetadataByItself() bool

func (*MintNftResponse) ValidateSanityData

func (response *MintNftResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*MintNftResponse) ValidateTxWithBlockChain

func (response *MintNftResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

func (*MintNftResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (response *MintNftResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte,
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type MintPDEXGenesisContent

type MintPDEXGenesisContent struct {
	MintingPaymentAddress string `json:"MintingPaymentAddress"`
	MintingAmount         uint64 `json:"MintingAmount"`
	ShardID               byte   `json:"ShardID"`
}

type MintPDEXGenesisResponse

type MintPDEXGenesisResponse struct {
	metadataCommon.MetadataBase
	MintingPaymentAddress string `json:"MintingPaymentAddress"`
	MintingAmount         uint64 `json:"MintingAmount"`
	SharedRandom          []byte `json:"SharedRandom"`
}

func NewPdexv3MintPDEXGenesisResponse

func NewPdexv3MintPDEXGenesisResponse(
	metaType int,
	mintingPaymentAddress string,
	mintingAmount uint64,
) *MintPDEXGenesisResponse

func (*MintPDEXGenesisResponse) CalculateSize

func (mintResponse *MintPDEXGenesisResponse) CalculateSize() uint64

func (MintPDEXGenesisResponse) CheckTransactionFee

func (mintResponse MintPDEXGenesisResponse) CheckTransactionFee(
	tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB,
) bool

func (MintPDEXGenesisResponse) Hash

func (mintResponse MintPDEXGenesisResponse) Hash() *common.Hash

func (*MintPDEXGenesisResponse) SetSharedRandom

func (mintResponse *MintPDEXGenesisResponse) SetSharedRandom(r []byte)

func (MintPDEXGenesisResponse) ValidateMetadataByItself

func (mintResponse MintPDEXGenesisResponse) ValidateMetadataByItself() bool

func (MintPDEXGenesisResponse) ValidateSanityData

func (mintResponse MintPDEXGenesisResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (MintPDEXGenesisResponse) ValidateTxWithBlockChain

func (mintResponse MintPDEXGenesisResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

func (MintPDEXGenesisResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (mintResponse MintPDEXGenesisResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte, tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type ParamsModifyingContent

type ParamsModifyingContent struct {
	Content  Pdexv3Params `json:"Content"`
	ErrorMsg string       `json:"ErrorMsg"`
	TxReqID  common.Hash  `json:"TxReqID"`
	ShardID  byte         `json:"ShardID"`
}

type ParamsModifyingRequest

type ParamsModifyingRequest struct {
	metadataCommon.MetadataBaseWithSignature
	Pdexv3Params `json:"Pdexv3Params"`
}

func NewPdexv3ParamsModifyingRequest

func NewPdexv3ParamsModifyingRequest(
	metaType int,
	params Pdexv3Params,
) (*ParamsModifyingRequest, error)

func (*ParamsModifyingRequest) CalculateSize

func (paramsModifying *ParamsModifyingRequest) CalculateSize() uint64

func (ParamsModifyingRequest) Hash

func (paramsModifying ParamsModifyingRequest) Hash() *common.Hash

func (ParamsModifyingRequest) HashWithoutSig

func (paramsModifying ParamsModifyingRequest) HashWithoutSig() *common.Hash

func (ParamsModifyingRequest) ValidateMetadataByItself

func (paramsModifying ParamsModifyingRequest) ValidateMetadataByItself() bool

func (ParamsModifyingRequest) ValidateSanityData

func (paramsModifying ParamsModifyingRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (ParamsModifyingRequest) ValidateTxWithBlockChain

func (paramsModifying ParamsModifyingRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

type ParamsModifyingRequestStatus

type ParamsModifyingRequestStatus struct {
	Status       int    `json:"Status"`
	ErrorMsg     string `json:"ErrorMsg"`
	Pdexv3Params `json:"Pdexv3Params"`
}

type Pdexv3Params

type Pdexv3Params struct {
	DefaultFeeRateBPS                 uint            `json:"DefaultFeeRateBPS"`
	FeeRateBPS                        map[string]uint `json:"FeeRateBPS"`
	PRVDiscountPercent                uint            `json:"PRVDiscountPercent"`
	TradingProtocolFeePercent         uint            `json:"TradingProtocolFeePercent"`
	TradingStakingPoolRewardPercent   uint            `json:"TradingStakingPoolRewardPercent"`
	PDEXRewardPoolPairsShare          map[string]uint `json:"PDEXRewardPoolPairsShare"`
	StakingPoolsShare                 map[string]uint `json:"StakingPoolsShare"`
	StakingRewardTokens               []common.Hash   `json:"StakingRewardTokens"`
	MintNftRequireAmount              uint64          `json:"MintNftRequireAmount"`
	MaxOrdersPerNft                   uint            `json:"MaxOrdersPerNft"`
	AutoWithdrawOrderLimitAmount      uint            `json:"AutoWithdrawOrderLimitAmount"`
	MinPRVReserveTradingRate          uint64          `json:"MinPRVReserveTradingRate"`
	DefaultOrderTradingRewardRatioBPS uint            `json:"DefaultOrderTradingRewardRatioBPS,omitempty"`
	OrderTradingRewardRatioBPS        map[string]uint `json:"OrderTradingRewardRatioBPS,omitempty"`
	OrderLiquidityMiningBPS           map[string]uint `json:"OrderLiquidityMiningBPS,omitempty"`
	DAOContributingPercent            uint            `json:"DAOContributingPercent,omitempty"`
	MiningRewardPendingBlocks         uint64          `json:"MiningRewardPendingBlocks,omitempty"`
	OrderMiningRewardRatioBPS         map[string]uint `json:"OrderMiningRewardRatioBPS,omitempty"`
}

type ReceiverInfo

type ReceiverInfo struct {
	Address privacy.OTAReceiver `json:"Address"`
	Amount  uint64              `json:"Amount"`
}

type RefundAddLiquidity

type RefundAddLiquidity struct {
	Contribution *statedb.Pdexv3ContributionState `json:"Contribution"`
}

type RefundedAddOrder

type RefundedAddOrder struct {
	Receiver privacy.OTAReceiver `json:"Receiver"`
	TokenID  common.Hash         `json:"TokenID"`
	Amount   uint64              `json:"Amount"`
}

RefundedAddOrder is added as Content for produced beacon instruction after failure to handle an order

func (RefundedAddOrder) GetStatus

func (md RefundedAddOrder) GetStatus() int

func (RefundedAddOrder) GetType

func (md RefundedAddOrder) GetType() int

type RefundedTrade

type RefundedTrade struct {
	Receiver privacy.OTAReceiver `json:"Receiver"`
	TokenID  common.Hash         `json:"TokenToSell"`
	Amount   uint64              `json:"Amount"`
}

RefundedTrade is added as Content for produced beacon instruction after failure to handle a trade

func (RefundedTrade) GetStatus

func (md RefundedTrade) GetStatus() int

func (RefundedTrade) GetType

func (md RefundedTrade) GetType() int

type RejectedWithdrawOrder

type RejectedWithdrawOrder struct {
	PoolPairID string `json:"PoolPairID"`
	OrderID    string `json:"OrderID"`
}

func (RejectedWithdrawOrder) GetStatus

func (md RejectedWithdrawOrder) GetStatus() int

func (RejectedWithdrawOrder) GetType

func (md RejectedWithdrawOrder) GetType() int

type StakingRequest

type StakingRequest struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewStakingRequest

func NewStakingRequest() *StakingRequest

func NewStakingRequestWithValue

func NewStakingRequestWithValue(
	tokenID, nftID, otaReceiver string, tokenAmount uint64,
) *StakingRequest

func (*StakingRequest) CalculateSize

func (request *StakingRequest) CalculateSize() uint64

func (*StakingRequest) GetOTADeclarations

func (request *StakingRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (*StakingRequest) Hash

func (request *StakingRequest) Hash() *common.Hash

func (*StakingRequest) MarshalJSON

func (request *StakingRequest) MarshalJSON() ([]byte, error)

func (*StakingRequest) NftID

func (request *StakingRequest) NftID() string

func (*StakingRequest) OtaReceiver

func (request *StakingRequest) OtaReceiver() string

func (*StakingRequest) TokenAmount

func (request *StakingRequest) TokenAmount() uint64

func (*StakingRequest) TokenID

func (request *StakingRequest) TokenID() string

func (*StakingRequest) UnmarshalJSON

func (request *StakingRequest) UnmarshalJSON(data []byte) error

func (*StakingRequest) ValidateMetadataByItself

func (request *StakingRequest) ValidateMetadataByItself() bool

func (*StakingRequest) ValidateSanityData

func (request *StakingRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*StakingRequest) ValidateTxWithBlockChain

func (request *StakingRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

type StakingResponse

type StakingResponse struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewStakingResponse

func NewStakingResponse() *StakingResponse

func (*StakingResponse) CalculateSize

func (response *StakingResponse) CalculateSize() uint64

func (*StakingResponse) CheckTransactionFee

func (response *StakingResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (*StakingResponse) Hash

func (response *StakingResponse) Hash() *common.Hash

func (*StakingResponse) MarshalJSON

func (response *StakingResponse) MarshalJSON() ([]byte, error)

func (*StakingResponse) Status

func (response *StakingResponse) Status() string

func (*StakingResponse) TxReqID

func (response *StakingResponse) TxReqID() string

func (*StakingResponse) UnmarshalJSON

func (response *StakingResponse) UnmarshalJSON(data []byte) error

func (*StakingResponse) ValidateMetadataByItself

func (response *StakingResponse) ValidateMetadataByItself() bool

func (*StakingResponse) ValidateSanityData

func (response *StakingResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*StakingResponse) ValidateTxWithBlockChain

func (response *StakingResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

func (*StakingResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (response *StakingResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte,
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type TradeRequest

type TradeRequest struct {
	TradePath           []string                            `json:"TradePath"`
	TokenToSell         common.Hash                         `json:"TokenToSell"`
	SellAmount          uint64                              `json:"SellAmount"`
	MinAcceptableAmount uint64                              `json:"MinAcceptableAmount"`
	TradingFee          uint64                              `json:"TradingFee"`
	Receiver            map[common.Hash]privacy.OTAReceiver `json:"Receiver"`
	metadataCommon.MetadataBase
}

TradeRequest

func NewTradeRequest

func NewTradeRequest(
	tradePath []string,
	tokenToSell common.Hash,
	sellAmount uint64,
	minAcceptableAmount uint64,
	tradingFee uint64,
	recv map[common.Hash]privacy.OTAReceiver,
	metaType int,
) (*TradeRequest, error)

func (*TradeRequest) CalculateSize

func (req *TradeRequest) CalculateSize() uint64

func (TradeRequest) GetOTADeclarations

func (req TradeRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (TradeRequest) Hash

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

func (TradeRequest) ValidateMetadataByItself

func (req TradeRequest) ValidateMetadataByItself() bool

func (TradeRequest) ValidateSanityData

func (req TradeRequest) ValidateSanityData(chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, beaconHeight uint64, tx metadataCommon.Transaction) (bool, bool, error)

func (TradeRequest) ValidateTxWithBlockChain

func (req TradeRequest) ValidateTxWithBlockChain(tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, shardID byte, transactionStateDB *statedb.StateDB) (bool, error)

type TradeResponse

type TradeResponse struct {
	Status      int         `json:"Status"`
	RequestTxID common.Hash `json:"RequestTxID"`
	metadataCommon.MetadataBase
}

TradeResponse is the metadata inside response tx for trade

func (*TradeResponse) CalculateSize

func (res *TradeResponse) CalculateSize() uint64

func (TradeResponse) CheckTransactionFee

func (res TradeResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (TradeResponse) Hash

func (res TradeResponse) Hash() *common.Hash

func (TradeResponse) ValidateMetadataByItself

func (res TradeResponse) ValidateMetadataByItself() bool

func (TradeResponse) ValidateSanityData

func (res TradeResponse) ValidateSanityData(chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, beaconHeight uint64, tx metadataCommon.Transaction) (bool, bool, error)

func (TradeResponse) ValidateTxWithBlockChain

func (res TradeResponse) ValidateTxWithBlockChain(tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, shardID byte, transactionStateDB *statedb.StateDB) (bool, error)

func (TradeResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (res TradeResponse) VerifyMinerCreatedTxBeforeGettingInBlock(mintData *metadataCommon.MintData, shardID byte, tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, ac *metadataCommon.AccumulatedValues, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever) (bool, error)

type TradeStatus

type TradeStatus struct {
	Status     int         `json:"Status"`
	BuyAmount  uint64      `json:"BuyAmount"`
	TokenToBuy common.Hash `json:"TokenToBuy"`
}

TradeStatus containns the info tracked by feature statedb, which is then displayed in RPC status queries. For refunded trade, all fields except Status are ignored

type UnstakingRequest

type UnstakingRequest struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewUnstakingRequest

func NewUnstakingRequest() *UnstakingRequest

func NewUnstakingRequestWithValue

func NewUnstakingRequestWithValue(
	stakingPoolID, nftID string,
	otaReceivers map[string]string,
	unstakingAmount uint64,
) *UnstakingRequest

func (*UnstakingRequest) CalculateSize

func (request *UnstakingRequest) CalculateSize() uint64

func (*UnstakingRequest) GetOTADeclarations

func (request *UnstakingRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (*UnstakingRequest) Hash

func (request *UnstakingRequest) Hash() *common.Hash

func (*UnstakingRequest) MarshalJSON

func (request *UnstakingRequest) MarshalJSON() ([]byte, error)

func (*UnstakingRequest) NftID

func (request *UnstakingRequest) NftID() string

func (*UnstakingRequest) OtaReceivers

func (request *UnstakingRequest) OtaReceivers() map[string]string

func (*UnstakingRequest) StakingPoolID

func (request *UnstakingRequest) StakingPoolID() string

func (*UnstakingRequest) UnmarshalJSON

func (request *UnstakingRequest) UnmarshalJSON(data []byte) error

func (*UnstakingRequest) UnstakingAmount

func (request *UnstakingRequest) UnstakingAmount() uint64

func (*UnstakingRequest) ValidateMetadataByItself

func (request *UnstakingRequest) ValidateMetadataByItself() bool

func (*UnstakingRequest) ValidateSanityData

func (request *UnstakingRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*UnstakingRequest) ValidateTxWithBlockChain

func (request *UnstakingRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

type UnstakingResponse

type UnstakingResponse struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewUnstakingResponse

func NewUnstakingResponse() *UnstakingResponse

func NewUnstakingResponseWithValue

func NewUnstakingResponseWithValue(status, txReqID string) *UnstakingResponse

func (*UnstakingResponse) CalculateSize

func (response *UnstakingResponse) CalculateSize() uint64

func (*UnstakingResponse) CheckTransactionFee

func (response *UnstakingResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (*UnstakingResponse) Hash

func (response *UnstakingResponse) Hash() *common.Hash

func (*UnstakingResponse) MarshalJSON

func (response *UnstakingResponse) MarshalJSON() ([]byte, error)

func (*UnstakingResponse) Status

func (response *UnstakingResponse) Status() string

func (*UnstakingResponse) TxReqID

func (response *UnstakingResponse) TxReqID() string

func (*UnstakingResponse) UnmarshalJSON

func (response *UnstakingResponse) UnmarshalJSON(data []byte) error

func (*UnstakingResponse) ValidateMetadataByItself

func (response *UnstakingResponse) ValidateMetadataByItself() bool

func (*UnstakingResponse) ValidateSanityData

func (response *UnstakingResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*UnstakingResponse) ValidateTxWithBlockChain

func (response *UnstakingResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

func (*UnstakingResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (response *UnstakingResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte,
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type UserMintNftRequest

type UserMintNftRequest struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewUserMintNftRequest

func NewUserMintNftRequest() *UserMintNftRequest

func NewUserMintNftRequestWithValue

func NewUserMintNftRequestWithValue(otaReceiver string, amount uint64) *UserMintNftRequest

func (*UserMintNftRequest) Amount

func (request *UserMintNftRequest) Amount() uint64

func (*UserMintNftRequest) CalculateSize

func (request *UserMintNftRequest) CalculateSize() uint64

func (*UserMintNftRequest) GetOTADeclarations

func (request *UserMintNftRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (*UserMintNftRequest) Hash

func (request *UserMintNftRequest) Hash() *common.Hash

func (*UserMintNftRequest) MarshalJSON

func (request *UserMintNftRequest) MarshalJSON() ([]byte, error)

func (*UserMintNftRequest) OtaReceiver

func (request *UserMintNftRequest) OtaReceiver() string

func (*UserMintNftRequest) UnmarshalJSON

func (request *UserMintNftRequest) UnmarshalJSON(data []byte) error

func (*UserMintNftRequest) ValidateMetadataByItself

func (request *UserMintNftRequest) ValidateMetadataByItself() bool

func (*UserMintNftRequest) ValidateSanityData

func (request *UserMintNftRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*UserMintNftRequest) ValidateTxWithBlockChain

func (request *UserMintNftRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

type UserMintNftResponse

type UserMintNftResponse struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewUserMintNftResponse

func NewUserMintNftResponse() *UserMintNftResponse

func NewUserMintNftResponseWithValue

func NewUserMintNftResponseWithValue(status, txReqID string) *UserMintNftResponse

func (*UserMintNftResponse) CalculateSize

func (response *UserMintNftResponse) CalculateSize() uint64

func (*UserMintNftResponse) CheckTransactionFee

func (response *UserMintNftResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (*UserMintNftResponse) Hash

func (response *UserMintNftResponse) Hash() *common.Hash

func (*UserMintNftResponse) MarshalJSON

func (response *UserMintNftResponse) MarshalJSON() ([]byte, error)

func (*UserMintNftResponse) Status

func (response *UserMintNftResponse) Status() string

func (*UserMintNftResponse) TxReqID

func (response *UserMintNftResponse) TxReqID() string

func (*UserMintNftResponse) UnmarshalJSON

func (response *UserMintNftResponse) UnmarshalJSON(data []byte) error

func (*UserMintNftResponse) ValidateMetadataByItself

func (response *UserMintNftResponse) ValidateMetadataByItself() bool

func (*UserMintNftResponse) ValidateSanityData

func (response *UserMintNftResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*UserMintNftResponse) ValidateTxWithBlockChain

func (response *UserMintNftResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

func (*UserMintNftResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (response *UserMintNftResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte,
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type WithdrawLiquidityRequest

type WithdrawLiquidityRequest struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewWithdrawLiquidityRequest

func NewWithdrawLiquidityRequest() *WithdrawLiquidityRequest

func NewWithdrawLiquidityRequestWithValue

func NewWithdrawLiquidityRequestWithValue(
	poolPairID, nftID string,
	otaReceivers map[string]string,
	shareAmount uint64,
) *WithdrawLiquidityRequest

func (*WithdrawLiquidityRequest) CalculateSize

func (request *WithdrawLiquidityRequest) CalculateSize() uint64

func (*WithdrawLiquidityRequest) GetOTADeclarations

func (request *WithdrawLiquidityRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (*WithdrawLiquidityRequest) Hash

func (request *WithdrawLiquidityRequest) Hash() *common.Hash

func (*WithdrawLiquidityRequest) MarshalJSON

func (request *WithdrawLiquidityRequest) MarshalJSON() ([]byte, error)

func (*WithdrawLiquidityRequest) NftID

func (request *WithdrawLiquidityRequest) NftID() string

func (*WithdrawLiquidityRequest) OtaReceivers

func (request *WithdrawLiquidityRequest) OtaReceivers() map[string]string

func (*WithdrawLiquidityRequest) PoolPairID

func (request *WithdrawLiquidityRequest) PoolPairID() string

func (*WithdrawLiquidityRequest) ShareAmount

func (request *WithdrawLiquidityRequest) ShareAmount() uint64

func (*WithdrawLiquidityRequest) UnmarshalJSON

func (request *WithdrawLiquidityRequest) UnmarshalJSON(data []byte) error

func (*WithdrawLiquidityRequest) ValidateMetadataByItself

func (request *WithdrawLiquidityRequest) ValidateMetadataByItself() bool

func (*WithdrawLiquidityRequest) ValidateSanityData

func (request *WithdrawLiquidityRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*WithdrawLiquidityRequest) ValidateTxWithBlockChain

func (request *WithdrawLiquidityRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

type WithdrawLiquidityResponse

type WithdrawLiquidityResponse struct {
	metadataCommon.MetadataBase
	// contains filtered or unexported fields
}

func NewWithdrawLiquidityResponse

func NewWithdrawLiquidityResponse() *WithdrawLiquidityResponse

func NewWithdrawLiquidityResponseWithValue

func NewWithdrawLiquidityResponseWithValue(status, txReqID string) *WithdrawLiquidityResponse

func (*WithdrawLiquidityResponse) CalculateSize

func (response *WithdrawLiquidityResponse) CalculateSize() uint64

func (*WithdrawLiquidityResponse) CheckTransactionFee

func (response *WithdrawLiquidityResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (*WithdrawLiquidityResponse) Hash

func (response *WithdrawLiquidityResponse) Hash() *common.Hash

func (*WithdrawLiquidityResponse) MarshalJSON

func (response *WithdrawLiquidityResponse) MarshalJSON() ([]byte, error)

func (*WithdrawLiquidityResponse) Status

func (response *WithdrawLiquidityResponse) Status() string

func (*WithdrawLiquidityResponse) TxReqID

func (response *WithdrawLiquidityResponse) TxReqID() string

func (*WithdrawLiquidityResponse) UnmarshalJSON

func (response *WithdrawLiquidityResponse) UnmarshalJSON(data []byte) error

func (*WithdrawLiquidityResponse) ValidateMetadataByItself

func (response *WithdrawLiquidityResponse) ValidateMetadataByItself() bool

func (*WithdrawLiquidityResponse) ValidateSanityData

func (response *WithdrawLiquidityResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (*WithdrawLiquidityResponse) ValidateTxWithBlockChain

func (response *WithdrawLiquidityResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	transactionStateDB *statedb.StateDB,
) (bool, error)

func (*WithdrawLiquidityResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (response *WithdrawLiquidityResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte,
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type WithdrawOrderRequest

type WithdrawOrderRequest struct {
	PoolPairID string                              `json:"PoolPairID"`
	OrderID    string                              `json:"OrderID"`
	Amount     uint64                              `json:"Amount"`
	Receiver   map[common.Hash]privacy.OTAReceiver `json:"Receiver"`
	NftID      common.Hash                         `json:"NftID"`
	metadataCommon.MetadataBase
}

WithdrawOrderRequest

func NewWithdrawOrderRequest

func NewWithdrawOrderRequest(
	pairID, orderID string,
	amount uint64,
	recv map[common.Hash]privacy.OTAReceiver,
	nftID common.Hash,
	metaType int,
) (*WithdrawOrderRequest, error)

func (*WithdrawOrderRequest) CalculateSize

func (req *WithdrawOrderRequest) CalculateSize() uint64

func (*WithdrawOrderRequest) GetOTADeclarations

func (req *WithdrawOrderRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (WithdrawOrderRequest) Hash

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

func (WithdrawOrderRequest) ValidateMetadataByItself

func (req WithdrawOrderRequest) ValidateMetadataByItself() bool

func (WithdrawOrderRequest) ValidateSanityData

func (req WithdrawOrderRequest) ValidateSanityData(chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, beaconHeight uint64, tx metadataCommon.Transaction) (bool, bool, error)

func (WithdrawOrderRequest) ValidateTxWithBlockChain

func (req WithdrawOrderRequest) ValidateTxWithBlockChain(tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, shardID byte, transactionStateDB *statedb.StateDB) (bool, error)

type WithdrawOrderResponse

type WithdrawOrderResponse struct {
	Status      int         `json:"Status"`
	RequestTxID common.Hash `json:"RequestTxID"`
	metadataCommon.MetadataBase
}

func (*WithdrawOrderResponse) CalculateSize

func (res *WithdrawOrderResponse) CalculateSize() uint64

func (WithdrawOrderResponse) CheckTransactionFee

func (res WithdrawOrderResponse) CheckTransactionFee(tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB) bool

func (WithdrawOrderResponse) Hash

func (res WithdrawOrderResponse) Hash() *common.Hash

func (WithdrawOrderResponse) ValidateMetadataByItself

func (res WithdrawOrderResponse) ValidateMetadataByItself() bool

func (WithdrawOrderResponse) ValidateSanityData

func (res WithdrawOrderResponse) ValidateSanityData(chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, beaconHeight uint64, tx metadataCommon.Transaction) (bool, bool, error)

func (WithdrawOrderResponse) ValidateTxWithBlockChain

func (res WithdrawOrderResponse) ValidateTxWithBlockChain(tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever, shardID byte, transactionStateDB *statedb.StateDB) (bool, error)

func (WithdrawOrderResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (res WithdrawOrderResponse) VerifyMinerCreatedTxBeforeGettingInBlock(mintData *metadataCommon.MintData, shardID byte, tx metadataCommon.Transaction, chainRetriever metadataCommon.ChainRetriever, ac *metadataCommon.AccumulatedValues, shardViewRetriever metadataCommon.ShardViewRetriever, beaconViewRetriever metadataCommon.BeaconViewRetriever) (bool, error)

type WithdrawOrderStatus

type WithdrawOrderStatus struct {
	Status         int         `json:"Status"`
	TokenID        common.Hash `json:"TokenID"`
	WithdrawAmount uint64      `json:"Amount"`
}

WithdrawOrderStatus containns the info tracked by feature statedb, which is then displayed in RPC status queries. For refunded `add order` requests, all fields except Status are ignored

type WithdrawalLPFeeContent

type WithdrawalLPFeeContent struct {
	PoolPairID string       `json:"PoolPairID"`
	NftID      common.Hash  `json:"NftID"`
	TokenID    common.Hash  `json:"TokenID"`
	Receiver   ReceiverInfo `json:"Receiver"`
	IsLastInst bool         `json:"IsLastInst"`
	TxReqID    common.Hash  `json:"TxReqID"`
	ShardID    byte         `json:"ShardID"`
}

type WithdrawalLPFeeRequest

type WithdrawalLPFeeRequest struct {
	metadataCommon.MetadataBase
	PoolPairID string                              `json:"PoolPairID"`
	NftID      common.Hash                         `json:"NftID"`
	Receivers  map[common.Hash]privacy.OTAReceiver `json:"Receivers"`
}

func NewPdexv3WithdrawalLPFeeRequest

func NewPdexv3WithdrawalLPFeeRequest(
	metaType int,
	pairID string,
	nftID common.Hash,
	receivers map[common.Hash]privacy.OTAReceiver,
) (*WithdrawalLPFeeRequest, error)

func (*WithdrawalLPFeeRequest) CalculateSize

func (withdrawal *WithdrawalLPFeeRequest) CalculateSize() uint64

func (*WithdrawalLPFeeRequest) GetOTADeclarations

func (withdrawal *WithdrawalLPFeeRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (WithdrawalLPFeeRequest) Hash

func (withdrawal WithdrawalLPFeeRequest) Hash() *common.Hash

func (WithdrawalLPFeeRequest) ValidateMetadataByItself

func (withdrawal WithdrawalLPFeeRequest) ValidateMetadataByItself() bool

func (WithdrawalLPFeeRequest) ValidateSanityData

func (withdrawal WithdrawalLPFeeRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (WithdrawalLPFeeRequest) ValidateTxWithBlockChain

func (withdrawal WithdrawalLPFeeRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

type WithdrawalLPFeeResponse

type WithdrawalLPFeeResponse struct {
	metadataCommon.MetadataBase
	ReqTxID common.Hash `json:"ReqTxID"`
}

func NewPdexv3WithdrawalLPFeeResponse

func NewPdexv3WithdrawalLPFeeResponse(
	metaType int,
	reqTxID common.Hash,
) *WithdrawalLPFeeResponse

func (*WithdrawalLPFeeResponse) CalculateSize

func (withdrawalResponse *WithdrawalLPFeeResponse) CalculateSize() uint64

func (WithdrawalLPFeeResponse) CheckTransactionFee

func (withdrawalResponse WithdrawalLPFeeResponse) CheckTransactionFee(
	tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB,
) bool

func (WithdrawalLPFeeResponse) Hash

func (withdrawalResponse WithdrawalLPFeeResponse) Hash() *common.Hash

func (WithdrawalLPFeeResponse) ValidateMetadataByItself

func (withdrawalResponse WithdrawalLPFeeResponse) ValidateMetadataByItself() bool

func (WithdrawalLPFeeResponse) ValidateSanityData

func (withdrawalResponse WithdrawalLPFeeResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (WithdrawalLPFeeResponse) ValidateTxWithBlockChain

func (withdrawalResponse WithdrawalLPFeeResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

func (WithdrawalLPFeeResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (withdrawalResponse WithdrawalLPFeeResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte, tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type WithdrawalLPFeeStatus

type WithdrawalLPFeeStatus struct {
	Status    int                          `json:"Status"`
	Receivers map[common.Hash]ReceiverInfo `json:"Receivers"`
}

type WithdrawalProtocolFeeContent

type WithdrawalProtocolFeeContent struct {
	PoolPairID string      `json:"PoolPairID"`
	Address    string      `json:"Address"`
	TokenID    common.Hash `json:"TokenID"`
	Amount     uint64      `json:"Amount"`
	IsLastInst bool        `json:"IsLastInst"`
	TxReqID    common.Hash `json:"TxReqID"`
	ShardID    byte        `json:"ShardID"`
}

type WithdrawalProtocolFeeRequest

type WithdrawalProtocolFeeRequest struct {
	metadataCommon.MetadataBaseWithSignature
	PoolPairID string `json:"PoolPairID"`
}

func NewPdexv3WithdrawalProtocolFeeRequest

func NewPdexv3WithdrawalProtocolFeeRequest(
	metaType int,
	pairID string,
) (*WithdrawalProtocolFeeRequest, error)

func (*WithdrawalProtocolFeeRequest) CalculateSize

func (withdrawal *WithdrawalProtocolFeeRequest) CalculateSize() uint64

func (WithdrawalProtocolFeeRequest) Hash

func (withdrawal WithdrawalProtocolFeeRequest) Hash() *common.Hash

func (WithdrawalProtocolFeeRequest) HashWithoutSig

func (withdrawal WithdrawalProtocolFeeRequest) HashWithoutSig() *common.Hash

func (WithdrawalProtocolFeeRequest) ValidateMetadataByItself

func (withdrawal WithdrawalProtocolFeeRequest) ValidateMetadataByItself() bool

func (WithdrawalProtocolFeeRequest) ValidateSanityData

func (withdrawal WithdrawalProtocolFeeRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (WithdrawalProtocolFeeRequest) ValidateTxWithBlockChain

func (withdrawal WithdrawalProtocolFeeRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

type WithdrawalProtocolFeeResponse

type WithdrawalProtocolFeeResponse struct {
	metadataCommon.MetadataBase
	Address      string      `json:"Address"`
	TokenID      common.Hash `json:"TokenID"`
	Amount       uint64      `json:"Amount"`
	ReqTxID      common.Hash `json:"ReqTxID"`
	SharedRandom []byte      `json:"SharedRandom"`
}

func NewPdexv3WithdrawalProtocolFeeResponse

func NewPdexv3WithdrawalProtocolFeeResponse(
	metaType int,
	address string,
	tokenID common.Hash,
	amount uint64,
	reqTxID common.Hash,
) *WithdrawalProtocolFeeResponse

func (*WithdrawalProtocolFeeResponse) CalculateSize

func (withdrawalResponse *WithdrawalProtocolFeeResponse) CalculateSize() uint64

func (WithdrawalProtocolFeeResponse) CheckTransactionFee

func (withdrawalResponse WithdrawalProtocolFeeResponse) CheckTransactionFee(
	tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB,
) bool

func (WithdrawalProtocolFeeResponse) Hash

func (withdrawalResponse WithdrawalProtocolFeeResponse) Hash() *common.Hash

func (*WithdrawalProtocolFeeResponse) SetSharedRandom

func (withdrawalResponse *WithdrawalProtocolFeeResponse) SetSharedRandom(r []byte)

func (WithdrawalProtocolFeeResponse) ValidateMetadataByItself

func (withdrawalResponse WithdrawalProtocolFeeResponse) ValidateMetadataByItself() bool

func (WithdrawalProtocolFeeResponse) ValidateSanityData

func (withdrawalResponse WithdrawalProtocolFeeResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (WithdrawalProtocolFeeResponse) ValidateTxWithBlockChain

func (withdrawalResponse WithdrawalProtocolFeeResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

func (WithdrawalProtocolFeeResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (withdrawalResponse WithdrawalProtocolFeeResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte, tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type WithdrawalProtocolFeeStatus

type WithdrawalProtocolFeeStatus struct {
	Status int                    `json:"Status"`
	Amount map[common.Hash]uint64 `json:"Amount"`
}

type WithdrawalStakingRewardContent

type WithdrawalStakingRewardContent struct {
	StakingPoolID string       `json:"StakingPoolID"`
	NftID         common.Hash  `json:"NftID"`
	TokenID       common.Hash  `json:"TokenID"`
	Receiver      ReceiverInfo `json:"Receiver"`
	IsLastInst    bool         `json:"IsLastInst"`
	TxReqID       common.Hash  `json:"TxReqID"`
	ShardID       byte         `json:"ShardID"`
}

type WithdrawalStakingRewardRequest

type WithdrawalStakingRewardRequest struct {
	metadataCommon.MetadataBase
	StakingPoolID string                              `json:"StakingPoolID"`
	NftID         common.Hash                         `json:"NftID"`
	Receivers     map[common.Hash]privacy.OTAReceiver `json:"Receivers"`
}

func NewPdexv3WithdrawalStakingRewardRequest

func NewPdexv3WithdrawalStakingRewardRequest(
	metaType int,
	stakingToken string,
	nftID common.Hash,
	receivers map[common.Hash]privacy.OTAReceiver,
) (*WithdrawalStakingRewardRequest, error)

func (*WithdrawalStakingRewardRequest) CalculateSize

func (withdrawal *WithdrawalStakingRewardRequest) CalculateSize() uint64

func (*WithdrawalStakingRewardRequest) GetOTADeclarations

func (withdrawal *WithdrawalStakingRewardRequest) GetOTADeclarations() []metadataCommon.OTADeclaration

func (WithdrawalStakingRewardRequest) Hash

func (withdrawal WithdrawalStakingRewardRequest) Hash() *common.Hash

func (WithdrawalStakingRewardRequest) ValidateMetadataByItself

func (withdrawal WithdrawalStakingRewardRequest) ValidateMetadataByItself() bool

func (WithdrawalStakingRewardRequest) ValidateSanityData

func (withdrawal WithdrawalStakingRewardRequest) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (WithdrawalStakingRewardRequest) ValidateTxWithBlockChain

func (withdrawal WithdrawalStakingRewardRequest) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

type WithdrawalStakingRewardResponse

type WithdrawalStakingRewardResponse struct {
	metadataCommon.MetadataBase
	ReqTxID common.Hash `json:"ReqTxID"`
}

func NewPdexv3WithdrawalStakingRewardResponse

func NewPdexv3WithdrawalStakingRewardResponse(
	metaType int,
	reqTxID common.Hash,
) *WithdrawalStakingRewardResponse

func (*WithdrawalStakingRewardResponse) CalculateSize

func (withdrawalResponse *WithdrawalStakingRewardResponse) CalculateSize() uint64

func (WithdrawalStakingRewardResponse) CheckTransactionFee

func (withdrawalResponse WithdrawalStakingRewardResponse) CheckTransactionFee(
	tx metadataCommon.Transaction, minFeePerKb uint64, minFeePerTx uint64, beaconHeight int64, db *statedb.StateDB,
) bool

func (WithdrawalStakingRewardResponse) Hash

func (withdrawalResponse WithdrawalStakingRewardResponse) Hash() *common.Hash

func (WithdrawalStakingRewardResponse) ValidateMetadataByItself

func (withdrawalResponse WithdrawalStakingRewardResponse) ValidateMetadataByItself() bool

func (WithdrawalStakingRewardResponse) ValidateSanityData

func (withdrawalResponse WithdrawalStakingRewardResponse) ValidateSanityData(
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	beaconHeight uint64,
	tx metadataCommon.Transaction,
) (bool, bool, error)

func (WithdrawalStakingRewardResponse) ValidateTxWithBlockChain

func (withdrawalResponse WithdrawalStakingRewardResponse) ValidateTxWithBlockChain(
	tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
	shardID byte,
	db *statedb.StateDB,
) (bool, error)

func (WithdrawalStakingRewardResponse) VerifyMinerCreatedTxBeforeGettingInBlock

func (withdrawalResponse WithdrawalStakingRewardResponse) VerifyMinerCreatedTxBeforeGettingInBlock(
	mintData *metadataCommon.MintData,
	shardID byte, tx metadataCommon.Transaction,
	chainRetriever metadataCommon.ChainRetriever,
	ac *metadataCommon.AccumulatedValues,
	shardViewRetriever metadataCommon.ShardViewRetriever,
	beaconViewRetriever metadataCommon.BeaconViewRetriever,
) (bool, error)

type WithdrawalStakingRewardStatus

type WithdrawalStakingRewardStatus struct {
	Status    int                          `json:"Status"`
	Receivers map[common.Hash]ReceiverInfo `json:"Receivers"`
}

Jump to

Keyboard shortcuts

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