# 45b ADA limit - how is it achieved in code?

**URL:** <https://forum.cardano.org/t/45b-ada-limit-how-is-it-achieved-in-code/29480>\
**Category:** Misc Dev Talk\
**Created:** [27 December 2019 10:21 UTC](https://forum.cardano.org/t/45b-ada-limit-how-is-it-achieved-in-code/29480 "2019-12-27T10:21:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maciejso](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@maciejso](https://forum.cardano.org/u/maciejso)\
**Post date:** [27 December 2019 10:21 UTC](https://forum.cardano.org/t/45b-ada-limit-how-is-it-achieved-in-code/29480/1 "2019-12-27T10:21:06Z")

</div>

Just exploring the codebase. It took me a while to find these lines below and I am not even sure if they are the ones that limit the ADA supply.

Can somebody with good understanding of Cardano point me at the direction of where is the limit of 45b of ADA coming from?

And whether or not these line below have anything to do with that?

```
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.

```

> <https://github.com/input-output-hk/cardano-sl/blob/develop/core/src/Pos/Core/Common/Coin.hs>

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![erikd](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/erikd/32/813_2.png) [@erikd](https://forum.cardano.org/u/erikd)\
**Post date:** [27 December 2019 20:08 UTC](https://forum.cardano.org/t/45b-ada-limit-how-is-it-achieved-in-code/29480/2 "2019-12-27T20:08:14Z")

</div>

Yes, you have found exactly where that limit is set.
