EccConfig.abi.json
Overview
The EccConfig.abi.json file defines the Application Binary Interface (ABI) for a smart contract that manages token configuration data. It specifies the contract's version, header fields, functions, data fields, and their types, enabling interaction with the contract by external applications or other smart contracts.
This ABI supports:
Initializing the contract.
Setting new token configurations.
Retrieving details of all configured tokens.
The contract internally maintains a mapping of token data indexed by a unique key and includes metadata such as timestamps and ownership.
File Structure and Components
ABI Metadata
ABI version:
2— Specifies the ABI schema version.version:
"2.4"— Contract version.header:
["pubkey", "time", "expire"]— Defines the standard header fields for messages interacting with the contract.
Fields
The contract defines several persistent fields used to store state:
Field Name | Type | Description | Initialization |
|---|---|---|---|
|
| Public key of the contract owner or deployer | Initialized |
|
| Timestamp of the last state change | Not initialized |
|
| Boolean flag indicating constructor execution status | Not initialized |
|
| Mapping from token key to token data and timestamp | Not initialized |
|
| Address of the owner of the contract | Not initialized |
The _data map stores complex tuples representing token configurations; each token entry includes:
key: A unique uint32 identifier.name: Token name as a string.decimals: Number of decimal places (uint64).baseMinted: Initial minted amount (uint64).description: Token description string.time: Timestamp uint32 indicating when the token data was set.
Functions
constructor
Purpose: Initializes the contract.
Inputs: None.
Outputs: None.
Details: Sets constructor-related state, likely initializing
_constructorFlagand other initial states.Usage: Automatically called when the contract is deployed.
setNewToken
Purpose: Adds or updates token configuration data in the contract.
Inputs:
token(tuple):key:uint32— Unique identifier for the token.name:string— Token name.decimals:uint64— Decimal precision.baseMinted:uint64— Initial minted token amount.description:string— Description of the token.
to(optionaladdress): Address that may receive permissions or reference related to this token configuration.
Outputs: None.
Details: This function updates the
_datamap with the new token tuple indexed bykey. It may set or update ownership or permissions based on the optionaltoaddress.Usage example (conceptual):
{ "name": "setNewToken", "inputs": [ { "key": 1, "name": "MyToken", "decimals": 18, "baseMinted": 1000000, "description": "Sample token" }, "to": "0:abcdef1234567890" ] }
getDetails
Purpose: Retrieves all stored token configurations along with their timestamps.
Inputs: None.
Outputs:
A map of
uint32keys to tuples containing:data: Token configuration tuple (key,name,decimals,baseMinted,description).time:uint32timestamp indicating when the token data was recorded.
Details: Returns the entire
_datamap to allow callers to view the current set of token configurations and their associated metadata.Usage example (conceptual):
{ "name": "getDetails", "outputs": { "1": { "data": { "key": 1, "name": "MyToken", "decimals": 18, "baseMinted": 1000000, "description": "Sample token" }, "time": 1680000000 } } }
Implementation Details and Algorithms
The contract maintains a mapping
_datawhere each entry is indexed by a unique token key (uint32). This map stores tuples that include token metadata and a timestamp.The
setNewTokenmethod allows for dynamic addition or updating of tokens, ensuring that the contract can evolve its token list post-deployment.The optional
toparameter insetNewTokenlikely facilitates ownership or permission control but requires further details from the contract's implementation.The
getDetailsmethod provides a snapshot of all token configurations, allowing external entities to synchronize or audit the stored tokens.The
_constructorFlagis used internally to track whether the constructor has been executed, preventing re-initialization.
Interaction with Other Parts of the System
External interfaces or user wallets interact with the contract via the ABI functions
setNewTokenandgetDetails.The contract owner (identified by
_ownerand_pubkey) manages the token configurations.The ABI header parameters (
pubkey,time,expire) ensure secure, time-bound, and authenticated transactions.This ABI likely serves as a configuration module for a larger token management or decentralized finance system, where tokens defined here are used or referenced by other contracts or services.
Visual Diagram
classDiagram
class EccConfig {
-_pubkey: uint256
-_timestamp: uint64
-_constructorFlag: bool
-_data: map(uint32, tuple)
-_owner: address
+constructor()
+setNewToken()
+getDetails()
}
class TokenData {
+key: uint32
+name: string
+decimals: uint64
+baseMinted: uint64
+description: string
+time: uint32
}
EccConfig "1" o-- "*" TokenData : _data