Documentation ¶
Index ¶
- Constants
- Variables
- func CalAmountTopUpWaitingPortings(portalState *CurrentPortalState, custodianState *statedb.CustodianState, ...) (map[string]uint64, error)
- func CalMinPortingFee(portingAmount uint64, portalTokenID string, ...) (uint64, error)
- func CalMinRedeemFee(redeemAmountInPToken uint64, portalTokenID string, ...) (uint64, error)
- func CalTopupAmountForCustodianState(currentPortalState *CurrentPortalState, custodian *statedb.CustodianState, ...) (uint64, error)
- func CalUnlockCollateralAmount(portalState *CurrentPortalState, custodianStateKey string, redeemAmount uint64, ...) (uint64, error)
- func CalUnlockCollateralAmountAfterLiquidation(portalState *CurrentPortalState, liquidatedCustodianStateKey string, ...) (uint64, uint64, error)
- func CalUnlockCollateralAmountAfterLiquidationV3(portalState *CurrentPortalState, liquidatedCustodianStateKey string, ...) (uint64, uint64, map[string]uint64, map[string]uint64, error)
- func CalUnlockCollateralAmountV3(portalState *CurrentPortalState, custodianStateKey string, redeemAmount uint64, ...) (uint64, map[string]uint64, error)
- func CheckAndPickMoreCustodianForWaitingRedeemRequest(bc metadata.ChainRetriever, beaconHeight uint64, shardHeights map[byte]uint64, ...) ([][]string, error)
- func CloneCustodians(custodians map[string]*statedb.CustodianState) map[string]*statedb.CustodianState
- func CloneRedeemRequests(redeemReqs map[string]*statedb.RedeemRequest) map[string]*statedb.RedeemRequest
- func CloneWPortingRequests(wPortingReqs map[string]*statedb.WaitingPortingRequest) map[string]*statedb.WaitingPortingRequest
- func DownPercent(amount uint64, percent uint64) uint64
- func GetHoldPubTokensByCustodian(portalState *CurrentPortalState, custodianState *statedb.CustodianState) (totalHoldPubToken map[string]uint64, ...)
- func GetTotalHoldPubTokenAmount(portalState *CurrentPortalState, custodianState *statedb.CustodianState, ...) uint64
- func GetTotalHoldPubTokenAmountExcludeMatchedRedeemReqs(portalState *CurrentPortalState, custodianState *statedb.CustodianState, ...) uint64
- func GetTotalLockedCollateralAmountInWaitingPortings(portalState *CurrentPortalState, custodianState *statedb.CustodianState, ...) uint64
- func GetTotalLockedCollateralAmountInWaitingPortingsV3(portalState *CurrentPortalState, custodianState *statedb.CustodianState, ...) map[string]uint64
- func GetTotalLockedCollateralInEpoch(featureStateDB *statedb.StateDB, lastState *CurrentPortalState) (uint64, error)
- func GetTotalMatchingPubTokenInWaitingPortings(portalState *CurrentPortalState, custodianState *statedb.CustodianState, ...) uint64
- func GetUniqExternalTxID(chainName string, blockHash eCommon.Hash, txIndex uint) []byte
- func HandlePortalInstsV3(bc metadata.ChainRetriever, stateDB *statedb.StateDB, beaconHeight uint64, ...) ([][]string, error)
- func MatchCustodianToWaitingRedeemReq(custodianAddr string, redeemID string, portalState *CurrentPortalState) (uint64, bool, error)
- func PickExchangesRatesFinal(currentPortalState *CurrentPortalState)
- func ProcessPortalConfirmWithdrawInstV3(portalStateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func ProcessPortalReward(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func ProcessPortalTotalCustodianReward(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func StorePortalStateToDB(stateDB *statedb.StateDB, currentPortalState *CurrentPortalState) error
- func UpPercent(amount uint64, percent uint64) uint64
- func UpdateCustodianAfterTopup(currentPortalState *CurrentPortalState, custodian *statedb.CustodianState, ...) (uint64, error)
- func UpdateCustodianAfterTopupWaitingPorting(currentPortalState *CurrentPortalState, ...) error
- func UpdateCustodianRewards(currentPortalState *CurrentPortalState, ...)
- func UpdateCustodianStateAfterMatchingPortingRequest(currentPortalState *CurrentPortalState, ...) error
- func UpdateCustodianStateAfterMatchingRedeemReq(custodianState *statedb.CustodianState, matchingAmount uint64, tokenID string) error
- func UpdateCustodianStateAfterRejectRedeemRequestByLiquidation(portalState *CurrentPortalState, rejectedRedeemReq *statedb.RedeemRequest, ...) error
- func UpdateCustodianStateAfterUserRequestPToken(currentPortalState *CurrentPortalState, custodianKey string, pTokenId string, ...) error
- func UpdateCustodianStateAfterWithdrawCollateral(custodian *statedb.CustodianState, collateralTokenID string, amount uint64) *statedb.CustodianState
- func UpdateLiquidationPoolAfterRedeemFrom(currentPortalState *CurrentPortalState, ...)
- func UpdateLockedCollateralForRewards(currentPortalState *CurrentPortalState, portalParam portalv3.PortalParams)
- func UpdateLockedCollateralForRewardsV3(currentPortalState *CurrentPortalState, portalParam portalv3.PortalParams)
- func UpdatePortalStateAfterCustodianReqMatchingRedeem(custodianAddr string, redeemID string, matchedAmount uint64, ...) (*statedb.RedeemRequest, error)
- func UpdatePortalStateAfterPickMoreCustodiansForWaitingRedeemReq(moreCustodians []*statedb.MatchingRedeemCustodianDetail, ...) (*statedb.RedeemRequest, error)
- type CurrentPortalState
- type CustodianStateSlice
- type PortalCusUnlockOverRateCollateralsProcessor
- func (p *PortalCusUnlockOverRateCollateralsProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalCusUnlockOverRateCollateralsProcessor) GetActions() map[byte][][]string
- func (p *PortalCusUnlockOverRateCollateralsProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalCusUnlockOverRateCollateralsProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalCusUnlockOverRateCollateralsProcessor) PutAction(action []string, shardID byte)
- type PortalCustodianDepositProcessor
- func (p *PortalCustodianDepositProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalCustodianDepositProcessor) GetActions() map[byte][][]string
- func (p *PortalCustodianDepositProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalCustodianDepositProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalCustodianDepositProcessor) PutAction(action []string, shardID byte)
- type PortalCustodianDepositProcessorV3
- func (p *PortalCustodianDepositProcessorV3) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalCustodianDepositProcessorV3) GetActions() map[byte][][]string
- func (p *PortalCustodianDepositProcessorV3) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalCustodianDepositProcessorV3) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalCustodianDepositProcessorV3) PutAction(action []string, shardID byte)
- type PortalCustodianTopupProcessor
- func (p *PortalCustodianTopupProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalCustodianTopupProcessor) GetActions() map[byte][][]string
- func (p *PortalCustodianTopupProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalCustodianTopupProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalCustodianTopupProcessor) PutAction(action []string, shardID byte)
- type PortalCustodianTopupProcessorV3
- func (p *PortalCustodianTopupProcessorV3) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalCustodianTopupProcessorV3) GetActions() map[byte][][]string
- func (p *PortalCustodianTopupProcessorV3) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalCustodianTopupProcessorV3) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalCustodianTopupProcessorV3) PutAction(action []string, shardID byte)
- type PortalExchangeRateProcessor
- func (p *PortalExchangeRateProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalExchangeRateProcessor) GetActions() map[byte][][]string
- func (p *PortalExchangeRateProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalExchangeRateProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalExchangeRateProcessor) PutAction(action []string, shardID byte)
- type PortalExchangeRateTool
- func (t *PortalExchangeRateTool) Convert(tokenIDFrom string, tokenIDTo string, amount uint64) (uint64, error)
- func (t *PortalExchangeRateTool) ConvertFromUSD(tokenIDTo string, amount uint64) (uint64, error)
- func (t *PortalExchangeRateTool) ConvertMapTokensFromUSD(amountInUSDT uint64, maxPRVAmount uint64, maxTokenAmounts map[string]uint64) (uint64, map[string]uint64, error)
- func (t *PortalExchangeRateTool) ConvertMapTokensToUSD(tokens map[string]uint64) (uint64, error)
- func (t *PortalExchangeRateTool) ConvertToUSD(tokenIDFrom string, amount uint64) (uint64, error)
- type PortalExpiredWaitingPortingProcessor
- func (p *PortalExpiredWaitingPortingProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalExpiredWaitingPortingProcessor) GetActions() map[byte][][]string
- func (p *PortalExpiredWaitingPortingProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalExpiredWaitingPortingProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalExpiredWaitingPortingProcessor) PutAction(action []string, shardID byte)
- type PortalInstLogger
- type PortalInstProcessorV3
- type PortalInstructionProcessorV3
- type PortalLiquidationByRatesProcessor
- func (p *PortalLiquidationByRatesProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalLiquidationByRatesProcessor) GetActions() map[byte][][]string
- func (p *PortalLiquidationByRatesProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalLiquidationByRatesProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalLiquidationByRatesProcessor) PutAction(action []string, shardID byte)
- type PortalLiquidationByRatesV3Processor
- func (p *PortalLiquidationByRatesV3Processor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalLiquidationByRatesV3Processor) GetActions() map[byte][][]string
- func (p *PortalLiquidationByRatesV3Processor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalLiquidationByRatesV3Processor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalLiquidationByRatesV3Processor) PutAction(action []string, shardID byte)
- type PortalLiquidationCustodianRunAwayProcessor
- func (p *PortalLiquidationCustodianRunAwayProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalLiquidationCustodianRunAwayProcessor) GetActions() map[byte][][]string
- func (p *PortalLiquidationCustodianRunAwayProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalLiquidationCustodianRunAwayProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalLiquidationCustodianRunAwayProcessor) PutAction(action []string, shardID byte)
- type PortalPickMoreCustodianForRedeemProcessor
- func (p *PortalPickMoreCustodianForRedeemProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalPickMoreCustodianForRedeemProcessor) GetActions() map[byte][][]string
- func (p *PortalPickMoreCustodianForRedeemProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalPickMoreCustodianForRedeemProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalPickMoreCustodianForRedeemProcessor) PutAction(action []string, shardID byte)
- type PortalPickMoreCustodiansForRedeemReqContent
- type PortalPortingRequestProcessor
- func (p *PortalPortingRequestProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalPortingRequestProcessor) GetActions() map[byte][][]string
- func (p *PortalPortingRequestProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalPortingRequestProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalPortingRequestProcessor) PutAction(action []string, shardID byte)
- type PortalProcessError
- type PortalRedeemFromLiquidationPoolProcessor
- func (p *PortalRedeemFromLiquidationPoolProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRedeemFromLiquidationPoolProcessor) GetActions() map[byte][][]string
- func (p *PortalRedeemFromLiquidationPoolProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRedeemFromLiquidationPoolProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRedeemFromLiquidationPoolProcessor) PutAction(action []string, shardID byte)
- type PortalRedeemFromLiquidationPoolProcessorV3
- func (p *PortalRedeemFromLiquidationPoolProcessorV3) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRedeemFromLiquidationPoolProcessorV3) GetActions() map[byte][][]string
- func (p *PortalRedeemFromLiquidationPoolProcessorV3) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRedeemFromLiquidationPoolProcessorV3) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRedeemFromLiquidationPoolProcessorV3) PutAction(action []string, shardID byte)
- type PortalRedeemRequestProcessor
- func (p *PortalRedeemRequestProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRedeemRequestProcessor) GetActions() map[byte][][]string
- func (p *PortalRedeemRequestProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRedeemRequestProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRedeemRequestProcessor) PutAction(action []string, shardID byte)
- type PortalReqWithdrawRewardProcessor
- func (p *PortalReqWithdrawRewardProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalReqWithdrawRewardProcessor) GetActions() map[byte][][]string
- func (p *PortalReqWithdrawRewardProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalReqWithdrawRewardProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalReqWithdrawRewardProcessor) PutAction(action []string, shardID byte)
- type PortalRequestMatchingRedeemProcessor
- func (p *PortalRequestMatchingRedeemProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRequestMatchingRedeemProcessor) GetActions() map[byte][][]string
- func (p *PortalRequestMatchingRedeemProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRequestMatchingRedeemProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRequestMatchingRedeemProcessor) PutAction(action []string, shardID byte)
- type PortalRequestPTokenProcessor
- func (p *PortalRequestPTokenProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRequestPTokenProcessor) GetActions() map[byte][][]string
- func (p *PortalRequestPTokenProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRequestPTokenProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRequestPTokenProcessor) PutAction(action []string, shardID byte)
- type PortalRequestUnlockCollateralProcessor
- func (p *PortalRequestUnlockCollateralProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRequestUnlockCollateralProcessor) GetActions() map[byte][][]string
- func (p *PortalRequestUnlockCollateralProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRequestUnlockCollateralProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRequestUnlockCollateralProcessor) PutAction(action []string, shardID byte)
- type PortalRequestWithdrawCollateralProcessor
- func (p *PortalRequestWithdrawCollateralProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRequestWithdrawCollateralProcessor) GetActions() map[byte][][]string
- func (p *PortalRequestWithdrawCollateralProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRequestWithdrawCollateralProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRequestWithdrawCollateralProcessor) PutAction(action []string, shardID byte)
- type PortalRequestWithdrawCollateralProcessorV3
- func (p *PortalRequestWithdrawCollateralProcessorV3) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalRequestWithdrawCollateralProcessorV3) GetActions() map[byte][][]string
- func (p *PortalRequestWithdrawCollateralProcessorV3) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalRequestWithdrawCollateralProcessorV3) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalRequestWithdrawCollateralProcessorV3) PutAction(action []string, shardID byte)
- type PortalTopupWaitingPortingReqProcessor
- func (p *PortalTopupWaitingPortingReqProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalTopupWaitingPortingReqProcessor) GetActions() map[byte][][]string
- func (p *PortalTopupWaitingPortingReqProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalTopupWaitingPortingReqProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalTopupWaitingPortingReqProcessor) PutAction(action []string, shardID byte)
- type PortalTopupWaitingPortingReqProcessorV3
- func (p *PortalTopupWaitingPortingReqProcessorV3) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalTopupWaitingPortingReqProcessorV3) GetActions() map[byte][][]string
- func (p *PortalTopupWaitingPortingReqProcessorV3) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error)
- func (p *PortalTopupWaitingPortingReqProcessorV3) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalTopupWaitingPortingReqProcessorV3) PutAction(action []string, shardID byte)
- type RateInfo
Constants ¶
const ( UnexpectedError = iota HandlePortingRequestError )
Variables ¶
var ErrCodeMessage = map[int]struct { Code int Message string }{ UnexpectedError: {-1, "Unexpected error"}, HandlePortingRequestError: {-13001, "Handle porting request error"}, }
var Logger = PortalInstLogger{}
Global instant to use
Functions ¶
func CalAmountTopUpWaitingPortings ¶
func CalAmountTopUpWaitingPortings( portalState *CurrentPortalState, custodianState *statedb.CustodianState, portalParam portalv3.PortalParams, collateralTokenID string) (map[string]uint64, error)
func CalMinPortingFee ¶
func CalMinPortingFee(portingAmount uint64, portalTokenID string, exchangeRate *statedb.FinalExchangeRatesState, portalParam portalv3.PortalParams) (uint64, error)
CalMinPortingFee calculates the minimum porting fee in PRV
func CalMinRedeemFee ¶
func CalMinRedeemFee(redeemAmountInPToken uint64, portalTokenID string, exchangeRate *statedb.FinalExchangeRatesState, portalParam portalv3.PortalParams) (uint64, error)
CalMinRedeemFee calculates the minimum redeeming fee in PRV
func CalTopupAmountForCustodianState ¶
func CalTopupAmountForCustodianState( currentPortalState *CurrentPortalState, custodian *statedb.CustodianState, exchangeRates *statedb.FinalExchangeRatesState, portalTokenId string, collateralTokenID string, portalParams portalv3.PortalParams) (uint64, error)
CalTopupAmountForCustodianState calculates topup amount for one custodian
func CalUnlockCollateralAmount ¶
func CalUnlockCollateralAmount( portalState *CurrentPortalState, custodianStateKey string, redeemAmount uint64, tokenID string) (uint64, error)
CalUnlockCollateralAmount returns unlock collateral amount by percentage of redeem amount
func CalUnlockCollateralAmountAfterLiquidation ¶
func CalUnlockCollateralAmountAfterLiquidation( portalState *CurrentPortalState, liquidatedCustodianStateKey string, amountPubToken uint64, tokenID string, exchangeRate *statedb.FinalExchangeRatesState, portalParams portalv3.PortalParams) (uint64, uint64, error)
func CalUnlockCollateralAmountV3 ¶
func CalUnlockCollateralAmountV3( portalState *CurrentPortalState, custodianStateKey string, redeemAmount uint64, tokenID string, portalParams portalv3.PortalParams) (uint64, map[string]uint64, error)
CalUnlockCollateralAmountV3 returns unlock collateral amount by percentage of redeem amount in usd
func CheckAndPickMoreCustodianForWaitingRedeemRequest ¶
func CheckAndPickMoreCustodianForWaitingRedeemRequest( bc metadata.ChainRetriever, beaconHeight uint64, shardHeights map[byte]uint64, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams) ([][]string, error)
checkAndPickMoreCustodianForWaitingRedeemRequest check waiting redeem requests get timeout or not if the waiting redeem request gets timeout, but not enough matching custodians, auto pick up more custodians
func CloneCustodians ¶
func CloneCustodians(custodians map[string]*statedb.CustodianState) map[string]*statedb.CustodianState
func CloneRedeemRequests ¶
func CloneRedeemRequests(redeemReqs map[string]*statedb.RedeemRequest) map[string]*statedb.RedeemRequest
func CloneWPortingRequests ¶
func CloneWPortingRequests(wPortingReqs map[string]*statedb.WaitingPortingRequest) map[string]*statedb.WaitingPortingRequest
func DownPercent ¶
DownPercent returns the result be down to percent of amount
func GetHoldPubTokensByCustodian ¶
func GetHoldPubTokensByCustodian(portalState *CurrentPortalState, custodianState *statedb.CustodianState) ( totalHoldPubToken map[string]uint64, holdPubTokenInWaitingRedeems map[string]uint64, holdPubTokenInMatchedRedeems map[string]uint64, waitingRedeemIDs []string)
func GetTotalHoldPubTokenAmount ¶
func GetTotalHoldPubTokenAmount(portalState *CurrentPortalState, custodianState *statedb.CustodianState, tokenID string) uint64
GetTotalHoldPubTokenAmount returns total holding public token amount (include both waiting and matched redeem requests)
func GetTotalHoldPubTokenAmountExcludeMatchedRedeemReqs ¶
func GetTotalHoldPubTokenAmountExcludeMatchedRedeemReqs(portalState *CurrentPortalState, custodianState *statedb.CustodianState, tokenID string) uint64
func GetTotalLockedCollateralAmountInWaitingPortings ¶
func GetTotalLockedCollateralAmountInWaitingPortings(portalState *CurrentPortalState, custodianState *statedb.CustodianState, tokenID string) uint64
get total porting token in waiting porting requests
func GetTotalLockedCollateralAmountInWaitingPortingsV3 ¶
func GetTotalLockedCollateralAmountInWaitingPortingsV3(portalState *CurrentPortalState, custodianState *statedb.CustodianState, tokenID string) map[string]uint64
get total porting tokens in waiting porting requests v3
func GetTotalLockedCollateralInEpoch ¶
func GetTotalLockedCollateralInEpoch(featureStateDB *statedb.StateDB, lastState *CurrentPortalState) (uint64, error)
func GetTotalMatchingPubTokenInWaitingPortings ¶
func GetTotalMatchingPubTokenInWaitingPortings(portalState *CurrentPortalState, custodianState *statedb.CustodianState, tokenID string) uint64
func GetUniqExternalTxID ¶
func HandlePortalInstsV3 ¶
func HandlePortalInstsV3( bc metadata.ChainRetriever, stateDB *statedb.StateDB, beaconHeight uint64, shardHeights map[byte]uint64, currentPortalState *CurrentPortalState, rewardForCustodianByEpoch map[common.Hash]uint64, portalParams portalv3.PortalParams, pv3 map[int]PortalInstructionProcessorV3, ) ([][]string, error)
handle portal instructions for block producer
func MatchCustodianToWaitingRedeemReq ¶
func MatchCustodianToWaitingRedeemReq( custodianAddr string, redeemID string, portalState *CurrentPortalState) (uint64, bool, error)
MatchCustodianToWaitingRedeemReq returns amount matching of custodian in redeem request if valid
func PickExchangesRatesFinal ¶
func PickExchangesRatesFinal(currentPortalState *CurrentPortalState)
func ProcessPortalConfirmWithdrawInstV3 ¶
func ProcessPortalConfirmWithdrawInstV3( portalStateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams) error
func ProcessPortalReward ¶
func ProcessPortalReward( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, epoch uint64) error
func ProcessPortalTotalCustodianReward ¶
func ProcessPortalTotalCustodianReward( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, epoch uint64) error
func StorePortalStateToDB ¶
func StorePortalStateToDB( stateDB *statedb.StateDB, currentPortalState *CurrentPortalState, ) error
func UpdateCustodianAfterTopup ¶
func UpdateCustodianAfterTopup( currentPortalState *CurrentPortalState, custodian *statedb.CustodianState, portalTokenID string, depositAmount uint64, freeCollateralAmount uint64, collateralTokenID string) (uint64, error)
UpdateCustodianAfterTopup - v2 and v3
func UpdateCustodianAfterTopupWaitingPorting ¶
func UpdateCustodianAfterTopupWaitingPorting( currentPortalState *CurrentPortalState, waitingPortingReq *statedb.WaitingPortingRequest, custodian *statedb.CustodianState, portalTokenID string, depositAmount uint64, freeCollateralAmount uint64, collateralTokenID string) error
UpdateCustodianAfterTopup - v2 and v3
func UpdateCustodianRewards ¶
func UpdateCustodianRewards(currentPortalState *CurrentPortalState, rewardInfos map[string]*statedb.PortalRewardInfo)
func UpdateCustodianStateAfterMatchingPortingRequest ¶
func UpdateCustodianStateAfterMatchingPortingRequest( currentPortalState *CurrentPortalState, matchCus *statedb.MatchingPortingCustodianDetail, portalTokenID string) error
UpdateCustodianStateAfterMatchingPortingRequest updates current portal state after matching porting request
func UpdateCustodianStateAfterMatchingRedeemReq ¶
func UpdateCustodianStateAfterMatchingRedeemReq(custodianState *statedb.CustodianState, matchingAmount uint64, tokenID string) error
func UpdateCustodianStateAfterRejectRedeemRequestByLiquidation ¶
func UpdateCustodianStateAfterRejectRedeemRequestByLiquidation(portalState *CurrentPortalState, rejectedRedeemReq *statedb.RedeemRequest, beaconHeight uint64) error
func UpdateCustodianStateAfterUserRequestPToken ¶
func UpdateCustodianStateAfterUserRequestPToken(currentPortalState *CurrentPortalState, custodianKey string, pTokenId string, amountPToken uint64) error
UpdateCustodianStateAfterMatchingPortingRequest updates current portal state after requesting ptoken
func UpdateCustodianStateAfterWithdrawCollateral ¶
func UpdateCustodianStateAfterWithdrawCollateral( custodian *statedb.CustodianState, collateralTokenID string, amount uint64) *statedb.CustodianState
func UpdateLiquidationPoolAfterRedeemFrom ¶
func UpdateLiquidationPoolAfterRedeemFrom( currentPortalState *CurrentPortalState, liquidationPool *statedb.LiquidationPool, portalTokenID string, redeemAmount uint64, mintedPRVCollateral uint64, unlockedTokenCollaterals map[string]uint64)
func UpdateLockedCollateralForRewards ¶
func UpdateLockedCollateralForRewards(currentPortalState *CurrentPortalState, portalParam portalv3.PortalParams)
func UpdateLockedCollateralForRewardsV3 ¶
func UpdateLockedCollateralForRewardsV3(currentPortalState *CurrentPortalState, portalParam portalv3.PortalParams)
func UpdatePortalStateAfterCustodianReqMatchingRedeem ¶
func UpdatePortalStateAfterCustodianReqMatchingRedeem( custodianAddr string, redeemID string, matchedAmount uint64, isEnoughCustodians bool, portalState *CurrentPortalState) (*statedb.RedeemRequest, error)
func UpdatePortalStateAfterPickMoreCustodiansForWaitingRedeemReq ¶
func UpdatePortalStateAfterPickMoreCustodiansForWaitingRedeemReq( moreCustodians []*statedb.MatchingRedeemCustodianDetail, waitingRedeem *statedb.RedeemRequest, portalState *CurrentPortalState) (*statedb.RedeemRequest, error)
Types ¶
type CurrentPortalState ¶
type CurrentPortalState struct { CustodianPoolState map[string]*statedb.CustodianState // key : hash(custodian_address) WaitingPortingRequests map[string]*statedb.WaitingPortingRequest // key : hash(UniquePortingID) WaitingRedeemRequests map[string]*statedb.RedeemRequest // key : hash(UniqueRedeemID) MatchedRedeemRequests map[string]*statedb.RedeemRequest // key : hash(UniquePortingID) FinalExchangeRatesState *statedb.FinalExchangeRatesState LiquidationPool map[string]*statedb.LiquidationPool // key : hash(beaconHeight || TxID) // it used for calculate reward for custodian at the end epoch LockedCollateralForRewards *statedb.LockedCollateralState //Store temporary exchange rates requests ExchangeRatesRequests map[string]*metadata.ExchangeRatesRequestStatus // key : hash(beaconHeight | TxID) }
func InitCurrentPortalStateFromDB ¶
func InitCurrentPortalStateFromDB( stateDB *statedb.StateDB, lastState *CurrentPortalState, ) (*CurrentPortalState, error)
func ProcessPortalInstsV3 ¶
func ProcessPortalInstsV3( portalStateDB *statedb.StateDB, lastState *CurrentPortalState, portalParams portalv3.PortalParams, beaconHeight uint64, instructions [][]string, pv3 map[int]PortalInstructionProcessorV3, epoch uint64, ) (*CurrentPortalState, error)
func (*CurrentPortalState) Copy ¶
func (s *CurrentPortalState) Copy() *CurrentPortalState
type CustodianStateSlice ¶
type CustodianStateSlice struct { Key string Value *statedb.CustodianState }
type PortalCusUnlockOverRateCollateralsProcessor ¶
type PortalCusUnlockOverRateCollateralsProcessor struct {
*PortalInstProcessorV3
}
func (*PortalCusUnlockOverRateCollateralsProcessor) BuildNewInsts ¶
func (p *PortalCusUnlockOverRateCollateralsProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalCusUnlockOverRateCollateralsProcessor) GetActions ¶
func (p *PortalCusUnlockOverRateCollateralsProcessor) GetActions() map[byte][][]string
func (*PortalCusUnlockOverRateCollateralsProcessor) PrepareDataForBlockProducer ¶
func (*PortalCusUnlockOverRateCollateralsProcessor) ProcessInsts ¶
func (p *PortalCusUnlockOverRateCollateralsProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalCusUnlockOverRateCollateralsProcessor) PutAction ¶
func (p *PortalCusUnlockOverRateCollateralsProcessor) PutAction(action []string, shardID byte)
type PortalCustodianDepositProcessor ¶
type PortalCustodianDepositProcessor struct {
*PortalInstProcessorV3
}
func (*PortalCustodianDepositProcessor) BuildNewInsts ¶
func (p *PortalCustodianDepositProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalCustodianDepositProcessor) GetActions ¶
func (p *PortalCustodianDepositProcessor) GetActions() map[byte][][]string
func (*PortalCustodianDepositProcessor) PrepareDataForBlockProducer ¶
func (*PortalCustodianDepositProcessor) ProcessInsts ¶
func (p *PortalCustodianDepositProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalCustodianDepositProcessor) PutAction ¶
func (p *PortalCustodianDepositProcessor) PutAction(action []string, shardID byte)
type PortalCustodianDepositProcessorV3 ¶
type PortalCustodianDepositProcessorV3 struct {
*PortalInstProcessorV3
}
=======
Portal Custodian Deposit Collaterals V3 (ETH and ERC20) Processor =======
func (*PortalCustodianDepositProcessorV3) BuildNewInsts ¶
func (p *PortalCustodianDepositProcessorV3) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalCustodianDepositProcessorV3) GetActions ¶
func (p *PortalCustodianDepositProcessorV3) GetActions() map[byte][][]string
func (*PortalCustodianDepositProcessorV3) PrepareDataForBlockProducer ¶
func (*PortalCustodianDepositProcessorV3) ProcessInsts ¶
func (p *PortalCustodianDepositProcessorV3) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalCustodianDepositProcessorV3) PutAction ¶
func (p *PortalCustodianDepositProcessorV3) PutAction(action []string, shardID byte)
type PortalCustodianTopupProcessor ¶
type PortalCustodianTopupProcessor struct {
*PortalInstProcessorV3
}
func (*PortalCustodianTopupProcessor) BuildNewInsts ¶
func (p *PortalCustodianTopupProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalCustodianTopupProcessor) GetActions ¶
func (p *PortalCustodianTopupProcessor) GetActions() map[byte][][]string
func (*PortalCustodianTopupProcessor) PrepareDataForBlockProducer ¶
func (*PortalCustodianTopupProcessor) ProcessInsts ¶
func (p *PortalCustodianTopupProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalCustodianTopupProcessor) PutAction ¶
func (p *PortalCustodianTopupProcessor) PutAction(action []string, shardID byte)
type PortalCustodianTopupProcessorV3 ¶
type PortalCustodianTopupProcessorV3 struct {
*PortalInstProcessorV3
}
func (*PortalCustodianTopupProcessorV3) BuildNewInsts ¶
func (p *PortalCustodianTopupProcessorV3) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalCustodianTopupProcessorV3) GetActions ¶
func (p *PortalCustodianTopupProcessorV3) GetActions() map[byte][][]string
func (*PortalCustodianTopupProcessorV3) PrepareDataForBlockProducer ¶
func (*PortalCustodianTopupProcessorV3) ProcessInsts ¶
func (p *PortalCustodianTopupProcessorV3) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalCustodianTopupProcessorV3) PutAction ¶
func (p *PortalCustodianTopupProcessorV3) PutAction(action []string, shardID byte)
type PortalExchangeRateProcessor ¶
type PortalExchangeRateProcessor struct {
*PortalInstProcessorV3
}
func (*PortalExchangeRateProcessor) BuildNewInsts ¶
func (p *PortalExchangeRateProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalExchangeRateProcessor) GetActions ¶
func (p *PortalExchangeRateProcessor) GetActions() map[byte][][]string
func (*PortalExchangeRateProcessor) PrepareDataForBlockProducer ¶
func (*PortalExchangeRateProcessor) ProcessInsts ¶
func (p *PortalExchangeRateProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalExchangeRateProcessor) PutAction ¶
func (p *PortalExchangeRateProcessor) PutAction(action []string, shardID byte)
type PortalExchangeRateTool ¶
func NewPortalExchangeRateTool ¶
func NewPortalExchangeRateTool( finalExchangeRate *statedb.FinalExchangeRatesState, portalParams portalv3.PortalParams, ) *PortalExchangeRateTool
func (*PortalExchangeRateTool) Convert ¶
func (t *PortalExchangeRateTool) Convert(tokenIDFrom string, tokenIDTo string, amount uint64) (uint64, error)
convert converts amount in nano unit from tokenIDFrom to tokenIDTo result in nano unit (smallest unit of token)
func (*PortalExchangeRateTool) ConvertFromUSD ¶
func (t *PortalExchangeRateTool) ConvertFromUSD(tokenIDTo string, amount uint64) (uint64, error)
ConvertToUSD converts amount from usdt to token amount (in nano)
func (*PortalExchangeRateTool) ConvertMapTokensFromUSD ¶
func (*PortalExchangeRateTool) ConvertMapTokensToUSD ¶
func (t *PortalExchangeRateTool) ConvertMapTokensToUSD(tokens map[string]uint64) (uint64, error)
func (*PortalExchangeRateTool) ConvertToUSD ¶
func (t *PortalExchangeRateTool) ConvertToUSD(tokenIDFrom string, amount uint64) (uint64, error)
ConvertToUSD converts amount to usdt amount (in nano)
type PortalExpiredWaitingPortingProcessor ¶
type PortalExpiredWaitingPortingProcessor struct {
*PortalInstProcessorV3
}
=======
Portal Liquidation Custodian Run Away Processor =======
func (*PortalExpiredWaitingPortingProcessor) BuildNewInsts ¶
func (p *PortalExpiredWaitingPortingProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalExpiredWaitingPortingProcessor) GetActions ¶
func (p *PortalExpiredWaitingPortingProcessor) GetActions() map[byte][][]string
func (*PortalExpiredWaitingPortingProcessor) PrepareDataForBlockProducer ¶
func (*PortalExpiredWaitingPortingProcessor) ProcessInsts ¶
func (p *PortalExpiredWaitingPortingProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalExpiredWaitingPortingProcessor) PutAction ¶
func (p *PortalExpiredWaitingPortingProcessor) PutAction(action []string, shardID byte)
type PortalInstLogger ¶
type PortalInstLogger struct {
// contains filtered or unexported fields
}
func (*PortalInstLogger) Init ¶
func (portalInstLogger *PortalInstLogger) Init(inst common.Logger)
type PortalInstProcessorV3 ¶
type PortalInstructionProcessorV3 ¶
type PortalInstructionProcessorV3 interface { GetActions() map[byte][][]string PutAction(action []string, shardID byte) // get necessary db from stateDB to verify instructions when producing new block PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string) (map[string]interface{}, error) // validate and create new instructions in new beacon blocks BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error) // process instructions that confirmed in beacon blocks ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error }
interface for portal instruction processor v3
func GetPortalInstProcessorByMetaType ¶
func GetPortalInstProcessorByMetaType(pv3 map[int]PortalInstructionProcessorV3, metaType int) PortalInstructionProcessorV3
type PortalLiquidationByRatesProcessor ¶
type PortalLiquidationByRatesProcessor struct {
*PortalInstProcessorV3
}
=======
Portal Liquidation By Rates Processor =======
func (*PortalLiquidationByRatesProcessor) BuildNewInsts ¶
func (p *PortalLiquidationByRatesProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalLiquidationByRatesProcessor) GetActions ¶
func (p *PortalLiquidationByRatesProcessor) GetActions() map[byte][][]string
func (*PortalLiquidationByRatesProcessor) PrepareDataForBlockProducer ¶
func (*PortalLiquidationByRatesProcessor) ProcessInsts ¶
func (p *PortalLiquidationByRatesProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalLiquidationByRatesProcessor) PutAction ¶
func (p *PortalLiquidationByRatesProcessor) PutAction(action []string, shardID byte)
type PortalLiquidationByRatesV3Processor ¶
type PortalLiquidationByRatesV3Processor struct {
*PortalInstProcessorV3
}
=======
Portal Liquidation Custodian Run Away Processor =======
func (*PortalLiquidationByRatesV3Processor) BuildNewInsts ¶
func (p *PortalLiquidationByRatesV3Processor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalLiquidationByRatesV3Processor) GetActions ¶
func (p *PortalLiquidationByRatesV3Processor) GetActions() map[byte][][]string
func (*PortalLiquidationByRatesV3Processor) PrepareDataForBlockProducer ¶
func (*PortalLiquidationByRatesV3Processor) ProcessInsts ¶
func (p *PortalLiquidationByRatesV3Processor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalLiquidationByRatesV3Processor) PutAction ¶
func (p *PortalLiquidationByRatesV3Processor) PutAction(action []string, shardID byte)
type PortalLiquidationCustodianRunAwayProcessor ¶
type PortalLiquidationCustodianRunAwayProcessor struct {
*PortalInstProcessorV3
}
=======
Portal Liquidation Custodian Run Away Processor =======
func (*PortalLiquidationCustodianRunAwayProcessor) BuildNewInsts ¶
func (p *PortalLiquidationCustodianRunAwayProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalLiquidationCustodianRunAwayProcessor) GetActions ¶
func (p *PortalLiquidationCustodianRunAwayProcessor) GetActions() map[byte][][]string
func (*PortalLiquidationCustodianRunAwayProcessor) PrepareDataForBlockProducer ¶
func (*PortalLiquidationCustodianRunAwayProcessor) ProcessInsts ¶
func (p *PortalLiquidationCustodianRunAwayProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalLiquidationCustodianRunAwayProcessor) PutAction ¶
func (p *PortalLiquidationCustodianRunAwayProcessor) PutAction(action []string, shardID byte)
type PortalPickMoreCustodianForRedeemProcessor ¶
type PortalPickMoreCustodianForRedeemProcessor struct {
*PortalInstProcessorV3
}
func (*PortalPickMoreCustodianForRedeemProcessor) BuildNewInsts ¶
func (p *PortalPickMoreCustodianForRedeemProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalPickMoreCustodianForRedeemProcessor) GetActions ¶
func (p *PortalPickMoreCustodianForRedeemProcessor) GetActions() map[byte][][]string
func (*PortalPickMoreCustodianForRedeemProcessor) PrepareDataForBlockProducer ¶
func (*PortalPickMoreCustodianForRedeemProcessor) ProcessInsts ¶
func (p *PortalPickMoreCustodianForRedeemProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalPickMoreCustodianForRedeemProcessor) PutAction ¶
func (p *PortalPickMoreCustodianForRedeemProcessor) PutAction(action []string, shardID byte)
type PortalPickMoreCustodiansForRedeemReqContent ¶
type PortalPickMoreCustodiansForRedeemReqContent struct { RedeemID string Custodians []*statedb.MatchingRedeemCustodianDetail }
PortalPickMoreCustodiansForRedeemReqContent - Beacon builds a new instruction with this content after timeout of redeem request It will be appended to beaconBlock
type PortalPortingRequestProcessor ¶
type PortalPortingRequestProcessor struct {
*PortalInstProcessorV3
}
=======
Portal Porting Request Processor =======
func (*PortalPortingRequestProcessor) BuildNewInsts ¶
func (p *PortalPortingRequestProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalPortingRequestProcessor) GetActions ¶
func (p *PortalPortingRequestProcessor) GetActions() map[byte][][]string
func (*PortalPortingRequestProcessor) PrepareDataForBlockProducer ¶
func (*PortalPortingRequestProcessor) ProcessInsts ¶
func (p *PortalPortingRequestProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalPortingRequestProcessor) PutAction ¶
func (p *PortalPortingRequestProcessor) PutAction(action []string, shardID byte)
type PortalProcessError ¶
type PortalProcessError struct { Code int // The code to send with reject messages Message string // Human readable message of the issue Err error }
func NewPortalProcessError ¶
func NewPortalProcessError(key int, err error, params ...interface{}) *PortalProcessError
func (PortalProcessError) Error ¶
func (e PortalProcessError) Error() string
Error satisfies the error interface and prints human-readable errors.
type PortalRedeemFromLiquidationPoolProcessor ¶
type PortalRedeemFromLiquidationPoolProcessor struct {
*PortalInstProcessorV3
}
func (*PortalRedeemFromLiquidationPoolProcessor) BuildNewInsts ¶
func (p *PortalRedeemFromLiquidationPoolProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRedeemFromLiquidationPoolProcessor) GetActions ¶
func (p *PortalRedeemFromLiquidationPoolProcessor) GetActions() map[byte][][]string
func (*PortalRedeemFromLiquidationPoolProcessor) PrepareDataForBlockProducer ¶
func (*PortalRedeemFromLiquidationPoolProcessor) ProcessInsts ¶
func (p *PortalRedeemFromLiquidationPoolProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRedeemFromLiquidationPoolProcessor) PutAction ¶
func (p *PortalRedeemFromLiquidationPoolProcessor) PutAction(action []string, shardID byte)
type PortalRedeemFromLiquidationPoolProcessorV3 ¶
type PortalRedeemFromLiquidationPoolProcessorV3 struct {
*PortalInstProcessorV3
}
func (*PortalRedeemFromLiquidationPoolProcessorV3) BuildNewInsts ¶
func (p *PortalRedeemFromLiquidationPoolProcessorV3) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRedeemFromLiquidationPoolProcessorV3) GetActions ¶
func (p *PortalRedeemFromLiquidationPoolProcessorV3) GetActions() map[byte][][]string
func (*PortalRedeemFromLiquidationPoolProcessorV3) PrepareDataForBlockProducer ¶
func (*PortalRedeemFromLiquidationPoolProcessorV3) ProcessInsts ¶
func (p *PortalRedeemFromLiquidationPoolProcessorV3) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRedeemFromLiquidationPoolProcessorV3) PutAction ¶
func (p *PortalRedeemFromLiquidationPoolProcessorV3) PutAction(action []string, shardID byte)
type PortalRedeemRequestProcessor ¶
type PortalRedeemRequestProcessor struct {
*PortalInstProcessorV3
}
func (*PortalRedeemRequestProcessor) BuildNewInsts ¶
func (p *PortalRedeemRequestProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRedeemRequestProcessor) GetActions ¶
func (p *PortalRedeemRequestProcessor) GetActions() map[byte][][]string
func (*PortalRedeemRequestProcessor) PrepareDataForBlockProducer ¶
func (*PortalRedeemRequestProcessor) ProcessInsts ¶
func (p *PortalRedeemRequestProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRedeemRequestProcessor) PutAction ¶
func (p *PortalRedeemRequestProcessor) PutAction(action []string, shardID byte)
type PortalReqWithdrawRewardProcessor ¶
type PortalReqWithdrawRewardProcessor struct {
*PortalInstProcessorV3
}
func (*PortalReqWithdrawRewardProcessor) BuildNewInsts ¶
func (p *PortalReqWithdrawRewardProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalReqWithdrawRewardProcessor) GetActions ¶
func (p *PortalReqWithdrawRewardProcessor) GetActions() map[byte][][]string
func (*PortalReqWithdrawRewardProcessor) PrepareDataForBlockProducer ¶
func (*PortalReqWithdrawRewardProcessor) ProcessInsts ¶
func (p *PortalReqWithdrawRewardProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalReqWithdrawRewardProcessor) PutAction ¶
func (p *PortalReqWithdrawRewardProcessor) PutAction(action []string, shardID byte)
type PortalRequestMatchingRedeemProcessor ¶
type PortalRequestMatchingRedeemProcessor struct {
*PortalInstProcessorV3
}
func (*PortalRequestMatchingRedeemProcessor) BuildNewInsts ¶
func (p *PortalRequestMatchingRedeemProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRequestMatchingRedeemProcessor) GetActions ¶
func (p *PortalRequestMatchingRedeemProcessor) GetActions() map[byte][][]string
func (*PortalRequestMatchingRedeemProcessor) PrepareDataForBlockProducer ¶
func (*PortalRequestMatchingRedeemProcessor) ProcessInsts ¶
func (p *PortalRequestMatchingRedeemProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRequestMatchingRedeemProcessor) PutAction ¶
func (p *PortalRequestMatchingRedeemProcessor) PutAction(action []string, shardID byte)
type PortalRequestPTokenProcessor ¶
type PortalRequestPTokenProcessor struct {
*PortalInstProcessorV3
}
func (*PortalRequestPTokenProcessor) BuildNewInsts ¶
func (p *PortalRequestPTokenProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRequestPTokenProcessor) GetActions ¶
func (p *PortalRequestPTokenProcessor) GetActions() map[byte][][]string
func (*PortalRequestPTokenProcessor) PrepareDataForBlockProducer ¶
func (*PortalRequestPTokenProcessor) ProcessInsts ¶
func (p *PortalRequestPTokenProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRequestPTokenProcessor) PutAction ¶
func (p *PortalRequestPTokenProcessor) PutAction(action []string, shardID byte)
type PortalRequestUnlockCollateralProcessor ¶
type PortalRequestUnlockCollateralProcessor struct {
*PortalInstProcessorV3
}
func (*PortalRequestUnlockCollateralProcessor) BuildNewInsts ¶
func (p *PortalRequestUnlockCollateralProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRequestUnlockCollateralProcessor) GetActions ¶
func (p *PortalRequestUnlockCollateralProcessor) GetActions() map[byte][][]string
func (*PortalRequestUnlockCollateralProcessor) PrepareDataForBlockProducer ¶
func (*PortalRequestUnlockCollateralProcessor) ProcessInsts ¶
func (p *PortalRequestUnlockCollateralProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRequestUnlockCollateralProcessor) PutAction ¶
func (p *PortalRequestUnlockCollateralProcessor) PutAction(action []string, shardID byte)
type PortalRequestWithdrawCollateralProcessor ¶
type PortalRequestWithdrawCollateralProcessor struct {
*PortalInstProcessorV3
}
func (*PortalRequestWithdrawCollateralProcessor) BuildNewInsts ¶
func (p *PortalRequestWithdrawCollateralProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRequestWithdrawCollateralProcessor) GetActions ¶
func (p *PortalRequestWithdrawCollateralProcessor) GetActions() map[byte][][]string
func (*PortalRequestWithdrawCollateralProcessor) PrepareDataForBlockProducer ¶
func (*PortalRequestWithdrawCollateralProcessor) ProcessInsts ¶
func (p *PortalRequestWithdrawCollateralProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRequestWithdrawCollateralProcessor) PutAction ¶
func (p *PortalRequestWithdrawCollateralProcessor) PutAction(action []string, shardID byte)
type PortalRequestWithdrawCollateralProcessorV3 ¶
type PortalRequestWithdrawCollateralProcessorV3 struct {
*PortalInstProcessorV3
}
func (*PortalRequestWithdrawCollateralProcessorV3) BuildNewInsts ¶
func (p *PortalRequestWithdrawCollateralProcessorV3) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalRequestWithdrawCollateralProcessorV3) GetActions ¶
func (p *PortalRequestWithdrawCollateralProcessorV3) GetActions() map[byte][][]string
func (*PortalRequestWithdrawCollateralProcessorV3) PrepareDataForBlockProducer ¶
func (*PortalRequestWithdrawCollateralProcessorV3) ProcessInsts ¶
func (p *PortalRequestWithdrawCollateralProcessorV3) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalRequestWithdrawCollateralProcessorV3) PutAction ¶
func (p *PortalRequestWithdrawCollateralProcessorV3) PutAction(action []string, shardID byte)
type PortalTopupWaitingPortingReqProcessor ¶
type PortalTopupWaitingPortingReqProcessor struct {
*PortalInstProcessorV3
}
func (*PortalTopupWaitingPortingReqProcessor) BuildNewInsts ¶
func (p *PortalTopupWaitingPortingReqProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalTopupWaitingPortingReqProcessor) GetActions ¶
func (p *PortalTopupWaitingPortingReqProcessor) GetActions() map[byte][][]string
func (*PortalTopupWaitingPortingReqProcessor) PrepareDataForBlockProducer ¶
func (*PortalTopupWaitingPortingReqProcessor) ProcessInsts ¶
func (p *PortalTopupWaitingPortingReqProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalTopupWaitingPortingReqProcessor) PutAction ¶
func (p *PortalTopupWaitingPortingReqProcessor) PutAction(action []string, shardID byte)
type PortalTopupWaitingPortingReqProcessorV3 ¶
type PortalTopupWaitingPortingReqProcessorV3 struct {
*PortalInstProcessorV3
}
func (*PortalTopupWaitingPortingReqProcessorV3) BuildNewInsts ¶
func (p *PortalTopupWaitingPortingReqProcessorV3) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalState, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv3.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalTopupWaitingPortingReqProcessorV3) GetActions ¶
func (p *PortalTopupWaitingPortingReqProcessorV3) GetActions() map[byte][][]string
func (*PortalTopupWaitingPortingReqProcessorV3) PrepareDataForBlockProducer ¶
func (*PortalTopupWaitingPortingReqProcessorV3) ProcessInsts ¶
func (p *PortalTopupWaitingPortingReqProcessorV3) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalState, portalParams portalv3.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalTopupWaitingPortingReqProcessorV3) PutAction ¶
func (p *PortalTopupWaitingPortingReqProcessorV3) PutAction(action []string, shardID byte)