tx · trJuHoX1NitFuvuN9RLQ4nq5rCwRBmH4qXBDwrvjfFu

3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc:  -0.01000000 Waves

2021.10.22 00:14 [1756581] smart account 3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc > SELF 0.00000000 Waves

{ "type": 13, "id": "trJuHoX1NitFuvuN9RLQ4nq5rCwRBmH4qXBDwrvjfFu", "fee": 1000000, "feeAssetId": null, "timestamp": 1634850897863, "version": 2, "chainId": 84, "sender": "3N7a7sTSKaE621QewSqQcL1mUbknJjnLkZc", "senderPublicKey": "6LrPmGtwuADhwHYcxBouLzwfSTGgucbwYG5Pja7LUrcd", "proofs": [ "47A9U9h6Dsjd1bgqbdYaDEwF25ScThBMd2RWCKKsHEuGqp1nHx7jzdhDWadiFKCeSw7srnVZLqAEheZk37VUeymy" ], "script": "base64:AAIFAAAAAAAAABcIAhIECgIIGRIDCgEBEgMKAQESAwoBAQAAABUAAAAACm9mZmVySWRLZXkCAAAADSRPRkZFUl9OVU1CRVIAAAAAB3Rlc3RLZXkCAAAABSRURVNUAAAAAA9vZmZlck9wZW5TdGF0dXMAAAAAAAAAAAEAAAAAE29mZmVyQ2FuY2VsZWRTdGF0dXMAAAAAAAAAAAIAAAAAE29mZmVyQWNjZXB0ZWRTdGF0dXMAAAAAAAAAAAMAAAAAE29mZmVyUmVqZWN0ZWRTdGF0dXMAAAAAAAAAAAQAAAAAEndhdmVzU3RhbmRJblN0cmluZwIAAAAFV0FWRVMAAAAAFndhdmVzU3RhbmRJbkJ5dGVWZWN0b3IJAAGbAAAAAQUAAAASd2F2ZXNTdGFuZEluU3RyaW5nAAAAABJ3YXZlc1N0YW5kSW5CYXNlNjQJAAJaAAAAAQUAAAAWd2F2ZXNTdGFuZEluQnl0ZVZlY3RvcgEAAAARZ2V0T2ZmZXJTdGF0dXNLZXkAAAABAAAAB29mZmVySWQJAAEsAAAAAgkAAaQAAAABBQAAAAdvZmZlcklkAgAAAAdfc3RhdHV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YWRlIHRvIGNhbGxlcgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAAEWdldE9mZmVyU3RhdHVzS2V5AAAAAQUAAAAHb2ZmZXJJZAUAAAATb2ZmZXJBY2NlcHRlZFN0YXR1cwUAAAADbmlsAAAAAWkBAAAAC3JlamVjdE9mZmVyAAAAAQAAAAdvZmZlcklkBAAAAAtvZmZlclN0YXR1cwkBAAAADXRyeUdldEludGVnZXIAAAABCQEAAAARZ2V0T2ZmZXJTdGF0dXNLZXkAAAABBQAAAAdvZmZlcklkAwkBAAAAAiE9AAAAAgUAAAALb2ZmZXJTdGF0dXMFAAAAD29mZmVyT3BlblN0YXR1cwkAAAIAAAABAgAAABlvZmZlciBzdGF0dXMgbXVzdCBiZSBvcGVuBAAAAAlhZGRyZXNzVG8JAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMJAQAAABRnZXRPZmZlckFkZHJlc3NUb0tleQAAAAEFAAAAB29mZmVySWQEAAAACWNhbGxlclN0cgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAAiE9AAAAAgUAAAAJYWRkcmVzc1RvBQAAAAljYWxsZXJTdHIJAAACAAAAAQIAAAAcb2ZmZXIgbXVzdCBiZSBtYWRlIHRvIGNhbGxlcgkBAAAACWRyb3BPZmZlcgAAAAIFAAAAB29mZmVySWQFAAAAE29mZmVyUmVqZWN0ZWRTdGF0dXMAAAAAdYaFEA==", "height": 1756581, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CAR2m5ja2HCzeMUZAmpv77SL8vSFGqZuM9MdAF16ZAmY Next: 9s4HzRGug4Jii9dBtYjSao3raLMji4sJKJfJyhzC4Xdo Diff:
OldNewDifferences
5454 func tryGetAssetIdFromAssetList (asset) = {
5555 let res = match asset[0] {
5656 case b: String =>
57- fromBase64String(b)
57+ toBytes(b)
5858 case _ =>
5959 throw("must have an assetId")
6060 }
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 wavesStandInString = "WAVES"
1717
1818 let wavesStandInByteVector = toBytes(wavesStandInString)
1919
2020 let wavesStandInBase64 = toBase64String(wavesStandInByteVector)
2121
2222 func getOfferStatusKey (offerId) = (toString(offerId) + "_status")
2323
2424
2525 func getOfferAddressFromKey (offerId) = (toString(offerId) + "_from")
2626
2727
2828 func getOfferAddressToKey (offerId) = (toString(offerId) + "_to")
2929
3030
3131 func getOfferOfferedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_id")
3232
3333
3434 func getOfferOfferedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_offered_asset_amount")
3535
3636
3737 func getOfferAskedAssetKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_id")
3838
3939
4040 func getOfferAskedAmountKey (offerId,itemNumber) = (((toString(offerId) + "_") + toString(itemNumber)) + "_asked_asset_amount")
4141
4242
4343 func tryGetInteger (key) = {
4444 let val = match getInteger(this, key) {
4545 case b: Int =>
4646 b
4747 case _ =>
4848 0
4949 }
5050 val
5151 }
5252
5353
5454 func tryGetAssetIdFromAssetList (asset) = {
5555 let res = match asset[0] {
5656 case b: String =>
57- fromBase64String(b)
57+ toBytes(b)
5858 case _ =>
5959 throw("must have an assetId")
6060 }
6161 res
6262 }
6363
6464
6565 func tryGetAmountFromAssetList (asset) = {
6666 let res = match asset[1] {
6767 case b: Int =>
6868 b
6969 case _ =>
7070 throw("must have an amount")
7171 }
7272 res
7373 }
7474
7575
7676 func tryGetAssetId (offerId,itemNumber) = {
7777 let val = fromBase64String(getStringValue(this, getOfferOfferedAssetKey(offerId, itemNumber)))
7878 if ((val == wavesStandInByteVector))
7979 then unit
8080 else val
8181 }
8282
8383
8484 func dropOffer (offerId,dropStatus) = {
8585 let addressFrom = Address(fromBase58String(getStringValue(this, getOfferAddressFromKey(offerId))))
8686 let assetId = tryGetAssetId(offerId, 0)
8787 let assetAmount = tryGetInteger(getOfferOfferedAmountKey(offerId, 0))
8888 [IntegerEntry(getOfferStatusKey(offerId), dropStatus), ScriptTransfer(addressFrom, assetAmount, assetId)]
8989 }
9090
9191
9292 @Callable(i)
9393 func createOffer (toAddress,asset0) = {
9494 let offerId = (tryGetInteger(offerIdKey) + 1)
9595 let firstPayment = value(i.payments[0])
9696 if (!(isDefined(firstPayment)))
9797 then throw("no payment")
9898 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), StringEntry(getOfferAskedAssetKey(offerId, 0), toBase64String(tryGetAssetIdFromAssetList(asset0))), IntegerEntry(getOfferAskedAmountKey(offerId, 0), tryGetAmountFromAssetList(asset0))]
9999 }
100100
101101
102102
103103 @Callable(i)
104104 func cancelOffer (offerId) = {
105105 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
106106 if ((offerStatus != offerOpenStatus))
107107 then throw("offer status must be open")
108108 else {
109109 let addressFrom = getStringValue(this, getOfferAddressFromKey(offerId))
110110 let callerStr = toBase58String(i.caller.bytes)
111111 if ((addressFrom != callerStr))
112112 then throw("offer must be made by caller")
113113 else dropOffer(offerId, offerCanceledStatus)
114114 }
115115 }
116116
117117
118118
119119 @Callable(i)
120120 func acceptOffer (offerId) = {
121121 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
122122 if ((offerStatus != offerOpenStatus))
123123 then throw("offer status must be open")
124124 else {
125125 let addressTo = getStringValue(this, getOfferAddressToKey(offerId))
126126 let callerStr = toBase58String(i.caller.bytes)
127127 if ((addressTo != callerStr))
128128 then throw("offer must be made to caller")
129129 else [IntegerEntry(getOfferStatusKey(offerId), offerAcceptedStatus)]
130130 }
131131 }
132132
133133
134134
135135 @Callable(i)
136136 func rejectOffer (offerId) = {
137137 let offerStatus = tryGetInteger(getOfferStatusKey(offerId))
138138 if ((offerStatus != offerOpenStatus))
139139 then throw("offer status must be open")
140140 else {
141141 let addressTo = getStringValue(this, getOfferAddressToKey(offerId))
142142 let callerStr = toBase58String(i.caller.bytes)
143143 if ((addressTo != callerStr))
144144 then throw("offer must be made to caller")
145145 else dropOffer(offerId, offerRejectedStatus)
146146 }
147147 }
148148
149149

github/deemru/w8io/026f985 
27.17 ms