ledger

package
v0.6.2-testnet Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AmountIndexTokenBalance = byte(iota)
	AmountIndexInflation
	AmountIndexFrozenCoverage
)
View Source
const (
	TrieArity    = common.PathArity16
	TrieHashSize = trie_blake2b.HashSize256
)
View Source
const (
	DefaultTickDuration = 80 * time.Millisecond

	DustPerProxi         = 1_000_000
	PRXI                 = DustPerProxi
	InitialSupplyProxi   = 1_000_000_000
	DefaultInitialSupply = InitialSupplyProxi * PRXI

	DefaultTransactionPace          = 12
	DefaultTransactionPaceSequencer = 2
)
View Source
const (
	TransactionBranch = byte(iota)
	ConsumedBranch
)

Top level branches

View Source
const (
	TxInputIDs = byte(iota)
	TxUnlockData
	TxOutputs
	TxSignature
	TxSequencerAndStemOutputIndices
	TxTimestamp
	TxInputCommitment
	TxEndorsements
	TxExplicitBaseline
	TxLocalLibraries
	TxTreeIndexMax
)

Transaction tree

View Source
const (
	ConstraintIndexAmounts = byte(iota)
	ConstraintIndexLock
	ConstraintIndexFirstOptionalConstraint
)

Mandatory output block indices

View Source
const (
	EnsureStopDelegationName       = "ensureStopDelegation"
	EnsureStopDelegationTemplate   = EnsureStopDelegationName + "(0x%s)"
	EnsureStopDelegationTemplateHR = EnsureStopDelegationName + "(%s)"
)
View Source
const (
	BootstrapSequencerName = "boot"
	// BoostrapSequencerIDHex is a constant
	BoostrapSequencerIDHex = "8739faa34a6902e49bc16455bbd642fd3c649e8959d97089e43f214ca57ea0e5"
)
View Source
const (
	DelegateLockName       = "delegateLock"
	DelegateLockTemplate   = DelegateLockName + "(%s, %s, %s, z16/%d)"
	DelegateLockTemplateHR = DelegateLockName + "(target=%s, master=%s, maxFreezeEpochs=%d, inflationShare=%d%%%%)"

	DelegateLockStateName       = "delegateLockState"
	DelegateLockStateTemplate   = DelegateLockStateName + "(z32/%d, %d)"
	DelegateLockStateTemplateHR = DelegateLockStateName + "(frozenUntilEpoch=%d, state=%s)"

	DelegateLockStateUndef  = byte(0)
	DelegateLockStateFrozen = byte(1)
	DelegateLockStateOnHold = byte(2)

	DelegationUnlockedByTarget = byte(0)
	DelegationUnlockedByMaster = byte(0xff)
)
View Source
const (
	//AddressED25519Name     = "addressED25519"
	AddressED25519Name = "a"
)
View Source
const AmountsConstraintName = "amounts"
View Source
const (
	ChainConstraintName = "chain"
)
View Source
const (
	//ChainLockName     = "chainLock"
	ChainLockName = "c"
)
View Source
const (
	CommitToSiblingName = "commitToSibling"
)
View Source
const ConditionalLockName = "conditionalLock"
View Source
const ConsumedOutputsBranch = byte(0)
View Source
const (
	DeadlineLockName = "deadlineLock"
)
View Source
const (
	ImmutableName = "immutable"
)
View Source
const SeqMilestoneDataFixedIndex = 4
View Source
const (
	SequencerConstraintName = "sequencer"
)
View Source
const (
	StemLockName = "stemLock"
)
View Source
const (
	TagAlongLockName = "tagAlong"
)
View Source
const (
	TimelockName = "timelock"
)
View Source
const (
	TotalAmountConstraintName = "total"
)

Variables

View Source
var (
	PathToConsumedOutputs               = tuples.Path(ConsumedBranch, ConsumedOutputsBranch)
	PathToProducedOutputs               = tuples.Path(TransactionBranch, TxOutputs)
	PathToUnlockParams                  = tuples.Path(TransactionBranch, TxUnlockData)
	PathToInputIDs                      = tuples.Path(TransactionBranch, TxInputIDs)
	PathToSignature                     = tuples.Path(TransactionBranch, TxSignature)
	PathToSequencerAndStemOutputIndices = tuples.Path(TransactionBranch, TxSequencerAndStemOutputIndices)
	PathToInputCommitment               = tuples.Path(TransactionBranch, TxInputCommitment)
	PathToEndorsements                  = tuples.Path(TransactionBranch, TxEndorsements)
	PathToExplicitBaseline              = tuples.Path(TransactionBranch, TxExplicitBaseline)
	PathToLocalLibraries                = tuples.Path(TransactionBranch, TxLocalLibraries)
	PathToTimestamp                     = tuples.Path(TransactionBranch, TxTimestamp)
)
View Source
var FinishChainUnlockParams = []byte{0xff, 0xff}
View Source
var NilTimelock = Timelock(0)
View Source
var StemAccountID = AccountID([]byte{0})

Functions

func AddressED25519MatchesPrivateKey

func AddressED25519MatchesPrivateKey(addr AddressED25519, privateKey ed25519.PrivateKey) bool

func AdjustedAmount

func AdjustedAmount(amount uint64, slot uint32) uint64

AdjustedAmount calculates amount adjusted to the maximum inflation. I.e. adjusted amount A as a result to maximal inflation in 'slot' slots reaches 'amount' If amount == totalSupply, then adjusted amount == initialSupply TODO experimental

  • consider name 'real supply/amount/balance'
  • consider adjustment of the branch inflation bonus

func BelongsToAccount

func BelongsToAccount(lock Lock, acc Accountable) bool

func BranchInflationBonus

func BranchInflationBonus(proof []byte) uint64

func ChainInflation

func ChainInflation(amount uint64, inSlot, forSlots uint32) uint64

func ChainInflationOneSlot

func ChainInflationOneSlot(amount uint64, inSlot uint32) uint64

func ClockTime

func ClockTime(t base.LedgerTime) time.Time

func ConstantsYAMLFromParams

func ConstantsYAMLFromParams(par InitParameters) []byte

func Coverage

func Coverage(o *Output, oid base.OutputID, txTs base.LedgerTime) (coverage, frozen uint64)

Coverage returns for the consumed output in the transaction with specified timestamp - coverage presented by the output, which includes frozen coverage part - frozen part separately

func DefaultStorageDeposit

func DefaultStorageDeposit() uint64

DefaultStorageDeposit not always enough

func EmbedHardcoded

func EmbedHardcoded(lib *easyfl.Library[*EvalContext]) error

EmbedHardcoded upgrades library with hardcoded (embedded) functions of the proxima ledger

func EqualAccountables

func EqualAccountables(a1, a2 Accountable) bool

func EqualConstraints

