Welcome to the first part of a new series where we will report on the final result of CR Proposals submitted to the Cyber Republic Consensus (CRC) Process.
ChainLink Integration with VulcanLink Oracles
Our first fully completed CR Proposal is “Chainlink x ELASTOS — High-TPS Decentralized Oracles (Price Feeds, API Data, Real World Data)” — at: https://www.cyberrepublic.org/proposals/5f20d5627a0b6d0078041fc8.
Below we’ll also cover an example of how to use the oracle data.
The early push for oracle integration actually began in September of 2019 when Zach — Communications Lead and Clarence Liu — VP of Development from Elastos met with Sergey (whom you should all know) and Dan Kochis the Head of BD at Chainlink. At that time DeFi was in its infancy and Elastos’ focus on its Smart Contract Chain — the Elastos Ethereum Sidechain — was just beginning.
It wasn’t until February of 2020 when Clarence attended and participated in the ETHDenver hackathon that he met VulcanLink. Since he attended alone he randomly joined a team through Discord, and serendipitously ended up on the same team as Leo Vigna, the founder of VulcanLink — https://vulcan.link. ChainLink was also in attendance at ETHDenver and Clarence spoke again with Dan Kochis who he had been in touch with for the past months.
Starting the CR Suggestion
As you may know, the CR Proposal process begins with a CR Suggestion — a detailed guide and explanation can be found here https://crregions.com/#/proposal — which started on July 24, 2020. No changes are allowed when a Suggestion is promoted to a CR Proposal, so the proposal link above is the same.
The primary goals were:
- Deploy the Chainlink Smart Contracts on the Elastos ETH Sidechain TestNet.
This was completed and the oracle contracts are listed here: https://www.notion.so/Elastos-Oracles-8a44498a815a46eaa382774c91dbcbf1
- Run a VulcanLink data oracle for the ELA/USD price feed, and find 2 other oracle providers to ensure we meet the minimum requirement of 3 oracles.
VulcanLink has been sourced through its contacts Secure Data Links and DaVinci Nodes which have joined to provide the oracle data.
- Host a Web UI at https://elastos.feeds.link to show the current price feed.
This feed is now working and has a 5 minute refresh, also the data is available free of charge to developers for the initial interim period.
CR Regions Contributed By Creating Documentation and Guides
- https://developer.elastos.org now has a new section on “Browser dApps” to guide developers looking to learn how to build the standard web-based dApps that most people are used to.
- This Developer documentation makes significant references to this Github Repo which demonstrates an Elastos dApp running on the TestNet ETH Sidechain, complete with Metamask integration:
- https://github.com/crregions/vulcanlink-test/tree/master/contracts also has an example that shows the interaction with the oracle contract.
- Lastly VulcanLink’s contract reference is here: https://www.notion.so/Elastos-Oracles-8a44498a815a46eaa382774c91dbcbf1
Budget and Expenditures
All rewards were in-line with the budget in the proposal, all funds were fully directed to VulcanLink — CR Regions took no funds for its role in verification and consultation.
VulcanLink will provide the ELA/USD data feed free of charge to developers for a generous interim period until with the pre-allocated 300 ELA fund until dApp development opens new use cases. We have no set date for transition to a sponsorship type system yet.
Also VulcanLink has graciously exposed its websocket and https Elastos ETH Sidechain endpoints for all developers to use:
How to Reference the ELA/USD Value In Your Smart Contract
For a quick crash course in how oracle data is used, we’ll run through the basic steps assuming you know how to deploy and interact with smart contracts — learn at https://developer.elastos.org/build/dapps.
Add the Aggregator contract and the “function signature” to your smart contract
In our case we’ll be using the Solidity 0.4 Aggregator used by VulcanLink found at https://github.com/vulcanlink/chainlink/tree/chainlink-elastos.
The pertinent contracts are found under evm-contracts, in our case we only want the method latestAnswer so we’ll add the “function signature” to our smart contract.
We are also using Open Zeppelin’s Initializable smart contract so we can initialize the smart contract with the address of the existing smart contract address of the deployed Aggregator.
By referencing https://www.notion.so/Elastos-Oracles-8a44498a815a46eaa382774c91dbcbf1 you can see that the VulcanLink Aggregator deployed is at address: 0xA64267e44af675498310620418c8F08A9dAeB1eb.
So your deploy must include something like:
This call to initialize overwrites the contract address of Aggregator with the existing deployed contract.
If you’re running the test from the Github Repo vulcanlink-test you should see something similar to the above.
Here I’m just using the ELA/USD price to calculate the price in USD for a given amount of ELA, but you can take this and extend it to do a lot of cool stuff. For example as an exercise you can create a “prediction market” where you guess the price of ELA at a certain date.
If you have issues or would like to share your project with us feel free to email us at firstname.lastname@example.org.