Definition: [
"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;
};
$isValidQmHash = $hash=>{
$allowedChars = {
"1": true,
"2": true,
"3": true,
"4": true,
"5": true,
"6": true,
"7": true,
"8": true,
"9": true,
"A": true,
"B": true,
"C": true,
"D": true,
"E": true,
"F": true,
"G": true,
"H": true,
"J": true,
"K": true,
"L": true,
"M": true,
"N": true,
"P": true,
"Q": true,
"R": true,
"S": true,
"T": true,
"U": true,
"V": true,
"W": true,
"X": true,
"Y": true,
"Z": true,
"a": true,
"b": true,
"c": true,
"d": true,
"e": true,
"f": true,
"g": true,
"h": true,
"i": true,
"j": true,
"k": true,
"m": true,
"n": true,
"o": true,
"p": true,
"q": true,
"r": true,
"s": true,
"t": true,
"u": true,
"v": true,
"w": true,
"x": true,
"y": true,
"z": true
};
$prefix = substring($hash, 0, 2);
$payload = substring($hash, 2);
if ($prefix != "Qm")
return false;
if (length($payload) != 44)
return false;
return reduce(split($payload, ""), 44, ($acc, $x)=>$allowedChars[$x] AND $acc, true);
};
}",
"init": "{
$BOUNCER = "CFUQKRS37OGK4NDQRI6VHFNWTGHHAJAC";
$sendAsset = var[trigger.initial_address];
}",
"messages": [
{
"app": "asset",
"if": "{exists(trigger.data["init"])}",
"payload": {
"cap": 10000,
"is_private": false,
"is_transferrable": true,
"auto_destroy": true,
"transfer_condition": [
"and",
[
[
"has one",
{
"what": "output",
"asset": "this asset"
}
],
[
"has one equal",
{
"equal_fields": [
"address",
"amount"
],
"search_criteria": [
{
"what": "output",
"asset": "base"
},
{
"what": "output",
"asset": "this asset"
}
]
}
]
]
],
"fixed_denominations": false,
"issued_by_definer_only": true,
"cosigned_by_definer": false,
"spender_attested": false
}
},
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"if": "{trigger.address == $BOUNCER}",
"address": "{trigger.initial_address}"
},
{
"if": "{trigger.address != $BOUNCER}",
"address": "{$BOUNCER}",
"amount": 1000
}
]
}
},
{
"if": "{$sendAsset}",
"app": "payment",
"payload": {
"asset": "{$sendAsset.asset}",
"outputs": [
{
"address": "{trigger.initial_address}",
"amount": "{$sendAsset.cap}"
}
]
}
},
{
"if": "{$sendAsset}",
"app": "data",
"payload": {
"asset": "{$sendAsset.asset}",
"decimals": 0,
"name": "{$sendAsset.title}",
"issuer": "NFT_IPFS_CIDV0",
"ticker": "{$sendAsset.ticker}"
}
},
{
"app": "state",
"state": "{
var[trigger.initial_address] = exists(trigger.data["init"]) ? {asset: response_unit, cap: 100} : false;
}"
}
]
}
]