func EqualConstraints(l1, l2 Constraint) bool

func GetEmbeddedFunctionResolver

func GetEmbeddedFunctionResolver(lib *easyfl.Library[*EvalContext]) func(sym string) easyfl.EmbeddedFunction[*EvalContext]

func HashOutputs

func HashOutputs(outs ...*Output) [32]byte

HashOutputs calculates input commitment from outputs: the hash of lazyarray composed of output data

func InitWithTestingLedgerIDData

func InitWithTestingLedgerIDData(opts ...ParametersOption) ed25519.PrivateKey

func LibraryYAMLFromParameters

func LibraryYAMLFromParameters(id InitParameters, compiled bool) []byte

func MinimumInflatableAmount

func MinimumInflatableAmount(slot uint32) uint64

func MinimumStorageDeposit

func MinimumStorageDeposit(o *Output) uint64

func MustInitSingleton

func MustInitSingleton(identityData []byte)

func NameByPrefix

func NameByPrefix(prefix []byte) (string, bool)

func NewChainLockUnlockParams

func NewChainLockUnlockParams(predChainOutputIndex, predChainConstraintIndex byte) []byte

func NewChainUnlockParams

func NewChainUnlockParams(successorOutputIdx, successorConstraintIndex byte) []byte

NewChainUnlockParams unlock parameters for the chain constraint. 3 bytes: 0 - successor output index 1 - successor block index 2 - transition mode must be equal to the transition mode in the successor constraint data

func NewTagAlongLockUnlockParams

func NewTagAlongLockUnlockParams(predChainOutputIndex, predChainConstraintIndex, unlockMode byte) []byte

func OriginChainID

func OriginChainID() base.ChainID

func OutputFromBytesMain

func OutputFromBytesMain(data []byte) (*Output, Amounts, Lock, error)

func OutputsWithIDToString

func OutputsWithIDToString(outs ...*OutputWithID) string

func ParseLibraryFromYAML

func ParseLibraryFromYAML(
	yamlData []byte,
	getResolver ...func(lib *easyfl.Library[*EvalContext],
	) func(sym string) easyfl.EmbeddedFunction[*EvalContext]) (*easyfl.Library[*EvalContext], error)

func ParseSequencerData

func ParseSequencerData(o *Output) (ret seqdata.SequencerData, err error)

ParseSequencerData expected at index 4

func RandomFromSeed

func RandomFromSeed(data []byte, scale uint64) uint64

RandomFromSeed returns a random uin64 number in [0, scale) by scaling the data value as BigInt to the interval [0, scale). The 'scale' value itself is not included It is used to extract a verifiable random uint64 from a ED25519 signature.

func SlotDuration

func SlotDuration() time.Duration

func SlotNow

func SlotNow() uint32

func TickDuration

func TickDuration() time.Duration

func TimeFromClockTime

func TimeFromClockTime(nowis time.Time) base.LedgerTime

func TimeNow

func TimeNow() base.LedgerTime

func TokenBalanceFromAmountsBytes

func TokenBalanceFromAmountsBytes(data []byte) (int64, error)

func TooCloseOnTimeAxis

func TooCloseOnTimeAxis(txid1, txid2 base.TransactionID) bool

func UnixNanoFromLedgerTime

func UnixNanoFromLedgerTime(t base.LedgerTime) int64

func ValidSequencerPace

func ValidSequencerPace(t1, t2 base.LedgerTime) bool

ValidSequencerPace return true if input and target sequencer tx timestamps make a valid pace

func ValidTransactionPace

func ValidTransactionPace(t1, t2 base.LedgerTime) bool

ValidTransactionPace return true if input and target non-sequencer tx timestamps make a valid pace

Types

type AccountID

type AccountID []byte

func (AccountID) Bytes

func (acc AccountID) Bytes() []byte

type Accountable

type Accountable interface {
	Constraint
	AccountID() AccountID
	AsLock() Lock
}

func AccountableFromBytes

func AccountableFromBytes(data []byte) (Accountable, error)

func AccountableFromSource

func AccountableFromSource(src string) (Accountable, error)

func NoDuplicatesAccountables

func NoDuplicatesAccountables(acc []Accountable) []Accountable

type AddressED25519

type AddressED25519 []byte

func AddressED25519FromBytes

func AddressED25519FromBytes(data []byte) (AddressED25519, error)

func AddressED25519FromPrivateKey

func AddressED25519FromPrivateKey(privateKey ed25519.PrivateKey) AddressED25519

func AddressED25519FromPublicKey

func AddressED25519FromPublicKey(pubKey ed25519.PublicKey) AddressED25519

func AddressED25519FromSource

func AddressED25519FromSource(src string) (AddressED25519, error)

func AddressED25519Null

func AddressED25519Null() AddressED25519

func AddressED25519Random

func AddressED25519Random() AddressED25519

func AddressesED25519FromPrivateKeys

func AddressesED25519FromPrivateKeys(privateKeys []ed25519.PrivateKey) []AddressED25519

func (AddressED25519) AccountID

func (a AddressED25519) AccountID() AccountID

func (AddressED25519) Accounts

func (a AddressED25519) Accounts() []Accountable

func (AddressED25519) AsLock

func (a AddressED25519) AsLock() Lock

func (AddressED25519) Bytes

func (a AddressED25519) Bytes() []byte

func (AddressED25519) Clone

func (a AddressED25519) Clone() AddressED25519

func (AddressED25519) Master

func (a AddressED25519) Master() Accountable

func (AddressED25519) Name

func (a AddressED25519) Name() string

func (AddressED25519) Short

func (a AddressED25519) Short() string

func (AddressED25519) Source

func (a AddressED25519) Source() string

func (AddressED25519) String

func (a AddressED25519) String() string

type Amounts

type Amounts []int64

func AmountsFromBytes

func AmountsFromBytes(data []byte) (Amounts, error)

func NewAmounts

func NewAmounts(args ...int64) Amounts

func (Amounts) AddToVector

func (a Amounts) AddToVector(vect *[15]int64) (overflow bool)

AddToVector adds amounts to vector with safe arithmetics Returns false in case of arithmetic overflow, but does not panic It is up to the caller to process overflow

func (Amounts) Amount

func (a Amounts) Amount(i byte) (ret int64)

func (Amounts) Bytes

func (a Amounts) Bytes() []byte

func (Amounts) FrozenCoverageAt

func (a Amounts) FrozenCoverageAt(i byte) (ret int64)

func (Amounts) FrozenCoverageVector

func (a Amounts) FrozenCoverageVector() []int64

func (Amounts) InflationAmount

func (a Amounts) InflationAmount() uint64

func (Amounts) IsFrozenCoverageZero

func (a Amounts) IsFrozenCoverageZero() bool

func (Amounts) Name

func (a Amounts) Name() string

func (Amounts) Source

func (a Amounts) Source() string

