From 1ff2fa770e59a20dbfc6077887953d8b4923ad02 Mon Sep 17 00:00:00 2001 From: Philipp Kant Date: Tue, 16 Jul 2024 11:40:49 +0200 Subject: [PATCH] Document the limitation in number of account updates. Also, switch to `TokenContractV2`. --- FungibleToken.ts | 7 ++++++- documentation/introduction.md | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/FungibleToken.ts b/FungibleToken.ts index 7ddf590..ce3006f 100644 --- a/FungibleToken.ts +++ b/FungibleToken.ts @@ -14,6 +14,7 @@ import { state, Struct, TokenContract, + TokenContractV2, Types, UInt64, UInt8, @@ -36,7 +37,7 @@ interface FungibleTokenDeployProps extends Exclude { startUnpaused?: boolean } -export class FungibleToken extends TokenContract { +export class FungibleToken extends TokenContractV2 { @state(UInt8) decimals = State() @state(PublicKey) @@ -162,6 +163,10 @@ export class FungibleToken extends TokenContract { assert(updateAllowed.or(permissions.isSome.not())) } + /** Approve `AccountUpdate`s that have been created outside of the token contract. + * + * @argument {AccountUpdateForest} updates - The `AccountUpdate`s to approve. Note that the forest size is limited by the base token contract, @see TokenContractV2.MAX_ACCOUNT_UPDATES The current limit is 9. + */ @method async approveBase(updates: AccountUpdateForest): Promise { this.paused.getAndRequireEquals().assertFalse() diff --git a/documentation/introduction.md b/documentation/introduction.md index 2124f7b..fd67369 100644 --- a/documentation/introduction.md +++ b/documentation/introduction.md @@ -93,3 +93,6 @@ the `approveBase()` method of the custom token standard reference implementation > [!IMPORTANT] When manually constructing `AccountUpdate`s, make sure to order then appropriately in > the call to `approveBase()`. The contract will not allow flash minting, i.e., tokens cannot be > received by an account before they have been sent from an account. + +[!NOTE] The number of `AccountUpdate`s that you can pass to `approveBase()` is limited by the base +token contract. The current limit is 9.