tx · 92F7uHhM4VbWxqVmF26NimdPQmy4uiPSTsN1VsaJDRA7

3N7cKXykq32Xk6z4jSbECdcjyswJy84iSLZ:  -0.05000000 Waves

2019.09.08 16:51 [667180] smart account 3N7cKXykq32Xk6z4jSbECdcjyswJy84iSLZ > SELF 0.00000000 Waves

{ "type": 13, "id": "92F7uHhM4VbWxqVmF26NimdPQmy4uiPSTsN1VsaJDRA7", "fee": 5000000, "feeAssetId": null, "timestamp": 1567950774252, "version": 1, "sender": "3N7cKXykq32Xk6z4jSbECdcjyswJy84iSLZ", "senderPublicKey": "3bC9HyDT8KaxdVq6EzZLqW53SX9MrALqoWf8zBXEBc2R", "proofs": [ "2zPsy4sVewixEunbJFpb7KkfW37bGdSW2GtGW1JcpjNmtCfP654fkpVZpAehMiDUyq3hbj17YzhFyNUQ5EMeYgPg" ], "script": "base64:AAIDAAAAAAAAAAAAAAAIAAAAAARob3VyCQAAaAAAAAIAAAAAAAAAADwAAAAAAAAAADwAAAAAEXN0YXJ2ZVRvRGVhdGhUaW1lCQAAaAAAAAIJAABoAAAAAgUAAAAEaG91cgAAAAAAAAAAGAAAAAAAAAAABwAAAAAMYmFua0NvbnRyYWN0CQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNON3FRNGFkazY4czJjcVJuVXpIRlJQUUIySlgxQ1B4aGNOAAAAAA9mZWVkaW5nQ29udHJhY3QJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQIAAAAjM043cVE0YWRrNjhzMmNxUm5VekhGUlBRQjJKWDFDUHhoY04AAAAACXBpZ2d5QmFuawkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABAgAAACMzTjY0dFo0N1JhNFB3OXVGQ1hIeWFITVF6bkJyUXZ4ZzRzQQAAAAAEdHlwZQIAAAADQ2F0AQAAABJub3JtYWxpemVUaW1lc3RhbXAAAAABAAAACXRpbWVzdGFtcAMJ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c3VmaWNpZW50IGFtb3VudCBvZiBXYXZlcyB0byBmZWVkIHRoZSBjcmVhdHVyZQQAAAAJdGltZXN0YW1wCQEAAAADbWF4AAAAAgUAAAAQY3VycmVudFRpbWVzdGFtcAUAAAAUbGFzdEZlZWRpbmdUaW1lc3RhbXAJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAxsYXN0X2ZlZWRpbmcJAQAAABJub3JtYWxpemVUaW1lc3RhbXAAAAABBQAAAAl0aW1lc3RhbXAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAxiYW5rQ29udHJhY3QIBQAAAANwbXQAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAAA9ARxYA==", "chainId": 84, "height": 667180, "spentComplexity": 0 } View: original | compacted Prev: Fc2HWrNA4vU9CPPcmQBW7LRGTxftYfjJfUreiHC9JLks Next: none Diff:
OldNewDifferences
2626 @Callable(i)
2727 func feed () = {
2828 let pmt = extract(i.payment)
29- let currentTimestamp = 1
29+ let currentTimestamp = lastBlock.timestamp
3030 let lastFeedingTimestamp = match getInteger(this, "last_feeding") {
3131 case t: Int =>
3232 t
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let hour = (60 * 60)
55
66 let starveToDeathTime = ((hour * 24) * 7)
77
88 let bankContract = addressFromStringValue("3N7qQ4adk68s2cqRnUzHFRPQB2JX1CPxhcN")
99
1010 let feedingContract = addressFromStringValue("3N7qQ4adk68s2cqRnUzHFRPQB2JX1CPxhcN")
1111
1212 let piggyBank = addressFromStringValue("3N64tZ47Ra4Pw9uFCXHyaHMQznBrQvxg4sA")
1313
1414 let type = "Cat"
1515
1616 func normalizeTimestamp (timestamp) = if ((timestamp > starveToDeathTime))
1717 then starveToDeathTime
1818 else timestamp
1919
2020
2121 func max (a,b) = if ((a > b))
2222 then a
2323 else b
2424
2525
2626 @Callable(i)
2727 func feed () = {
2828 let pmt = extract(i.payment)
29- let currentTimestamp = 1
29+ let currentTimestamp = lastBlock.timestamp
3030 let lastFeedingTimestamp = match getInteger(this, "last_feeding") {
3131 case t: Int =>
3232 t
3333 case _ =>
3434 (currentTimestamp + (starveToDeathTime / 2))
3535 }
3636 if ((currentTimestamp > (lastFeedingTimestamp + starveToDeathTime)))
3737 then throw("The creature is dead =(")
3838 else if (isDefined(pmt.assetId))
3939 then TransferSet([ScriptTransfer(piggyBank, pmt.amount, pmt.assetId)])
4040 else {
4141 let feedingPrice = 100000
4242 if ((feedingPrice > pmt.amount))
4343 then throw("Insuficient amount of Waves to feed the creature")
4444 else {
4545 let timestamp = max(currentTimestamp, lastFeedingTimestamp)
4646 ScriptResult(WriteSet([DataEntry("last_feeding", normalizeTimestamp(timestamp))]), TransferSet([ScriptTransfer(bankContract, pmt.amount, unit)]))
4747 }
4848 }
4949 }
5050
5151

github/deemru/w8io/169f3d6 
34.07 ms