func (Amounts) String

func (a Amounts) String() string

func (Amounts) TokenBalance

func (a Amounts) TokenBalance() uint64

type ChainConstraint

type ChainConstraint struct {
	// ChainID all-0 for origin
	ChainID base.ChainID
	// Predecessor output index with the same ChainID. Must be 0xFF for the origin
	PredecessorInputIndex byte
	// Predecessor constraint index. Must be 0xff for the origin
	PredecessorConstraintIndex byte
	// slot of the origin chain output
	OriginSlot uint32
	// amount on the chain at the origin
	OriginAmount uint64
}

ChainConstraint is a chain constraint

func ChainConstraintFromBytes

func ChainConstraintFromBytes(data []byte) (*ChainConstraint, error)

func NewChainConstraint

func NewChainConstraint(id base.ChainID, predOutputIndex, predConstraintIndex byte, originSlot uint32, originAmount uint64) *ChainConstraint

func NewChainOrigin

func NewChainOrigin(startSlot uint32, startAmount uint64) *ChainConstraint

func (*ChainConstraint) Bytes

func (cc *ChainConstraint) Bytes() []byte

func (*ChainConstraint) IsOrigin

func (cc *ChainConstraint) IsOrigin() bool

func (*ChainConstraint) Name

func (cc *ChainConstraint) Name() string

func (*ChainConstraint) Source

func (cc *ChainConstraint) Source() string

func (*ChainConstraint) String

func (cc *ChainConstraint) String() string

type ChainConstraintData

type ChainConstraintData struct {
	ChainConstraint
	ChainConstraintIndex byte
}

func ExtractChainData

func ExtractChainData(o *Output, oid base.OutputID) (chainConstraintData ChainConstraintData, ok bool)

type ChainLock

type ChainLock []byte

func ChainLockFromBytes

func ChainLockFromBytes(data []byte) (ChainLock, error)

func ChainLockFromChainID

func ChainLockFromChainID(chainID base.ChainID) ChainLock

func (ChainLock) AccountID

func (cl ChainLock) AccountID() AccountID

func (ChainLock) Accounts

func (cl ChainLock) Accounts() []Accountable

func (ChainLock) AsLock

func (cl ChainLock) AsLock() Lock

func (ChainLock) Bytes

func (cl ChainLock) Bytes() []byte

func (ChainLock) ChainID

func (cl ChainLock) ChainID() base.ChainID

func (ChainLock) Master

func (cl ChainLock) Master() Accountable

func (ChainLock) Name

func (cl ChainLock) Name() string

func (ChainLock) Source

func (cl ChainLock) Source() string

func (ChainLock) String

func (cl ChainLock) String() string

type CommitToSibling

type CommitToSibling struct {
	SiblingIndex byte
	SiblingHash  []byte
}

func CommitToSiblingFromBytes

func CommitToSiblingFromBytes(data []byte) (*CommitToSibling, error)

func NewCommitToSibling

func NewCommitToSibling(siblingIndex byte, siblingHash []byte) *CommitToSibling

func (*CommitToSibling) Bytes

func (cs *CommitToSibling) Bytes() []byte

func (*CommitToSibling) Name

func (cs *CommitToSibling) Name() string

func (*CommitToSibling) Source

func (cs *CommitToSibling) Source() string

func (*CommitToSibling) String

func (cs *CommitToSibling) String() string

type ConditionalLock

type ConditionalLock struct {
	Conditions [4]Constraint
	Locks      [4]Accountable
}

ConditionalLock enforces condition by selecting first of up to 4 satisfied conditions and evaluating corresponding accountable lock

func ConditionalLockFromBytes

func ConditionalLockFromBytes(data []byte) (*ConditionalLock, error)

func NewConditionalLock

func NewConditionalLock(conds []Constraint, locks []Accountable) (*ConditionalLock, error)

func (*ConditionalLock) Accounts

func (c *ConditionalLock) Accounts() []Accountable

func (*ConditionalLock) Bytes

func (c *ConditionalLock) Bytes() []byte

func (*ConditionalLock) Master

func (c *ConditionalLock) Master() Accountable

func (*ConditionalLock) Name

func (c *ConditionalLock) Name() string

func (*ConditionalLock) Source

func (c *ConditionalLock) Source() string

func (*ConditionalLock) String

func (c *ConditionalLock) String() string

type Constants

type Constants struct {
	Hash [32]byte
	// arbitrary string up 255 bytes
	Description string
	// genesis time unix seconds
	GenesisTimeUnix uint32
	// ED25519 public key of the controller
	GenesisControllerPublicKey ed25519.PublicKey
	// time tick duration in nanoseconds
	TickDuration time.Duration
	TicksPerSlot uint64
	// initial supply of tokens
	InitialSupply uint64
	// ----------- begin inflation-related
	SlotInflationBase        uint64 // inflation of the total initial supply in slot 0
	MinimumInflatableAmount0 uint64 // initial supply / slot inflation base
	// BranchInflationBonusBase inflation bonus
	BranchInflationBonusBase uint64
	// ----------- end inflation-related
	// number of ticks between non-sequencer transactions
	TransactionPace byte
	// number of ticks between sequencer transactions
	TransactionPaceSequencer byte
	// this limits number of sequencers in the network. Reasonable amount would be few hundreds of sequencers
	MinimumAmountOnSequencer uint64
	// limit maximum number of endorsements. For determinism
	MaxNumberOfEndorsements uint64
	// PreBranchConsolidationTicks enforces endorsement-only constraint for specified amount of ticks
	// before the slot boundary. It means, sequencer transaction can have only one input, its own predecessor
	// for any transaction with timestamp ticks > MaxTickValueInSlot - PreBranchConsolidationTicks
	// value 0 of PreBranchConsolidationTicks effectively means no constraint
	PreBranchConsolidationTicks  uint8
	PostBranchConsolidationTicks uint8
	// -------------- delegation related
	// number of slots where target cannot consume delegation output
	SafeRevocationSlots uint32
	// number of slot in the delegation epoch
	DelegationEpochSlots uint32
	// maximum number of frozen epochs
	MaxFrozenEpochs uint32
	// ---------- tag-along related
	TagAlongSlots        uint32
	TagAlongReclaimSlots uint32
}

Constants contains constant values of the ledger

var Const *Constants

func ConstantsFromLibrary

func ConstantsFromLibrary(lib *easyfl.Library[*EvalContext]) *Constants

func (*Constants) AdjustFrozenCoverageVector

func (c *Constants) AdjustFrozenCoverageVector(targetID base.ChainID, vect []int64, predTs, succTs base.LedgerTime) []int64

func (*Constants) CoveredSlotsInCurrentEpoch

func (c *Constants) CoveredSlotsInCurrentEpoch(targetID base.ChainID, slot uint32) uint32

