Skip to main content

FungibleToken

Hierarchy

  • TokenContract
    • FungibleToken

Index

Constructors

externalconstructor

  • new FungibleToken(address: PublicKey, tokenId?: Field): FungibleToken
  • Parameters

    • externaladdress: PublicKey
    • externaloptionaltokenId: Field

    Returns FungibleToken

Properties

admin

admin: State<PublicKey> = ...

decimals

decimals: State<UInt8> = ...

readonlyevents

events: { BalanceChange: typeof BalanceChangeEvent; Burn: typeof BurnEvent; Mint: typeof MintEvent; Pause: typeof PauseEvent; SetAdmin: typeof SetAdminEvent } = ...

Type declaration

paused

paused: State<Bool> = ...

staticAdminContract

AdminContract: new (...args: any) => FungibleTokenAdminBase = FungibleTokenAdmin

Type declaration

Methods

approveBase

  • approveBase(updates: AccountUpdateForest): Promise<void>
  • Approve AccountUpdates that have been created outside of the token contract.

    @argument

    updates - The AccountUpdates to approve. Note that the forest size is limited by the base token contract,

    @see

    TokenContractV2.MAX_ACCOUNT_UPDATES The current limit is 9.


    Parameters

    • updates: AccountUpdateForest

    Returns Promise<void>

burn

  • burn(from: PublicKey, amount: UInt64): Promise<AccountUpdate>
  • Parameters

    • from: PublicKey
    • amount: UInt64

    Returns Promise<AccountUpdate>

deploy

  • deploy(props: FungibleTokenDeployProps): Promise<void>
  • Parameters

    • props: FungibleTokenDeployProps

    Returns Promise<void>

publicgetAdminContract

getBalanceOf

  • getBalanceOf(address: PublicKey): Promise<UInt64>
  • Parameters

    • address: PublicKey

    Returns Promise<UInt64>

getCirculating

  • getCirculating(): Promise<UInt64>
  • Reports the current circulating supply This does take into account currently unreduced actions.


    Returns Promise<UInt64>

getDecimals

  • getDecimals(): Promise<UInt8>
  • Returns Promise<UInt8>

initialize

  • initialize(admin: PublicKey, decimals: UInt8, startPaused: Bool): Promise<void>
  • Initializes the account for tracking total circulation.

    @argument

    admin - public key where the admin contract is deployed

    @argument

    decimals - number of decimals for the token

    @argument

    startPaused - if set to `Bool(true), the contract will start in a mode where token minting and transfers are paused. This should be used for non-atomic deployments


    Parameters

    • admin: PublicKey
    • decimals: UInt8
    • startPaused: Bool

    Returns Promise<void>

mint

  • mint(recipient: PublicKey, amount: UInt64): Promise<AccountUpdate>
  • Parameters

    • recipient: PublicKey
    • amount: UInt64

    Returns Promise<AccountUpdate>

pause

  • pause(): Promise<void>
  • Returns Promise<void>

resume

  • resume(): Promise<void>
  • Returns Promise<void>

setAdmin

  • setAdmin(admin: PublicKey): Promise<void>
  • Parameters

    • admin: PublicKey

    Returns Promise<void>

transfer

  • transfer(from: PublicKey, to: PublicKey, amount: UInt64): Promise<void>
  • Parameters

    • from: PublicKey
    • to: PublicKey
    • amount: UInt64

    Returns Promise<void>

updateVerificationKey

  • updateVerificationKey(vk: VerificationKey): Promise<void>
  • Update the verification key. Note that because we have set the permissions for setting the verification key to impossibleDuringCurrentVersion(), this will only be possible in case of a protocol update that requires an update.


    Parameters

    • vk: VerificationKey

    Returns Promise<void>