tx · 7kAzQdS8JYDqaw1JVDdEKAmUMksr6zsuEMNzU98SwG3q
3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.01000000 Waves
2022.11.04 18:46 [2302563] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{
"type": 13,
"id": "7kAzQdS8JYDqaw1JVDdEKAmUMksr6zsuEMNzU98SwG3q",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1667576799925,
"version": 2,
"chainId": 84,
"sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H",
"senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu",
"proofs": [
"5qayE3VR4DubBumAEqRFbeMtP7C6kt7Vfz96TpWUf55ivGWTLjJE2nJpUn9fgkGWHViUdjepnMENNfE5EJkH8R9Y"
],
"script": "base64:BgIQCAISBQoDCAgBEgMKAQgSAAUACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAVrU2VsbAIEc2VsbAAGa1ByaWNlAgVwcmljZQEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcDAWkBCGlzc3VlTmZ0AwRuYW1lBG1ldGEFcHJpY2UECG5ld1Rva2VuCQDCCAUFBG5hbWUFBG1ldGEAAQAABwQHaXNzdWVJZAkAuAgBBQhuZXdUb2tlbgkAzAgCBQhuZXdUb2tlbgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGa1ByaWNlBQlzZXBhcmF0b3IJANgEAQUHaXNzdWVJZAkApAMBBQVwcmljZQUDbmlsAWkBBmJ1eU5GVAEFbmZ0SUQECSR0MDcwNjc5MQkAlAoC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ApAMBBQdhbW91bnQwBQNuaWwAOsLZvg==",
"height": 2302563,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: Hk5vVWZFa4gLdkX9AcmvxJfo8nKvfkDUvbsaMfShuRLq
Next: FUM6eon4yn5HeRSh7J27AKrCneSJpzd8VR2h3hJL6dNd
Diff:
Old | New | | Differences |
---|
25 | 25 | | func issueNft (name,meta,price) = { |
---|
26 | 26 | | let newToken = Issue(name, meta, 1, 0, false) |
---|
27 | 27 | | let issueId = calculateAssetId(newToken) |
---|
28 | | - | [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price)), BinaryEntry("byyyyyte", issueId)] |
---|
| 28 | + | [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price))] |
---|
29 | 29 | | } |
---|
30 | 30 | | |
---|
31 | 31 | | |
---|
32 | 32 | | |
---|
33 | 33 | | @Callable(i) |
---|
34 | 34 | | func buyNFT (nftID) = { |
---|
35 | | - | let $t0750835 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
36 | | - | let token0 = $t0750835._1 |
---|
37 | | - | let amount0 = $t0750835._2 |
---|
38 | | - | [ScriptTransfer(i.caller, 1, nftID), StringEntry(((toString(i.caller) + separator) + kBuy), ((toBase58String(nftID) + separator) + toString(amount0)))] |
---|
| 35 | + | let $t0706791 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 36 | + | let token0 = $t0706791._1 |
---|
| 37 | + | let amount0 = $t0706791._2 |
---|
| 38 | + | [ScriptTransfer(i.caller, 1, toBytes(nftID)), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount0)))] |
---|
39 | 39 | | } |
---|
40 | 40 | | |
---|
41 | 41 | | |
---|
42 | 42 | | |
---|
43 | 43 | | @Callable(i) |
---|
44 | 44 | | func sellNFT () = { |
---|
45 | | - | let $t010441129 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
46 | | - | let token0 = $t010441129._1 |
---|
47 | | - | let amount0 = $t010441129._2 |
---|
| 45 | + | let $t09931078 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 46 | + | let token0 = $t09931078._1 |
---|
| 47 | + | let amount0 = $t09931078._2 |
---|
48 | 48 | | let price = getStringValue(((kPrice + separator) + valueOrErrorMessage(toBase58String(token0), "There is no price for this NFT"))) |
---|
49 | 49 | | if (!(isNft(token0))) |
---|
50 | 50 | | then throw("Token is not NFT") |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let separator = "_" |
---|
5 | 5 | | |
---|
6 | 6 | | let kBuy = "buy" |
---|
7 | 7 | | |
---|
8 | 8 | | let kSell = "sell" |
---|
9 | 9 | | |
---|
10 | 10 | | let kPrice = "price" |
---|
11 | 11 | | |
---|
12 | 12 | | func isNft (assetId) = match assetInfo(assetId) { |
---|
13 | 13 | | case token: Asset => |
---|
14 | 14 | | if (if ((token.decimals == 0)) |
---|
15 | 15 | | then (token.quantity == 1) |
---|
16 | 16 | | else false) |
---|
17 | 17 | | then (token.reissuable == false) |
---|
18 | 18 | | else false |
---|
19 | 19 | | case _ => |
---|
20 | 20 | | false |
---|
21 | 21 | | } |
---|
22 | 22 | | |
---|
23 | 23 | | |
---|
24 | 24 | | @Callable(i) |
---|
25 | 25 | | func issueNft (name,meta,price) = { |
---|
26 | 26 | | let newToken = Issue(name, meta, 1, 0, false) |
---|
27 | 27 | | let issueId = calculateAssetId(newToken) |
---|
28 | | - | [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price)), BinaryEntry("byyyyyte", issueId)] |
---|
| 28 | + | [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price))] |
---|
29 | 29 | | } |
---|
30 | 30 | | |
---|
31 | 31 | | |
---|
32 | 32 | | |
---|
33 | 33 | | @Callable(i) |
---|
34 | 34 | | func buyNFT (nftID) = { |
---|
35 | | - | let $t0750835 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
36 | | - | let token0 = $t0750835._1 |
---|
37 | | - | let amount0 = $t0750835._2 |
---|
38 | | - | [ScriptTransfer(i.caller, 1, nftID), StringEntry(((toString(i.caller) + separator) + kBuy), ((toBase58String(nftID) + separator) + toString(amount0)))] |
---|
| 35 | + | let $t0706791 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 36 | + | let token0 = $t0706791._1 |
---|
| 37 | + | let amount0 = $t0706791._2 |
---|
| 38 | + | [ScriptTransfer(i.caller, 1, toBytes(nftID)), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount0)))] |
---|
39 | 39 | | } |
---|
40 | 40 | | |
---|
41 | 41 | | |
---|
42 | 42 | | |
---|
43 | 43 | | @Callable(i) |
---|
44 | 44 | | func sellNFT () = { |
---|
45 | | - | let $t010441129 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
46 | | - | let token0 = $t010441129._1 |
---|
47 | | - | let amount0 = $t010441129._2 |
---|
| 45 | + | let $t09931078 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) |
---|
| 46 | + | let token0 = $t09931078._1 |
---|
| 47 | + | let amount0 = $t09931078._2 |
---|
48 | 48 | | let price = getStringValue(((kPrice + separator) + valueOrErrorMessage(toBase58String(token0), "There is no price for this NFT"))) |
---|
49 | 49 | | if (!(isNft(token0))) |
---|
50 | 50 | | then throw("Token is not NFT") |
---|
51 | 51 | | else [ScriptTransfer(i.caller, (parseIntValue(price) * amount0), unit), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] |
---|
52 | 52 | | } |
---|
53 | 53 | | |
---|
54 | 54 | | |
---|