Skip to content

Commit 22b4636

Browse files
authored
CIP-0153 | Add range limits to amounts in builtin Value (#1095)
1 parent b86ccdb commit 22b4636

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

CIP-0153/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ We propose the following set of builtin functions to accompany the new builtin t
9191
- it returns a Mary-era Value with the `Coin` inserted, silently discarding any previous value.
9292
If the `BuiltinInteger` argument (the quantity) is zero, the `Coin` is removed.
9393
- Both `BuiltinCurrencySymbol` and `BuiltinTokenName` must be no longer than 32 bytes (unless the amount is zero).
94+
- The amount (`BuiltinInteger`) must satisfy -2<sup>127</sup> amount 2<sup>127</sup>-1.
9495
2. `lookupCoin :: BuiltinCurrencySymbol -> BuiltinTokenName -> BuiltinValue -> BuiltinQuantity`
9596
- it returns the quantity of a given `Coin` in a Mary-era Value.
9697
3. `unionValue :: BuiltinValue -> BuiltinValue -> BuiltinValue`
@@ -106,6 +107,7 @@ We propose the following set of builtin functions to accompany the new builtin t
106107
6. `unValueData :: BuiltinData -> BuiltinValue`
107108
- decodes a `BuiltinData` into a `BuiltinValue`, or fails if it is not one.
108109
- All currency symbols and token names must be no longer than 32 bytes.
110+
- All amounts must lie between -2<sup>127</sup> and 2<sup>127</sup>-1 (inclusive).
109111

110112
A note on `valueData` and `unValueData`: in Plutus V1, V2 and V3, the encoding of `BuiltinValue` in `BuiltinData` is identical to that of the [existing `Value` type](https://plutus.cardano.intersectmbo.org/haddock/latest/plutus-ledger-api/PlutusLedgerApi-V1-Value.html#t:Value) in plutus-ledger-api.
111113
This ensures backwards compatibility.

0 commit comments

Comments
 (0)