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:AAIDAAAAAAAAABEIARIDCgEBEgMKAQESAwoBAQAAAAMAAAAADVJFQ09WRVJZUEhBU0UAAAAAAAAAAGQAAAAAC1BSSUNFT1JBQ0xFAgAAACMzTjROUzdkNEpvOWE2RjE0TGlGVUtLWVZkVWtrZjJlUDRaeAEAAAASZ2V0RGF0YUVudHJ5Rm9yS2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXgFAAAAByRtYXRjaDAFAAAAAXgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQAAAAAAAAAAAAJAQAAAAV0aHJvdwAAAAAAAAADAAAAAWkBAAAACGluaXRpYXRlAAAAAQAAAAZ0YXJnZXQEAAAADGN1cnJlbnRQcmljZQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAtQUklDRU9SQUNMRQIAAAAFcHJpY2UDCQAAZwAAAAIJAABkAAAAAg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lc3NLZXkEAAAADGN1cnJlbnRMb25ncwkBAAAAEmdldERhdGFFbnRyeUZvcktleQAAAAEFAAAADWxvbmdzVG90YWxLZXkEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAGYW1vdW50CAUAAAAHcGF5bWVudAAAAAZhbW91bnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACZPbmx5IFdhdmVzIHBheW1lbnRzIGFsbG93ZWQgY3VycmVudGx5IQMJAABnAAAAAgkAAGQAAAACBQAAAAZoZWlnaHQFAAAADVJFQ09WRVJZUEhBU0UFAAAACmxvbmdUYXJnZXQJAAACAAAAAQIAAABTUmVjb3ZlcnkgcGhhc2UgYWN0aXZlLiBZb3UgY2FuIG5vIGxvbmdlciBnbyBsb25nIHRvd2FyZHMgdGhpcyBsb25nIHRhcmdldCAvIGhlaWdodCEJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADmxvbmdBZGRyZXNzS2V5CQAAZAAAAAIFAAAAG2N1cnJlbnRMb25nQW1vdW50Rm9yQWRkcmVzcwUAAAAGYW1vdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA1sb25nc1RvdGFsS2V5CQAAZAAAAAIFAAAADGN1cnJlbnRMb25ncwUAAAAGYW1vdW50BQAAAANuaWwAAAAAnr1EbQ==", "chainId": 84, "height": 1148589, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GyD6ons7oJ8dpbT5KA4yy8fyWMFy4FJSyVuxDK632gjx Next: 5ufjCRb8mag4i6s7bRHKrZguwfyGD1SDYUYf2RLfgNvP Diff:
OldNewDifferences
1818 @Callable(i)
1919 func initiate (target) = {
2020 let currentPrice = getIntegerValue(addressFromStringValue(PRICEORACLE), "price")
21- if (((height + RECOVERYPHASE) >= height))
21+ if (((height + RECOVERYPHASE) >= target))
2222 then throw(("No new future instantiable for the given height: " + toString(target)))
2323 else WriteSet([DataEntry(("target_price_" + toString(target)), currentPrice), DataEntry(("shorts_total_" + toString(target)), 0), DataEntry(("longs_total_" + toString(target)), 0)])
2424 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let RECOVERYPHASE = 100
55
66 let PRICEORACLE = "3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx"
77
88 func getDataEntryForKey (key) = match getInteger(this, key) {
99 case x: Int =>
1010 x
1111 case _: Unit =>
1212 0
1313 case _ =>
1414 throw()
1515 }
1616
1717
1818 @Callable(i)
1919 func initiate (target) = {
2020 let currentPrice = getIntegerValue(addressFromStringValue(PRICEORACLE), "price")
21- if (((height + RECOVERYPHASE) >= height))
21+ if (((height + RECOVERYPHASE) >= target))
2222 then throw(("No new future instantiable for the given height: " + toString(target)))
2323 else WriteSet([DataEntry(("target_price_" + toString(target)), currentPrice), DataEntry(("shorts_total_" + toString(target)), 0), DataEntry(("longs_total_" + toString(target)), 0)])
2424 }
2525
2626
2727
2828 @Callable(i)
2929 func short (shortTarget) = {
3030 let caller = toString(i.caller)
3131 let shortAddressKey = ((("short_" + toString(shortTarget)) + "_") + caller)
3232 let shortsTotalKey = ("shorts_total_" + toString(shortTarget))
3333 let currentShortAmountForAddress = getDataEntryForKey(shortAddressKey)
3434 let currentShorts = getDataEntryForKey(shortsTotalKey)
3535 let payment = extract(i.payment)
3636 let amount = payment.amount
3737 if (isDefined(payment.assetId))
3838 then throw("Only Waves payments allowed currently!")
3939 else if (((height + RECOVERYPHASE) >= shortTarget))
4040 then throw("Recovery phase active. You can no longer go short towards this short target / height!")
4141 else WriteSet([DataEntry(shortAddressKey, (currentShortAmountForAddress + amount)), DataEntry(shortsTotalKey, (currentShorts + amount))])
4242 }
4343
4444
4545
4646 @Callable(i)
4747 func long (longTarget) = {
4848 let caller = toString(i.caller)
4949 let longAddressKey = ((("long_" + toString(longTarget)) + "_") + caller)
5050 let longsTotalKey = ("longs_total_" + toString(longTarget))
5151 let currentLongAmountForAddress = getDataEntryForKey(longAddressKey)
5252 let currentLongs = getDataEntryForKey(longsTotalKey)
5353 let payment = extract(i.payment)
5454 let amount = payment.amount
5555 if (isDefined(payment.assetId))
5656 then throw("Only Waves payments allowed currently!")
5757 else if (((height + RECOVERYPHASE) >= longTarget))
5858 then throw("Recovery phase active. You can no longer go long towards this long target / height!")
5959 else WriteSet([DataEntry(longAddressKey, (currentLongAmountForAddress + amount)), DataEntry(longsTotalKey, (currentLongs + amount))])
6060 }
6161
6262

github/deemru/w8io/169f3d6 
25.62 ms