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BSDS5PDSTTJTJOLEKZRRTAONS3T3JFZ3FQGFGS3AOXDBZ6SPLAC
Y35QCWYW2OTZ27ZVTH2BA3XJTUCJ2WMLKU32ZCOCDY3AW7TIZXRAC
let winFraction rem = rem % (bid ^. bidAmount . satoshi)
remainderSeconds (Satoshi rem) = Seconds . round $ winFraction rem * fromIntegral (bid ^. bidSeconds)
adjustBid rem = bid & bidSeconds .~ remainderSeconds rem & bidAmount .~ rem
let winFraction r = r % (bid ^. bidAmount . satoshi)
remainderSeconds (Satoshi r) = Seconds . round $ winFraction r * fromIntegral (bid ^. bidSeconds)
adjustBid r = bid & bidSeconds .~ remainderSeconds r & bidAmount .~ r
let winFraction rem = rem % (bid ^. bidAmount . satoshi)
remainderSeconds (Satoshi rem) = Seconds . round $ winFraction rem * fromIntegral (bid ^. bidSeconds)
let winFraction r = r % (bid ^. bidAmount . satoshi)
remainderSeconds (Satoshi r) = Seconds . round $ winFraction r * fromIntegral (bid ^. bidSeconds)
prec "annually" = nullField *> pure B.Annually
prec "monthly" = B.Monthly <$> field
--prec "semimonthly" = nullField *> pure B.SemiMonthly
prec "weekly" = B.Weekly <$> field
prec "onetime" = nullField *> pure B.OneTime
prec s = fail $ "Unrecognized recurrence type: " ++ show s
prec = \case
"annually" -> nullField *> pure B.Annually
"monthly" -> B.Monthly <$> field
--"semimonthly" = nullField *> pure B.SemiMonthly
"weekly" -> B.Weekly <$> field
"onetime" -> nullField *> pure B.OneTime
_ -> empty
cfgExists <- doesFileExist $ encodeString cfgFile
pathExists <- doesPathExist $ encodeString cfgFile
files <- listDirectory (encodeString $ parent cfgFile)
putStrLn $ "Loading config from: " <> (pack . encodeString $ cfgFile)
<> "; file exists = " <> (pack . show $ cfgExists)
<> "; path exists = " <> (pack . show $ pathExists)
<> "; parent dir = " <> (pack . encodeString $ parent cfgFile)
<> "; dir contents = " <> (pack . show $ files)
let dbEnvCfg = pgsDefaultConfig . C8.pack <$> lookup "DATABASE_URL" env
conf <- readQConfig cfg dbEnvCfg
putStrLn $ "Config loaded successfully."
pure conf
let dbEnvCfg = pgsDefaultConfig . C8.pack <$> L.lookup "DATABASE_URL" env
readQConfig cfg dbEnvCfg
exchResp <- liftIO . try $ asValue =<< (withOpenSSL $ getWith opts (cfg ^. exchangeRateServiceURI))
_ <- traverse (logError . encodeUtf8 . tshow @ HttpException) (preview _Left exchResp)
exchResp <- liftIO . try @HttpException $ asValue =<< (withOpenSSL $ getWith opts (cfg ^. exchangeRateServiceURI))
_ <- traverse (logError . T.encodeUtf8 . show) (preview _Left exchResp)