tx · J1uGn7AHhSdpA5fbXf9gzQ5nvEu4QwSZwm7BvcQKm7Sk 3MyenyZ4nuu7o8sfGaX9Rb7SfXs7tm2LgoY: -0.01000000 Waves 2019.09.08 15:37 [667112] smart account 3MyenyZ4nuu7o8sfGaX9Rb7SfXs7tm2LgoY > SELF 0.00000000 Waves
{ "type": 13, "id": "J1uGn7AHhSdpA5fbXf9gzQ5nvEu4QwSZwm7BvcQKm7Sk", "fee": 1000000, "feeAssetId": null, "timestamp": 1567946319517, "version": 1, "sender": "3MyenyZ4nuu7o8sfGaX9Rb7SfXs7tm2LgoY", "senderPublicKey": "FaN2AKbGozusK5LYgW53sn1ApfmPcQFuJgPXdG9wF3Mb", "proofs": [ "5rNhosHYapW7ryFN1NAJ64PaN2WxkZXhnBrtFGPKnAkH9AjEgMLaKmL6PX6VZBfKW2deetD5PRgdSdzi2PwRzQU9" ], "script": "base64:AAIDAAAAAAAAAAAAAAAIAAAAAARob3VyCQAAaAAAAAIAAAAAAAAAADwAAAAAAAAAADwAAAAAEXN0YXJ2ZVRvRGVhdGhUaW1lCQAAaAAAAAIJAABoAAAAAgUAAAAEaG91cgAAAAAAAAAAGAAAAAAAAAAABwAAAAAMYmFua0NvbnRyYWN0CQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNON3FRNGFkazY4czJjcVJuVXpIRlJQUUIySlgxQ1B4aGNOAAAAAA9mZWVkaW5nQ29udHJhY3QJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQIAAAAjM043cVE0YWRrNjhzMmNxUm5VekhGUlBRQjJKWDFDUHhoY04AAAAACXBpZ2d5QmFuawkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTjY0dFo0N1JhNFB3OXVGQ1hIeWFITVF6bkJyUXZ4ZzRzQQAAAAAEdHlwZQIAAAADQ2F0AQAAABJub3JtYWxpemVUaW1lc3RhbXA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MFAAAACXBpZ2d5QmFuawgFAAAAA3BtdAAAAAZhbW91bnQIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAADbmlsBAAAAAxmZWVkaW5nUHJpY2UAAAAAAAABhqADCQAAZgAAAAIFAAAADGZlZWRpbmdQcmljZQgFAAAAA3BtdAAAAAZhbW91bnQJAAACAAAAAQIAAAAwSW5zdWZpY2llbnQgYW1vdW50IG9mIFdhdmVzIHRvIGZlZWQgdGhlIGNyZWF0dXJlBAAAAAl0aW1lc3RhbXAJAQAAAANtYXgAAAACBQAAABBjdXJyZW50VGltZXN0YW1wBQAAABRsYXN0RmVlZGluZ1RpbWVzdGFtcAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAADGxhc3RfZmVlZGluZwkBAAAAEm5vcm1hbGl6ZVRpbWVzdGFtcAAAAAEFAAAACXRpbWVzdGFtcAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADGJhbmtDb250cmFjdAgFAAAAA3BtdAAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAAAXkaA9", "chainId": 84, "height": 667112, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let hour = (60 * 60) | |
5 | + | ||
6 | + | let starveToDeathTime = ((hour * 24) * 7) | |
7 | + | ||
8 | + | let bankContract = addressFromStringValue("3N7qQ4adk68s2cqRnUzHFRPQB2JX1CPxhcN") | |
9 | + | ||
10 | + | let feedingContract = addressFromStringValue("3N7qQ4adk68s2cqRnUzHFRPQB2JX1CPxhcN") | |
11 | + | ||
12 | + | let piggyBank = addressFromStringValue("3N64tZ47Ra4Pw9uFCXHyaHMQznBrQvxg4sA") | |
13 | + | ||
14 | + | let type = "Cat" | |
15 | + | ||
16 | + | func normalizeTimestamp (timestamp) = if ((timestamp > starveToDeathTime)) | |
17 | + | then starveToDeathTime | |
18 | + | else timestamp | |
19 | + | ||
20 | + | ||
21 | + | func max (a,b) = if ((a > b)) | |
22 | + | then a | |
23 | + | else b | |
24 | + | ||
25 | + | ||
26 | + | @Callable(i) | |
27 | + | func feed () = { | |
28 | + | let pmt = extract(i.payment) | |
29 | + | let currentTimestamp = match blockInfoByHeight(extract(transactionHeightById(i.transactionId))) { | |
30 | + | case bi: BlockInfo => | |
31 | + | bi.timestamp | |
32 | + | case _ => | |
33 | + | throw() | |
34 | + | } | |
35 | + | let lastFeedingTimestamp = match getInteger(this, "last_feeding") { | |
36 | + | case t: Int => | |
37 | + | t | |
38 | + | case _ => | |
39 | + | (currentTimestamp + (starveToDeathTime / 2)) | |
40 | + | } | |
41 | + | if ((currentTimestamp > (lastFeedingTimestamp + starveToDeathTime))) | |
42 | + | then throw("The creature is dead =(") | |
43 | + | else if (isDefined(pmt.assetId)) | |
44 | + | then TransferSet([ScriptTransfer(piggyBank, pmt.amount, pmt.assetId)]) | |
45 | + | else { | |
46 | + | let feedingPrice = 100000 | |
47 | + | if ((feedingPrice > pmt.amount)) | |
48 | + | then throw("Insuficient amount of Waves to feed the creature") | |
49 | + | else { | |
50 | + | let timestamp = max(currentTimestamp, lastFeedingTimestamp) | |
51 | + | ScriptResult(WriteSet([DataEntry("last_feeding", normalizeTimestamp(timestamp))]), TransferSet([ScriptTransfer(bankContract, pmt.amount, unit)])) | |
52 | + | } | |
53 | + | } | |
54 | + | } | |
55 | + | ||
56 | + |
github/deemru/w8io/169f3d6 23.34 ms ◑