tx · HCAb1vt7VX4A19VvxNYF6TT1nVuNNEEB4qiWfGxJEipM

3N7cKXykq32Xk6z4jSbECdcjyswJy84iSLZ:  -0.01000000 Waves

2019.09.08 00:46 [666228] smart account 3N7cKXykq32Xk6z4jSbECdcjyswJy84iSLZ > SELF 0.00000000 Waves

{ "type": 13, "id": "HCAb1vt7VX4A19VvxNYF6TT1nVuNNEEB4qiWfGxJEipM", "fee": 1000000, "feeAssetId": null, "timestamp": 1567892785759, "version": 1, "sender": "3N7cKXykq32Xk6z4jSbECdcjyswJy84iSLZ", "senderPublicKey": "3bC9HyDT8KaxdVq6EzZLqW53SX9MrALqoWf8zBXEBc2R", "proofs": [ "37xcgK3eY2dVdKEuCfmkZVTrcRPewxqAQbouUYVLmKyRrsFo4FneXdMaQgdhGdgXVHxnaQQnfB8x9WJqzCz8hCo6" ], "script": "base64:AAIDAAAAAAAAAAAAAAAGAAAAAARob3VyAAAAAAAAAAABAAAAABFzdGFydmVUb0RlYXRoVGltZQkAAGgAAAACCQAAaAAAAAIFAAAABGhvdXIAAAAAAAAAABgAAAAAAAAAAAcAAAAAD2ZlZWRpbmdDb250cmFjdAkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTjdxUTRhZGs2OHMyY3FSblV6SEZSUFFCMkpYMUNQeGhjTgAAAAAJcGlnZ3lCYW5rCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNONjR0WjQ3UmE0UHc5dUZDWEh5YUhNUXpuQnJRdnhnNHNBAAAAAAR0eXBlAgAAAANDYXQBAAAABmlzRGVhZAAAAAIAAAACaWQAAAAMY3VycmVudEJsb2NrBAAAABZsYXN0RmVlZGluZ0Jsb2NrSGVpZ2h0BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAADGxhc3RfZmVlZGluZwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAJsZgUAAAAH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CAUAAAADcG10AAAAB2Fzc2V0SWQJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAJcGlnZ3lCYW5rCAUAAAADcG10AAAABmFtb3VudAgFAAAAA3BtdAAAAAdhc3NldElkBQAAAANuaWwEAAAADGZlZWRpbmdQcmljZQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAPZmVlZGluZ0NvbnRyYWN0CQABLAAAAAICAAAABnByaWNlXwUAAAAEdHlwZQMJAABmAAAAAgUAAAAMZmVlZGluZ1ByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAADBJbnN1ZmljaWVudCBhbW91bnQgb2YgV2F2ZXMgdG8gZmVlZCB0aGUgY3JlYXR1cmUEAAAACmFuaW1hbEZ1bmQJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAPZmVlZGluZ0NvbnRyYWN0CQABLAAAAAICAAAABWZ1bmRfBQAAAAR0eXBlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAMbGFzdF9mZWVkaW5nCAUAAAAMY3VycmVudEJsb2NrAAAACXRpbWVzdGFtcAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAACmFuaW1hbEZ1bmQIBQAAAANwbXQAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAAA0PwvtQ==", "chainId": 84, "height": 666228, "spentComplexity": 0 } View: original | compacted Prev: none Next: 6W9s6wUYFBTWhGghogWN3DgEwfzWgfaG5TajC1EZz9kP Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let hour = 1
5+
6+let starveToDeathTime = ((hour * 24) * 7)
7+
8+let feedingContract = addressFromStringValue("3N7qQ4adk68s2cqRnUzHFRPQB2JX1CPxhcN")
9+
10+let piggyBank = addressFromStringValue("3N64tZ47Ra4Pw9uFCXHyaHMQznBrQvxg4sA")
11+
12+let type = "Cat"
13+
14+func isDead (id,currentBlock) = {
15+ let lastFeedingBlockHeight = match getInteger(this, "last_feeding") {
16+ case lf: Int =>
17+ lf
18+ case _ =>
19+ match transactionHeightById(id) {
20+ case a: Int =>
21+ a
22+ case _ =>
23+ throw()
24+ }
25+ }
26+ let lastFeedingBlock = match blockInfoByHeight(lastFeedingBlockHeight) {
27+ case bi: BlockInfo =>
28+ bi
29+ case _ =>
30+ throw()
31+ }
32+ ((lastFeedingBlock.timestamp + starveToDeathTime) >= currentBlock.timestamp)
33+ }
34+
35+
36+@Callable(i)
37+func feed () = {
38+ let pmt = extract(i.payment)
39+ let currentBlockHeight = match transactionHeightById(i.transactionId) {
40+ case a: Int =>
41+ a
42+ case _ =>
43+ throw()
44+ }
45+ let currentBlock = match blockInfoByHeight(currentBlockHeight) {
46+ case bi: BlockInfo =>
47+ bi
48+ case _ =>
49+ throw()
50+ }
51+ if (isDead(i.transactionId, currentBlock))
52+ then throw("The creature is dead =(")
53+ else if (isDefined(pmt.assetId))
54+ then TransferSet([ScriptTransfer(piggyBank, pmt.amount, pmt.assetId)])
55+ else {
56+ let feedingPrice = getIntegerValue(feedingContract, ("price_" + type))
57+ if ((feedingPrice > pmt.amount))
58+ then throw("Insuficient amount of Waves to feed the creature")
59+ else {
60+ let animalFund = addressFromStringValue(getStringValue(feedingContract, ("fund_" + type)))
61+ ScriptResult(WriteSet([DataEntry("last_feeding", currentBlock.timestamp)]), TransferSet([ScriptTransfer(animalFund, pmt.amount, unit)]))
62+ }
63+ }
64+ }
65+
66+

github/deemru/w8io/169f3d6 
38.60 ms