[
"autonomous agent",
{
"bounce_fees": {
"base": 10000
},
"getters": "{
$validate = $asset =>{
$unitInfo = unit[$asset];
if (NOT $unitInfo.messages)
return false;
$schema = $unitInfo.authors[0].authentifiers
? false
: $unitInfo.authors[0].address;
if (NOT $schema)
return false;
if ($schema != this_address)
return false;
return true;
};
}",
"init": "{
$BOUNCER = "
CFUQKRS37OGK4NDQRI6VHFNWTGHHAJAC";
$sendAsset = var[trigger.initial_address];
response["sendAsset"] = $sendAsset;
if (NOT $sendAsset AND NOT exists(trigger.data["title"]))
bounce("title field is mandatory");
if (trigger.data){
if (NOT exists(trigger.data["title"]))
bounce("title field is mandatory");
if (NOT exists(trigger.data["ipfs"]))
bounce("ipfs field is mandatory");
if (NOT exists(trigger.data["type"]))
bounce("type field is mandatory");
if (length(trigger.data["type"]) > 16)
bounce("type field must be shorter than 16 characters");
if (exists(trigger.data["ticker"])){
if (length(trigger.data["ticker"]) > 5)
bounce("ticker field must be shorter than 5 characters");
}
if (NOT exists(trigger.data["copies"]))
bounce("copies field is mandatory");
if (NOT is_integer(trigger.data["copies"]))
bounce("copies field must be an integer");
if (trigger.data["copies"] < 1)
bounce("copies must be at least 1");
if (exists(trigger.data["royalty"])){
if (NOT is_integer(trigger.data["royalty"]))
bounce("royalty field must be an integer");
if (trigger.data["royalty"] < 0)
bounce("royalty cannot be negative");
if (trigger.data["royalty"] > 100)
bounce("royalty can't be higher than 100");
}
}
}",
"messages": [
{
"app": "asset",
"if": "{exists(trigger.data["title"])}",
"payload": {
"cap": "{trigger.data["copies"]}",
"is_private": false,
"is_transferrable": true,
"auto_destroy": "{trigger.data["burn"]}",
"fixed_denominations": false,
"issued_by_definer_only": true,
"cosigned_by_definer": false,
"spender_attested": false
}
},
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{trigger.address == $BOUNCER ? trigger.initial_address : trigger.data["title"] ? $BOUNCER : trigger.initial_address}"
}
]
}
},
{
"if": "{trigger.address == $BOUNCER}",
"app": "payment",
"payload": {
"asset": "{$sendAsset}",
"outputs": [
{
"address": "{trigger.address}"
}
]
}
},
{
"app": "state",
"state": "{
var[trigger.address] = exists(trigger.data["title"]) ? response_unit : false;
}"
}
]
}
]