Example : Chainlink Price Feed
A simple smart contract call to the Chainlink ETH/USD Pricefeed on Polygon Mumbai Testnet from your SAP system
Configuration instructions
Retrieve the required ABI file from https://mumbai.polygonscan.com/address/0x0715A7794a1dc8e42615F059dD6e406A6594651A#code
Select the Export ABI button to save the file as pricefeed.abi.json
Upload the pricefeed.abi.json file to a chosen location on your SAP system through transaction code CG3Z. If your system does not tcode CG3Z - try using using the zapcommander for an open source ABAP tool for uploading files to AL11 directories
Use transaction code SM30 on the ZPRVDABIREGISTRY
table to create an entry
Create a table entry with the following parameters (the entries are case sensitive!)
PRVD Nchain Network ID 4251b6fd-c98d-4017-87a3-d691a77a52a7
Smart contract address 0x0715A7794a1dc8e42615F059dD6e406A6594651A
File location: Use the AL11 file location you uploaded the file to
We are looking to improve the UX of this process with a SAPUI5 Fiori App. Contact us if you are interested in how you can contribute!
Running an example
Heads up! While this example doesn't require a zero knowledge proof here - you do still need and entry in the ZPRVDTENANTS
table to authenticate to Polygon via PRVD Nchain.
If you successfully set up a subject account in Shuttle earlier - that should suffice. Otherwise you can set up an organization and vault using the PRVD CLI and maintain the org in SAP using the Postman collection
For a basic example : You can copy / paste the following ABAP code into a report and execute
For a more advanced example: You can also check out our Chainlink Fall 2022 Hackathon Entry for a more advanced example that alters the foreign exchange rates maintained in SAP in the table TCURR.
Regardless of what way you choose to explore using smart contracts in ABAP, you should receive a JSON HTTP response at the end of the call_chainlink_pricefeed
method like this
Interpreting the results
The output values in Nchain response can appear quite raw - but they do correspond precisely to the outputs defined in the smart contract function we called. Note how the solidity function below corresponds to the smart contract outputs received.
Source:
Feel free to poke around the block explorer for the smart contract a bit more - it's full of useful information!
Last updated