Documentation ¶
Index ¶
- Variables
- type BroadcastTx
- type OutputTx
- type PortalBTCTokenProcessor
- func (p PortalBTCTokenProcessor) AppendTinyUTXOs(batchTxs []*BroadcastTx, sortedUTXOs []utxoItem, thresholdTinyValue uint64, ...) []*BroadcastTx
- func (p PortalBTCTokenProcessor) AppendWaitingUnshieldRequests(batchTxs []*BroadcastTx, remainUnshieldReqs []unshieldItem, ...) []*BroadcastTx
- func (p PortalBTCTokenProcessor) CalculateTinyUTXONumber(batchTx *BroadcastTx, maxUTXOsCanPick int) int
- func (p PortalBTCTokenProcessor) ChooseUTXOsForUnshieldReq(utxos []utxoItem, unshieldAmount uint64) ([]utxoItem, []int, error)
- func (p PortalBTCTokenProcessor) ConvertExternalToIncAmount(externalAmt uint64) uint64
- func (p PortalBTCTokenProcessor) ConvertIncToExternalAmount(incAmt uint64) uint64
- func (p PortalBTCTokenProcessor) CreateRawExternalTx(inputs []*statedb.UTXO, outputs []*OutputTx, feePerOutput uint64, ...) (string, string, error)
- func (p PortalBTCTokenProcessor) EstimateTxSize(numInputs int, numOutputs int) uint
- func (p PortalBTCTokenProcessor) GenerateOTMultisigAddress(masterPubKeys [][]byte, numSigsRequired int, chainCodeSeed string) ([]byte, string, error)
- func (p PortalBTCTokenProcessor) GetChainID() string
- func (p PortalBTCTokenProcessor) GetMinTokenAmount() uint64
- func (p PortalBTCTokenProcessor) GetMultipleTokenAmount() uint64
- func (p PortalBTCTokenProcessor) GetPortalTokenID() string
- func (p PortalBTCTokenProcessor) GetTxHashFromProof(proof string) (string, error)
- func (p PortalBTCTokenProcessor) GetTxHashFromRawTx(rawTx string) (string, error)
- func (p PortalBTCTokenProcessor) IsAcceptableTxSize(numInputs int, numOutputs int) bool
- func (p PortalBTCTokenProcessor) IsValidRemoteAddress(address string, bcr metadata.ChainRetriever) (bool, error)
- func (p PortalBTCTokenProcessor) MatchUTXOsAndUnshieldIDs(utxos map[string]*statedb.UTXO, ...) []*BroadcastTx
- func (p PortalBTCTokenProcessor) MatchUTXOsAndUnshieldIDsNew(utxos map[string]*statedb.UTXO, ...) ([]*BroadcastTx, error)
- func (p PortalBTCTokenProcessor) MergeBatches(batchTxs []*BroadcastTx) []*BroadcastTx
- func (p PortalBTCTokenProcessor) ParseAndVerifyShieldProof(proof string, bc metadata.ChainRetriever, ...) (bool, []*statedb.UTXO, error)
- func (p PortalBTCTokenProcessor) ParseAndVerifyUnshieldProof(proof string, bc metadata.ChainRetriever, ...) (bool, []*statedb.UTXO, string, uint64, error)
- func (p PortalBTCTokenProcessor) PartSignOnRawExternalTx(seedKey []byte, masterPubKeys [][]byte, numSigsRequired int, rawTxBytes []byte, ...) ([][]byte, string, error)
- type PortalToken
- type PortalTokenLoggerV4
- type PortalTokenProcessor
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger = PortalTokenLoggerV4{}
Global instant to use
Functions ¶
This section is empty.
Types ¶
type BroadcastTx ¶
type PortalBTCTokenProcessor ¶
type PortalBTCTokenProcessor struct { *PortalToken ChainParam *chaincfg.Params PortalTokenID string }
func (PortalBTCTokenProcessor) AppendTinyUTXOs ¶
func (p PortalBTCTokenProcessor) AppendTinyUTXOs( batchTxs []*BroadcastTx, sortedUTXOs []utxoItem, thresholdTinyValue uint64, minUTXOs uint64, ) []*BroadcastTx
func (PortalBTCTokenProcessor) AppendWaitingUnshieldRequests ¶
func (p PortalBTCTokenProcessor) AppendWaitingUnshieldRequests( batchTxs []*BroadcastTx, remainUnshieldReqs []unshieldItem, waitingUnshieldReqs map[string]*statedb.WaitingUnshieldRequest, ) []*BroadcastTx
func (PortalBTCTokenProcessor) CalculateTinyUTXONumber ¶
func (p PortalBTCTokenProcessor) CalculateTinyUTXONumber(batchTx *BroadcastTx, maxUTXOsCanPick int) int
func (PortalBTCTokenProcessor) ChooseUTXOsForUnshieldReq ¶
func (p PortalBTCTokenProcessor) ChooseUTXOsForUnshieldReq( utxos []utxoItem, unshieldAmount uint64, ) ([]utxoItem, []int, error)
func (PortalBTCTokenProcessor) ConvertExternalToIncAmount ¶
func (p PortalBTCTokenProcessor) ConvertExternalToIncAmount(externalAmt uint64) uint64
func (PortalBTCTokenProcessor) ConvertIncToExternalAmount ¶
func (p PortalBTCTokenProcessor) ConvertIncToExternalAmount(incAmt uint64) uint64
func (PortalBTCTokenProcessor) CreateRawExternalTx ¶
func (p PortalBTCTokenProcessor) CreateRawExternalTx(inputs []*statedb.UTXO, outputs []*OutputTx, feePerOutput uint64, bc metadata.ChainRetriever, beaconHeight uint64) (string, string, error)
CreateRawExternalTx creates raw btc transaction (not include signatures of beacon validator) inputs: UTXO state of beacon, unit of amount in btc outputs: unit of amount in pbtc ~ unshielding amount feePerOutput: unit in pbtc
func (PortalBTCTokenProcessor) EstimateTxSize ¶
func (p PortalBTCTokenProcessor) EstimateTxSize(numInputs int, numOutputs int) uint
func (PortalBTCTokenProcessor) GenerateOTMultisigAddress ¶
func (p PortalBTCTokenProcessor) GenerateOTMultisigAddress(masterPubKeys [][]byte, numSigsRequired int, chainCodeSeed string) ([]byte, string, error)
Generate Bech32 P2WSH multisig address for each Incognito address Return redeem script, OTMultisigAddress
func (PortalBTCTokenProcessor) GetChainID ¶
func (p PortalBTCTokenProcessor) GetChainID() string
func (PortalBTCTokenProcessor) GetMinTokenAmount ¶
func (p PortalBTCTokenProcessor) GetMinTokenAmount() uint64
func (PortalBTCTokenProcessor) GetMultipleTokenAmount ¶
func (p PortalBTCTokenProcessor) GetMultipleTokenAmount() uint64
func (PortalBTCTokenProcessor) GetPortalTokenID ¶
func (p PortalBTCTokenProcessor) GetPortalTokenID() string
func (PortalBTCTokenProcessor) GetTxHashFromProof ¶
func (p PortalBTCTokenProcessor) GetTxHashFromProof(proof string) (string, error)
func (PortalBTCTokenProcessor) GetTxHashFromRawTx ¶
func (p PortalBTCTokenProcessor) GetTxHashFromRawTx(rawTx string) (string, error)
func (PortalBTCTokenProcessor) IsAcceptableTxSize ¶
func (p PortalBTCTokenProcessor) IsAcceptableTxSize(numInputs int, numOutputs int) bool
func (PortalBTCTokenProcessor) IsValidRemoteAddress ¶
func (p PortalBTCTokenProcessor) IsValidRemoteAddress(address string, bcr metadata.ChainRetriever) (bool, error)
func (PortalBTCTokenProcessor) MatchUTXOsAndUnshieldIDs ¶
func (p PortalBTCTokenProcessor) MatchUTXOsAndUnshieldIDs( utxos map[string]*statedb.UTXO, waitingUnshieldReqs map[string]*statedb.WaitingUnshieldRequest, dustValueThreshold uint64) []*BroadcastTx
TODO: update Choose list of pairs (UTXOs and unshield IDs) for broadcast external transactions
func (PortalBTCTokenProcessor) MatchUTXOsAndUnshieldIDsNew ¶
func (p PortalBTCTokenProcessor) MatchUTXOsAndUnshieldIDsNew( utxos map[string]*statedb.UTXO, waitingUnshieldReqs map[string]*statedb.WaitingUnshieldRequest, tinyValueThreshold uint64, minUTXOs uint64, ) ([]*BroadcastTx, error)
func (PortalBTCTokenProcessor) MergeBatches ¶
func (p PortalBTCTokenProcessor) MergeBatches(batchTxs []*BroadcastTx) []*BroadcastTx
func (PortalBTCTokenProcessor) ParseAndVerifyShieldProof ¶
func (PortalBTCTokenProcessor) ParseAndVerifyUnshieldProof ¶
type PortalToken ¶
type PortalToken struct { ChainID string MinTokenAmount uint64 // set MinTokenAmount to avoid attacking with amount is less than smallest unit of cryptocurrency, such as satoshi in BTC MultipleTokenAmount uint64 // amount token must be a multiple of this param in order to avoid not consistent when converting between public token and private token ExternalInputSize uint // they are used to estimate size of external txs (in byte) ExternalOutputSize uint ExternalTxMaxSize uint }
type PortalTokenLoggerV4 ¶
type PortalTokenLoggerV4 struct {
// contains filtered or unexported fields
}
func (*PortalTokenLoggerV4) Init ¶
func (portalTokenLogger *PortalTokenLoggerV4) Init(inst common.Logger)
type PortalTokenProcessor ¶
type PortalTokenProcessor interface { IsValidRemoteAddress(address string, bcr metadata.ChainRetriever) (bool, error) GetChainID() string GetMinTokenAmount() uint64 GetMultipleTokenAmount() uint64 ConvertExternalToIncAmount(incAmt uint64) uint64 ConvertIncToExternalAmount(incAmt uint64) uint64 GetTxHashFromRawTx(rawTx string) (string, error) GetTxHashFromProof(proof string) (string, error) ParseAndVerifyShieldProof( proof string, bc metadata.ChainRetriever, expectedReceivedMultisigAddress string, chainCodeSeed string, minShieldAmt uint64) (bool, []*statedb.UTXO, error) ParseAndVerifyUnshieldProof( proof string, bc metadata.ChainRetriever, expectedReceivedMultisigAddress string, chainCodeSeed string, expectPaymentInfo []*OutputTx, utxos []*statedb.UTXO) (bool, []*statedb.UTXO, string, uint64, error) MatchUTXOsAndUnshieldIDs(utxos map[string]*statedb.UTXO, waitingUnshieldReqs map[string]*statedb.WaitingUnshieldRequest, tinyAmount uint64) []*BroadcastTx MatchUTXOsAndUnshieldIDsNew( utxos map[string]*statedb.UTXO, waitingUnshieldReqs map[string]*statedb.WaitingUnshieldRequest, tinyAmount uint64, minUTXOs uint64) ([]*BroadcastTx, error) CreateRawExternalTx(inputs []*statedb.UTXO, outputs []*OutputTx, networkFee uint64, bc metadata.ChainRetriever, beaconHeight uint64) (string, string, error) PartSignOnRawExternalTx(seedKey []byte, masterPubKeys [][]byte, numSigsRequired int, rawTxBytes []byte, inputs []*statedb.UTXO) ([][]byte, string, error) GenerateOTMultisigAddress(masterPubKeys [][]byte, numSigsRequired int, chainCodeSeed string) ([]byte, string, error) GetPortalTokenID() string }
Click to show internal directories.
Click to hide internal directories.