Skip to content

Commit

Permalink
fix: use seconds unit for auction extension for governance and return…
Browse files Browse the repository at this point in the history
… if we've extended it
  • Loading branch information
ze97286 authored and jeremyletang committed Feb 19, 2024
1 parent 8c35ac5 commit 4a36fe2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion core/execution/future/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func (m *Market) checkAuction(ctx context.Context, now time.Time, idgen common.I

if m.mkt.State == types.MarketStateSuspendedViaGovernance {
if endTS := m.as.ExpiresAt(); endTS != nil && endTS.Before(now) {
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration)})
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration.Seconds())})
return
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/execution/future/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ func (m *Market) UpdateMarketState(ctx context.Context, changes *types.MarketSta
m.mkt.State = types.MarketStateSuspendedViaGovernance
m.mkt.TradingMode = types.MarketTradingModeSuspendedViaGovernance
if m.as.InAuction() {
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration)})
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration.Seconds())})
evt := m.as.AuctionExtended(ctx, m.timeService.GetTimeNow())
if evt != nil {
m.broker.Send(evt)
Expand Down
2 changes: 1 addition & 1 deletion core/execution/spot/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (m *Market) checkAuction(ctx context.Context, now time.Time, idgen common.I

if m.mkt.State == types.MarketStateSuspendedViaGovernance {
if endTS := m.as.ExpiresAt(); endTS != nil && endTS.Before(now) {
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration)})
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration.Seconds())})
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/execution/spot/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ func (m *Market) UpdateMarketState(ctx context.Context, changes *types.MarketSta
m.mkt.State = types.MarketStateSuspendedViaGovernance
m.mkt.TradingMode = types.MarketTradingModeSuspendedViaGovernance
if m.as.InAuction() {
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration)})
m.as.ExtendAuctionSuspension(types.AuctionDuration{Duration: int64(m.minDuration.Seconds())})
evt := m.as.AuctionExtended(ctx, m.timeService.GetTimeNow())
if evt != nil {
m.broker.Send(evt)
Expand Down

0 comments on commit 4a36fe2

Please sign in to comment.