Unit ID
4tv3zUkHMZggPKDKbJbEloRlSvcIdYYsRGVsS4kG8Pw=
Received
15.08.2019 14:30:35
Confirmation delay (full node)
7 minutes 34 seconds
Confirmation delay (light node)
8 minutes 15 seconds
Messages
Definition
Definition: [ "autonomous agent", { "bounce_fees": { "base": 30000 }, "init": "{ // bounce_fees might cover premium so make min premium a bit expensive // varaibles to be filled on front end bu insurance service maker... $mcr = 110000; // minium capital requirement to activate this service... $expiration = 86400 * 360; // 12 months of cover $selected_arbiter = ''; // Address of selected arbiter to make final decision $min_premium = 100; // min premium to pay by single user one time to get certain amount of coverage $coverage_times = 12; // Premium amount multiply with this value, so here it could be 100 * 12 = 1200 $author_address = 'T77QBAHR4CN2G6KJ3BHMJLAAPU2WG2KG'; $old_investment = 0; }", "messages": { "cases": [ { "if": "{trigger.data.investor AND var['close_investment'] == false}", "messages": { "cases": [ { "if": "{var['investor_'||trigger.address]}", "messages": [ { "app": "state", "state": "{ response['unaccepted_request'] = 'Your request to get invest in this AA is not accepted, because the investments cannot be done from same address again, You can withdraw previous and invest again with your new amount...'; }" } ] }, { "if": "{balance[base] >= $mcr AND !var['investor_'||trigger.address]}", "messages": [ { "app": "state", "state": "{ var['close_investments'] = true; // close further investments var['investments_locked'] = false; // only locked when a user buy insurance var['start_service'] = true; // Let users buy services var['capitalLocked'] = 0; var['investor_'||trigger.address] = trigger.output[[asset=base]]; // how much invested... }" } ] }, { "if": "{balance[base] < $mcr AND !var['investor_'||trigger.address]}", "messages": [ { "app": "state", "state": "{ var['close_investments'] = false; // let further investments come, On withdraw make the close_investment true if balance is less than mcr var['investments_locked'] = false; // only locked when a user buy insurance so no service started here var['start_service'] = false; // Don't let users buy anything because minimum capital requirement is not fullfilled var['capitalLocked'] = 0; var['investor_'||trigger.address] = trigger.output[[asset=base]]; // how much invested... }" } ] } ] } }, { "if": "{trigger.data.investor AND var['close_investment'] == true}", "messages": [ { "app": "state", "state": "{ response['unaccepted_request'] = 'Your request to get invest in this AA is not accepted, because the investments are closed...'; }" } ] }, { "if": "{trigger.data.insured AND trigger.output[[asset=base]] >= $min_premium AND var['start_service'] == true}", "messages": { "cases": [ { "if": "{($mcr - var['capitalLocked']) > (trigger.output[[asset=base]] * $coverage_times)}", "messages": [ { "app": "state", "state": "{ var['insured_' || trigger.address] = trigger.output[[asset=base]] * $coverage_times; var['capitalLocked'] = var['capitalLocked'] + (trigger.output[[asset=base]] * $coverage_times); response['accepted_request'] = 'Your request to get insured is accepted, Your coverage is ' || (trigger.output[[asset=base]] * $coverage_times) || ' and you paid - ' || trigger.output[[asset=base]]; }" } ] }, { "if": "{($mcr - var['capitalLocked']) < (trigger.output[[asset=base]] * $coverage_times)}", "messages": [ { "app": "state", "state": "{ response['unaccepted_request'] = 'Your request to get insured is not accepted, because the capital left is not enough to give you the right coverage, The capital left to be used is just ' || ($mcr - var['capitalLocked']); }" } ] } ] } }, { "if": "{trigger.data.insured AND var['start_service'] != true}", "messages": [ { "app": "state", "state": "{ response['unaccepted_request'] = 'Your request to get insured is not accepted, because the minimum requirement of capital is not fullfilled yet!'; }" } ] }, { "if": "{trigger.data.insured AND trigger.output[[asset=base]] < $min_premium}", "messages": [ { "app": "state", "state": "{ response['unaccepted_request'] = 'Your request to get insured is not accepted, because the minimum one time premium to pay to buy this policy is ' || $min_premium || ' But you paid ' || trigger.output[[asset=base]]; }" } ] } ] } } ]
Technical information
Fees:
4,317 bytes
(353 headers, 3964 payload)
Level:1001009
Witnessed level:1001002
Main chain index:999827
Latest included mc index:999826
Status:stable/confirmed/final