End data consumers - Apothem

(If you are a price consumer on Apothem testnet, then follow below steps)

NOTE: To get Apothem PLI & XDC tokens in your wallet, please follow the link "https://docs.goplugin.co/wallet/xdcpay-apothem"

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 Cryptocurrencies (Other) feed option for Apothem testnet.

STEP 3:

Choose the GNC/GNC Index Pair, which has the Apothem as Network.

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 apothem with your wallet address. In the resultant page choose "XDCPay Wallet".

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

STEP 5:

Once the PLI is deposited successfully you will get the below mentioned page.

STEP 5:

Now deploy this consumerContract.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, with input parameters of "from tokens" in "fsyms" and "to tokens" in "tsyms", and click on "transact" button, this should trigger oracle contract and will write the data for your request id. For example, we are overriding the PLI & USDT in fsyms, tsyms

STEP 8:

Click "requestId" button to get your requested value. Then copy the request id as highlighted in the given below image.

STEP 9:

Paste the copied request id in "Show" function and click the show button to get the value of the index pair.

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 - 552 / 10000 => 0.0552 would be the actual PLI price, as of today. This price may vary, when you execute.

Last updated