CoveredSlotsInCurrentEpoch returns how many slots are covered in the current epoch defined by txSlot and taking into account the offset calculated from the target

func (*Constants) DiffEpochs

func (c *Constants) DiffEpochs(targetID base.ChainID, ts1, ts2 base.LedgerTime) int

DiffEpochs return ts1 - ts2 in delegation epochs

func (*Constants) EnsurePostBranchConsolidationConstraintTimestamp

func (c *Constants) EnsurePostBranchConsolidationConstraintTimestamp(ts base.LedgerTime) base.LedgerTime

func (*Constants) EpochFromSlotDirect

func (c *Constants) EpochFromSlotDirect(targetID base.ChainID, slot uint32) (epoch uint32)

EpochFromSlotDirect which delegation epoch slot belongs to

func (*Constants) EpochFromSlotFromSource

func (c *Constants) EpochFromSlotFromSource(targetID base.ChainID, slot uint32) (epoch uint32)

EpochFromSlotFromSource which delegation epoch slot belongs to

func (*Constants) EpochLimits

func (c *Constants) EpochLimits(targetID base.ChainID, epoch uint32) (firstSlot, lastSlot uint32)

func (*Constants) EpochOffsetSlotsDirect

func (c *Constants) EpochOffsetSlotsDirect(targetID base.ChainID) uint32

EpochOffsetSlotsDirect returns slot offset unique for the delegation target chain ChainID. Each chain ChainID defines own grid of epochs. It spreads delegation output consumption among sequencers

func (*Constants) EpochOffsetSlotsFromSource

func (c *Constants) EpochOffsetSlotsFromSource(targetID base.ChainID) uint32

func (*Constants) FrozenSlotsFromFrozenEpochs

func (c *Constants) FrozenSlotsFromFrozenEpochs(target base.ChainID, txSlot uint32, frozenEpochs byte) uint32

func (*Constants) GenesisControlledAddress

func (c *Constants) GenesisControlledAddress() AddressED25519

func (*Constants) GenesisTime

func (c *Constants) GenesisTime() time.Time

func (*Constants) GenesisTimeUnixNano

func (c *Constants) GenesisTimeUnixNano() int64

func (*Constants) IsPostBranchConsolidationTimestamp

func (c *Constants) IsPostBranchConsolidationTimestamp(ts base.LedgerTime) bool

func (*Constants) IsPreBranchConsolidationTimestamp

func (c *Constants) IsPreBranchConsolidationTimestamp(ts base.LedgerTime) bool

func (*Constants) LastSlotInEpochDirect

func (c *Constants) LastSlotInEpochDirect(targetID base.ChainID, epoch uint32) (lastSlot uint32)

func (*Constants) LastSlotInEpochFromSource

func (c *Constants) LastSlotInEpochFromSource(targetID base.ChainID, epoch uint32) (lastSlot uint32)

func (*Constants) LedgerTimeFromClockTime

func (c *Constants) LedgerTimeFromClockTime(nowis time.Time) base.LedgerTime

func (*Constants) Lines

func (c *Constants) Lines(prefix ...string) *lines.Lines

func (*Constants) SlotDuration

func (c *Constants) SlotDuration() time.Duration

func (*Constants) SlotsPerDay

func (c *Constants) SlotsPerDay() int

func (*Constants) SlotsPerYear

func (c *Constants) SlotsPerYear() int

func (*Constants) String

func (c *Constants) String() string

func (*Constants) TicksPerYear

func (c *Constants) TicksPerYear() int

func (*Constants) TimeConstantsToString

func (c *Constants) TimeConstantsToString() string

func (*Constants) TimeToTicksSinceGenesis

func (c *Constants) TimeToTicksSinceGenesis(nowis time.Time) int64

TimeToTicksSinceGenesis converts time value into ticks since genesis

type Constraint

type Constraint interface {
	Name() string   // EasyFL function name in the ledger library
	Bytes() []byte  // bytecode, compiled from EasyFL source
	Source() string // EasyFL source
	String() string // human-readable
}

func ConstraintFromBytes

func ConstraintFromBytes(data []byte) (Constraint, error)

type ConstraintParser

type ConstraintParser func([]byte) (Constraint, error)

type DeadlineLock

type DeadlineLock struct {
	Deadline         uint32
	ConstraintMain   Accountable
	ConstraintExpiry Accountable
}

func DeadlineLockFromBytes

func DeadlineLockFromBytes(data []byte) (*DeadlineLock, error)

func NewDeadlineLock

func NewDeadlineLock(deadline uint32, main, expiry Accountable) *DeadlineLock

func (*DeadlineLock) Accounts

func (dl *DeadlineLock) Accounts() []Accountable

func (*DeadlineLock) Bytes

func (dl *DeadlineLock) Bytes() []byte

func (*DeadlineLock) Master

func (dl *DeadlineLock) Master() Accountable

func (*DeadlineLock) Name

func (dl *DeadlineLock) Name() string

func (*DeadlineLock) Source

func (dl *DeadlineLock) Source() string

func (*DeadlineLock) String

func (dl *DeadlineLock) String() string

type DelegateLock

type DelegateLock struct {
	Target                 ChainLock
	MasterLock             Accountable
	MaxFrozenEpochs        byte
	RequiredInflationShare uint16 // in promille, <= 1000
}

func Delegate2LockFromBytes

func Delegate2LockFromBytes(data []byte) (*DelegateLock, error)

func NewDelegateLock

func NewDelegateLock(target ChainLock, master Accountable, maxFreezeEpochs byte, requiredInflationShare uint16) *DelegateLock

func (*DelegateLock) Accounts

func (d *DelegateLock) Accounts() []Accountable

func (*DelegateLock) Bytes

func (d *DelegateLock) Bytes() []byte

func (*DelegateLock) Master

func (d *DelegateLock) Master() Accountable

func (*DelegateLock) Name

func (d *DelegateLock) Name() string

func (*DelegateLock) Source

func (d *DelegateLock) Source() string

func (*DelegateLock) String

func (d *DelegateLock) String() string

type DelegateLockState

type DelegateLockState struct {
	LastFrozenEpoch uint32
	State           byte
}

func DelegateLockStateFromBytes

func DelegateLockStateFromBytes(data []byte) (DelegateLockState, error)

func (DelegateLockState) Bytes

func (d DelegateLockState) Bytes() []byte

func (DelegateLockState) Name

func (d DelegateLockState) Name() string

func (DelegateLockState) Source

func (d DelegateLockState) Source() string

func (DelegateLockState) String

func (d DelegateLockState) String() string

type DelegationOutput

type DelegationOutput struct {
	OutputWithChainID
	DelegateLock
	DelegateLockState
}

func AsDelegationOutput

func AsDelegationOutput(o *Output, oid base.OutputID) (ret DelegationOutput, ok bool)

