I want to get a random value in my smart contract to provide a fair distribution of different tokens.
I read that using Harbinger to get values and use it for entropy could be the good way to do. But I can't figure out how to make a call to the deployed normalizer contract using Smartpy and then retrieve the given price value.
This is actually the method that I implemented but I get an error when I run it on the Granada network and I don't know how to retrieve the price value (I don't know where and how to pass a callback name)
@ sp.entry_point def call_oracle(self): params_type = sp.TPair(sp.TString, sp.TAddress) oracle_params = sp.contract(params_type, self.data.oracle_address, entry_point="get").open_some() data_to_be_sent = sp.pair(sp.string("XTZ-USD"), sp.self_address) sp.transfer(data_to_be_sent, sp.mutez(0), oracle_params)
- So my first question is, can I use directly the deployed Harbinger normalizer smart contract or do I need to develop and deploy my own ?
- And second question, does anyone have an implementation example to call the normalizer smart contract from another smart contract using Smartpy ?
Thanks for your attention.