Constructor
# new ERC20Token(mopt) → {void}
Represents an ERC20 token definition within the Fabric ERC20 sample, including name, symbol, decimals, and the owning identity. Used to define the unique token managed by the contract.
ERC20 token metadata model
sequenceDiagram
participant App
participant Repo
participant Adapter
App->>Repo: create(new ERC20Token({...}), ctx)
Repo->>Adapter: create(table, id=name, record, flags)
Adapter-->>Repo: stored
Repo-->>App: model
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
m |
ModelArg.<ERC20Token>
|
<optional> |
Optional partial data or another instance to initialize the model |
void
Example
const token = new ERC20Token({ name: "MyToken", symbol: "MTK", decimals: 18, owner: "x509::..." });
// Persist through a repository: await repo.create(token, ctx)
Members
# decimals
Number of digits after the decimal separator used when formatting token balances
Decimal precision for token amounts
# name
Serves as the primary key for the ERC20 token definition; typically a human-readable identifier
Token unique name
# owner
X.509 subject or MSP identity string that denotes who owns/controls the token definition
Owning identity of the token