Skip to content

Commit 6661d45

Browse files
committed
Address comments
1 parent 97825db commit 6661d45

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

source/CIS/cis-5.rst

+25-21
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ CIS-5: Smart Contract Wallet Standard
99

1010
* - Created
1111
- Mar 17, 2024
12+
* - Final
13+
- May 23, 2024
1214
* - Supported versions
1315
- | Smart contract version 1 or newer
1416
| (Protocol version 4 or newer)
@@ -24,10 +26,10 @@ A standard interface for defining a smart contract wallet that can hold and tran
2426
CCDs/CIS-2 tokens can be deposited into the smart contract wallet by
2527
specifying to which public key the deposit should be assigned.
2628

27-
The holder of the corresponding private key does not have to submit transactions
29+
The holder of the corresponding private key does not submit transactions
2830
on chain to transfer/withdraw its CCD/CIS-2 token balances,
2931
but instead, it can generate a valid signature, identify a willing third
30-
party to submit its signature on-chain (a service fee can be added to financially incentivize a third party to do so).
32+
party to submit its signature in a transaction on-chain (a service fee can be added to financially incentivize a third party to do so).
3133

3234
The three main actions in the smart contract that can be taken:
3335

@@ -37,8 +39,9 @@ The three main actions in the smart contract that can be taken:
3739

3840
- *withdraw*: withdraws the balance out of the smart contract wallet to a native account or smart contract.
3941

40-
The goal of this standard is to simplify the account creation onboarding flow on Concordium
41-
allowing for CIS-5 smart contract wallets to be supported as first-class citizens in Concordium wallets and tooling.
42+
The goal of this standard is to create an alternative simplified onboarding flow
43+
without the inconvenience of a native account creation on Concordium.
44+
Allowing for CIS-5 smart contract wallets to be supported as first-class citizens in Concordium wallets and tooling.
4245

4346
Specification
4447
=============
@@ -57,6 +60,7 @@ General types and serialization
5760
``TokenID``
5861
^^^^^^^^^^^
5962

63+
The token ID is from the CIS-2 standard :ref:`CIS-2-TokenID`.
6064
A token ID is serialized as 1 byte for the size (``n``) of the identifier, followed by this number of bytes for the token id (``id``)::
6165

6266
TokenID ::= (n: Byte) (id: Byteⁿ)
@@ -66,6 +70,7 @@ A token ID is serialized as 1 byte for the size (``n``) of the identifier, follo
6670
``TokenAmount``
6771
^^^^^^^^^^^^^^^
6872

73+
The token amount is from the CIS-2 standard :ref:`CIS-2-TokenAmount`.
6974
It is serialized using the LEB128_ variable-length unsigned integer encoding, with the additional constraint that the total number of bytes of the encoding MUST not exceed 37 bytes::
7075

7176
TokenAmount ::= (x: Byte) => x if x < 2^7
@@ -220,7 +225,7 @@ The ``NonceEvent`` is serialized as: First a byte with the value of 250, followe
220225
``DepositCcdEvent``
221226
^^^^^^^^^^^^^^^^^^^
222227

223-
A ``DepositCcdEvent`` SHALL be logged ever time an amount of CCD received by the contract is assigned to a public key.
228+
A ``DepositCcdEvent`` SHALL be logged every time an amount of CCD received by the contract is assigned to a public key.
224229

225230
The ``DepositCcdEvent`` is serialized as: First a byte with the value of 249, followed by the :ref:`CIS-5-CCDAmount` (``ccdAmount``), the :ref:`CIS-5-Address` (``from``), and a :ref:`CIS-5-PublicKeyEd25519` (``to``)::
226231

@@ -229,7 +234,7 @@ The ``DepositCcdEvent`` is serialized as: First a byte with the value of 249, fo
229234
``DepositCis2TokensEvent``
230235
^^^^^^^^^^^^^^^^^^^^^^^^^^
231236

232-
A ``DepositCis2TokensEvent`` SHALL be logged ever time a token amount received by the contract is assigned to a public key.
237+
A ``DepositCis2TokensEvent`` SHALL be logged every time a token amount received by the contract is assigned to a public key.
233238

