Token Version Specification
Overview
The TokenVersion field is an enum that indicates which token implementation is being used for a specific token. This field is crucial for determining the capabilities and features available for each token launched through the Portal contract.
TokenVersion Enum Values
/// @dev Token version
/// Which token implementation is used
enum TokenVersion {
TOKEN_LEGACY_MINT_NO_PERMIT,
TOKEN_LEGACY_MINT_NO_PERMIT_DUPLICATE, // for historical reasons, both 0 and 1 are the same: TOKEN_LEGACY_MINT_NO_PERMIT
TOKEN_V2_PERMIT, // 2
TOKEN_GOPLUS, // 3
TOKEN_TAXED, // 4: The original tax token (FlapTaxToken)
TOKEN_TAXED_V2 // 5: The new advanced tax token (FlapTaxTokenV2)
}The TokenVersion has the following values:
0
TOKEN_LEGACY_MINT_NO_PERMIT
Legacy token implementation without permit functionality
1
TOKEN_LEGACY_MINT_NO_PERMIT_DUPLICATE
Historical duplicate (identical to value 0)
2
TOKEN_V2_PERMIT
V2 token implementation with EIP-2612 permit support
3
TOKEN_GOPLUS
Token implementation with GoPlus security integration
4
TOKEN_TAXED
Original tax token implementation (FlapTaxToken)
5
TOKEN_TAXED_V2
Advanced tax token implementation (FlapTaxTokenV2)
Version Details
TOKEN_LEGACY_MINT_NO_PERMIT (0 & 1): The obsolete token implementation. Due to historical reasons, both values 0 and 1 represent the same implementation type.
TOKEN_V2_PERMIT (2): Enhanced token with permit functionality allowing gasless approvals via signed messages (EIP-2612 standard).
TOKEN_GOPLUS (3): Token integrated with GoPlus security features for enhanced safety and verification. (Not Used in current deployments)
TOKEN_TAXED (4): The first generation tax token (
FlapTaxToken) that implements tax mechanisms on transfers.TOKEN_TAXED_V2 (5): The second generation tax token (
FlapTaxTokenV2) with advanced tax features and improvements over the original tax token.
How to Get Token Version
There are two primary methods to retrieve the token version for a specific token:
Method 1: Index from Events
The protocol emits a TokenVersionSet event whenever a token's version is set or updated. You can listen to this event or query historical events to determine a token's version.
Event Definition:
Example Usage:
Listen for
TokenVersionSetevents on the Portal contractFilter events by the token address
The
versionparameter contains theTokenVersionenum value
Method 2: Using getTokenV* Methods
The Portal contract provides multiple view functions to query token state, each returning progressively more fields. All of these methods include the tokenVersion field in their return values.
Available Methods:
getTokenV5 - Returns
TokenStateV5structuregetTokenV6 - Returns
TokenStateV6structuregetTokenV7 - Returns
TokenStateV7structure (most comprehensive)
All TokenState structures include:
TokenVersion tokenVersion- The version of the token implementation
Example Usage:
Last updated