EquivalentToken, CBC20 Token Extension for Value Equivalence Based on External Price Feeds
EquivalentToken, CBC20 Token Extension
Abstract
This CIP introduces the "EquivalentToken" contract, an extension of the BaseToken contract, which integrates external price feeds to determine the equivalent value of token transactions. This functionality enables the token to adapt its transfer, approval, and spending mechanisms based on real-time price data, making it suitable for applications requiring value stability or reference to external assets.
Motivation
The motivation behind the EquivalentToken contract is to provide a flexible token standard that can reference external price data to maintain value equivalence. This is particularly useful for tokens pegged to external assets, stablecoins, or any application where the token value needs to be adjusted in accordance with real-world data.
Specification
The EquivalentToken Contract
Key Features:
- Price Feed Integration: Utilizes an external price feed contract to obtain real-time price data.
- Value Equivalence Functions: Includes modified transfer, approve, and transferFrom functions that calculate the equivalent amount of tokens based on the current price data.
- Oracle Management: Functionality for the contract owner to change the price feed source.
Technical Details
- Blockchain Compatibility: Core Blockchain (Ylem Version >0.8.0)
- Core Functions:
transferEquivalent
,approveEquivalent
,transferFromEquivalent
: Modified CBC20 functions to handle value equivalence.changeOracle(address _priceFeed)
: The owner can change the price feed source._equivalent(uint256 amount)
: Private function to calculate the equivalent amount of tokens based on the price feed.
Rationale
Integrating external price feeds into the EquivalentToken contract addresses the need for tokens whose value can be adjusted based on real-world data. This feature is essential in applications where tokens are pegged to external assets or value stability is critical.
Backward Compatibility
This contract aims to be compatible with the CBC20 standard, with additional functionalities that do not hinder its integration with existing Core Blockchain-based systems.
Security Considerations
Security concerns include the reliability and security of the external price feed and the potential for manipulation. Regular audits and reviews of the EquivalentToken contract and the price feed are recommended to ensure data integrity and contract security.
Conclusion
The EquivalentToken contract extends the CBC20 standard by incorporating external price data to maintain value equivalence. This innovation could significantly enhance the utility of tokens in various Core Blockchain-based applications, especially those requiring value stability or asset pegging.
Copyright
Copyright and related rights waived via CC0.