tx · 3M46Ya3cDg9cHAK74GPjD4bFYQYmPMUXAk8dXMCFdAYF 3NC5E3y11PtakmAUxN9Nfdvx7XjWsffcJrr: -0.05000000 Waves 2020.08.25 19:56 [1148589] smart account 3NC5E3y11PtakmAUxN9Nfdvx7XjWsffcJrr > SELF 0.00000000 Waves
{ "type": 13, "id": "3M46Ya3cDg9cHAK74GPjD4bFYQYmPMUXAk8dXMCFdAYF", "fee": 5000000, "feeAssetId": null, "timestamp": 1598374709120, "version": 1, "sender": "3NC5E3y11PtakmAUxN9Nfdvx7XjWsffcJrr", "senderPublicKey": "DuSyT6XMpGpexrez81rru35TfpmHJcYQP1WJxT9wjcry", "proofs": [ "5g6gMmRqjB1XDguFUZfuRmYA2KMRHTwBcqQQfMcTVwBphS3RXtw88gz46npai2FnAWv4HYHRr8qdmVkdwyyLhmSw" ], "script": "base64:AAIDAAAAAAAAABEIARIDCgEBEgMKAQESAwoBAQAAAAMAAAAADVJFQ09WRVJZUEhBU0UAAAAAAAAAAGQAAAAAC1BSSUNFT1JBQ0xFAgAAACMzTjROUzdkNEpvOWE2RjE0TGlGVUtLWVZkVWtrZjJlUDRaeAEAAAASZ2V0RGF0YUVudHJ5Rm9yS2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXgFAAAAByRtYXRjaDAFAAAAAXgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQAAAAAAAAAAAAJAQAAAAV0aHJvdwAAAAAAAAADAAAAAWkBAAAACGluaXRpYXRlAAAAAQAAAAZ0YXJnZXQEAAAADGN1cnJlbnRQcmljZQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAtQUklDRU9SQUNMRQIAAAAFcHJpY2UDCQAAZwAAAAIJAABkAAAAAgU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c3NLZXkEAAAADGN1cnJlbnRMb25ncwkBAAAAEmdldERhdGFFbnRyeUZvcktleQAAAAEFAAAADWxvbmdzVG90YWxLZXkEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGYW1vdW50CAUAAAAHcGF5bWVudAAAAAZhbW91bnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACZPbmx5IFdhdmVzIHBheW1lbnRzIGFsbG93ZWQgY3VycmVudGx5IQMJAABnAAAAAgkAAGQAAAACBQAAAAZoZWlnaHQFAAAADVJFQ09WRVJZUEhBU0UFAAAACmxvbmdUYXJnZXQJAAACAAAAAQIAAABTUmVjb3ZlcnkgcGhhc2UgYWN0aXZlLiBZb3UgY2FuIG5vIGxvbmdlciBnbyBsb25nIHRvd2FyZHMgdGhpcyBsb25nIHRhcmdldCAvIGhlaWdodCEJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADmxvbmdBZGRyZXNzS2V5CQAAZAAAAAIFAAAAG2N1cnJlbnRMb25nQW1vdW50Rm9yQWRkcmVzcwUAAAAGYW1vdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA1sb25nc1RvdGFsS2V5CQAAZAAAAAIFAAAADGN1cnJlbnRMb25ncwUAAAAGYW1vdW50BQAAAANuaWwAAAAAnr1EbQ==", "chainId": 84, "height": 1148589, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GyD6ons7oJ8dpbT5KA4yy8fyWMFy4FJSyVuxDK632gjx Next: 5ufjCRb8mag4i6s7bRHKrZguwfyGD1SDYUYf2RLfgNvP Diff:
Old | New | Differences | |
---|---|---|---|
18 | 18 | @Callable(i) | |
19 | 19 | func initiate (target) = { | |
20 | 20 | let currentPrice = getIntegerValue(addressFromStringValue(PRICEORACLE), "price") | |
21 | - | if (((height + RECOVERYPHASE) >= | |
21 | + | if (((height + RECOVERYPHASE) >= target)) | |
22 | 22 | then throw(("No new future instantiable for the given height: " + toString(target))) | |
23 | 23 | else WriteSet([DataEntry(("target_price_" + toString(target)), currentPrice), DataEntry(("shorts_total_" + toString(target)), 0), DataEntry(("longs_total_" + toString(target)), 0)]) | |
24 | 24 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RECOVERYPHASE = 100 | |
5 | 5 | ||
6 | 6 | let PRICEORACLE = "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx" | |
7 | 7 | ||
8 | 8 | func getDataEntryForKey (key) = match getInteger(this, key) { | |
9 | 9 | case x: Int => | |
10 | 10 | x | |
11 | 11 | case _: Unit => | |
12 | 12 | 0 | |
13 | 13 | case _ => | |
14 | 14 | throw() | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | @Callable(i) | |
19 | 19 | func initiate (target) = { | |
20 | 20 | let currentPrice = getIntegerValue(addressFromStringValue(PRICEORACLE), "price") | |
21 | - | if (((height + RECOVERYPHASE) >= | |
21 | + | if (((height + RECOVERYPHASE) >= target)) | |
22 | 22 | then throw(("No new future instantiable for the given height: " + toString(target))) | |
23 | 23 | else WriteSet([DataEntry(("target_price_" + toString(target)), currentPrice), DataEntry(("shorts_total_" + toString(target)), 0), DataEntry(("longs_total_" + toString(target)), 0)]) | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func short (shortTarget) = { | |
30 | 30 | let caller = toString(i.caller) | |
31 | 31 | let shortAddressKey = ((("short_" + toString(shortTarget)) + "_") + caller) | |
32 | 32 | let shortsTotalKey = ("shorts_total_" + toString(shortTarget)) | |
33 | 33 | let currentShortAmountForAddress = getDataEntryForKey(shortAddressKey) | |
34 | 34 | let currentShorts = getDataEntryForKey(shortsTotalKey) | |
35 | 35 | let payment = extract(i.payment) | |
36 | 36 | let amount = payment.amount | |
37 | 37 | if (isDefined(payment.assetId)) | |
38 | 38 | then throw("Only Waves payments allowed currently!") | |
39 | 39 | else if (((height + RECOVERYPHASE) >= shortTarget)) | |
40 | 40 | then throw("Recovery phase active. You can no longer go short towards this short target / height!") | |
41 | 41 | else WriteSet([DataEntry(shortAddressKey, (currentShortAmountForAddress + amount)), DataEntry(shortsTotalKey, (currentShorts + amount))]) | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | 46 | @Callable(i) | |
47 | 47 | func long (longTarget) = { | |
48 | 48 | let caller = toString(i.caller) | |
49 | 49 | let longAddressKey = ((("long_" + toString(longTarget)) + "_") + caller) | |
50 | 50 | let longsTotalKey = ("longs_total_" + toString(longTarget)) | |
51 | 51 | let currentLongAmountForAddress = getDataEntryForKey(longAddressKey) | |
52 | 52 | let currentLongs = getDataEntryForKey(longsTotalKey) | |
53 | 53 | let payment = extract(i.payment) | |
54 | 54 | let amount = payment.amount | |
55 | 55 | if (isDefined(payment.assetId)) | |
56 | 56 | then throw("Only Waves payments allowed currently!") | |
57 | 57 | else if (((height + RECOVERYPHASE) >= longTarget)) | |
58 | 58 | then throw("Recovery phase active. You can no longer go long towards this long target / height!") | |
59 | 59 | else WriteSet([DataEntry(longAddressKey, (currentLongAmountForAddress + amount)), DataEntry(longsTotalKey, (currentLongs + amount))]) | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 |
github/deemru/w8io/169f3d6 25.62 ms ◑