tx · EQsk4kmittQy7Re7ZRkQgomcom7JZ6LGj5QAvDvA6xyp
3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6: -0.01000000 Waves
2023.02.24 11:31 [2463516] smart account 3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6 > SELF 0.00000000 Waves
{
"type": 13,
"id": "EQsk4kmittQy7Re7ZRkQgomcom7JZ6LGj5QAvDvA6xyp",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1677227576450,
"version": 2,
"chainId": 84,
"sender": "3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6",
"senderPublicKey": "3pW4h7e3NAcqGkvc1AyziZLMPSsG2eXvCGU7vLxPXkaq",
"proofs": [
"zKPYcAwjM9gKFSA6j8WAwThkdc1gCrYopMT7WBRZtKXqUmnvAvcm2U9MMjYUHbEbukjs97XYnLW9kWFJE7MHpAU"
],
"script": "base64:BgIKCAISABIECgIBAQMAFmJzdFVzZHRBc3NldFN0b3JhZ2VLZXkCDmJzdFVzZHRBc3NldElkABZic3RTdXJmQXNzZXRTdG9yYWdlS2V5Ag5ic3RTdXJmQXNzZXRJZAEGdW53cmFwAQRkYXRhBAckbWF0Y2gwBQRkYXRhAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAXYFByRtYXRjaDAFAXYJAAIBAiFFeHBlY3RlZCB0aGF0IGRhdGEgd2lsbCBiZSBzdHJpbmcCAWkBC2lzc3VlQXNzZXRzAAQHYnN0VXNkdAkAwwgHAgxic3RVc2R0VGVzdDECAACAreIEAAYGBQR1bml0AAAEDmJzdFVzZHRBc3NldElkCQC4CAEFB2JzdFVzZHQEB2JzdFN1cmYJAMMIBwIMYnN0U3VyZlRlc3QxAgAAgK3iBAAGBgUEdW5pdAABBA5ic3RTdXJmQXNzZXRJZAkAuAgBBQdic3RTdXJmCQDMCAIJAQtEZWxldGVFbnRyeQEFFmJzdFVzZHRBc3NldFN0b3JhZ2VLZXkJAMwIAgkBC0RlbGV0ZUVudHJ5AQUWYnN0U3VyZkFzc2V0U3RvcmFnZUtleQkAzAgCCQELQmluYXJ5RW50cnkCBRZic3RVc2R0QXNzZXRTdG9yYWdlS2V5BQ5ic3RVc2R0QXNzZXRJZAkAzAgCCQELQmluYXJ5RW50cnkCBRZic3RTdXJmQXNzZXRTdG9yYWdlS2V5BQ5ic3RTdXJmQXNzZXRJZAkAzAgCBQdic3RVc2R0CQDMCAIFB2JzdFN1cmYFA25pbAFpAR1zZW5kSW50ZXJuYWxBc3NldHNUb1RoZUNhbGxlcgICaWQGYW1vdW50BAdhc3NldElkAwkAAAIFAmlkAAAJAQZ1bndyYXABCQChCAEFFmJzdFVzZHRBc3NldFN0b3JhZ2VLZXkDCQAAAgUCaWQAAQkBBnVud3JhcAEJAKEIAQUWYnN0U3VyZkFzc2V0U3RvcmFnZUtleQkAAgECDldyb25nIEFzc2V0IElkBAdiYWxhbmNlCQDwBwIFBHRoaXMFB2Fzc2V0SWQDCQBnAgUHYmFsYW5jZQUGYW1vdW50CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUGYW1vdW50BQdhc3NldElkBQNuaWwJAAIBAhJJbnN1ZmZpY2llbnQgZnVuZHMBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V58LU5Jg==",
"height": 2463516,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 9ipHkRPdWWm6MTNR77qg3gn8tcF2VW3mdGFFBRk5XGsg
Next: oBAdq27BP79QYqV5tJoQQHvRwaBv5d3Q9QNvHK3Em7u
Diff:
Old | New | | Differences |
---|
5 | 5 | | |
---|
6 | 6 | | let bstSurfAssetStorageKey = "bstSurfAssetId" |
---|
7 | 7 | | |
---|
8 | | - | func convertToByteVector (data) = match data { |
---|
9 | | - | case str: String => |
---|
10 | | - | toBytes(str) |
---|
| 8 | + | func unwrap (data) = match data { |
---|
| 9 | + | case v: ByteVector => |
---|
| 10 | + | v |
---|
11 | 11 | | case _ => |
---|
12 | 12 | | throw("Expected that data will be string") |
---|
13 | 13 | | } |
---|
14 | 14 | | |
---|
15 | 15 | | |
---|
16 | 16 | | @Callable(i) |
---|
17 | | - | func call () = { |
---|
18 | | - | let asset = Issue("Asset", "", 100, 8, true, unit, 0) |
---|
19 | | - | let assetId = calculateAssetId(asset) |
---|
20 | | - | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset] |
---|
21 | | - | } |
---|
22 | | - | |
---|
23 | | - | |
---|
24 | | - | |
---|
25 | | - | @Callable(i) |
---|
26 | 17 | | func issueAssets () = { |
---|
27 | | - | let bstUsdt = Issue("bstUsdtTest1", "", 1000000, 6, true, unit, 0) |
---|
| 18 | + | let bstUsdt = Issue("bstUsdtTest1", "", 10000000, 6, true, unit, 0) |
---|
28 | 19 | | let bstUsdtAssetId = calculateAssetId(bstUsdt) |
---|
29 | | - | let bstSurf = Issue("bstSurfTest1", "", 1000000, 6, true, unit, 1) |
---|
| 20 | + | let bstSurf = Issue("bstSurfTest1", "", 10000000, 6, true, unit, 1) |
---|
30 | 21 | | let bstSurfAssetId = calculateAssetId(bstSurf) |
---|
31 | | - | [StringEntry(bstUsdtAssetStorageKey, toBase58String(bstUsdtAssetId)), StringEntry(bstSurfAssetStorageKey, toBase58String(bstSurfAssetId)), BinaryEntry("TestData", bstSurfAssetId), bstUsdt, bstSurf] |
---|
| 22 | + | [DeleteEntry(bstUsdtAssetStorageKey), DeleteEntry(bstSurfAssetStorageKey), BinaryEntry(bstUsdtAssetStorageKey, bstUsdtAssetId), BinaryEntry(bstSurfAssetStorageKey, bstSurfAssetId), bstUsdt, bstSurf] |
---|
32 | 23 | | } |
---|
33 | 24 | | |
---|
34 | 25 | | |
---|
|
36 | 27 | | @Callable(i) |
---|
37 | 28 | | func sendInternalAssetsToTheCaller (id,amount) = { |
---|
38 | 29 | | let assetId = if ((id == 0)) |
---|
39 | | - | then getString(bstUsdtAssetStorageKey) |
---|
| 30 | + | then unwrap(getBinary(bstUsdtAssetStorageKey)) |
---|
40 | 31 | | else if ((id == 1)) |
---|
41 | | - | then getString(bstSurfAssetStorageKey) |
---|
| 32 | + | then unwrap(getBinary(bstSurfAssetStorageKey)) |
---|
42 | 33 | | else throw("Wrong Asset Id") |
---|
43 | | - | let balance = assetBalance(this, convertToByteVector(assetId)) |
---|
| 34 | + | let balance = assetBalance(this, assetId) |
---|
44 | 35 | | if ((balance >= amount)) |
---|
45 | | - | then [ScriptTransfer(i.caller, amount, convertToByteVector(assetId))] |
---|
46 | | - | else [ScriptTransfer(i.caller, amount, convertToByteVector(assetId))] |
---|
| 36 | + | then [ScriptTransfer(i.caller, amount, assetId)] |
---|
| 37 | + | else throw("Insufficient funds") |
---|
47 | 38 | | } |
---|
48 | 39 | | |
---|
49 | 40 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let bstUsdtAssetStorageKey = "bstUsdtAssetId" |
---|
5 | 5 | | |
---|
6 | 6 | | let bstSurfAssetStorageKey = "bstSurfAssetId" |
---|
7 | 7 | | |
---|
8 | | - | func convertToByteVector (data) = match data { |
---|
9 | | - | case str: String => |
---|
10 | | - | toBytes(str) |
---|
| 8 | + | func unwrap (data) = match data { |
---|
| 9 | + | case v: ByteVector => |
---|
| 10 | + | v |
---|
11 | 11 | | case _ => |
---|
12 | 12 | | throw("Expected that data will be string") |
---|
13 | 13 | | } |
---|
14 | 14 | | |
---|
15 | 15 | | |
---|
16 | 16 | | @Callable(i) |
---|
17 | | - | func call () = { |
---|
18 | | - | let asset = Issue("Asset", "", 100, 8, true, unit, 0) |
---|
19 | | - | let assetId = calculateAssetId(asset) |
---|
20 | | - | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset] |
---|
21 | | - | } |
---|
22 | | - | |
---|
23 | | - | |
---|
24 | | - | |
---|
25 | | - | @Callable(i) |
---|
26 | 17 | | func issueAssets () = { |
---|
27 | | - | let bstUsdt = Issue("bstUsdtTest1", "", 1000000, 6, true, unit, 0) |
---|
| 18 | + | let bstUsdt = Issue("bstUsdtTest1", "", 10000000, 6, true, unit, 0) |
---|
28 | 19 | | let bstUsdtAssetId = calculateAssetId(bstUsdt) |
---|
29 | | - | let bstSurf = Issue("bstSurfTest1", "", 1000000, 6, true, unit, 1) |
---|
| 20 | + | let bstSurf = Issue("bstSurfTest1", "", 10000000, 6, true, unit, 1) |
---|
30 | 21 | | let bstSurfAssetId = calculateAssetId(bstSurf) |
---|
31 | | - | [StringEntry(bstUsdtAssetStorageKey, toBase58String(bstUsdtAssetId)), StringEntry(bstSurfAssetStorageKey, toBase58String(bstSurfAssetId)), BinaryEntry("TestData", bstSurfAssetId), bstUsdt, bstSurf] |
---|
| 22 | + | [DeleteEntry(bstUsdtAssetStorageKey), DeleteEntry(bstSurfAssetStorageKey), BinaryEntry(bstUsdtAssetStorageKey, bstUsdtAssetId), BinaryEntry(bstSurfAssetStorageKey, bstSurfAssetId), bstUsdt, bstSurf] |
---|
32 | 23 | | } |
---|
33 | 24 | | |
---|
34 | 25 | | |
---|
35 | 26 | | |
---|
36 | 27 | | @Callable(i) |
---|
37 | 28 | | func sendInternalAssetsToTheCaller (id,amount) = { |
---|
38 | 29 | | let assetId = if ((id == 0)) |
---|
39 | | - | then getString(bstUsdtAssetStorageKey) |
---|
| 30 | + | then unwrap(getBinary(bstUsdtAssetStorageKey)) |
---|
40 | 31 | | else if ((id == 1)) |
---|
41 | | - | then getString(bstSurfAssetStorageKey) |
---|
| 32 | + | then unwrap(getBinary(bstSurfAssetStorageKey)) |
---|
42 | 33 | | else throw("Wrong Asset Id") |
---|
43 | | - | let balance = assetBalance(this, convertToByteVector(assetId)) |
---|
| 34 | + | let balance = assetBalance(this, assetId) |
---|
44 | 35 | | if ((balance >= amount)) |
---|
45 | | - | then [ScriptTransfer(i.caller, amount, convertToByteVector(assetId))] |
---|
46 | | - | else [ScriptTransfer(i.caller, amount, convertToByteVector(assetId))] |
---|
| 36 | + | then [ScriptTransfer(i.caller, amount, assetId)] |
---|
| 37 | + | else throw("Insufficient funds") |
---|
47 | 38 | | } |
---|
48 | 39 | | |
---|
49 | 40 | | |
---|
50 | 41 | | @Verifier(tx) |
---|
51 | 42 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
52 | 43 | | |
---|