FantomPriceFeed.sol
Documentation for FantomPriceFeed.sol
Overview
FantomPriceFeed
serves as a price oracle for tokens within the Fantom ecosystem. It facilitates the registration of new tokens, the setting of token prices, and the retrieval of current prices. The contract integrates with other ecosystem components like AddressRegistry
and TokenRegistry
.
Key Features
Registering new tokens
Setting prices for tokens
Retrieving current prices for tokens
Integration with
AddressRegistry
andTokenRegistry
Structs
Token: Contains details about a token, including its decimals and current price.
Mappings
tokens: Maps a token address to a Token struct, storing information about decimals and price.
Events
NewToken: Emitted when a new token is registered in the contract.
NewTokenPrice: Emitted when the price of a registered token is updated.
Methods
registerNewToken: Allows the owner to register a new token by specifying its address, decimals, and initial price.
updateTokenPrice: Allows the owner to update the price of an already registered token.
getPrice: Public function that retrieves the current price and decimals for a given token.
Access Control
Owner Only: The owner has exclusive access to register new tokens and update their prices.
Public: The
getPrice
method is open to the public for price retrieval.
Payment Methods
The
FantomPriceFeed
contract does not involve any payments or transactions. It serves as a read-only price feed for tokens.Therefore, neither ERC20 tokens nor native tokens like ETH or FTM are used for payments in this contract.
ERC-20 Token Initialization
The contract does not initialize any ERC-20 tokens. It simply stores information about token decimals and prices for external retrieval. The specific tokens are registered and updated by the owner of the contract.
Last updated