| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | $aa_name = "SAAFE with name"; |
| 9 | $SAAFE = "TUJT2AOQ6BBNBHU3H4AE3KJ6OEAGE4KA"; |
| 10 | |
| 11 | $name = trigger.data.name otherwise bounce ("Please, specify 'name'."); |
| 12 | $puk1 = var[$name]||"_puk1" otherwise trigger.data.puk1 otherwise false; |
| 13 | $puk2 = var[$name]||"_puk2" otherwise trigger.data.puk2 otherwise false; |
| 14 | $puk = ($puk1 AND $puk2)? $puk1||$puk2 : bounce ("Please specify existing 'name', or create a new safe with 'name', 'puk1' and 'puk2' (2 halfs of a public key for which your have the private key safely store in real world."); |
| 15 | $withdraw_address = trigger.data.address otherwise trigger.address; |
| 16 | }", |
| 17 | "messages": [ |
| 18 | { |
| 19 | "if": "{ $puk and !(trigger.data.s1 or trigger.data.s2)}", |
| 20 | "app": "data", |
| 21 | "payload": { |
| 22 | "puk1": "{ trigger.data.puk1 }", |
| 23 | "puk2": "{ trigger.data.puk2 }", |
| 24 | "private": "{ true }" |
| 25 | } |
| 26 | }, |
| 27 | { |
| 28 | "if": "{ trigger.data.s1 AND trigger.data.s2}", |
| 29 | "app": "data", |
| 30 | "payload": { |
| 31 | "puk1": "{ trigger.data.puk1 }", |
| 32 | "puk2": "{ trigger.data.puk2 }", |
| 33 | "s1": "{ trigger.data.s1 }", |
| 34 | "s2": "{ trigger.data.s2 }", |
| 35 | "asset": "{ trigger.data.asset }", |
| 36 | "ad": "{ $withdraw_address }" |
| 37 | } |
| 38 | }, |
| 39 | { |
| 40 | "app": "payment", |
| 41 | "payload": { |
| 42 | "asset": "{'base'}", |
| 43 | "outputs": [ |
| 44 | { |
| 45 | "address": "{$SAAFE}", |
| 46 | "amount": "{trigger.output[[asset=base]] - 1000}" |
| 47 | } |
| 48 | ] |
| 49 | } |
| 50 | }, |
| 51 | { |
| 52 | "app": "state", |
| 53 | "state": "{ |
| 54 | var[$name||"_puk1"] = $puk1; |
| 55 | var[$name||"_puk2"] = $puk2; |
| 56 | response['message'] = var[$SAAFE]["message"]; |
| 57 | }" |
| 58 | } |
| 59 | ] |
| 60 | } |
| 61 | ] |