mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 20:24:21 +01:00
* feat: add market hour configuration for optimal payment timing This commit adds market hour configuration to help users determine optimal times for making payments with lower fees. The configuration is managed through environment variables and exposed via the GetInfo RPC. Changes: - Add MarketHour message type to protobuf service definition - Add market hour configuration fields to Config struct - Update covenant and covenantless services to handle market hour data - Extend GetInfo RPC response to include market hour information - Set default market hour period to 24 hours - Initialize market hour fields after other service fields Configuration: - ARK_FIRST_MARKET_HOUR: Initial market hour timestamp (default: current server start time) - ARK_MARKET_HOUR_PERIOD: Time between market hours in seconds (default: 86400) - ARK_MARKET_HOUR_ROUND_LIFETIME: Round lifetime for market hours (default: 0, falls back to ARK_ROUND_LIFETIME) * feat: add admin RPC for updating market hour configuration Add new UpdateMarketHour RPC to AdminService for configuring market hour parameters: - Add request/response messages to admin.proto - Add UpdateMarketHour method to Service interface - Implement market hour updates in covenant and covenantless services - Add validation for market hour parameters - Implement admin gRPC handler The RPC allows updating: - First market hour timestamp - Market hour period - Market hour round lifetime (optional, defaults to round lifetime * feat: add market hour persistence with sqlite - Add MarketHourRepo interface in domain layer - Implement market hour persistence using SQLite - Add market hour queries to sqlc/query.sql - Update service initialization to load market hours from DB - Add fallback to config values if no DB entry exists - Update RepoManager interface with new MarketHourRepo method
42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package domain
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type RoundEventRepository interface {
|
|
Save(ctx context.Context, id string, events ...RoundEvent) (*Round, error)
|
|
Load(ctx context.Context, id string) (*Round, error)
|
|
RegisterEventsHandler(func(*Round))
|
|
Close()
|
|
}
|
|
|
|
type RoundRepository interface {
|
|
AddOrUpdateRound(ctx context.Context, round Round) error
|
|
GetRoundWithId(ctx context.Context, id string) (*Round, error)
|
|
GetRoundWithTxid(ctx context.Context, txid string) (*Round, error)
|
|
GetSweepableRounds(ctx context.Context) ([]Round, error)
|
|
GetRoundsIds(ctx context.Context, startedAfter int64, startedBefore int64) ([]string, error)
|
|
GetSweptRounds(ctx context.Context) ([]Round, error)
|
|
Close()
|
|
}
|
|
|
|
type VtxoRepository interface {
|
|
AddVtxos(ctx context.Context, vtxos []Vtxo) error
|
|
SpendVtxos(ctx context.Context, vtxos []VtxoKey, txid string) error
|
|
RedeemVtxos(ctx context.Context, vtxos []VtxoKey) error
|
|
GetVtxos(ctx context.Context, vtxos []VtxoKey) ([]Vtxo, error)
|
|
GetVtxosForRound(ctx context.Context, txid string) ([]Vtxo, error)
|
|
SweepVtxos(ctx context.Context, vtxos []VtxoKey) error
|
|
GetAllVtxos(ctx context.Context, pubkey string) ([]Vtxo, []Vtxo, error)
|
|
GetAllSweepableVtxos(ctx context.Context) ([]Vtxo, error)
|
|
UpdateExpireAt(ctx context.Context, vtxos []VtxoKey, expireAt int64) error
|
|
Close()
|
|
}
|
|
|
|
type MarketHourRepo interface {
|
|
Get(ctx context.Context) (*MarketHour, error)
|
|
Upsert(ctx context.Context, marketHour MarketHour) error
|
|
Close()
|
|
}
|