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:AAIEAAAAAAAAAB4IAhIGCgQICAgBEgMKAQgSBgoECAgICBIFCgMICAgAAAAAAAAABAAAAAFpAQAAAApkZXBvc2l0TmZ0AAAABAAAAAVuZnRJZAAAABByZWNpcGllbnRBZGRyZXNzAAAAB3ByaWNlSWQAAAALcHJpY2VBbW91bnQEAAAAA3BtdAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAQAAAAJY3VycmVudElkCQACWAAAAAEJAQAAAAV2YWx1ZQAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAQAAAANc2VuZGVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAAAiE9AAAAAgUAAAAFbmZ0SWQFAAAACWN1cnJlbnRJZAkAAAIAAAABAgAAABBjYW4gbm90IHRyYW5zZmVyCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgUAAAAJY3VycmVudElkAgAAAAdfc2VuZGVyBQAAAA1zZW5kZXJBZGRy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mdFbnRyeQAAAAIFAAAAC25mdElkU3RyaW5nBQAAAARqc29uCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAAFbmZ0SWQFAAAAA25pbAAAAAFpAQAAAAl1cGRhdGVOZnQAAAADAAAABGNvZGUAAAAFbmZ0aWQAAAAEanNvbgQAAAAFbmZ0SWQJAAJZAAAAAQUAAAAFbmZ0aWQEAAAAB2JhbGFuY2UJAAPwAAAAAggFAAAAAWkAAAAGY2FsbGVyBQAAAAVuZnRJZAMJAAAAAAAAAgUAAAAHYmFsYW5jZQAAAAAAAAAAAQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAVuZnRpZAUAAAAEanNvbgUAAAADbmlsCQAAAgAAAAECAAAAIVlvdSBhcmUgbm90IGF1dGhvcml6ZWQgdG8gdXBkYXRlLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5nWUEaA==", "height": 1479438, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HsmusuhHUpnqfiKYnAVKGPYnQ2bv8QNa7KhpSfECrM9S Next: none Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# 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+
454
555
656 @Callable(i)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# 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+
454
555
656 @Callable(i)
757 func issueNft (code,brand,name,json) = {
858 let nft = Issue("GOLF GEAR NFT", ((brand + " / ") + name), 1, 0, false)
959 let nftId = calculateAssetId(nft)
1060 let nftIdString = toBase58String(nftId)
1161 [nft, StringEntry(nftIdString, json), ScriptTransfer(i.caller, 1, nftId)]
1262 }
1363
1464
1565
1666 @Callable(i)
1767 func updateNft (code,nftid,json) = {
1868 let nftId = fromBase58String(nftid)
1969 let balance = assetBalance(i.caller, nftId)
2070 if ((balance == 1))
2171 then [StringEntry(nftid, json)]
2272 else throw("You are not authorized to update.")
2373 }
2474
2575
2676 @Verifier(tx)
2777 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
2878

github/deemru/w8io/169f3d6 
27.42 ms