**Smart Contract**
#Escrow
##Diagram
-
* -
+--------------------------------+ +---------------------+ * -
| modifier | | function | * -
+--------------------------------+ +---------------------+ * -
| check_on_init_installment() | | prime_day_Payout() +<--------------------. * -
| | | | | * -
+---------------+----------------+ +---------+-----------+ | * -
| | | * -
+----------------v---------------------------------v----------------------+ | * -
| queryOracle(string memory url, string memory json, string memory _type) | | * -
+-------------------------------------------------------------------------+ | * -
| pendingQueries[queryId] = QueryType(true,_type); | | * -
| | | * -
+-------------------------------------------------------------------------+ | * -
| * -
+--------------------------------------------------------------------------------+ | * -
| provable_query() | | * -
| | | * -
+----------------------------------------+---------------------------------------+ | * -
| if (_type == "CurrencyConversion") => | if (_type == "DayofMonth") => | | * -
| executes immediately | executes in one day | | * -
+----------------------------------------+---------------------------------------+ | * -
| pendingQueries[queryId] = QueryType(true,_type); | | * -
| | | * -
+--------------------------------------+-----------------------------------------+ | * -
| | * -
v | * -
.--. | * -
.--+ | | * -
.---+ '--. | * -
| Provable Oracle | | * -
| | | * -
'---------+-------' | * -
| | * -
| | * -
v | * -
+-----------------------------------------------+-----------------------------------------------+ | * -
| _callback() | | * -
+-----------------------------------------------------------------------------------------------+ | * -
| require (pendingQueries[myid].exists == true); | | * -
+-----------------------------------------------------------------------------------------------+ | * -
| delete pendingQueries[myid]; | | * -
+------------------------------------------------+----------------------------------------------+ | * -
| if (pendingQueries[myid].exists._type | if (pendingQueries[myid].exists._type | | * -
| == "CurrencyConvert")=> | == "DayofMonth") | | * -
| | | | * -
| funds_change(1/stringToUint(result)*2); | split string | | * -
| | | | * -
| | if(check_if_prime(stringToUint(_day) | | * -
| | funds_change(.01*this.balance); | | * -
| | | | * -
+------------------------------------------------+---------------------+------------------------+ | * -
| | * -
'------------------------' *
<script src="https://casual-effects.com/markdeep/latest/markdeep.min.js?" charset="utf-8"></script>