Skip to content

Commit

Permalink
Merge pull request #11729 from vegaprotocol/fix_expiry
Browse files Browse the repository at this point in the history
fix: handle pap expiry correctly
  • Loading branch information
ze97286 authored Oct 2, 2024
2 parents a623d5a + 6fe07a5 commit ac9993d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/execution/spot/protocol_automated_purchase.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ func (m *Market) checkPAP(ctx context.Context) {
return
}
// pap has expired
if !m.pap.readyToStop && !m.pap.config.ExpiryTimestamp.IsZero() && m.pap.config.ExpiryTimestamp.Before(m.timeService.GetTimeNow()) {
if !m.pap.readyToStop && m.pap.config.ExpiryTimestamp.Unix() > 0 && m.pap.config.ExpiryTimestamp.Before(m.timeService.GetTimeNow()) {
m.log.Info("protocol automated purchase has expired, going to stop", logging.String("ID", m.pap.ID))
m.stopPAP(ctx)
}
}
Expand Down
5 changes: 1 addition & 4 deletions core/integration/steps/the_automated_puchase.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ func NewProtocolAutomatedPurchase(r apRow, config *market.Config) (*types.NewPro

auctionPriceOracle, priceOracleBinding, _ := config.OracleConfigs.GetOracleDefinitionForCompositePrice(r.row.MustStr("price oracle"))
expiry := r.row.MustI64("expiry timestamp")
var expiryTime time.Time
if expiry > 0 {
expiryTime = time.Unix(expiry, 0)
}
expiryTime := time.Unix(expiry, 0)

priceOracle := datasource.FromOracleSpecProto(auctionPriceOracle)

Expand Down

0 comments on commit ac9993d

Please sign in to comment.