234239
The ``DepositCis2TokensEvent`` is serialized as: First a byte with the value of 248, followed by the
235240
:ref:`CIS-5-TokenAmount` (``tokenAmount``), :ref:`CIS-5-TokenID` (``TokenID``),
@@ -240,7 +245,7 @@ The ``DepositCis2TokensEvent`` is serialized as: First a byte with the value of
240245
``WithdrawCcdEvent``
241246
^^^^^^^^^^^^^^^^^^^^
242247

243-
A ``WithdrawCcdEvent`` SHALL be logged ever time an amount of CCD held by a public key is withdrawn to an address.
248+
A ``WithdrawCcdEvent`` SHALL be logged every time an amount of CCD held by a public key is withdrawn to an address.
244249

245250
The ``WithdrawCcdEvent`` is serialized as: First a byte with the value of 247, followed by the :ref:`CIS-5-CCDAmount` (``ccdAmount``), a :ref:`CIS-5-PublicKeyEd25519` (``from``), and the :ref:`CIS-5-Address` (``to``)::
246251

@@ -249,7 +254,7 @@ The ``WithdrawCcdEvent`` is serialized as: First a byte with the value of 247, f
249254
``WithdrawCis2TokensEvent``
250255
^^^^^^^^^^^^^^^^^^^^^^^^^^^
251256

252-
A ``WithdrawCis2TokensEvent`` SHALL be logged ever time a token amount held by a public key is withdrawn to an address.
257+
A ``WithdrawCis2TokensEvent`` SHALL be logged every time a token amount held by a public key is withdrawn to an address.
253258

254259
The ``WithdrawCis2TokensEvent`` is serialized as: First a byte with the value of 246, followed by the
255260
:ref:`CIS-5-TokenAmount` (``tokenAmount``), :ref:`CIS-5-TokenID` (``TokenID``),
@@ -260,7 +265,7 @@ The ``WithdrawCis2TokensEvent`` is serialized as: First a byte with the value of
260265
``TransferCcdEvent``
261266
^^^^^^^^^^^^^^^^^^^^
262267

263-
A ``TransferCcdEvent`` SHALL be logged ever time an amount of CCD held by a public key is transferred to another public key within the contract.
268+
A ``TransferCcdEvent`` SHALL be logged every time an amount of CCD held by a public key is transferred to another public key within the contract.
264269

265270
The ``TransferCcdEvent`` is serialized as: First a byte with the value of 245, followed by the :ref:`CIS-5-CCDAmount` (``ccdAmount``), a :ref:`CIS-5-PublicKeyEd25519` (``from``), and the :ref:`CIS-5-PublicKeyEd25519` (``to``)::
266271

@@ -269,7 +274,7 @@ The ``TransferCcdEvent`` is serialized as: First a byte with the value of 245, f
269274
``TransferCis2TokensEvent``
270275
^^^^^^^^^^^^^^^^^^^^^^^^^^^
271276

272-
A ``TransferCis2TokensEvent`` SHALL be logged ever time a token amount held by a public key is transferred to another public key within the contract.
277+
A ``TransferCis2TokensEvent`` SHALL be logged every time a token amount held by a public key is transferred to another public key within the contract.
273278

274279
The ``TransferCis2TokensEvent`` is serialized as: First a byte with the value of 244, followed by the
275280
:ref:`CIS-5-TokenAmount` (``tokenAmount``), :ref:`CIS-5-TokenID` (``TokenID``),
@@ -279,7 +284,7 @@ The ``TransferCis2TokensEvent`` is serialized as: First a byte with the value of
279284

280285
.. note::
281286

282-
The CIS-5 events SHALL enable off-chain applications to compute off-chain all balances that the public keys are holding.
287+
The collection of all CIS-5 events emitted by a smart contract instance implementing CIS-5 SHALL enable off-chain applications to compute off-chain all non-zero balances that the public keys are holding.
283288

284289
.. _CIS-5-functions:
285290

@@ -359,13 +364,13 @@ It is serialized as: 2 bytes representing the number of withdrawals (``n``) foll
359364

360365
Each ``WithdrawBatchCcdAmount`` is serialized as: a :ref:`CIS-5-PublicKeyEd25519` (``signer``), a :ref:`CIS-5-SignatureEd25519` (``signature``), and a ``WithdrawMessageCcdAmount`` (``message``).
361366

