<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Developers Forum for XinFin XDC Network: Luciano</title>
    <description>The latest articles on Developers Forum for XinFin XDC Network by Luciano (@juvinski).</description>
    <link>https://www.xdc.dev/juvinski</link>
    <image>
      <url>https://www.xdc.dev/images/2HjaM__0cthqXkfqLrBpVajAZDKK68J7lxCRKTU2P4k/rs:fill:90:90/mb:500000/ar:1/aHR0cHM6Ly93d3cu/eGRjLmRldi91cGxv/YWRzL3VzZXIvcHJv/ZmlsZV9pbWFnZS8z/NzA4LzgzYWQ2N2Rj/LTQ3NDItNGExZS05/ZjE5LTdmYmZlZDli/MDJmZS5qcGc</url>
      <title>Developers Forum for XinFin XDC Network: Luciano</title>
      <link>https://www.xdc.dev/juvinski</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://www.xdc.dev/feed/juvinski"/>
    <language>en</language>
    <item>
      <title>Getting Started with Fact Finance on XDC</title>
      <dc:creator>Luciano</dc:creator>
      <pubDate>Tue, 28 Jan 2025 03:28:23 +0000</pubDate>
      <link>https://www.xdc.dev/juvinski/getting-started-with-fact-finance-on-xdc-1aac</link>
      <guid>https://www.xdc.dev/juvinski/getting-started-with-fact-finance-on-xdc-1aac</guid>
      <description>&lt;p&gt;The Fact Finance is a Sync Oracle designed for efficiency and scalability in Web3. Unlike traditional oracles that require constant querying by smart contracts (pull model), the push oracle actively syncs critical economic data on-chain, making it instantly available for smart contract consumption.&lt;/p&gt;

&lt;p&gt;Our push oracle supports a wide range of real-world data types, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exchange rates&lt;/li&gt;
&lt;li&gt;Interest rates&lt;/li&gt;
&lt;li&gt;Inflation indices&lt;/li&gt;
&lt;li&gt;Proof-of-reserve data for tokenized assets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.xdc.dev/images/K2evN3sRNtU1OxLMjhttM_G99yx3A9FXHvAoOa2jB40/w:880/mb:500000/ar:1/aHR0cHM6Ly93d3cu/eGRjLmRldi91cGxv/YWRzL2FydGljbGVz/LzM1OHo1d2Y5bjRm/d2NqbjB2bHBxLnBu/Zw" class="article-body-image-wrapper"&gt;&lt;img src="https://www.xdc.dev/images/K2evN3sRNtU1OxLMjhttM_G99yx3A9FXHvAoOa2jB40/w:880/mb:500000/ar:1/aHR0cHM6Ly93d3cu/eGRjLmRldi91cGxv/YWRzL2FydGljbGVz/LzM1OHo1d2Y5bjRm/d2NqbjB2bHBxLnBu/Zw" alt="Fact Finance Push Oracle" width="880" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Getting Started
&lt;/h1&gt;

&lt;p&gt;The &lt;a href="https://docs.fact.finance/static/fointerfacev1.sol"&gt;&lt;strong&gt;FOInterfaceV1&lt;/strong&gt;&lt;/a&gt; contract provides an interface for interacting with the synchronous (push) version of the Fact Oracle, where data is periodically updated on-chain. This guide explains how to use the interface to retrieve data feeds, manage subscriptions, and ensure best practices when working with Fact Oracle services.&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation
&lt;/h1&gt;

&lt;p&gt;Import the Interface:&lt;br&gt;
Include the FOInterfaceV1.sol file in your Solidity project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"./FOInterfaceV1.sol"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Contract Initialization:
&lt;/h1&gt;

&lt;p&gt;Obtain the address of a contract that implements the FOInterfaceV1 interface from the &lt;a href="!https://docs.fact.finance/chains/"&gt;chain list&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Usage
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Return Type - DataFeed Struct
&lt;/h2&gt;

&lt;p&gt;The DataFeed struct represents the oracle data feed, including the value, confidence score, and metadata for interpretation. This is how the data is structured:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;/// @title Data Feed Struct
/// @notice Represents the data feed with a value, timestamp, and confidence level
/// @dev Stores oracle data with additional metadata for reliability and scaling
&lt;/span&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;DataFeed&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int128&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;        &lt;span class="c1"&gt;/// @dev Integer value of the data feed, representing the main metric or value.
&lt;/span&gt;    &lt;span class="kt"&gt;uint64&lt;/span&gt; &lt;span class="n"&gt;updatedAt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;/// @dev Timestamp (in seconds) when the backend last updated this data feed.
&lt;/span&gt;    &lt;span class="kt"&gt;uint8&lt;/span&gt; &lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;       &lt;span class="c1"&gt;/// @dev Number of decimal places for the data value (e.g., 2 for cents, 6 for micro-units).
&lt;/span&gt;    &lt;span class="kt"&gt;uint8&lt;/span&gt; &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;/// @dev Confidence level of the data feed (0: outlier, 5: acceptable, 95: highly reliable).
&lt;/span&gt;    &lt;span class="kt"&gt;bytes6&lt;/span&gt; &lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;         &lt;span class="c1"&gt;/// @dev Encoded additional information about the data feed (e.g., metadata or tags).
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  value:
&lt;/h3&gt;

&lt;p&gt;The raw integer data from the oracle. To derive the actual value, multiply value by 10^-decimal.&lt;br&gt;
Example: If value = 12345 and decimal = 2, the actual value is 123.45.&lt;/p&gt;
&lt;h3&gt;
  
  
  updatedAt:
