Integration Re-oraclize in the smart contract
1. Import Re-oraclize code into your smart contract
2. Inherit your smart contract from ReoraclizerUser
3. Each time you want to obtain the actual rate Ethereum/USD, call the method updatePrice() to update the variable priceEthUsd
4. Use the priceEthUsd variable for calculations. The variable stores a value with an accuracy of 0.0001. So, if the ETH/USD rate is exactly 320 USD, the variable will contain the number 3200000.
Access & payments
There are two ways to access Re-Oraclize’s data:
1. Payment for each request.
Each time the updated Price() function is called, 0.0002 ETH will be deducted from the smart contract account.
2. Access for 28 days.
In order to obtain unlimited access for 28 days, you must call the function processPurchase()
of the basic smart contract Reoraclizer at 0x9276096a81159efF8aac815D2578AecE98Cd7053, and as a parameter, put
the address of the smart contract from which the data will be accessed.
You can pay for the entire period if a transaction has a value of 0.144 ETH. For example, if you send 0.3 ETH,
access will be granted for 56 days, and the remaining 0.012 ETH will be sent back to the sender. (0.3 – (0.144*2)) = 0.012 ETH