multisig

package
v7.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0, MIT Imports: 17 Imported by: 6

Documentation

Index

Constants

View Source
const SignersMax = 256

SignersMax is the maximum number of signers allowed in a multisig. If more are required, please use a combining tree of multisigs.

Variables

This section is empty.

Functions

func ComputeProposalHash

func ComputeProposalHash(txn *Transaction, hash func([]byte) [32]byte) ([]byte, error)

Computes a digest of a proposed transaction. This digest is used to confirm identity of the transaction associated with an ID, which might change under chain re-orgs.

Types

type Actor

type Actor struct{}

func (Actor) AddSigner

func (a Actor) AddSigner(rt runtime.Runtime, params *AddSignerParams) *abi.EmptyValue

func (Actor) Approve

func (a Actor) Approve(rt runtime.Runtime, params *TxnIDParams) *ApproveReturn

func (Actor) Cancel

func (a Actor) Cancel(rt runtime.Runtime, params *TxnIDParams) *abi.EmptyValue

func (Actor) ChangeNumApprovalsThreshold

func (a Actor) ChangeNumApprovalsThreshold(rt runtime.Runtime, params *ChangeNumApprovalsThresholdParams) *abi.EmptyValue

func (Actor) Code

func (a Actor) Code() cid.Cid

func (Actor) Constructor

func (a Actor) Constructor(rt runtime.Runtime, params *ConstructorParams) *abi.EmptyValue

func (Actor) Exports

func (a Actor) Exports() []interface{}

func (Actor) LockBalance

func (a Actor) LockBalance(rt runtime.Runtime, params *LockBalanceParams) *abi.EmptyValue

func (Actor) Propose

func (a Actor) Propose(rt runtime.Runtime, params *ProposeParams) *ProposeReturn

func (Actor) RemoveSigner

func (a Actor) RemoveSigner(rt runtime.Runtime, params *RemoveSignerParams) *abi.EmptyValue

func (Actor) State

func (a Actor) State() cbor.Er

func (Actor) SwapSigner

func (a Actor) SwapSigner(rt runtime.Runtime, params *SwapSignerParams) *abi.EmptyValue

type AddSignerParams

type AddSignerParams = multisig0.AddSignerParams
type AddSignerParams struct {
	Signer   addr.Address
	Increase bool
}

type ApproveReturn

type ApproveReturn = multisig0.ApproveReturn
type ApproveReturn struct {
	// Applied indicates if the transaction was applied as opposed to proposed but not applied due to lack of approvals
	Applied bool
	// Code is the exitcode of the transaction, if Applied is false this field should be ignored.
	Code exitcode.ExitCode
	// Ret is the return vale of the transaction, if Applied is false this field should be ignored.
	Ret []byte
}

type ChangeNumApprovalsThresholdParams

type ChangeNumApprovalsThresholdParams = multisig0.ChangeNumApprovalsThresholdParams
type ChangeNumApprovalsThresholdParams struct {
	NewThreshold uint64
}

type ConstructorParams

type ConstructorParams = multisig2.ConstructorParams
type ConstructorParams struct {
	Signers               []addr.Address
	NumApprovalsThreshold uint64
	UnlockDuration        abi.ChainEpoch
	StartEpoch            abi.ChainEpoch
}

type LockBalanceParams

type LockBalanceParams = multisig0.LockBalanceParams
type LockBalanceParams struct {
	StartEpoch abi.ChainEpoch
	UnlockDuration abi.ChainEpoch
	Amount abi.TokenAmount
}

type ProposalHashData

type ProposalHashData = multisig0.ProposalHashData

Data for a BLAKE2B-256 to be attached to methods referencing proposals via TXIDs. Ensures the existence of a cryptographic reference to the original proposal. Useful for offline signers and for protection when reorgs change a multisig TXID.

Requester - The requesting multisig wallet member. All other fields - From the "Transaction" struct.

type ProposalHashData struct {
	Requester addr.Address
	To        addr.Address
	Value     abi.TokenAmount
	Method    abi.MethodNum
	Params    []byte
}

type ProposeParams

type ProposeParams = multisig0.ProposeParams
type ProposeParams struct {
	To     addr.Address
	Value  abi.TokenAmount
	Method abi.MethodNum
	Params []byte
}

type ProposeReturn

type ProposeReturn = multisig0.ProposeReturn
type ProposeReturn struct {
	// TxnID is the ID of the proposed transaction
	TxnID TxnID
	// Applied indicates if the transaction was applied as opposed to proposed but not applied due to lack of approvals
	Applied bool
	// Code is the exitcode of the transaction, if Applied is false this field should be ignored.
	Code exitcode.ExitCode
	// Ret is the return vale of the transaction, if Applied is false this field should be ignored.
	Ret []byte
}

type RemoveSignerParams

type RemoveSignerParams = multisig0.RemoveSignerParams
type RemoveSignerParams struct {
	Signer   addr.Address
	Decrease bool
}

type State

type State struct {
	Signers               []address.Address // Signers must be canonical ID-addresses.
	NumApprovalsThreshold uint64
	NextTxnID             TxnID

	// Linear unlock
	InitialBalance abi.TokenAmount
	StartEpoch     abi.ChainEpoch
	UnlockDuration abi.ChainEpoch

	PendingTxns cid.Cid // HAMT[TxnID]Transaction
}

func (*State) AmountLocked

func (st *State) AmountLocked(elapsedEpoch abi.ChainEpoch) abi.TokenAmount

func (*State) IsSigner

func (st *State) IsSigner(address address.Address) bool

Tests whether an address is in the list of signers.

func (*State) MarshalCBOR

func (t *State) MarshalCBOR(w io.Writer) error

func (*State) PurgeApprovals

func (st *State) PurgeApprovals(store adt.Store, addr address.Address) error

Iterates all pending transactions and removes an address from each list of approvals, if present. If an approval list becomes empty, the pending transaction is deleted.

func (*State) SetLocked

func (st *State) SetLocked(startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, lockedAmount abi.TokenAmount)

func (*State) UnmarshalCBOR

func (t *State) UnmarshalCBOR(r io.Reader) error

type StateSummary

type StateSummary struct {
	PendingTxnCount       uint64
	NumApprovalsThreshold uint64
	SignerCount           int
}

func CheckStateInvariants

func CheckStateInvariants(st *State, store adt.Store) (*StateSummary, *builtin.MessageAccumulator)

Checks internal invariants of multisig state.

type StringKey

type StringKey string

An adt.Map key that just preserves the underlying string.

func (StringKey) Key

func (k StringKey) Key() string

type SwapSignerParams

type SwapSignerParams = multisig0.SwapSignerParams
type SwapSignerParams struct {
	From addr.Address
	To   addr.Address
}

type Transaction

type Transaction = multisig0.Transaction
type Transaction struct {
	To     addr.Address
	Value  abi.TokenAmount
	Method abi.MethodNum
	Params []byte

	// This address at index 0 is the transaction proposer, order of this slice must be preserved.
	Approved []addr.Address
}

type TxnID

type TxnID = multisig0.TxnID

func ParseTxnIDKey

func ParseTxnIDKey(key string) (TxnID, error)

type TxnIDParams

type TxnIDParams = multisig0.TxnIDParams
type TxnIDParams struct {
	ID TxnID
	// Optional hash of proposal to ensure an operation can only apply to a
	// specific proposal.
	ProposalHash []byte
}

Jump to

Keyboard shortcuts

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