func DelegationOutputFromOutputWithChainID

func DelegationOutputFromOutputWithChainID(o *OutputWithChainID) (ret DelegationOutput, ok bool)

func (*DelegationOutput) FreezeUntilMax

func (o *DelegationOutput) FreezeUntilMax(ts base.LedgerTime) (freezeUntilEpoch uint32)

func (*DelegationOutput) FrozenEpochs

func (o *DelegationOutput) FrozenEpochs(txTs base.LedgerTime) (from, to, total uint32)

func (*DelegationOutput) FrozenSlots

func (o *DelegationOutput) FrozenSlots(txTs ...base.LedgerTime) (from, to, total uint32)

func (*DelegationOutput) InflationOneSlot

func (o *DelegationOutput) InflationOneSlot() uint64

func (*DelegationOutput) IsInFrozenSlot

func (o *DelegationOutput) IsInFrozenSlot(slot uint32) bool

IsInFrozenSlot true means only target can consume it in the slot

func (*DelegationOutput) IsInSafeRevocationWindow

func (o *DelegationOutput) IsInSafeRevocationWindow(txSlot uint32) bool

func (*DelegationOutput) IsMarkedFrozen

func (o *DelegationOutput) IsMarkedFrozen() bool

func (*DelegationOutput) IsMarkedOnHold

func (o *DelegationOutput) IsMarkedOnHold() bool

func (*DelegationOutput) IsUnlockableByMaster

func (o *DelegationOutput) IsUnlockableByMaster(txSlot uint32) bool

func (*DelegationOutput) IsUnlockableByTarget

func (o *DelegationOutput) IsUnlockableByTarget(txSlot uint32) bool

IsUnlockableByTarget true if it is not revoked and not in the safe revocation window

func (*DelegationOutput) IsUnlockableByTargetForFreezing

func (o *DelegationOutput) IsUnlockableByTargetForFreezing(txSlot uint32) bool

func (*DelegationOutput) IsUnlockableByTargetWithReason

func (o *DelegationOutput) IsUnlockableByTargetWithReason(txSlot uint32) (valid bool, err error)

IsUnlockableByTargetWithReason returns:

  • false, <reason> if permanently unclockable,
  • true, <reason> if temporarily unlockable

func (*DelegationOutput) LinesDelegationData

func (o *DelegationOutput) LinesDelegationData(prefix ...string) *lines.Lines

func (*DelegationOutput) LinesHRFull

func (o *DelegationOutput) LinesHRFull(prefix ...string) *lines.Lines

func (*DelegationOutput) LinesSourceFull

func (o *DelegationOutput) LinesSourceFull(prefix ...string) *lines.Lines

func (*DelegationOutput) MakeDelegationFreezeOutput

func (o *DelegationOutput) MakeDelegationFreezeOutput(txTs base.LedgerTime, freezeUntilEpoch uint32, predOutputIndex byte, advance uint64, disableConsistencyCheck ...bool) (ret *Output, err error)

MakeDelegationFreezeOutput constructs successor of the delegation output using maximum possible frozen epochs

func (*DelegationOutput) MakeDelegationRevokeOutput

func (o *DelegationOutput) MakeDelegationRevokeOutput(par MakeDelegationRevokeOutputParams) (*Output, error)

MakeDelegationRevokeOutput error means reason why it cannot be constructed in particular situation

func (*DelegationOutput) MakeFrozenCoverageAmountDeltasForRevoking

func (o *DelegationOutput) MakeFrozenCoverageAmountDeltasForRevoking(txTs base.LedgerTime) []int64

func (*DelegationOutput) MakeFrozenCoverageAmounts

func (o *DelegationOutput) MakeFrozenCoverageAmounts(frozenEpochs byte, tokenBalance uint64) ([]int64, error)

func (*DelegationOutput) ProjectedInflation

func (o *DelegationOutput) ProjectedInflation(txTs base.LedgerTime, frozenEpochs byte) uint64

ProjectedInflation max inflation that could be generated on the output for a number of frozen epochs

func (*DelegationOutput) RequiredMinimumInflationAdvance

func (o *DelegationOutput) RequiredMinimumInflationAdvance(txTs base.LedgerTime, freezeUntilEpoch uint32) (uint64, error)

func (*DelegationOutput) RequiredMinimumInflationAdvanceByFrozenEpochs

func (o *DelegationOutput) RequiredMinimumInflationAdvanceByFrozenEpochs(txTs base.LedgerTime, frozenEpochs uint32) (uint64, error)

func (*DelegationOutput) RequiredMinimumInflationAdvanceOriginal

func (o *DelegationOutput) RequiredMinimumInflationAdvanceOriginal(txTs base.LedgerTime, frozenEpochs byte) uint64

RequiredMinimumInflationAdvanceOriginal calculates how big advance requires the delegation output for freezing it, as calculated from immutable MinInflationAdvancePerFullEpoch value on it

func (*DelegationOutput) RevocationCompensationEstimate

func (o *DelegationOutput) RevocationCompensationEstimate(txSlot uint32) uint64

func (*DelegationOutput) SafeRevocationWindow

func (o *DelegationOutput) SafeRevocationWindow() (from, to uint32, applicable bool)

func (*DelegationOutput) UnfreezeSlot

func (o *DelegationOutput) UnfreezeSlot() uint32

type EnsureStopDelegation

type EnsureStopDelegation struct {
	base.ChainID
}

func EnsureStopDelegationFromBytes

func EnsureStopDelegationFromBytes(data []byte) (*EnsureStopDelegation, error)

func EnsureStopDelegationFromDelegationID

func EnsureStopDelegationFromDelegationID(chainID base.ChainID) EnsureStopDelegation

func (*EnsureStopDelegation) Bytes

func (d *EnsureStopDelegation) Bytes() []byte

func (*EnsureStopDelegation) Name

func (d *EnsureStopDelegation) Name() string

func (*EnsureStopDelegation) Source

func (d *EnsureStopDelegation) Source() string

func (*EnsureStopDelegation) String

func (d *EnsureStopDelegation) String() string

type EvalContext

type EvalContext struct {
	TxContextAccess
	// contains filtered or unexported fields
}

EvalContext is the data structure passed to the eval call. It contains: - access interface to the transaction context - path: a path in the validation context of the constraint being validated in the eval call

func NewEvalContext

func NewEvalContext(ctx TxContextAccess) *EvalContext

func (*EvalContext) EvalPath

func (c *EvalContext) EvalPath() []byte

func (*EvalContext) SelfIsConsumedOutput

func (c *EvalContext) SelfIsConsumedOutput() bool

func (*EvalContext) SelfIsProducedOutput

func (c *EvalContext) SelfIsProducedOutput() bool

func (*EvalContext) SelfOutput

func (c *EvalContext) SelfOutput() *Output

