I have a situation where I send 1$ worth of ether to my smart contract..
Now, how do I validate the same on solidity? How do I make sure that the user is sending 1$ worth of ether at any given time.
I mean to say, how can I make sure msg.value
in solidity is actually equal to 1$ worth of fiat from solidity.
Edit: I do know, an oracle can be used as a data source. But is there an oracle that provides an api like poloinex.
Step 1: I call the https://poloniex.com/support/api/ and obtain ether - fiat value
Step 2: I send a transaction to a contract using the previously obtained value:
contract.method.aPayableMethod().sendTransaction({ value: toWei('value from poloinex') })
Step 3: In my payable function inside solidity, how do I make sure, that that the msg.value
is always equal to 1$.