Check out the Issue Explorer
Looking to fund some work? You can submit a new Funded Issue here.
When deploying a contract, the user must pay enough ETH into the contract in order to fund future queries from Oraclize.it and the gas costs associated with those queries. Any unused amount is reclaimable by the creator upon contract expiration.
The costs of each query is set by [Oraclize.it pricing](http://docs.oraclize.it/#pricing) and we also must add the needed gas for the `_callback()` function to be executed from Oraclize.it
As the user modifies the query frequency or expiration date in the contract deployer, the needed amount of pre-funding should be dynamically calculated in the same manner shown [here](https://github.com/MarketProject/MarketProtocol/blob/d0c5c3efd4c3922a187de87d65f91b87eb6347c3/contracts/oraclize/MarketContractOraclize.sol#L160)
The above calculation and check doesn't really need to occur on chain. It just adds to the deployment costs of contracts.
We should be able to suggest to a user the correct `payable()` amount for contract creation in order to ensure successful deployment, and future query execution but with minimal capital requirements.
http://docs.oraclize.it/#ethereum-quick-start-custom-gas-limit-and-gas-price - currently we are using the default gas price in Oraclize.it of 20 gwei
Eventually the protocol needs to support functionality for the `creator` to change the gas price of the callbacks to by dynamic in situations of high network gas costs, but for now that is outside of the scope if this issue.
### Tasks for this bounty
- [x] Create the ability to find the estimated cost per query from Oraclize.it - we have exposed this [here](https://github.com/MarketProject/MarketProtocol/blob/b2817deab6bddaac28d5954ccde149e8174ab74a/contracts/oraclize/OraclizeQueryTest.sol#L73)
- [x] Using the same calculation as the protocol layer, suggest a pre-funding amount for the contract deployer
- [x] Use this amount for the deployment of contracts in the dApp
- [x] Create needed tests covering all new code generated