362-
Each ``WithdrawMessageCcdAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-TimeStamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-CCDAmount` (``serviceFee``), 2 bytes representing the number of simple withdraws (``m``) followed by the bytes for this number of simple withdraws (``simpleWithdraws``).
367+
Each ``WithdrawMessageCcdAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-Timestamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-CCDAmount` (``serviceFee``), 2 bytes representing the number of simple withdraws (``m``) followed by the bytes for this number of simple withdraws (``simpleWithdraws``).
363368

364369
Each ``WithdrawCcdAmount`` is serialized as: the receiving address :ref:`CIS-2-Receiver` (``to``), the :ref:`CIS-5-CCDAmount` (``withdrawAmount``), and some additional data :ref:`CIS-2-AdditionalData` (``data``)::
365370

366371
WithdrawCcdAmount ::= (to: Receiver) (withdrawAmount: CCDAmount) (data: AdditionalData)
367372

368-
WithdrawMessageCcdAmount ::= (entryPoint: EntrypointName) (expiryTime: TimeStamp) (nonce: u64) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: CCDAmount) (m: Byte²) (simpleWithdraws: WithdrawCcdAmountᵐ)
373+
WithdrawMessageCcdAmount ::= (entryPoint: EntrypointName) (expiryTime: Timestamp) (nonce: Nonce) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: CCDAmount) (m: Byte²) (simpleWithdraws: WithdrawCcdAmountᵐ)
369374

370375
WithdrawBatchCcdAmount ::= (signer: PublicKeyEd25519) (signature: SignatureEd25519) (message: WithdrawMessageCcdAmount)
371376

@@ -406,8 +411,7 @@ Requirements
406411

407412
.. warning::
408413

409-
Be aware of transferring CCDs to a non-existing account address or contract address.
410-
This specification by itself does not include a standard that has to be followed.
414+
Be aware of transferring CCDs to a non-existing account address or contract address which results in an error on Concordium.
411415
Checking the existence of an account address/ contract address would ideally be done off-chain before the message is even sent to the smart contract.
412416

413417
.. _CIS-5-functions-withdrawCis2Tokens:
@@ -427,13 +431,13 @@ It is serialized as: 2 bytes representing the number of withdrawals (``n``) foll
427431

428432
Each ``WithdrawBatchTokenAmount`` is serialized as: a :ref:`CIS-5-PublicKeyEd25519` (``signer``), a :ref:`CIS-5-SignatureEd25519` (``signature``), and a ``WithdrawMessageTokenAmount`` (``message``).
429433

430-
Each ``WithdrawMessageTokenAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-TimeStamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-ExternalTokenAmount` (``serviceFee``), 2 bytes representing the number of simple withdraws (``m``) followed by the bytes for this number of simple withdraws (``simpleWithdraws``).
434+
Each ``WithdrawMessageTokenAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-Timestamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-ExternalTokenAmount` (``serviceFee``), 2 bytes representing the number of simple withdraws (``m``) followed by the bytes for this number of simple withdraws (``simpleWithdraws``).
431435

432436
Each ``WithdrawTokenAmount`` is serialized as: the receiving address :ref:`CIS-2-Receiver` (``to``), the :ref:`CIS-5-ExternalTokenAmount` (``withdrawAmount``), and some additional data :ref:`CIS-2-AdditionalData` (``data``)::
433437

434438
WithdrawTokenAmount ::= (to: Receiver) (withdrawAmount: ExternalTokenAmount) (data: AdditionalData)
435439

436-
WithdrawMessageTokenAmount ::= (entryPoint: EntrypointName) (expiryTime: TimeStamp) (nonce: u64) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: ExternalTokenAmount) (m: Byte²) (simpleWithdraws: WithdrawTokenAmountᵐ)
440+
WithdrawMessageTokenAmount ::= (entryPoint: EntrypointName) (expiryTime: Timestamp) (nonce: Nonce) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: ExternalTokenAmount) (m: Byte²) (simpleWithdraws: WithdrawTokenAmountᵐ)
437441

438442
WithdrawBatchTokenAmount ::= (signer: PublicKeyEd25519) (signature: SignatureEd25519) (message: WithdrawMessageTokenAmount)
439443