&lt;/h3&gt;

&lt;p&gt;The timestamp indicating when the data was last updated.&lt;br&gt;
Important: Use this to verify the freshness of the data and ensure it hasn’t expired before using it in smart contracts.&lt;/p&gt;
&lt;h3&gt;
  
  
  decimal:
&lt;/h3&gt;

&lt;p&gt;Indicates how many decimal places the value needs for interpretation.&lt;/p&gt;
&lt;h3&gt;
  
  
  confidence:
&lt;/h3&gt;

&lt;p&gt;Represents the reliability of the data feed:&lt;br&gt;
0: Outlier (use with caution).&lt;br&gt;
5: Acceptable (mild volatility).&lt;br&gt;
95: Reliable (highly trustworthy).&lt;/p&gt;
&lt;h3&gt;
  
  
  info:
&lt;/h3&gt;

&lt;p&gt;Encoded extra information about the data feed, which can contain metadata or tags. For example:&lt;br&gt;
For a CPI (Consumer Price Index) feed, info might include the month, last 12 months, and last change.&lt;/p&gt;
&lt;h1&gt;
  
  
  Interacting with FOInterfaceV1
&lt;/h1&gt;

&lt;p&gt;Initialization Set up your contract with the Fact Oracle address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;address&lt;/span&gt; &lt;span class="n"&gt;_oracle&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fOracle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FOInterfaceV1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_oracle&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Methods&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getSyncData():&lt;/strong&gt; Retrieve the latest data feed for a specific code.&lt;/p&gt;

&lt;p&gt;Parameter:&lt;br&gt;
code (uint16): The identification code of the feed. Codes for various feeds can be found at DataFeed List.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getSyncData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint16&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;DataFeed&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fOracle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getSyncData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
    &lt;span class="c1"&gt;// Calculate actual value
&lt;/span&gt;    &lt;span class="kt"&gt;int256&lt;/span&gt; &lt;span class="n"&gt;actualValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="kt"&gt;int256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// Check if data is fresh
&lt;/span&gt;    &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;updatedAt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Data expired"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 1-hour limit
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Freemium Oracle Model
&lt;/h1&gt;

&lt;p&gt;The Fact Oracle operates on a freemium model. Most data feeds, such as economic indices and public data, are free to access. Licensed data feeds require a subscription.&lt;/p&gt;

&lt;h1&gt;
  
  
  Best Practices
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Restrict Oracle Updates:&lt;/strong&gt;&lt;br&gt;
Always use a restricted modifier (e.g., onlyOwner) to update the oracle address securely.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;updateOracle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;address&lt;/span&gt; &lt;span class="n"&gt;_oracle&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;onlyOwner&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
    &lt;span class="n"&gt;fOracle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FOInterfaceV1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_oracle&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Validate Freshness:&lt;/strong&gt;&lt;br&gt;
Ensure data retrieved from the oracle is not expired by comparing data.updatedAt with the current block timestamp.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handle Confidence Levels:&lt;/strong&gt;&lt;br&gt;
Implement logic to treat confidence appropriately. For example:&lt;/p&gt;

&lt;p&gt;Reject feeds with confidence = 0.&lt;br&gt;
Use stricter rules for confidence = 5.&lt;br&gt;
Fully trust data with confidence = 95.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Decimals Correctly:&lt;/strong&gt;&lt;br&gt;
Always factor in decimal when calculating or displaying the data value.&lt;/p&gt;

&lt;p&gt;With these steps and best practices, you can seamlessly integrate Fact Oracle services into your smart contracts while ensuring security, accuracy, and efficiency. &lt;/p&gt;

</description>
      <category>oracle</category>
      <category>latam</category>
      <category>rwa</category>
      <category>data</category>
    </item>
    <item>
      <title>XDC RWA Oracle for Latin America</title>
      <dc:creator>Luciano</dc:creator>
      <pubDate>Fri, 06 Dec 2024 14:39:31 +0000</pubDate>
      <link>https://www.xdc.dev/juvinski/xdc-rwa-oracle-for-latin-america-1hpo</link>
      <guid>https://www.xdc.dev/juvinski/xdc-rwa-oracle-for-latin-america-1hpo</guid>
      <description>&lt;p&gt;🚀 Attention #Developers on the @XDCNetwork!&lt;/p&gt;

&lt;p&gt;Fact Finance is now live on #XDC, providing seamless access to Brazilian and Argentine economic indices like CDI (interest rates) and CPI (inflation) through our reliable oracle.&lt;/p&gt;

&lt;p&gt;🔧 This integration is built with developers in mind, offering you official, compliant data from trusted sources to power secure and accurate dapps, especially in #DeFi and tokenization projects.&lt;/p&gt;

&lt;p&gt;💡 With Fact Finance, you can effortlessly incorporate real-world economic data into your applications, enhancing trust, functionality, and user experience. Whether you’re building lending platforms, stablecoins, or tokenized assets, our tools are here to simplify the process.&lt;/p&gt;

&lt;p&gt;Stay tuned for more updates in the next post! In the meantime, explore our GitHub and start building today: &lt;a href="https://github.com/FactFinance"&gt;https://github.com/FactFinance&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Be in touch &lt;a href="mailto:xdc@fact.finance"&gt;xdc@fact.finance&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  RWA #oracle #Latam #DevTools
&lt;/h1&gt;

</description>
    </item>
  </channel>
</rss>
