Skip to content

api.entities.Asset.Fungible.TransferRestrictions.Count.Count

prashantasdeveloper edited this page Dec 2, 2024 · 30 revisions

Class: Count

api/entities/Asset/Fungible/TransferRestrictions/Count.Count

Handles all Count Transfer Restriction related functionality

Hierarchy

Table of contents

Properties

Properties

addRestriction

addRestriction: ProcedureMethod<Omit<AddCountTransferRestrictionParams, "type">, BigNumber, BigNumber>

Add a Count Transfer Restriction to this Asset. This limits to total number of individual investors that may hold the Asset. In some jurisdictions once a threshold of investors is passed, different regulations may apply. Count Transfer Restriction can ensure such limits are not exceeded

Throws

if a count statistic is not enabled for the Asset. Count.enableStat should be called before this method

Overrides

TransferRestrictionBase.addRestriction

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:39


disableStat

disableStat: NoArgsProcedureMethod<void, void>

Disables the investor count statistic for the Asset. Since statistics introduce slight overhead to each transaction involving the Asset, disabling unused stats will reduce gas fees for investors when they transact with the Asset

Throws

if the stat is being used by a restriction or is not set

Overrides

TransferRestrictionBase.disableStat

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:83


enableStat

enableStat: ProcedureMethod<Pick<AddCountStatParams, "count">, void, void>

Enables an investor count statistic for the Asset, which is required before creating restrictions

The counter is only updated automatically with each transfer of tokens after the stat has been enabled. As such the initial value for the stat should be passed in, which can be fetched with Count.investorCount

Note

Currently there is a potential race condition if passing in counts values when the Asset is being traded. It is recommended to call this method during the initial configuration of the Asset, before people are trading it. Otherwise the Asset should be frozen, or the stat checked after being set to ensure the correct value is used. Future versions of the chain may expose a new extrinsic to avoid this issue

Overrides

TransferRestrictionBase.enableStat

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:75


get

get: () => Promise<ActiveTransferRestrictions<CountTransferRestriction>>

Type declaration

▸ (): Promise<ActiveTransferRestrictions<CountTransferRestriction>>

/**

  • Retrieve all active Count Transfer Restrictions
Returns

Promise<ActiveTransferRestrictions<CountTransferRestriction>>

Note

there is a maximum number of restrictions allowed across all types.

  • The availableSlots property of the result represents how many more restrictions can be added
  • before reaching that limit

Overrides

TransferRestrictionBase.get

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:94


getStat

getStat: () => Promise<ActiveStats>

Type declaration

▸ (): Promise<ActiveStats>

Retrieve current Count Transfer Restriction investor balance statistic for the Asset

Returns

Promise<ActiveStats>

Overrides

TransferRestrictionBase.getStat

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:109


investorCount

investorCount: () => Promise<BigNumber>

Type declaration

▸ (): Promise<BigNumber>

Returns the count of individual holders of the Asset

Returns

Promise<BigNumber>

Note

This value can be used to initialize enableStat. If used for this purpose there is a potential race condition if Asset transfers happen between the time of check and time of use. Either pause Asset transfers, or check after stat creation and try again if a race occurred. Future versions of the chain should introduce an extrinsic to avoid this issue

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:103


removeRestrictions

removeRestrictions: NoArgsProcedureMethod<BigNumber, BigNumber>

Removes all Count Transfer Restrictions from this Asset

Note

the result is the total amount of restrictions after the procedure has run

Overrides

TransferRestrictionBase.removeRestrictions

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:62


setRestrictions

setRestrictions: ProcedureMethod<Omit<SetCountTransferRestrictionsParams, "type">, BigNumber, BigNumber>

Sets all Count Transfer Restrictions on this Asset

Note

this method sets exempted Identities for restrictions as well. If an Identity is currently exempted from a Count Transfer Restriction but not passed into this call then it will be removed

Note

the result is the total amount of restrictions after the procedure has run

Overrides

TransferRestrictionBase.setRestrictions

Defined in

api/entities/Asset/Fungible/TransferRestrictions/Count.ts:52

Clone this wiki locally