End data consumers - Mainnet

(If you are a price consumer then follow below steps)

Explore https://feeds.goplugin.co & check which contract fulfills your requirement for the required price index pairs (Example: XDC-USDT, PLI-USDT, BTC-USDT, etc.,).

STEP 1:

Go to "Explore data feeds" and click on "View Feeds".

STEP 2:

Now choose the available feeds by category.

STEP 3:

Choose the Index Pair.

STEP 4:

Integrate your wallet.

Copy and save the contract.

In the next page, click on the "Connect Wallet to Deposit" button by pointing your XDCPay to mainnet with your registered wallet address. In the resultant page choose "XDCPay Wallet".

Now, you can Deposit PLI within the minimum & maximum range as highlighted.

STEP 5:

Deploy this IntegrationSample.sol using Remix.

STEP 6:

Copy the deployed contract address, go back to the feeds platform where you deposited the PLI Tokens and click on "Approve Contract", and approve the contract deployed.

Note:- Replace the prefix xdc with 0x in the contract before approving it.

STEP 7:

Call the function "getPriceInfo" on remix, this should trigger Oracle contract and write the data in "currentValue" on the UI.

STEP 8:

Call the function "show" to pull the current market price in your contract and go from there!

Note: the value you see from "Show", is multipled with 10000 to include fractional values. So when you are using this value in your contract, make sure to apply safemath(div) operator to use the actual value.

For ex - 310 / 10000 => 0.0310 would be the actual XDC price, as of today. This price may vary, when you execute.

Last updated