tx · HdUYUQk91q5EuiGywKBw8iE6a8HNjMSa5dnr6R8o2iHq

3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc:  -0.01000000 Waves

2021.10.21 23:44 [1756550] smart account 3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc > SELF 0.00000000 Waves

{ "type": 13, "id": "HdUYUQk91q5EuiGywKBw8iE6a8HNjMSa5dnr6R8o2iHq", "fee": 1000000, "feeAssetId": null, "timestamp": 1634849077676, "version": 2, "chainId": 84, "sender": "3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc", "senderPublicKey": "6LrPmGtwuADhwHYcxBouLzwfSTGgucbwYG5Pja7LUrcd", "proofs": [ "4dU8LWEsq5CkW98SQzZMBGXURySNmUG3nyyMaLPkRZA7vVJXjRwTo3oTL53yix6PRNnneKigj1MJhw8TJ1dPvCL2" ], "script": "base64:AAIFAAAAAAAAABcIAhIECgIIGBIDCgEBEgMKAQESAwoBAQAAABAAAAAACm9mZmVySWRLZXkCAAAADSRPRkZFUl9OVU1CRVIAAAAAB3Rlc3RLZXkCAAAABSRURVNUAAAAAA9vZmZlck9wZW5TdGF0dXMAAAAAAAAAAAEAAAAAE29mZmVyQ2FuY2VsZWRTdGF0dXMAAAAAAAAAAAIAAAAAE29mZmVyQWNjZXB0ZWRTdGF0dXMAAAAAAAAAAAMAAAAAE29mZmVyUmVqZWN0ZWRTdGF0dXMAAAAAAAAAAAQAAAAAFndhdmVzU3RhbmRJbkJ5dGVWZWN0b3IJAAGbAAAAAQIAAAAFV0FWRVMBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQAAAAdvZmZlcklkCQABLAAAAAIJAAGkAAAAAQUAAAAHb2ZmZXJJZAIAAAAHX3N0YXR1cwEAAAAWZ2V0T2ZmZXJBZGRyZXNzRnJvbUtleQAAAAEAAAAHb2ZmZXJJZAkAASwAAAACCQABpAAAAAEFAAAAB29mZmVySWQCAAAABV9mcm9tAQAAABRnZXRPZmZlckFkZHJlc3NUb0t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3RhdHVzCQEAAAANdHJ5R2V0SW50ZWdlcgAAAAEJAQAAABFnZXRPZmZlclN0YXR1c0tleQAAAAEFAAAAB29mZmVySWQDCQEAAAACIT0AAAACBQAAAAtvZmZlclN0YXR1cwUAAAAPb2ZmZXJPcGVuU3RhdHVzCQAAAgAAAAECAAAAGW9mZmVyIHN0YXR1cyBtdXN0IGJlIG9wZW4EAAAACWFkZHJlc3NUbwkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwkBAAAAFGdldE9mZmVyQWRkcmVzc1RvS2V5AAAAAQUAAAAHb2ZmZXJJZAQAAAAJY2FsbGVyU3RyCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMDCQEAAAACIT0AAAACBQAAAAlhZGRyZXNzVG8FAAAACWNhbGxlclN0cgkAAAIAAAABAgAAABxvZmZlciBtdXN0IGJlIG1hZGUgdG8gY2FsbGVyCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAARZ2V0T2ZmZXJTdGF0dXNLZXkAAAABBQAAAAdvZmZlcklkBQAAABNvZmZlclJlamVjdGVkU3RhdHVzBQAAAANuaWwAAAAA33+z5Q==", "height": 1756550, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9N8EDBLqcnWxKYnRMt6jJHLYw1wzjsmUVfR7xcdVxpGx Next: 5F3R3xJbF2ppjFAHPNKT66mK4ratLMndQXkW9QWQBA2B Diff:
OldNewDifferences
5757
5858 @Callable(i)
5959 func createOffer (toAddress,asset) = {
60- let offerId = tryGetInteger(offerIdKey)
60+ let offerId = (tryGetInteger(offerIdKey) + 1)
6161 let firstPayment = value(i.payments[0])
6262 if (!(isDefined(firstPayment)))
6363 then throw("no payment")
64- else [IntegerEntry(offerIdKey, (offerId + 1)), IntegerEntry(getOfferStatusKey(offerId), offerOpenStatus), StringEntry(getOfferAddressFromKey(offerId), toBase58String(i.caller.bytes)), StringEntry(getOfferAddressToKey(offerId), toAddress), StringEntry(getOfferOfferedAssetKey(offerId, 0), toBase64String(valueOrElse(firstPayment.assetId, wavesStandInByteVector))), IntegerEntry(getOfferOfferedAmountKey(offerId, 0), firstPayment.amount)]
64+ else [IntegerEntry(offerIdKey, offerId), IntegerEntry(getOfferStatusKey(offerId), offerOpenStatus), StringEntry(getOfferAddressFromKey(offerId), toBase58String(i.caller.bytes)), StringEntry(getOfferAddressToKey(offerId), toAddress), StringEntry(getOfferOfferedAssetKey(offerId, 0), toBase64String(valueOrElse(firstPayment.assetId, wavesStandInByteVector))), IntegerEntry(getOfferOfferedAmountKey(offerId, 0), firstPayment.amount)]
6565 }
6666
6767
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let offerIdKey = "$OFFER_NUMBER"
55
66 let testKey = "$TEST"
77
88 let offerOpenStatus = 1
99
1010 let offerCanceledStatus = 2
1111
1212 let offerAcceptedStatus = 3
1313
1414 let offerRejectedStatus = 4
1515
1616 let wavesStandInByteVector = toBytes("WAVES")
1717
1818 func getOfferStatusKey (offerId) = (toString(offerId) + "_status")
1919
2020
2121 func getOfferAddressFromKey (offerId) = (toString(offerId) + "_from")
2222
2323
2424 func getOfferAddressToKey (offerId) = (toString(offerId) + "_to")
2525
2626
2727 func getOfferOfferedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_id")
2828
2929
3030 func getOfferOfferedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_amount")
3131
3232
3333 func getOfferAskedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_id")
3434
3535
3636 func getOfferAskedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_amount")
3737
3838
3939 func tryGetInteger (key) = {
4040 let val = match getInteger(this, key) {
4141 case b: Int =>
4242 b
4343 case _ =>
4444 0
4545 }
4646 val
4747 }
4848
4949
5050 func tryGetAssetId (offerId,itemNumber) = {
5151 let val = fromBase64String(getStringValue(this, getOfferOfferedAssetKey(offerId, itemNumber)))
5252 if ((val == wavesStandInByteVector))
5353 then unit
5454 else val
5555 }
5656
5757
5858 @Callable(i)
5959 func createOffer (toAddress,asset) = {
60- let offerId = tryGetInteger(offerIdKey)
60+ let offerId = (tryGetInteger(offerIdKey) + 1)
6161 let firstPayment = value(i.payments[0])
6262 if (!(isDefined(firstPayment)))
6363 then throw("no payment")
64- else [IntegerEntry(offerIdKey, (offerId + 1)), IntegerEntry(getOfferStatusKey(offerId), offerOpenStatus), StringEntry(getOfferAddressFromKey(offerId), toBase58String(i.caller.bytes)), StringEntry(getOfferAddressToKey(offerId), toAddress), StringEntry(getOfferOfferedAssetKey(offerId, 0), toBase64String(valueOrElse(firstPayment.assetId, wavesStandInByteVector))), IntegerEntry(getOfferOfferedAmountKey(offerId, 0), firstPayment.amount)]
64+ else [IntegerEntry(offerIdKey, offerId), IntegerEntry(getOfferStatusKey(offerId), offerOpenStatus), StringEntry(getOfferAddressFromKey(offerId), toBase58String(i.caller.bytes)), StringEntry(getOfferAddressToKey(offerId), toAddress), StringEntry(getOfferOfferedAssetKey(offerId, 0), toBase64String(valueOrElse(firstPayment.assetId, wavesStandInByteVector))), IntegerEntry(getOfferOfferedAmountKey(offerId, 0), firstPayment.amount)]
6565 }
6666
6767
6868
6969 @Callable(i)
7070 func cancelOffer (offerId) = {
7171 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
7272 if ((offerStatus != offerOpenStatus))
7373 then throw("offer status must be open")
7474 else {
7575 let addressFrom = getStringValue(this, getOfferAddressFromKey(offerId))
7676 let callerStr = toBase58String(i.caller.bytes)
7777 if ((addressFrom != callerStr))
7878 then throw("offer must be made by caller")
7979 else {
8080 let assetId = tryGetAssetId(offerId, 0)
8181 let assetAmount = tryGetInteger(getOfferOfferedAmountKey(offerId, 0))
8282 [IntegerEntry(getOfferStatusKey(offerId), offerCanceledStatus), ScriptTransfer(i.caller, assetAmount, assetId)]
8383 }
8484 }
8585 }
8686
8787
8888
8989 @Callable(i)
9090 func acceptOffer (offerId) = {
9191 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
9292 if ((offerStatus != offerOpenStatus))
9393 then throw("offer status must be open")
9494 else {
9595 let addressTo = getStringValue(this, getOfferAddressToKey(offerId))
9696 let callerStr = toBase58String(i.caller.bytes)
9797 if ((addressTo != callerStr))
9898 then throw("offer must be made to caller")
9999 else [IntegerEntry(getOfferStatusKey(offerId), offerAcceptedStatus)]
100100 }
101101 }
102102
103103
104104
105105 @Callable(i)
106106 func rejectOffer (offerId) = {
107107 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
108108 if ((offerStatus != offerOpenStatus))
109109 then throw("offer status must be open")
110110 else {
111111 let addressTo = getStringValue(this, getOfferAddressToKey(offerId))
112112 let callerStr = toBase58String(i.caller.bytes)
113113 if ((addressTo != callerStr))
114114 then throw("offer must be made to caller")
115115 else [IntegerEntry(getOfferStatusKey(offerId), offerRejectedStatus)]
116116 }
117117 }
118118
119119

github/deemru/w8io/026f985 
26.65 ms