| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "messages": [ |
| 5 | { |
| 6 | "if": "{ |
| 7 | $who = "HFNBIQTUNVMRM7PDP6NT2QRKLR62FOGR" ; |
| 8 | $day = 13 ; |
| 9 | $month = 9 ; |
| 10 | |
| 11 | // Time for Birthday Fiddle AA by [email protected] |
| 12 | // usage: |
| 13 | // friends or strangers can contribute to the annual fiddle fund anytime |
| 14 | // the person who has birthday can release the fiddle every year on their birthday to fulfil their wishes |
| 15 | // to release - need to send two 10,000 transactions, one to blow out the candle and one to withdraw |
| 16 | // the AA will also keep track of lifetime accumulated amount |
| 17 | // setup: |
| 18 | // set the person who has birthday address, day and month ( year might be a secret ) above |
| 19 | // maybe better to use real attestation, but let's keep it simple for now |
| 20 | |
| 21 | $today = timestamp ; |
| 22 | $storage = 1000 ; |
| 23 | $present = var[ "present" ] otherwise $storage ; |
| 24 | $fiddle = var[ "fiddle" ] otherwise 0 ; |
| 25 | |
| 26 | trigger.address != $who |
| 27 | |
| 28 | }", |
| 29 | "app": "data", |
| 30 | "payload": { |
| 31 | "friend": "{trigger.address}" |
| 32 | } |
| 33 | }, |
| 34 | { |
| 35 | "if": "{ trigger.address == $who AND ( balance[ base ] - $present ) > 0 }", |
| 36 | "app": "payment", |
| 37 | "payload": { |
| 38 | "asset": "base", |
| 39 | "outputs": [ |
| 40 | { |
| 41 | "address": "{$who}", |
| 42 | "amount": "{ balance[ base ] - $present }" |
| 43 | } |
| 44 | ] |
| 45 | } |
| 46 | } |
| 47 | ] |
| 48 | } |
| 49 | ] |