tx · HpyAvKCkFMgzDDJE257AYtxvKtTpaMF3rSarwr9tcjGT 3N8gbU8daeQsLjaMgBngnZB999X7e13Rk4A: -0.01400000 Waves 2021.04.12 18:50 [1479438] smart account 3N8gbU8daeQsLjaMgBngnZB999X7e13Rk4A > SELF 0.00000000 Waves
{ "type": 13, "id": "HpyAvKCkFMgzDDJE257AYtxvKtTpaMF3rSarwr9tcjGT", "fee": 1400000, "feeAssetId": null, "timestamp": 1618242640183, "version": 2, "chainId": 84, "sender": "3N8gbU8daeQsLjaMgBngnZB999X7e13Rk4A", "senderPublicKey": "Bo8DbABLbLDy5spqq8CTn9AWWjnwuyWYDyfVoSoUGJfL", "proofs": [ "33Yz9orjkwCik55MjNM62GjvWDZ5MtEbRf1jcszpzPpMfFwSjrAkVtXNeDVLrnfn4biKZ2bA6c6thCM2rUofz2zr" ], "script": "base64:AAIEAAAAAAAAAB4IAhIGCgQICAgBEgMKAQgSBgoECAgICBIFCgMICAgAAAAAAAAABAAAAAFpAQAAAApkZXBvc2l0TmZ0AAAABAAAAAVuZnRJZAAAABByZWNpcGllbnRBZGRyZXNzAAAAB3ByaWNlSWQAAAALcHJpY2VBbW91bnQEAAAAA3BtdAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAQAAAAJY3VycmVudElkCQACWAAAAAEJAQAAAAV2YWx1ZQAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAQAAAANc2VuZGVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAAiE9AAAAAgUAAAAFbmZ0SWQFAAAACWN1cnJlbnRJZAkAAAIAAAABAgAAABBjYW4gbm90IHRyYW5zZmVyCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgUAAAAJY3VycmVudElkAgAAAAdfc2VuZGVyBQAAAA1zZW5kZXJBZGRyZ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dFbnRyeQAAAAIFAAAAC25mdElkU3RyaW5nBQAAAARqc29uCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAAFbmZ0SWQFAAAAA25pbAAAAAFpAQAAAAl1cGRhdGVOZnQAAAADAAAABGNvZGUAAAAFbmZ0aWQAAAAEanNvbgQAAAAFbmZ0SWQJAAJZAAAAAQUAAAAFbmZ0aWQEAAAAB2JhbGFuY2UJAAPwAAAAAggFAAAAAWkAAAAGY2FsbGVyBQAAAAVuZnRJZAMJAAAAAAAAAgUAAAAHYmFsYW5jZQAAAAAAAAAAAQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAVuZnRpZAUAAAAEanNvbgUAAAADbmlsCQAAAgAAAAECAAAAIVlvdSBhcmUgbm90IGF1dGhvcml6ZWQgdG8gdXBkYXRlLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5nWUEaA==", "height": 1479438, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HsmusuhHUpnqfiKYnAVKGPYnQ2bv8QNa7KhpSfECrM9S Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func depositNft (nftId,recipientAddress,priceId,priceAmount) = { | |
8 | + | let pmt = i.payments[0] | |
9 | + | let pmtAmount = pmt.amount | |
10 | + | let currentId = toBase58String(value(pmt.assetId)) | |
11 | + | let senderAddress = toBase58String(i.caller.bytes) | |
12 | + | if ((nftId != currentId)) | |
13 | + | then throw("can not transfer") | |
14 | + | else [StringEntry((currentId + "_sender"), senderAddress), StringEntry((currentId + "_recipient"), recipientAddress), StringEntry((currentId + "_priceId"), priceId), IntegerEntry((currentId + "_priceAmount"), priceAmount), IntegerEntry((currentId + "_nftAmount"), pmtAmount)] | |
15 | + | } | |
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | @Callable(i) | |
20 | + | func swapNft (nftid) = { | |
21 | + | let pmt = i.payments[0] | |
22 | + | let pmtAmount = pmt.amount | |
23 | + | let nftId = fromBase58String(nftid) | |
24 | + | let priceId = toBase58String(value(pmt.assetId)) | |
25 | + | let recipientAddress = toBase58String(i.caller.bytes) | |
26 | + | let priceAmount = match getInteger(this, (nftid + "_priceAmount")) { | |
27 | + | case a: Int => | |
28 | + | a | |
29 | + | case _ => | |
30 | + | 0 | |
31 | + | } | |
32 | + | let recipient = match getString(this, (nftid + "_recipient")) { | |
33 | + | case a: String => | |
34 | + | a | |
35 | + | case _ => | |
36 | + | 0 | |
37 | + | } | |
38 | + | let currentAmount = match getInteger(this, (nftid + "_nftAmount")) { | |
39 | + | case a: Int => | |
40 | + | a | |
41 | + | case _ => | |
42 | + | 0 | |
43 | + | } | |
44 | + | let newAmount = (currentAmount - pmtAmount) | |
45 | + | if ((priceAmount != pmtAmount)) | |
46 | + | then throw("") | |
47 | + | else if ((recipientAddress != recipient)) | |
48 | + | then throw("") | |
49 | + | else if ((newAmount != 1)) | |
50 | + | then throw("") | |
51 | + | else [IntegerEntry((nftid + "_nftAmount"), newAmount), ScriptTransfer(i.caller, 1, nftId)] | |
52 | + | } | |
53 | + | ||
4 | 54 | ||
5 | 55 | ||
6 | 56 | @Callable(i) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func depositNft (nftId,recipientAddress,priceId,priceAmount) = { | |
8 | + | let pmt = i.payments[0] | |
9 | + | let pmtAmount = pmt.amount | |
10 | + | let currentId = toBase58String(value(pmt.assetId)) | |
11 | + | let senderAddress = toBase58String(i.caller.bytes) | |
12 | + | if ((nftId != currentId)) | |
13 | + | then throw("can not transfer") | |
14 | + | else [StringEntry((currentId + "_sender"), senderAddress), StringEntry((currentId + "_recipient"), recipientAddress), StringEntry((currentId + "_priceId"), priceId), IntegerEntry((currentId + "_priceAmount"), priceAmount), IntegerEntry((currentId + "_nftAmount"), pmtAmount)] | |
15 | + | } | |
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | @Callable(i) | |
20 | + | func swapNft (nftid) = { | |
21 | + | let pmt = i.payments[0] | |
22 | + | let pmtAmount = pmt.amount | |
23 | + | let nftId = fromBase58String(nftid) | |
24 | + | let priceId = toBase58String(value(pmt.assetId)) | |
25 | + | let recipientAddress = toBase58String(i.caller.bytes) | |
26 | + | let priceAmount = match getInteger(this, (nftid + "_priceAmount")) { | |
27 | + | case a: Int => | |
28 | + | a | |
29 | + | case _ => | |
30 | + | 0 | |
31 | + | } | |
32 | + | let recipient = match getString(this, (nftid + "_recipient")) { | |
33 | + | case a: String => | |
34 | + | a | |
35 | + | case _ => | |
36 | + | 0 | |
37 | + | } | |
38 | + | let currentAmount = match getInteger(this, (nftid + "_nftAmount")) { | |
39 | + | case a: Int => | |
40 | + | a | |
41 | + | case _ => | |
42 | + | 0 | |
43 | + | } | |
44 | + | let newAmount = (currentAmount - pmtAmount) | |
45 | + | if ((priceAmount != pmtAmount)) | |
46 | + | then throw("") | |
47 | + | else if ((recipientAddress != recipient)) | |
48 | + | then throw("") | |
49 | + | else if ((newAmount != 1)) | |
50 | + | then throw("") | |
51 | + | else [IntegerEntry((nftid + "_nftAmount"), newAmount), ScriptTransfer(i.caller, 1, nftId)] | |
52 | + | } | |
53 | + | ||
4 | 54 | ||
5 | 55 | ||
6 | 56 | @Callable(i) | |
7 | 57 | func issueNft (code,brand,name,json) = { | |
8 | 58 | let nft = Issue("GOLF GEAR NFT", ((brand + " / ") + name), 1, 0, false) | |
9 | 59 | let nftId = calculateAssetId(nft) | |
10 | 60 | let nftIdString = toBase58String(nftId) | |
11 | 61 | [nft, StringEntry(nftIdString, json), ScriptTransfer(i.caller, 1, nftId)] | |
12 | 62 | } | |
13 | 63 | ||
14 | 64 | ||
15 | 65 | ||
16 | 66 | @Callable(i) | |
17 | 67 | func updateNft (code,nftid,json) = { | |
18 | 68 | let nftId = fromBase58String(nftid) | |
19 | 69 | let balance = assetBalance(i.caller, nftId) | |
20 | 70 | if ((balance == 1)) | |
21 | 71 | then [StringEntry(nftid, json)] | |
22 | 72 | else throw("You are not authorized to update.") | |
23 | 73 | } | |
24 | 74 | ||
25 | 75 | ||
26 | 76 | @Verifier(tx) | |
27 | 77 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
28 | 78 |
github/deemru/w8io/169f3d6 27.42 ms ◑