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
}",
"messages": {
"cases": [
{
"if": "{trigger.data.investor AND var['close_investment'] == false}",
"messages": [
{
"if": "{balance[base] >= $mcr}",
"app": "state",
"state": "{
var['close_investment'] = true;
var['investment_locked'] = false;
response['closedInvestment'] = true;
}"
}
]
},
{
"if": "{trigger.data.insured AND trigger.output[[asset=base]] >= $min_premium}",
"messages": [
{
"if": "{($mcr - var['capitalLocked']) > (trigger.output[[asset=base]] * $coverage_times)}",
"app": "state",
"state": "{
var['insured_' || trigger.address] = trigger.output[[asset=base]] * $coverage_times;
var['capitalLocked'] = var['capitalLocked'] + (trigger.output[[asset=base]] * $coverage_times);
}"
}
]
}
]
}
}
]