func (*EvalContext) SelfOutputBytes

func (c *EvalContext) SelfOutputBytes() (ret []byte)

func (*EvalContext) SelfSiblingBytes

func (c *EvalContext) SelfSiblingBytes(idx byte) (ret []byte)

func (*EvalContext) SelfSiblingPath

func (c *EvalContext) SelfSiblingPath(idx byte) (ret []byte)

func (*EvalContext) SetEvalPath

func (c *EvalContext) SetEvalPath(path []byte)

func (*EvalContext) TxContext

func (c *EvalContext) TxContext() TxContextAccess

type GeneralScript

type GeneralScript []byte

func NewGeneralScript

func NewGeneralScript(data []byte) GeneralScript

func NewGeneralScriptFromSource

func NewGeneralScriptFromSource(src string) (GeneralScript, error)

func (GeneralScript) Bytes

func (u GeneralScript) Bytes() []byte

func (GeneralScript) Name

func (u GeneralScript) Name() string

func (GeneralScript) Source

func (u GeneralScript) Source() string

func (GeneralScript) String

func (u GeneralScript) String() string

type Immutable

type Immutable struct {
	ChainBlockIndex byte
	DataBlockIndex  byte
}

func ImmutableFromBytes

func ImmutableFromBytes(data []byte) (*Immutable, error)

func NewImmutable

func NewImmutable(chainBlockIndex, dataBlockIndex byte) *Immutable

func (*Immutable) Bytes

func (d *Immutable) Bytes() []byte

func (*Immutable) Name

func (d *Immutable) Name() string

func (*Immutable) Source

func (d *Immutable) Source() string

func (*Immutable) String

func (d *Immutable) String() string

type InitParameters

type InitParameters struct {
	Description                   string
	GenesisTimeUnix               uint32
	GenesisControllerPublicKey    ed25519.PublicKey
	TickDuration                  time.Duration
	TransactionPaceTicks          int
	TransactionPaceSequencerTicks int
}

InitParameters contains parameters which can modified ledger definitions before making them immutable

func DefaultParameters

func DefaultParameters(privateKey ed25519.PrivateKey, genesisTimeUnix uint32, description ...string) InitParameters

func GetTestingLedgerParams

func GetTestingLedgerParams(seed ...int) (InitParameters, ed25519.PrivateKey)

type Library

type Library struct {
	*easyfl.Library[*EvalContext]
	// contains filtered or unexported fields
}

func L

func L() *Library

func LibraryFromParameters

func LibraryFromParameters(idParams InitParameters, verbose ...bool) *Library

func (*Library) BranchInflationBonusBaseFromSource

func (lib *Library) BranchInflationBonusBaseFromSource() uint64

func (*Library) ChainInflationOriginal

func (lib *Library) ChainInflationOriginal(amount uint64, inSlot, forSlots uint32) uint64

func (*Library) IdentityData

func (lib *Library) IdentityData() []byte

type Lock

type Lock interface {
	Constraint
	// Accounts all accounts of the lock
	Accounts() []Accountable
	// Master is account which is always unlockable. For conditional locks it is usually nil (no master)
	Master() Accountable // TODO is it really needed
}

func LockFromBytes

func LockFromBytes(data []byte) (Lock, error)

type LockBalance

type LockBalance struct {
	// Lock of the output
	Lock Lock
	// Balance amount of tokens on the output
	Balance uint64
	// ChainOrigin true if start a chain on this output by adding chain constrain (origin)
	//	 false for simple ED25519 account balance (no chain origin added)
	ChainOrigin bool
}

LockBalance is an amount/target pair used in distribution list One LockBalance results in one produced output on the transaction

type LockParser

type LockParser func([]byte) (Lock, error)

type MakeDelegateInitOutputParams

type MakeDelegateInitOutputParams struct {
	Amount             uint64
	Master             Accountable
	Target             ChainLock
	MaxFreezeEpochs    byte
	MaxSeqProfitMargin uint16
	StartSlot          uint32
}

type MakeDelegationRevokeOutputParams

type MakeDelegationRevokeOutputParams struct {
	TxTs                     base.LedgerTime
	PredOutputIndex          byte
	Inflation                uint64
	HarvestInflation         uint64
	DisableConsistencyChecks bool
}

type Output

type Output struct {
	*tuples.Tuple
}

func MakeDelegationInitOutput

func MakeDelegationInitOutput(par MakeDelegateInitOutputParams) *Output

func NewOutput

func NewOutput(buildFun func(o *OutputBuilder)) *Output

func NewTagAlongOutput

func NewTagAlongOutput(fee uint64, targetChainID base.ChainID, sender AddressED25519) *Output

func OutputBasic

func OutputBasic(amount int64, lock Lock) *Output

func OutputFromBytes

func OutputFromBytes(data []byte, validateOpt ...func(*Output) error) (*Output, error)

func OutputFromHexString

func OutputFromHexString(hexStr string, validateOpt ...func(*Output) error) (*Output, error)

func (*Output) AccountIDs

func (o *Output) AccountIDs() []AccountID

func (*Output) Amounts

func (o *Output) Amounts() Amounts

func (*Output) ChainConstraint

func (o *Output) ChainConstraint() (*ChainConstraint, byte)

ChainConstraint finds and parses chain constraint. Returns its constraintIndex or 0xff if not found

func (*Output) Clone

func (o *Output) Clone(buildFun ...func(o *OutputBuilder)) *Output

Clone clones output and gives a chance to modify it

func (*Output) ConstraintAt

func (o *Output) ConstraintAt(idx byte) ([]byte, error)

func (*Output) ConstraintsRawBytes

func (o *Output) ConstraintsRawBytes() [][]byte

func (*Output) DelegationLock

func (o *Output) DelegationLock() *DelegateLock

func (*Output) EnoughAmountForStorageDeposit

func (o *Output) EnoughAmountForStorageDeposit() error

func (*Output) EnsureStopDelegationConstraint

func (o *Output) EnsureStopDelegationConstraint() (*EnsureStopDelegation, byte)

func (*Output) ForEachConstraint

func (o *Output) ForEachConstraint(fun func(idx byte, constr []byte) bool)

func (*Output) FrozenCoverage

func (o *Output) FrozenCoverage(i byte) int64

func (*Output) Hex

func (o *Output) Hex() string

func (*Output) InflatableAmount

func (o *Output) InflatableAmount() uint64

func (*Output) Inflation

func (o *Output) Inflation() uint64

func (*Output) IsSequencerOutput

func (o *Output) IsSequencerOutput() bool

IsSequencerOutput output contains sequencer constraint

func (*Output) Lines

func (o *Output) Lines(prefix ...string) *lines.Lines

func (*Output) LinesHR

func (o *Output) LinesHR(prefix ...string) *lines.Lines

func (*Output) LinesPlainHR

