Skip to content

Commit 767b79b

Browse files
committed
supplycommit: add MintCommitter and BurnSupplyCommitter interfaces
This commit extends the MultiStateMachineManager to implement the MintCommitter and BurnSupplyCommitter interfaces. These new methods provide a type-safe way to send mint and burn events to the supply commitment state machines. The SendMintEvent method accepts universe-specific types for minting operations, while SendBurnEvent handles burn leaf submissions. Both methods internally construct the appropriate event types and delegate to the existing SendEvent infrastructure, maintaining consistency with the state machine architecture.
1 parent 0acd873 commit 767b79b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

universe/supplycommit/multi_sm_manager.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/lightninglabs/taproot-assets/fn"
1313
"github.com/lightninglabs/taproot-assets/mssmt"
1414
"github.com/lightninglabs/taproot-assets/tapgarden"
15+
"github.com/lightninglabs/taproot-assets/universe"
1516
"github.com/lightningnetwork/lnd/msgmux"
1617
"github.com/lightningnetwork/lnd/protofsm"
1718
)
@@ -225,6 +226,30 @@ func (m *MultiStateMachineManager) SendEvent(ctx context.Context,
225226
return nil
226227
}
227228

229+
// SendMintEvent sends a mint event to the supply commitment state machine.
230+
func (m *MultiStateMachineManager) SendMintEvent(ctx context.Context,
231+
assetSpec asset.Specifier, leafKey universe.UniqueLeafKey,
232+
issuanceProof universe.Leaf) error {
233+
234+
mintEvent := &NewMintEvent{
235+
LeafKey: leafKey,
236+
IssuanceProof: issuanceProof,
237+
}
238+
239+
return m.SendEvent(ctx, assetSpec, mintEvent)
240+
}
241+
242+
// SendBurnEvent sends a burn event to the supply commitment state machine.
243+
func (m *MultiStateMachineManager) SendBurnEvent(ctx context.Context,
244+
assetSpec asset.Specifier, burnLeaf universe.BurnLeaf) error {
245+
246+
burnEvent := &NewBurnEvent{
247+
BurnLeaf: burnLeaf,
248+
}
249+
250+
return m.SendEvent(ctx, assetSpec, burnEvent)
251+
}
252+
228253
// CanHandle determines if the state machine associated with the given asset
229254
// specifier can handle the given message. If a state machine for the asset
230255
// group does not exist, it will be created and started.

0 commit comments

Comments
 (0)