Skip to content

Commit

Permalink
Document the limitation in number of account updates.
Browse files Browse the repository at this point in the history
Also, switch to `TokenContractV2`.
  • Loading branch information
kantp committed Jul 17, 2024
1 parent f423ccb commit 1ff2fa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion FungibleToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
state,
Struct,
TokenContract,
TokenContractV2,
Types,
UInt64,
UInt8,
Expand All @@ -36,7 +37,7 @@ interface FungibleTokenDeployProps extends Exclude<DeployArgs, undefined> {
startUnpaused?: boolean
}

export class FungibleToken extends TokenContract {
export class FungibleToken extends TokenContractV2 {
@state(UInt8)
decimals = State<UInt8>()
@state(PublicKey)
Expand Down Expand Up @@ -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<void> {
this.paused.getAndRequireEquals().assertFalse()
Expand Down
3 changes: 3 additions & 0 deletions documentation/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 1ff2fa7

Please sign in to comment.