func (o *Output) LinesPlainHR() *lines.Lines

func (*Output) LinesPlainSource

func (o *Output) LinesPlainSource() *lines.Lines

func (*Output) LinesSource

func (o *Output) LinesSource(prefix ...string) *lines.Lines

func (*Output) LinesVerbose

func (o *Output) LinesVerbose(prefix ...string) *lines.Lines

func (*Output) Lock

func (o *Output) Lock() Lock

func (*Output) MustConstraintAt

func (o *Output) MustConstraintAt(idx byte) []byte

func (*Output) MustHaveConstraintAnyOfAt

func (o *Output) MustHaveConstraintAnyOfAt(pos byte, names ...string)

func (*Output) MustStemLock

func (o *Output) MustStemLock() *StemLock

func (*Output) MustValidOutput

func (o *Output) MustValidOutput()

MustValidOutput checks if amount and lock constraints are as expected

func (*Output) NumConstraints

func (o *Output) NumConstraints() int

func (*Output) SequencerConstraint

func (o *Output) SequencerConstraint() (*SequencerConstraint, byte)

SequencerConstraint finds and parses chain constraint. Returns its constraintIndex or 0xff if not found

func (*Output) SequencerOutputData

func (o *Output) SequencerOutputData() (*SequencerOutputData, bool)

func (*Output) StemLock

func (o *Output) StemLock() (*StemLock, bool)

func (*Output) String

func (o *Output) String() string

func (*Output) TagAlongLock

func (o *Output) TagAlongLock() *TagAlongLock

TagAlongLock return tag-along lock if present, otherwise nil

func (*Output) TimeLock

func (o *Output) TimeLock() (uint32, bool)

func (*Output) ToSource

func (o *Output) ToSource(prefix ...string) string

func (*Output) ToString

func (o *Output) ToString(prefix ...string) string

func (*Output) TokenBalance

func (o *Output) TokenBalance() uint64

type OutputBuilder

type OutputBuilder struct {
	*tuples.TupleEditable
}

func OutputBuilderFromBytes

func OutputBuilderFromBytes(data []byte) (*OutputBuilder, error)

func (*OutputBuilder) MustPushConstraint

func (o *OutputBuilder) MustPushConstraint(c []byte) byte

MustPushConstraint can only be used inside the edit closure

func (*OutputBuilder) NumConstraints

func (o *OutputBuilder) NumConstraints() int

func (*OutputBuilder) PutAmounts

func (o *OutputBuilder) PutAmounts(amount ...int64)

func (*OutputBuilder) PutConstraint

func (o *OutputBuilder) PutConstraint(c []byte, idx byte)

PutConstraint places bytecode at the specific index

func (*OutputBuilder) PutLock

func (o *OutputBuilder) PutLock(lock Lock)

func (*OutputBuilder) WithAmounts

func (o *OutputBuilder) WithAmounts(amount ...int64) *OutputBuilder

WithAmounts can only be used inside r/o override closure

func (*OutputBuilder) WithLock

func (o *OutputBuilder) WithLock(lock Lock) *OutputBuilder

WithLock can only be used inside r/o override closure

func (*OutputBuilder) WithTokenBalance

func (o *OutputBuilder) WithTokenBalance(bal uint64) *OutputBuilder

type OutputDataWithChainID

type OutputDataWithChainID struct {
	OutputDataWithID
	ChainID base.ChainID
}

type OutputDataWithID

type OutputDataWithID struct {
	ID   base.OutputID
	Data []byte
}

func (*OutputDataWithID) MustParse

func (o *OutputDataWithID) MustParse() *OutputWithID

func (*OutputDataWithID) Parse

func (o *OutputDataWithID) Parse(validOpt ...func(o *Output) error) (*OutputWithID, error)

func (*OutputDataWithID) ParseAsChainOutput

func (o *OutputDataWithID) ParseAsChainOutput() (*OutputWithChainID, byte, error)

ParseAsChainOutput parses raw output data expecting chain output. Returns parsed output and index of the chain constraint in it

type OutputWithChainID

type OutputWithChainID struct {
	OutputWithID
	ChainConstraintData
}

func AsOutputWithChainID

func AsOutputWithChainID(o *Output, oid base.OutputID) (OutputWithChainID, bool)

func FilterChainOutputs

func FilterChainOutputs(outs []*OutputWithID) ([]*OutputWithChainID, error)

func GenesisOutput

func GenesisOutput(initialSupply uint64, controllerAddress AddressED25519) *OutputWithChainID

func ParseChainConstraintsFromData

func ParseChainConstraintsFromData(outs []*OutputDataWithID) ([]*OutputWithChainID, error)

func (*OutputWithChainID) AdjustedFrozenCoverage

func (o *OutputWithChainID) AdjustedFrozenCoverage(txTs base.LedgerTime) int64

type OutputWithID

type OutputWithID struct {
	*Output
	ID base.OutputID
}

func FilterOutputsSortByAmount

func FilterOutputsSortByAmount(outs []*OutputWithID, filter func(o *Output) bool, desc ...bool) []*OutputWithID

func GenesisStemOutput

func GenesisStemOutput() *OutputWithID

func ParseAndSortOutputData

func ParseAndSortOutputData(outs []*OutputDataWithID, filter func(oid *base.OutputID, o *Output) bool, desc ...bool) ([]*OutputWithID, error)

func ParseAndSortOutputDataUpToAmount

func ParseAndSortOutputDataUpToAmount(outs []*OutputDataWithID, amount uint64, filter func(oid *base.OutputID, o *Output) bool, desc ...bool) ([]*OutputWithID, uint64, base.LedgerTime, error)

func ParseOutputDataAndFilter

func ParseOutputDataAndFilter(outs []*OutputDataWithID, filter func(oid *base.OutputID, o *Output) bool) ([]*OutputWithID, error)

func (*OutputWithID) AdjustedTokenBalance

func (o *OutputWithID) AdjustedTokenBalance() uint64

AdjustedTokenBalance adjusted to inflation

func (*OutputWithID) AsChainOutput

func (o *OutputWithID) AsChainOutput() (*OutputWithChainID, error)

func (*OutputWithID) AsTagAlong

func (o *OutputWithID) AsTagAlong() TagAlongOutput

func (*OutputWithID) Clone

func (o *OutputWithID) Clone() *OutputWithID

func (*OutputWithID) ExtractChainID

func (o *OutputWithID) ExtractChainID() (chainID base.ChainID, predecessorConstraintIndex byte, ok bool)

ExtractChainID return chainID, predecessor constraint index, existence flag

func (*OutputWithID) IDShort

func (o *OutputWithID) IDShort() string

func (*OutputWithID) LinesHR

func (o *OutputWithID) LinesHR(prefix ...string) *lines.Lines

func (*OutputWithID) LinesSource

