75N3UJ4JK56KXF56GASGPAWLFYGJDETVJNYTF4KXFCQM767JUU5AC
WO2MINIF4TXOHWSE7JWXRZYN64XRVLYIRFMF4SMPSOXKA2V77KMQC
TZQJVHBAMDNWDBYCDE3SDVGBG2T5FOE3J5JAD6NENRW36XBHUUFQC
LAROLAYUGJ4Q5AEFV5EJMIA2ZKBNCBWHHHPCJ3CKCNIUIYUKRFVQC
EMVTF2IWNQGRL44FC4JNG5FYYQTZSFPNM6SOM7IAEH6T7PPK2NVAC
64C6AWH66FDKU6UE6Z6JPX2J2GBM2JOPTH2GL6LHKAIUBGNGDZ5AC
FRPWIKCNGK6PM6VCKEHEUG5A2LWL7WFN66L4CPQ7DLN4WAS3TIZQC
NVOCQVASZWTKQJG7GPH7KHKZZR7NUG4WLV5YY4KAIRPCJRWCZPIAC
7DBNV3GV773FH5ZLQWFX4RBOS4Q3CIK2RYZNNABY3ZOETYZCXRNQC
GKGVYBZGPJXO7N7GLHLRNYQPXFHBQSNQN53OKRFCXLQEYDTC5I4QC
| total < raiseAmount auction =
let remainder = raiseAmount auction <> invert total
winFraction = (toRational . runBTC $ remainder) / (toRational . runBTC $ btcAmount x)
remainderSeconds = Seconds . round $ winFraction * (toRational . seconds $ x)
in [Bid (userId x) remainderSeconds remainder]
| total < auction ^. raiseAmount =
let remainder = (auction ^. raiseAmount) ++ invert total
winFraction :: Rational
winFraction = (toRational $ remainder ^. btc) / (toRational $ x ^. (btcAmount . btc))
remainderSeconds = Seconds . round $ winFraction * (toRational $ x ^. seconds)
in [x & seconds .~ remainderSeconds & btcAmount .~ remainder]
newAuction' :: Auction -> ReaderT a (EitherT Text IO) AuctionId
newAuction' = undefined
readAuction' :: AuctionId -> ReaderT a (EitherT Text IO) Auction
readAuction' = undefined
recordBid' :: UTCTime -> Bid -> ReaderT a (EitherT Text IO) ()
recordBid' = undefined
readBids' :: AuctionId -> ReaderT a (EitherT Text IO) [(UTCTime, Bid)]
readBids' = undefined
createUser' :: User -> ReaderT a (EitherT Text IO) UserId
createUser' = undefined
module Quixotic
( BtcAddr(address)
, parseBtcAddr
, BTC(..)
) where
module Quixotic where