Skip to content

Commit a934652

Browse files
authored
Merge pull request #2 from jasonpaulos/arc-0004-type-number-spec
Clarify format of numbers in type strings & add more docs to types
2 parents a4eebf3 + 8d0384d commit a934652

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

ARCs/arc-0004.md

+25-8
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ interface Method {
147147
desc?: string
148148
}>,
149149
/** Information about the method's return value */
150-
returns: { type: string, desc?: string }
150+
returns: {
151+
/** The type of the return value, or "void" to indicate no return value. */
152+
type: string,
153+
/** Optional, user-friendly description for the return value */
154+
desc?: string
155+
}
151156
}
152157
```
153158

@@ -320,9 +325,13 @@ interface Contract {
320325
networks?: {
321326
/**
322327
* The key is the base64 genesis hash of the network, and the value contains
323-
* the app ID of the deployed contract in that network
328+
* information about the deployed contract in the network indicated by the
329+
* key
324330
*/
325-
[network: string]: { appID: number }
331+
[network: string]: {
332+
/** The app ID of the deployed contract in this network */
333+
appID: number
334+
}
326335
}
327336
/** All of the methods that the contract implements */
328337
methods: Method[]
@@ -495,16 +504,24 @@ properties:
495504

496505
The following types are supported in the Algorand ABI.
497506

498-
* `uint<N>`: An `N`-bit unsigned integer, where `8 <= N <= 512` and `N % 8 = 0`.
507+
* `uint<N>`: An `N`-bit unsigned integer, where `8 <= N <= 512` and `N % 8 = 0`. When this type is
508+
used as part of a method signature, `N` must be written as a base 10 number without any leading zeros.
499509
* `byte`: An alias for `uint8`.
500-
* `bool`: A boolean value that is restricted to either 0 or 1. When encoded, up to 8 consecutive `bool` values will be packed into a single byte.
501-
* `ufixed<N>x<M>`: An `N`-bit unsigned fixed-point decimal number with precision `M`, where `8 <= N <= 512`, `N % 8 = 0`, and `0 < M <= 160`, which denotes a value `v` as `v / (10^M)`.
510+
* `bool`: A boolean value that is restricted to either 0 or 1. When encoded, up to 8 consecutive
511+
`bool` values will be packed into a single byte.
512+
* `ufixed<N>x<M>`: An `N`-bit unsigned fixed-point decimal number with precision `M`, where
513+
`8 <= N <= 512`, `N % 8 = 0`, and `0 < M <= 160`, which denotes a value `v` as `v / (10^M)`. When
514+
this type is used as part of a method signature, `N` and `M` must be written as base 10 numbers
515+
without any leading zeros.
502516
* `<type>[<N>]`: A fixed-length array of length `N`, where `N >= 0`. `type` can be any other type.
517+
When this type is used as part of a method signature, `N` must be written as a base 10 number without
518+
any leading zeros, _unless_ `N` is zero, in which case only a single 0 character should be used.
503519
* `address`: Used to represent a 32-byte Algorand address. This is equivalent to `byte[32]`.
504520
* `<type>[]`: A variable-length array. `type` can be any other type.
505521
* `string`: A variable-length byte array (`byte[]`) assumed to contain UTF-8 encoded content.
506-
* `(T1,T2,...,TN)`: A tuple of the types `T1`, `T2`, …, `TN`, `N >= 0`.
507-
* reference types `account`, `asset`, `application`: only for arguments, in which case they are an alias for `uint8`. See section "Reference Types" below.
522+
* `(T1,T2,…,TN)`: A tuple of the types `T1`, `T2`, …, `TN`, `N >= 0`.
523+
* reference types `account`, `asset`, `application`: only for arguments, in which case they are an
524+
alias for `uint8`. See section "Reference Types" below.
508525

509526
Additional special use types are defined in [Reference Types](#reference-types)
510527
and [Transaction Types](#transaction-types).

0 commit comments

Comments
 (0)