func (o *OutputWithID) LinesSource(prefix ...string) *lines.Lines

func (*OutputWithID) MustAsChainOutput

func (o *OutputWithID) MustAsChainOutput() *OutputWithChainID

func (*OutputWithID) Short

func (o *OutputWithID) Short() string

func (*OutputWithID) Source

func (o *OutputWithID) Source() string

func (*OutputWithID) String

func (o *OutputWithID) String() string

func (*OutputWithID) Timestamp

func (o *OutputWithID) Timestamp() base.LedgerTime

type OutputWithSequencerData

type OutputWithSequencerData struct {
	OutputWithID
	SequencerOutputData
}

type ParametersOption

type ParametersOption func(par *InitParameters)

func WithTickDuration

func WithTickDuration(duration time.Duration) ParametersOption

func WithTransactionPace

func WithTransactionPace(transactionPace int) ParametersOption

func WithTransactionPaceSequencer

func WithTransactionPaceSequencer(transactionPace int) ParametersOption

type SequencerConstraint

type SequencerConstraint struct {
	// must point to the sibling chain constraint
	ChainConstraintIndex byte
}

func NewSequencerConstraint

func NewSequencerConstraint(chainConstraintIndex byte) *SequencerConstraint

func SequencerConstraintFromBytes

func SequencerConstraintFromBytes(data []byte) (*SequencerConstraint, error)

func (*SequencerConstraint) Bytes

func (s *SequencerConstraint) Bytes() []byte

func (*SequencerConstraint) Name

func (s *SequencerConstraint) Name() string

func (*SequencerConstraint) Source

func (s *SequencerConstraint) Source() string

func (*SequencerConstraint) String

func (s *SequencerConstraint) String() string

type SequencerOutputData

type SequencerOutputData struct {
	SequencerConstraint      *SequencerConstraint
	ChainConstraint          *ChainConstraint
	AmountOnChain            uint64
	SequencerConstraintIndex byte
	SequencerData            *seqdata.SequencerData
}

func (*SequencerOutputData) Lines

func (s *SequencerOutputData) Lines(prefix ...string) *lines.Lines

type SequencerTransactionData

type SequencerTransactionData struct {
	SequencerOutputData  *SequencerOutputData
	StemOutputData       *StemLock    // nil if does not contain stem output
	SequencerID          base.ChainID // adjusted for chain origin
	SequencerOutputIndex byte
	StemOutputIndex      byte // 0xff if not a branch transaction
}

SequencerTransactionData represents sequencer and stem data on the transaction

func (*SequencerTransactionData) Short

func (m *SequencerTransactionData) Short() string

type StemLock

type StemLock struct {
	PredecessorOutputID base.OutputID
	VRFProof            []byte
}

func StemLockFromBytes

func StemLockFromBytes(data []byte) (*StemLock, error)

func (*StemLock) AccountID

func (st *StemLock) AccountID() AccountID

func (*StemLock) Accounts

func (st *StemLock) Accounts() []Accountable

func (*StemLock) AsLock

func (st *StemLock) AsLock() Lock

func (*StemLock) Bytes

func (st *StemLock) Bytes() []byte

func (*StemLock) Master

func (st *StemLock) Master() Accountable

func (*StemLock) Name

func (st *StemLock) Name() string

func (*StemLock) Source

func (st *StemLock) Source() string

func (*StemLock) String

func (st *StemLock) String() string

type TagAlongLock

type TagAlongLock struct {
	TargetSequencerID base.ChainID
	Sender            Accountable
}

func TagAlongLockFromBytes

func TagAlongLockFromBytes(data []byte) (*TagAlongLock, error)

func (*TagAlongLock) Accounts

func (t *TagAlongLock) Accounts() []Accountable

func (*TagAlongLock) AsLock

func (t *TagAlongLock) AsLock() Lock

func (*TagAlongLock) Bytes

func (t *TagAlongLock) Bytes() []byte

func (*TagAlongLock) Master

func (t *TagAlongLock) Master() Accountable

func (*TagAlongLock) Name

func (t *TagAlongLock) Name() string

func (*TagAlongLock) Source

func (t *TagAlongLock) Source() string

func (*TagAlongLock) String

func (t *TagAlongLock) String() string

type TagAlongOutput

type TagAlongOutput struct {
	OutputWithID
	*TagAlongLock
}

func (*TagAlongOutput) IsTagAlongPurgeSlot

func (o *TagAlongOutput) IsTagAlongPurgeSlot(slot uint32) bool

func (*TagAlongOutput) IsTagAlongReclaimSlot

func (o *TagAlongOutput) IsTagAlongReclaimSlot(slot uint32) bool

func (*TagAlongOutput) IsTagAlongSlot

func (o *TagAlongOutput) IsTagAlongSlot(slot uint32) bool

func (*TagAlongOutput) StatusInSlot

func (o *TagAlongOutput) StatusInSlot(slot uint32) string

type Timelock

type Timelock uint32

func NewTimelock

func NewTimelock(timeSlot uint32) Timelock

func TimelockFromBytes

func TimelockFromBytes(data []byte) (Timelock, error)

func (Timelock) Bytes

func (t Timelock) Bytes() []byte

func (Timelock) Name

func (t Timelock) Name() string

func (Timelock) Source

func (t Timelock) Source() string

func (Timelock) String

func (t Timelock) String() string

type TotalAmount

type TotalAmount uint64

func NewTotalAmount

func NewTotalAmount(a uint64) TotalAmount

func TotalAmountFromBytes

func TotalAmountFromBytes(data []byte) (TotalAmount, error)

func (TotalAmount) Amount

func (a TotalAmount) Amount() uint64

func (TotalAmount) Bytes

func (a TotalAmount) Bytes() []byte

func (TotalAmount) Name

func (a TotalAmount) Name() string

func (TotalAmount) Source

func (a TotalAmount) Source() string

func (TotalAmount) String

func (a TotalAmount) String() string

type TxContextAccess

type TxContextAccess interface {
	BytesAtPath([]byte) ([]byte, error)
	ConsumedOutput(idx byte) (*Output, error)
	ConsumedTotal(i byte) int64
	ProducedTotal(i byte) int64
	IsBranchTransaction() bool
	IsSequencerTransaction() bool
	MustSequencerAndStemOutputIndices() (byte, byte)
	ProducedOutputWithIDAt(idx byte) (*OutputWithID, error)
	Timestamp() base.LedgerTime
	MustInputAt(idx byte) base.OutputID
	OutputID(idx byte) base.OutputID
	SequencerTransactionData() *SequencerTransactionData
	SenderAddress() AddressED25519
	UnlockParameters(inputIdx, constraintIdx byte) ([]byte, error)
}

EvalContext is the data structure passed to the eval call. It contains: - access interface to the transaction context - path: a path in the validation context of the constraint being validated in the eval call

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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