@@ -475,13 +479,13 @@ It is serialized as: 2 bytes representing the number of transfers (``n``) follow
475479

476480
Each ``TransferBatchCcdAmount`` is serialized as: a :ref:`CIS-5-PublicKeyEd25519` (``signer``), a :ref:`CIS-5-SignatureEd25519` (``signature``), and a ``TransferMessageCcdAmount`` (``message``).
477481

478-
Each ``TransferMessageCcdAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-TimeStamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-CCDAmount` (``serviceFee``), 2 bytes representing the number of simple transfers (``m``) followed by the bytes for this number of simple transers (``simpleTransfers``).
482+
Each ``TransferMessageCcdAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-Timestamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-CCDAmount` (``serviceFee``), 2 bytes representing the number of simple transfers (``m``) followed by the bytes for this number of simple transers (``simpleTransfers``).
479483

480484
Each ``TransferCcdAmount`` is serialized as: the receiving :ref:`CIS-5-PublicKeyEd25519` (``to``), and the :ref:`CIS-5-CCDAmount` (``transferAmount``)::
481485

482486
TransferCcdAmount ::= (to: PublicKeyEd25519) (transferAmount: CCDAmount)
483487

484-
TransferMessageCcdAmount ::= (entryPoint: EntrypointName) (expiryTime: TimeStamp) (nonce: u64) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: CCDAmount) (m: Byte²) (simpleTransfers: TransferCcdAmountᵐ)
488+
TransferMessageCcdAmount ::= (entryPoint: EntrypointName) (expiryTime: Timestamp) (nonce: Nonce) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: CCDAmount) (m: Byte²) (simpleTransfers: TransferCcdAmountᵐ)
485489

486490
TransferBatchCcdAmount ::= (signer: PublicKeyEd25519) (signature: SignatureEd25519) (message: TransferMessageCcdAmount)
487491

@@ -520,13 +524,13 @@ It is serialized as: 2 bytes representing the number of transfers (``n``) follow
520524

521525
Each ``TransferBatchTokenAmount`` is serialized as: a :ref:`CIS-5-PublicKeyEd25519` (``signer``), a :ref:`CIS-5-SignatureEd25519` (``signature``), and a ``TransferMessageTokenAmount`` (``message``).
522526

523-
Each ``TransferMessageTokenAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-TimeStamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-ExternalTokenAmount` (``serviceFee``), 2 bytes representing the number of simple transfers (``m``) followed by the bytes for this number of simple transfers (``simpleTransfers``).
527+
Each ``TransferMessageTokenAmount`` is serialized as: an :ref:`CIS-5-EntrypointName` (``entryPoint``), a :ref:`CIS-5-Timestamp` (``expiryTime``), a :ref:`CIS-5-Nonce` (``nonce``), a :ref:`CIS-5-PublicKeyEd25519` (``serviceFeeRecipient``), a :ref:`CIS-5-ExternalTokenAmount` (``serviceFee``), 2 bytes representing the number of simple transfers (``m``) followed by the bytes for this number of simple transfers (``simpleTransfers``).
524528

525529
Each ``TransferTokenAmount`` is serialized as: the receiving :ref:`CIS-5-PublicKeyEd25519` (``to``), the :ref:`CIS-5-ExternalTokenAmount` (``transferAmount``)::
526530

527531
TransferTokenAmount ::= (to: PublicKeyEd25519) (transferAmount: ExternalTokenAmount)
528532

529-
TransferMessageTokenAmount ::= (entryPoint: EntrypointName) (expiryTime: TimeStamp) (nonce: u64) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: ExternalTokenAmount) (m: Byte²) (simpletransfers: TransferTokenAmountᵐ)
533+
TransferMessageTokenAmount ::= (entryPoint: EntrypointName) (expiryTime: Timestamp) (nonce: Nonce) (serviceFeeRecipient: PublicKeyEd25519) (serviceFee: ExternalTokenAmount) (m: Byte²) (simpletransfers: TransferTokenAmountᵐ)
530534

531535
TransferBatchTokenAmount ::= (signer: PublicKeyEd25519) (signature: SignatureEd25519) (message: TransferMessageTokenAmount)
532536

0 commit comments

Comments
 (0)