{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}
module PaymentChannel.Internal.Config
( module PaymentChannel.Internal.Config
, module PaymentChannel.Internal.Types.Hour
)
where
import Bitcoin.Types
import PaymentChannel.Internal.Util
import PaymentChannel.Internal.Types.Hour
import qualified RBPCP.Types as RBPCP
class Monad m => HasConfSettlePeriod m where
confSettlePeriod :: m Hour
data ServerSettings = ServerSettings
{ serverConfDustLimit :: BtcAmount
, serverConfSettlePeriod :: Hour
, serverConfMinDuration :: Hour
, serverConfOpenPrice :: BtcAmount
} deriving (Eq, Show, Typeable, Generic, Serialize, ToJSON, FromJSON, NFData)
fromFundingInfo :: RBPCP.FundingInfo -> ServerSettings
fromFundingInfo RBPCP.FundingInfo{..} =
ServerSettings
(fromIntegral fundingInfoDustLimit)
(MkHour $ fromIntegral fundingInfoSettlementPeriodHours)
(MkHour $ fromIntegral fundingInfoMinDurationHours)
(fromIntegral fundingInfoOpenPrice)