tx · AshK3p7zNscKXJwKwy5AH9Zk25mqgcq55zf9ztdZvjnH

3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc:  -0.01000000 Waves

2021.10.21 23:29 [1756536] smart account 3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc > SELF 0.00000000 Waves

{ "type": 13, "id": "AshK3p7zNscKXJwKwy5AH9Zk25mqgcq55zf9ztdZvjnH", "fee": 1000000, "feeAssetId": null, "timestamp": 1634848178256, "version": 2, "chainId": 84, "sender": "3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc", "senderPublicKey": "6LrPmGtwuADhwHYcxBouLzwfSTGgucbwYG5Pja7LUrcd", "proofs": [ "5HmUFK9pwrfzwDHLC3fNVqBkckWzQdkWM7m8VkWFt8hfheK1hQFnhXMGTZxSXZU3xsf7jT2ttdtqj87xS87aayeB" ], "script": "base64:AAIFAAAAAAAAABcIAhIECgIIGBIDCgEBEgMKAQESAwoBAQAAAA4AAAAACm9mZmVySWRLZXkCAAAADSRPRkZFUl9OVU1CRVIAAAAAB3Rlc3RLZXkCAAAABSRURVNUAAAAAA9vZmZlck9wZW5TdGF0dXMAAAAAAAAAAAEAAAAAE29mZmVyQ2FuY2VsZWRTdGF0dXMAAAAAAAAAAAIAAAAAE29mZmVyQWNjZXB0ZWRTdGF0dXMAAAAAAAAAAAMAAAAAE29mZmVyUmVqZWN0ZWRTdGF0dXMAAAAAAAAAAAQBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQAAAAdvZmZlcklkCQABLAAAAAIJAAGkAAAAAQUAAAAHb2ZmZXJJZAIAAAAHX3N0YXR1cwEAAAAWZ2V0T2ZmZXJBZGRyZXNzRnJvbUtleQAAAAEAAAAHb2ZmZXJJZAkAASwAAAACCQABpAAAAAEFAAAAB29mZmVySWQCAAAABV9mcm9tAQAAABRnZXRPZmZlckFkZHJlc3NUb0tleQAAAAEAAAAHb2ZmZXJJZAkAASwAAAACCQABpAAAAAEFAAAAB29mZmVySWQCAAAA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J5dGVzAwkBAAAAAiE9AAAAAgUAAAAJYWRkcmVzc1RvBQAAAAljYWxsZXJTdHIJAAACAAAAAQIAAAAcb2ZmZXIgbXVzdCBiZSBtYWRlIHRvIGNhbGxlcgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQUAAAAHb2ZmZXJJZAUAAAATb2ZmZXJBY2NlcHRlZFN0YXR1cwUAAAADbmlsAAAAAWkBAAAAC3JlamVjdE9mZmVyAAAAAQAAAAdvZmZlcklkBAAAAAtvZmZlclN0YXR1cwkBAAAADXRyeUdldEludGVnZXIAAAABCQEAAAARZ2V0T2ZmZXJTdGF0dXNLZXkAAAABBQAAAAdvZmZlcklkAwkBAAAAAiE9AAAAAgUAAAALb2ZmZXJTdGF0dXMFAAAAD29mZmVyT3BlblN0YXR1cwkAAAIAAAABAgAAABlvZmZlciBzdGF0dXMgbXVzdCBiZSBvcGVuBAAAAAlhZGRyZXNzVG8JAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMJAQAAABRnZXRPZmZlckFkZHJlc3NUb0tleQAAAAEFAAAAB29mZmVySWQEAAAACWNhbGxlclN0cgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAAiE9AAAAAgUAAAAJYWRkcmVzc1RvBQAAAAljYWxsZXJTdHIJAAACAAAAAQIAAAAcb2ZmZXIgbXVzdCBiZSBtYWRlIHRvIGNhbGxlcgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQUAAAAHb2ZmZXJJZAUAAAATb2ZmZXJSZWplY3RlZFN0YXR1cwUAAAADbmlsAAAAAHLHJFc=", "height": 1756536, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3N4ffp7GmyG7iZNusRdnNB498uB2MFy7eKMxSwYY2PYW Next: E2AHDVsdo9hLL4FN1wT6FRC3CHziXBgpKdpqCuN87Pxt Diff:
OldNewDifferences
2222 func getOfferAddressToKey (offerId) = (toString(offerId) + "_to")
2323
2424
25-func getOfferOfferedAssetKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_offered_asset_id")
25+func getOfferOfferedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_id")
2626
2727
28-func getOfferOfferedAmountKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_offered_asset_amount")
28+func getOfferOfferedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_amount")
2929
3030
31-func getOfferAskedAssetKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_asked_asset_id")
31+func getOfferAskedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_id")
3232
3333
34-func getOfferAskedAmountKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_asked_asset_amount")
34+func getOfferAskedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_amount")
3535
3636
3737 func tryGetInteger (key) = {
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 func getOfferStatusKey (offerId) = (toString(offerId) + "_status")
1717
1818
1919 func getOfferAddressFromKey (offerId) = (toString(offerId) + "_from")
2020
2121
2222 func getOfferAddressToKey (offerId) = (toString(offerId) + "_to")
2323
2424
25-func getOfferOfferedAssetKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_offered_asset_id")
25+func getOfferOfferedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_id")
2626
2727
28-func getOfferOfferedAmountKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_offered_asset_amount")
28+func getOfferOfferedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_amount")
2929
3030
31-func getOfferAskedAssetKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_asked_asset_id")
31+func getOfferAskedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_id")
3232
3333
34-func getOfferAskedAmountKey (offerId,itemNumber) = ((toString(offerId) + toString(itemNumber)) + "_asked_asset_amount")
34+func getOfferAskedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_amount")
3535
3636
3737 func tryGetInteger (key) = {
3838 let val = match getInteger(this, key) {
3939 case b: Int =>
4040 b
4141 case _ =>
4242 0
4343 }
4444 val
4545 }
4646
4747
4848 @Callable(i)
4949 func createOffer (toAddress,asset) = {
5050 let offerId = tryGetInteger(offerIdKey)
5151 let firstPayment = value(i.payments[0])
5252 if (!(isDefined(firstPayment)))
5353 then throw("no payment")
5454 else [IntegerEntry(getOfferStatusKey(offerId), offerOpenStatus), StringEntry(getOfferAddressFromKey(offerId), toBase58String(i.caller.bytes)), StringEntry(getOfferAddressToKey(offerId), toAddress), StringEntry(getOfferOfferedAssetKey(offerId, 0), toBase58String(valueOrElse(firstPayment.assetId, toBytes("WAVES")))), IntegerEntry(getOfferOfferedAmountKey(offerId, 0), firstPayment.amount)]
5555 }
5656
5757
5858
5959 @Callable(i)
6060 func cancelOffer (offerId) = {
6161 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
6262 if ((offerStatus != offerOpenStatus))
6363 then throw("offer status must be open")
6464 else {
6565 let addressFrom = getStringValue(this, getOfferAddressFromKey(offerId))
6666 let callerStr = toBase58String(i.caller.bytes)
6767 if ((addressFrom != callerStr))
6868 then throw("offer must be made by caller")
6969 else [IntegerEntry(getOfferStatusKey(offerId), offerCanceledStatus)]
7070 }
7171 }
7272
7373
7474
7575 @Callable(i)
7676 func acceptOffer (offerId) = {
7777 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
7878 if ((offerStatus != offerOpenStatus))
7979 then throw("offer status must be open")
8080 else {
8181 let addressTo = getStringValue(this, getOfferAddressToKey(offerId))
8282 let callerStr = toBase58String(i.caller.bytes)
8383 if ((addressTo != callerStr))
8484 then throw("offer must be made to caller")
8585 else [IntegerEntry(getOfferStatusKey(offerId), offerAcceptedStatus)]
8686 }
8787 }
8888
8989
9090
9191 @Callable(i)
9292 func rejectOffer (offerId) = {
9393 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
9494 if ((offerStatus != offerOpenStatus))
9595 then throw("offer status must be open")
9696 else {
9797 let addressTo = getStringValue(this, getOfferAddressToKey(offerId))
9898 let callerStr = toBase58String(i.caller.bytes)
9999 if ((addressTo != callerStr))
100100 then throw("offer must be made to caller")
101101 else [IntegerEntry(getOfferStatusKey(offerId), offerRejectedStatus)]
102102 }
103103 }
104104
105105

github/deemru/w8io/026f985 
44.12 ms