卡尔达诺。如何以代码方式实现ADA 45B的高端供应?

时间:2019-12-27 10:32:34

标签: haskell cardano

一个对Haskell和Cardano有很好理解的人能指出我450亿ADA的总供应量限制的方向吗?

下面的这些行是否与此有关?

maxCoinVal :: Word64
maxCoinVal = 45000000000000000

-- | Makes a 'Coin' but is _|_ if that coin exceeds 'maxCoinVal'.
-- You can also use 'checkCoin' to do that check.
mkCoin :: Word64 -> Coin
mkCoin c = either error (const coin) (checkCoin coin)
  where
    coin = (Coin c)
{-# INLINE mkCoin #-}

checkCoin :: MonadError Text m => Coin -> m ()
checkCoin (Coin c)
    | c <= maxCoinVal = pure ()
    | otherwise       = throwError $ "Coin: " <> show c <> " is too large"

-- | Coin formatter which restricts type.

github上的实际文件 https://github.com/input-output-hk/cardano-sl/blob/develop/core/src/Pos/Core/Common/Coin.hs

0 个答案:

没有答案