Skip to content

Commit 15cdf80

Browse files
committed
new api
1 parent ebaedbf commit 15cdf80

File tree

8 files changed

+1693
-869
lines changed

8 files changed

+1693
-869
lines changed

hyperloop/actions.go

+222-125
Large diffs are not rendered by default.

hyperloop/fsm.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ type FSM struct {
213213

214214
cfg *Config
215215

216+
swapAmtFetcher TotalSwapAmountFetcher
217+
216218
// hyperloop contains all the data required for the hyperloop process.
217219
hyperloop *HyperLoop
218220

@@ -232,23 +234,25 @@ type FSM struct {
232234
}
233235

234236
// NewFSM creates a new instant out FSM.
235-
func NewFSM(cfg *Config) (*FSM, error) {
237+
func NewFSM(cfg *Config, swapAmtFetcher TotalSwapAmountFetcher) (*FSM, error) {
236238

237239
hyperloop := &HyperLoop{
238240
State: fsm.EmptyState,
239241
}
240242

241-
return NewFSMFromHyperloop(cfg, hyperloop)
243+
return NewFSMFromHyperloop(cfg, hyperloop, swapAmtFetcher)
242244
}
243245

244246
// NewFSMFromHyperloop creates a new instantout FSM from an existing instantout
245247
// recovered from the database.
246-
func NewFSMFromHyperloop(cfg *Config, hyperloop *HyperLoop) (*FSM, error) {
248+
func NewFSMFromHyperloop(cfg *Config, hyperloop *HyperLoop,
249+
swapAmtFetcher TotalSwapAmountFetcher) (*FSM, error) {
247250

248251
instantOutFSM := &FSM{
249-
cfg: cfg,
250-
hyperloop: hyperloop,
251-
spendChan: make(chan *chainntnfs.SpendDetail),
252+
cfg: cfg,
253+
hyperloop: hyperloop,
254+
spendChan: make(chan *chainntnfs.SpendDetail),
255+
swapAmtFetcher: swapAmtFetcher,
252256
}
253257

254258
instantOutFSM.ActionEntryFunc = instantOutFSM.updateHyperloop

0 commit comments

Comments
 (0)