tx · D76brpebbXP8T8kPFPHhFE1jCZMUPUnsWRc3kAR74LGH
3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.01000000 Waves
2022.11.04 18:24 [2302542] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{
"type": 13,
"id": "D76brpebbXP8T8kPFPHhFE1jCZMUPUnsWRc3kAR74LGH",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1667575501767,
"version": 2,
"chainId": 84,
"sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H",
"senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu",
"proofs": [
"5SQsry42qC4dxqYBwBs1Ny8nsxomdobRCoCnUnEcgM7EsiF2hFqS4Jw23jeyvCT68xDaPoYkSSg3hEeaDVtG39bD"
],
"script": "base64:BgIQCAISBQoDCAgBEgMKAQgSAAUACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAVrU2VsbAIEc2VsbAAGa1ByaWNlAgVwcmljZQEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcDAWkBCGlzc3VlTmZ0AwRuYW1lBG1ldGEFcHJpY2UECG5ld1Rva2VuCQDCCAUFBG5hbWUFBG1ldGEAAQAABwQHaXNzdWVJZAkAuAgBBQhuZXdUb2tlbgkAzAgCBQhuZXdUb2tlbgkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIIBQhuZXdUb2tlbghxdWFudGl0eQUHaXNzdWVJZAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGa1ByaWNlBQlzZXBhcmF0b3IJANgEA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wCAgUGa1ByaWNlBQlzZXBhcmF0b3IJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkA2AQBBQZ0b2tlbjACHlRoZXJlIGlzIG5vIHByaWNlIGZvciB0aGlzIE5GVAMJAQEhAQkBBWlzTmZ0AQUGdG9rZW4wCQACAQIQVG9rZW4gaXMgbm90IE5GVAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIJAGgCCQENcGFyc2VJbnRWYWx1ZQEFBXByaWNlBQdhbW91bnQwBQR1bml0CQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQClCAEIBQFpBmNhbGxlcgUJc2VwYXJhdG9yBQVrU2VsbAkArAICCQCsAgIJANgEAQUGdG9rZW4wBQlzZXBhcmF0b3IJAKQDAQUHYW1vdW50MAUDbmlsAHMYHRY=",
"height": 2302542,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: DsLcwqCtckvqSCfr4BeG9ntsTXWq4ZvTQDSTT18qcXJ5
Next: FFUyrG2x2EWNdTsmDSh5GN6A4JQukMuSmiJaHDcR6GBC
Diff:
Old | New | | Differences |
---|
34 | 34 | | |
---|
35 | 35 | | |
---|
36 | 36 | | @Callable(i) |
---|
37 | | - | func buyNFT (o,p) = { |
---|
38 | | - | let q = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
39 | | - | let r = q._1 |
---|
40 | | - | let s = q._2 |
---|
| 37 | + | func buyNFT (o) = { |
---|
| 38 | + | let f = fromBase58String(o) |
---|
| 39 | + | let p = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 40 | + | let q = p._1 |
---|
| 41 | + | let r = p._2 |
---|
41 | 42 | | let l = valueOrErrorMessage(getStringValue(((d + a) + o)), "There is no price for this NFT") |
---|
42 | 43 | | if ((i.payments[0].assetId != unit)) |
---|
43 | 44 | | then throw("Pay in waves") |
---|
44 | | - | else if ((parseIntValue(l) > (s * p))) |
---|
| 45 | + | else if ((parseIntValue(l) > r)) |
---|
45 | 46 | | then throw("Invalid payment attached") |
---|
46 | | - | else [ScriptTransfer(i.caller, p, fromBase58String(o)), StringEntry(((toString(i.caller) + a) + b), ((o + a) + toString(p)))] |
---|
| 47 | + | else [ScriptTransfer(i.caller, 1, f), StringEntry(((toString(i.caller) + a) + b), ((o + a) + toString(r)))] |
---|
47 | 48 | | } |
---|
48 | 49 | | |
---|
49 | 50 | | |
---|
50 | 51 | | |
---|
51 | 52 | | @Callable(i) |
---|
52 | 53 | | func sellNFT () = { |
---|
53 | | - | let t = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
54 | | - | let r = t._1 |
---|
55 | | - | let s = t._2 |
---|
56 | | - | let l = getStringValue(((d + a) + valueOrErrorMessage(toBase58String(r), "There is no price for this NFT"))) |
---|
57 | | - | if (!(e(r))) |
---|
| 54 | + | let s = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 55 | + | let q = s._1 |
---|
| 56 | + | let r = s._2 |
---|
| 57 | + | let l = getStringValue(((d + a) + valueOrErrorMessage(toBase58String(q), "There is no price for this NFT"))) |
---|
| 58 | + | if (!(e(q))) |
---|
58 | 59 | | then throw("Token is not NFT") |
---|
59 | | - | else [ScriptTransfer(i.caller, (parseIntValue(l) * s), unit), StringEntry(((toString(i.caller) + a) + c), ((toBase58String(r) + a) + toString(s)))] |
---|
| 60 | + | else [ScriptTransfer(i.caller, (parseIntValue(l) * r), unit), StringEntry(((toString(i.caller) + a) + c), ((toBase58String(q) + a) + toString(r)))] |
---|
60 | 61 | | } |
---|
61 | 62 | | |
---|
62 | 63 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let a = "_" |
---|
5 | 5 | | |
---|
6 | 6 | | let b = "buy" |
---|
7 | 7 | | |
---|
8 | 8 | | let c = "sell" |
---|
9 | 9 | | |
---|
10 | 10 | | let d = "price" |
---|
11 | 11 | | |
---|
12 | 12 | | func e (f) = { |
---|
13 | 13 | | let g = assetInfo(f) |
---|
14 | 14 | | if ($isInstanceOf(g, "Asset")) |
---|
15 | 15 | | then { |
---|
16 | 16 | | let h = g |
---|
17 | 17 | | if (if ((h.decimals == 0)) |
---|
18 | 18 | | then (h.quantity == 1) |
---|
19 | 19 | | else false) |
---|
20 | 20 | | then (h.reissuable == false) |
---|
21 | 21 | | else false |
---|
22 | 22 | | } |
---|
23 | 23 | | else false |
---|
24 | 24 | | } |
---|
25 | 25 | | |
---|
26 | 26 | | |
---|
27 | 27 | | @Callable(i) |
---|
28 | 28 | | func issueNft (j,k,l) = { |
---|
29 | 29 | | let m = Issue(j, k, 1, 0, false) |
---|
30 | 30 | | let n = calculateAssetId(m) |
---|
31 | 31 | | [m, ScriptTransfer(i.caller, m.quantity, n), StringEntry(((d + a) + toBase58String(n)), toString(l))] |
---|
32 | 32 | | } |
---|
33 | 33 | | |
---|
34 | 34 | | |
---|
35 | 35 | | |
---|
36 | 36 | | @Callable(i) |
---|
37 | | - | func buyNFT (o,p) = { |
---|
38 | | - | let q = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
39 | | - | let r = q._1 |
---|
40 | | - | let s = q._2 |
---|
| 37 | + | func buyNFT (o) = { |
---|
| 38 | + | let f = fromBase58String(o) |
---|
| 39 | + | let p = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 40 | + | let q = p._1 |
---|
| 41 | + | let r = p._2 |
---|
41 | 42 | | let l = valueOrErrorMessage(getStringValue(((d + a) + o)), "There is no price for this NFT") |
---|
42 | 43 | | if ((i.payments[0].assetId != unit)) |
---|
43 | 44 | | then throw("Pay in waves") |
---|
44 | | - | else if ((parseIntValue(l) > (s * p))) |
---|
| 45 | + | else if ((parseIntValue(l) > r)) |
---|
45 | 46 | | then throw("Invalid payment attached") |
---|
46 | | - | else [ScriptTransfer(i.caller, p, fromBase58String(o)), StringEntry(((toString(i.caller) + a) + b), ((o + a) + toString(p)))] |
---|
| 47 | + | else [ScriptTransfer(i.caller, 1, f), StringEntry(((toString(i.caller) + a) + b), ((o + a) + toString(r)))] |
---|
47 | 48 | | } |
---|
48 | 49 | | |
---|
49 | 50 | | |
---|
50 | 51 | | |
---|
51 | 52 | | @Callable(i) |
---|
52 | 53 | | func sellNFT () = { |
---|
53 | | - | let t = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
54 | | - | let r = t._1 |
---|
55 | | - | let s = t._2 |
---|
56 | | - | let l = getStringValue(((d + a) + valueOrErrorMessage(toBase58String(r), "There is no price for this NFT"))) |
---|
57 | | - | if (!(e(r))) |
---|
| 54 | + | let s = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 55 | + | let q = s._1 |
---|
| 56 | + | let r = s._2 |
---|
| 57 | + | let l = getStringValue(((d + a) + valueOrErrorMessage(toBase58String(q), "There is no price for this NFT"))) |
---|
| 58 | + | if (!(e(q))) |
---|
58 | 59 | | then throw("Token is not NFT") |
---|
59 | | - | else [ScriptTransfer(i.caller, (parseIntValue(l) * s), unit), StringEntry(((toString(i.caller) + a) + c), ((toBase58String(r) + a) + toString(s)))] |
---|
| 60 | + | else [ScriptTransfer(i.caller, (parseIntValue(l) * r), unit), StringEntry(((toString(i.caller) + a) + c), ((toBase58String(q) + a) + toString(r)))] |
---|
60 | 61 | | } |
---|
61 | 62 | | |
---|
62 | 63 | | |
---|