Documentation
¶
Index ¶
- func RandomSigningGroup(size int) []common.Address
- type Chain
- type ChainLogger
- type Signature
- type TBTCLocalChain
- func (lc TBTCLocalChain) AuthorizeOperator(operator common.Address)
- func (lc TBTCLocalChain) BlockCounter() corechain.BlockCounter
- func (lc TBTCLocalChain) BlockTimestamp(blockNumber *big.Int) (uint64, error)
- func (lc TBTCLocalChain) CloseKeep(keepAddress common.Address) error
- func (tlc *TBTCLocalChain) CreateDeposit(depositAddress string, signers []common.Address)
- func (tlc *TBTCLocalChain) CurrentState(depositAddress string) (chain.DepositState, error)
- func (tlc *TBTCLocalChain) DepositPubkey(depositAddress string) ([]byte, error)
- func (tlc *TBTCLocalChain) DepositRedemptionFee(depositAddress string) (*big.Int, error)
- func (tlc *TBTCLocalChain) DepositRedemptionProof(depositAddress string) (*TxProof, error)
- func (tlc *TBTCLocalChain) DepositRedemptionSignature(depositAddress string) (*Signature, error)
- func (tlc *TBTCLocalChain) FundDeposit(depositAddress string)
- func (tlc *TBTCLocalChain) FundingInfo(depositAddress string) (*chain.FundingInfo, error)
- func (lc TBTCLocalChain) GetKeepAtIndex(keepIndex *big.Int) (chain.BondedECDSAKeepHandle, error)
- func (lc TBTCLocalChain) GetKeepCount() (*big.Int, error)
- func (lc TBTCLocalChain) GetKeepWithID(keepID chain.ID) (chain.BondedECDSAKeepHandle, error)
- func (tlc *TBTCLocalChain) ID() chain.ID
- func (tlc *TBTCLocalChain) IncreaseRedemptionFee(depositAddress string, previousOutputValueBytes [8]uint8, ...) error
- func (tlc *TBTCLocalChain) IsEligibleForApplication() (bool, error)
- func (lc TBTCLocalChain) IsOperatorAuthorized(operator chain.ID) (bool, error)
- func (tlc *TBTCLocalChain) IsRegisteredForApplication() (bool, error)
- func (lc TBTCLocalChain) IsStatusUpToDateForApplication() (bool, error)
- func (tlc *TBTCLocalChain) Keep(depositAddress string) (chain.BondedECDSAKeepHandle, error)
- func (tlc *TBTCLocalChain) Logger() *ChainLogger
- func (lc TBTCLocalChain) Name() string
- func (lc TBTCLocalChain) OnBondedECDSAKeepCreated(handler func(event *chain.BondedECDSAKeepCreatedEvent)) subscription.EventSubscription
- func (tlc *TBTCLocalChain) OnDepositCreated(handler func(depositAddress string)) subscription.EventSubscription
- func (tlc *TBTCLocalChain) OnDepositGotRedemptionSignature(handler func(depositAddress string)) subscription.EventSubscription
- func (tlc *TBTCLocalChain) OnDepositRedeemed(handler func(depositAddress string)) subscription.EventSubscription
- func (tlc *TBTCLocalChain) OnDepositRedemptionRequested(handler func(depositAddress string)) subscription.EventSubscription
- func (tlc *TBTCLocalChain) OnDepositRegisteredPubkey(handler func(depositAddress string)) subscription.EventSubscription
- func (lc TBTCLocalChain) OpenKeep(keepAddress common.Address, ownerAddress common.Address, ...) chain.BondedECDSAKeepHandle
- func (lc TBTCLocalChain) OperatorAddress() common.Address
- func (lc TBTCLocalChain) OperatorID() chain.ID
- func (tlc *TBTCLocalChain) PastDepositRedemptionRequestedEvents(startBlock uint64, depositAddress string) ([]*chain.DepositRedemptionRequestedEvent, error)
- func (tlc *TBTCLocalChain) ProvideRedemptionProof(depositAddress string, txVersion [4]uint8, txInputVector []uint8, ...) error
- func (tlc *TBTCLocalChain) ProvideRedemptionSignature(depositAddress string, v uint8, r [32]uint8, s [32]uint8) error
- func (lc TBTCLocalChain) PublicKeyToOperatorID(publicKey *cecdsa.PublicKey) chain.ID
- func (tlc *TBTCLocalChain) RedeemDeposit(depositAddress string) error
- func (tlc *TBTCLocalChain) RegisterAsMemberCandidate() error
- func (lc TBTCLocalChain) RequestSignature(keepAddress common.Address, digest [32]byte) error
- func (tlc *TBTCLocalChain) RetrieveSignerPubkey(depositAddress string) error
- func (tlc *TBTCLocalChain) SetAlwaysFailingTransactions(transactions ...string)
- func (lc TBTCLocalChain) Signing() corechain.Signing
- func (lc TBTCLocalChain) StakeMonitor() (corechain.StakeMonitor, error)
- func (lc TBTCLocalChain) TBTCApplicationHandle() (chain.TBTCHandle, error)
- func (lc TBTCLocalChain) TerminateKeep(keepAddress common.Address) error
- func (lc TBTCLocalChain) UnmarshalID(idString string) (chain.ID, error)
- func (tlc *TBTCLocalChain) UpdateStatusForApplication() error
- type TxProof
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomSigningGroup ¶ added in v1.5.0
RandomSigningGroup randmly chooses `size` signers to be a new signing group
Types ¶
type Chain ¶
type Chain interface { chain.Handle OperatorAddress() common.Address OpenKeep( keepAddress common.Address, ownerAddress common.Address, members []common.Address, ) chain.BondedECDSAKeepHandle CloseKeep(keepAddress common.Address) error TerminateKeep(keepAddress common.Address) error RequestSignature(keepAddress common.Address, digest [32]byte) error AuthorizeOperator(operatorAddress common.Address) }
Chain is an extention of eth.Handle interface which exposes additional functions useful for testing.
type ChainLogger ¶ added in v1.8.0
type ChainLogger struct {
// contains filtered or unexported fields
}
ChainLogger writes log messages relevant to the local chain
func (*ChainLogger) IncreaseRedemptionFeeCalls ¶ added in v1.8.0
func (cl *ChainLogger) IncreaseRedemptionFeeCalls() int
IncreaseRedemptionFeeCalls returns the number of times we've increased the redemption fees
func (*ChainLogger) KeepAddressCalls ¶ added in v1.8.0
func (cl *ChainLogger) KeepAddressCalls() int
KeepAddressCalls returns the number of times we've attempted to retrieve the keep address
func (*ChainLogger) ProvideRedemptionSignatureCalls ¶ added in v1.8.0
func (cl *ChainLogger) ProvideRedemptionSignatureCalls() int
ProvideRedemptionSignatureCalls returns the number of times we've tried to provide the redemption signature
func (*ChainLogger) RetrieveSignerPubkeyCalls ¶ added in v1.8.0
func (cl *ChainLogger) RetrieveSignerPubkeyCalls() int
RetrieveSignerPubkeyCalls returns the number of times we've tried to retrieve the signer public key
type TBTCLocalChain ¶ added in v1.5.0
type TBTCLocalChain struct {
// contains filtered or unexported fields
}
TBTCLocalChain represents variables and state relative to the TBTC chain
func NewTBTCLocalChain ¶ added in v1.5.0
func NewTBTCLocalChain(ctx context.Context) *TBTCLocalChain
NewTBTCLocalChain creates a new TBTCLocalChain
func (TBTCLocalChain) AuthorizeOperator ¶ added in v1.5.0
func (TBTCLocalChain) BlockCounter ¶ added in v1.5.0
func (lc TBTCLocalChain) BlockCounter() corechain.BlockCounter
func (TBTCLocalChain) BlockTimestamp ¶ added in v1.5.0
func (*TBTCLocalChain) CreateDeposit ¶ added in v1.5.0
func (tlc *TBTCLocalChain) CreateDeposit( depositAddress string, signers []common.Address, )
CreateDeposit creates a new deposit by mutating the local TBTC chain
func (*TBTCLocalChain) CurrentState ¶ added in v1.5.0
func (tlc *TBTCLocalChain) CurrentState( depositAddress string, ) (chain.DepositState, error)
CurrentState returns the state of a particular deposit
func (*TBTCLocalChain) DepositPubkey ¶ added in v1.5.0
func (tlc *TBTCLocalChain) DepositPubkey( depositAddress string, ) ([]byte, error)
DepositPubkey returns the public key of a particular deposit
func (*TBTCLocalChain) DepositRedemptionFee ¶ added in v1.5.0
func (tlc *TBTCLocalChain) DepositRedemptionFee( depositAddress string, ) (*big.Int, error)
DepositRedemptionFee returns the redemption fee of a particular deposit
func (*TBTCLocalChain) DepositRedemptionProof ¶ added in v1.5.0
func (tlc *TBTCLocalChain) DepositRedemptionProof( depositAddress string, ) (*TxProof, error)
DepositRedemptionProof returns the redemption proof of a particular deposit
func (*TBTCLocalChain) DepositRedemptionSignature ¶ added in v1.5.0
func (tlc *TBTCLocalChain) DepositRedemptionSignature( depositAddress string, ) (*Signature, error)
DepositRedemptionSignature returns the redemption signature of a particular deposit
func (*TBTCLocalChain) FundDeposit ¶ added in v1.8.0
func (tlc *TBTCLocalChain) FundDeposit(depositAddress string)
FundDeposit sets funding info for the deposit. It simulates result of providing a funding proof for the deposit.
func (*TBTCLocalChain) FundingInfo ¶ added in v1.8.0
func (tlc *TBTCLocalChain) FundingInfo( depositAddress string, ) (*chain.FundingInfo, error)
FundingInfo retrieves the funding info for a particular deposit address
func (TBTCLocalChain) GetKeepAtIndex ¶ added in v1.5.0
func (lc TBTCLocalChain) GetKeepAtIndex( keepIndex *big.Int, ) (chain.BondedECDSAKeepHandle, error)
func (TBTCLocalChain) GetKeepCount ¶ added in v1.5.0
func (TBTCLocalChain) GetKeepWithID ¶ added in v1.8.0
func (lc TBTCLocalChain) GetKeepWithID( keepID chain.ID, ) (chain.BondedECDSAKeepHandle, error)
func (*TBTCLocalChain) ID ¶ added in v1.8.0
func (tlc *TBTCLocalChain) ID() chain.ID
ID implements the ID method in the chain.TBTCHandle interface.
func (*TBTCLocalChain) IncreaseRedemptionFee ¶ added in v1.5.0
func (tlc *TBTCLocalChain) IncreaseRedemptionFee( depositAddress string, previousOutputValueBytes [8]uint8, newOutputValueBytes [8]uint8, ) error
IncreaseRedemptionFee sets the remeption fee to `newOutputValueBytes` and uses `previousOutputValueBytes` for validation.
func (*TBTCLocalChain) IsEligibleForApplication ¶ added in v1.5.0
func (tlc *TBTCLocalChain) IsEligibleForApplication() (bool, error)
IsEligibleForApplication implements the IsEligibleForApplication method in the chain.TBTCHandle interface.
func (TBTCLocalChain) IsOperatorAuthorized ¶ added in v1.5.0
func (*TBTCLocalChain) IsRegisteredForApplication ¶ added in v1.5.0
func (tlc *TBTCLocalChain) IsRegisteredForApplication() (bool, error)
IsRegisteredForApplication implements the IsRegisteredForApplication method in the chain.TBTCHandle interface.
func (TBTCLocalChain) IsStatusUpToDateForApplication ¶ added in v1.5.0
IsStatusUpToDateForApplication implements the IsStatusUpToDateForApplication method in the chain.TBTCHandle interface.
func (*TBTCLocalChain) Keep ¶ added in v1.8.0
func (tlc *TBTCLocalChain) Keep(depositAddress string) (chain.BondedECDSAKeepHandle, error)
Keep returns the keep for a particular deposit
func (*TBTCLocalChain) Logger ¶ added in v1.5.0
func (tlc *TBTCLocalChain) Logger() *ChainLogger
Logger surfaces the chain's logger
func (TBTCLocalChain) OnBondedECDSAKeepCreated ¶ added in v1.5.0
func (lc TBTCLocalChain) OnBondedECDSAKeepCreated( handler func(event *chain.BondedECDSAKeepCreatedEvent), ) subscription.EventSubscription
OnBondedECDSAKeepCreated is a callback that is invoked when an on-chain notification of a new ECDSA keep creation is seen.
func (*TBTCLocalChain) OnDepositCreated ¶ added in v1.5.0
func (tlc *TBTCLocalChain) OnDepositCreated( handler func(depositAddress string), ) subscription.EventSubscription
OnDepositCreated installs a callback that is invoked when a local-chain notification of a new deposit creation is seen.
func (*TBTCLocalChain) OnDepositGotRedemptionSignature ¶ added in v1.5.0
func (tlc *TBTCLocalChain) OnDepositGotRedemptionSignature( handler func(depositAddress string), ) subscription.EventSubscription
OnDepositGotRedemptionSignature installs a callback that is invoked when the signers sign off on a redemption
func (*TBTCLocalChain) OnDepositRedeemed ¶ added in v1.5.0
func (tlc *TBTCLocalChain) OnDepositRedeemed( handler func(depositAddress string), ) subscription.EventSubscription
OnDepositRedeemed installs a callback that is invoked when the redemption process is successful
func (*TBTCLocalChain) OnDepositRedemptionRequested ¶ added in v1.5.0
func (tlc *TBTCLocalChain) OnDepositRedemptionRequested( handler func(depositAddress string), ) subscription.EventSubscription
OnDepositRedemptionRequested installs a callback that is invoked when a redemption is requested.
func (*TBTCLocalChain) OnDepositRegisteredPubkey ¶ added in v1.5.0
func (tlc *TBTCLocalChain) OnDepositRegisteredPubkey( handler func(depositAddress string), ) subscription.EventSubscription
OnDepositRegisteredPubkey installs a callback that is invoked when a local-chain notification of a deposit registration is seen.
func (TBTCLocalChain) OperatorAddress ¶ added in v1.8.0
func (TBTCLocalChain) OperatorID ¶ added in v1.8.0
func (*TBTCLocalChain) PastDepositRedemptionRequestedEvents ¶ added in v1.5.0
func (tlc *TBTCLocalChain) PastDepositRedemptionRequestedEvents( startBlock uint64, depositAddress string, ) ([]*chain.DepositRedemptionRequestedEvent, error)
PastDepositRedemptionRequestedEvents the redemption requested events relevant to a particular deposit
func (*TBTCLocalChain) ProvideRedemptionProof ¶ added in v1.5.0
func (tlc *TBTCLocalChain) ProvideRedemptionProof( depositAddress string, txVersion [4]uint8, txInputVector []uint8, txOutputVector []uint8, txLocktime [4]uint8, merkleProof []uint8, txIndexInBlock *big.Int, bitcoinHeaders []uint8, ) error
ProvideRedemptionProof sets the redemption proof on a deposit and updates the state to Redeemed
func (*TBTCLocalChain) ProvideRedemptionSignature ¶ added in v1.5.0
func (tlc *TBTCLocalChain) ProvideRedemptionSignature( depositAddress string, v uint8, r [32]uint8, s [32]uint8, ) error
ProvideRedemptionSignature enriches the deposit with a redemption signature and moves the state to AwaitingWithdrawalProof
func (TBTCLocalChain) PublicKeyToOperatorID ¶ added in v1.8.0
func (*TBTCLocalChain) RedeemDeposit ¶ added in v1.5.0
func (tlc *TBTCLocalChain) RedeemDeposit(depositAddress string) error
RedeemDeposit initiates the redemption process which involves trading the system back the minted TBTC in exhange for the underlying BTC.
func (*TBTCLocalChain) RegisterAsMemberCandidate ¶ added in v1.5.0
func (tlc *TBTCLocalChain) RegisterAsMemberCandidate() error
RegisterAsMemberCandidate registers client as a candidate to be selected to a keep.
func (TBTCLocalChain) RequestSignature ¶ added in v1.7.0
func (*TBTCLocalChain) RetrieveSignerPubkey ¶ added in v1.5.0
func (tlc *TBTCLocalChain) RetrieveSignerPubkey(depositAddress string) error
RetrieveSignerPubkey enriches the referenced deposit with the signer public key and moves the state to AwaitingBtcFundingProof
func (*TBTCLocalChain) SetAlwaysFailingTransactions ¶ added in v1.5.0
func (tlc *TBTCLocalChain) SetAlwaysFailingTransactions(transactions ...string)
SetAlwaysFailingTransactions adds the supplied transactions to collection of always failing transactions
func (TBTCLocalChain) StakeMonitor ¶ added in v1.5.0
func (lc TBTCLocalChain) StakeMonitor() (corechain.StakeMonitor, error)
func (TBTCLocalChain) TBTCApplicationHandle ¶ added in v1.8.0
func (lc TBTCLocalChain) TBTCApplicationHandle() (chain.TBTCHandle, error)
func (TBTCLocalChain) TerminateKeep ¶ added in v1.5.0
func (TBTCLocalChain) UnmarshalID ¶ added in v1.8.0
func (*TBTCLocalChain) UpdateStatusForApplication ¶ added in v1.5.0
func (tlc *TBTCLocalChain) UpdateStatusForApplication() error
UpdateStatusForApplication implements the UpdateStatusForApplication method in the chain.TBTCHandle interface.