tx · 6N6y16P3DaaaxaUQKcCC5WxEpJvRqL2rkUPpfWodXKk 3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6: -0.01000000 Waves 2023.02.27 16:01 [2468152] smart account 3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6 > SELF 0.00000000 Waves
{ "type": 13, "id": "6N6y16P3DaaaxaUQKcCC5WxEpJvRqL2rkUPpfWodXKk", "fee": 1000000, "feeAssetId": null, "timestamp": 1677502926285, "version": 2, "chainId": 84, "sender": "3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6", "senderPublicKey": "3pW4h7e3NAcqGkvc1AyziZLMPSsG2eXvCGU7vLxPXkaq", "proofs": [ "5w5s7bzFWT6Mqpkqgz8aqgnzFirWs7FfwX8StErjoEjfLKAApQ6Pexqf23h5y1fFv7RXksuKVsunudiiuYARkqHA" ], "script": "base64:BgIKCAISABIECgIBAQMAFmJzdFVzZHRBc3NldFN0b3JhZ2VLZXkCDmJzdFVzZHRBc3NldElkABZic3RTdXJmQXNzZXRTdG9yYWdlS2V5Ag5ic3RTdXJmQXNzZXRJZAEGdW53cmFwAQRkYXRhBAckbWF0Y2gwBQRkYXRhAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAXYFByRtYXRjaDAFAXYJAAIBAiFFeHBlY3RlZCB0aGF0IGRhdGEgd2lsbCBiZSBzdHJpbmcCAWkBC2lzc3VlQXNzZXRzAAQHYnN0VXNkdAkAwwgHAgxic3RVc2R0VGVzdDECAACAreIEAAYGBQR1bml0AAAEDmJzdFVzZHRBc3NldElkCQC4CAEFB2JzdFVzZHQEB2JzdFN1cmYJAMMIBwIMYnN0U3VyZlRlc3QxAgAAgK3iBAAGBgUEdW5pdAABBA5ic3RTdXJmQXNzZXRJZAkAuAgBBQdic3RTdXJmCQDMCAIJAQtEZWxldGVFbnRyeQEFFmJzdFVzZHRBc3NldFN0b3JhZ2VLZXkJAMwIAgkBC0RlbGV0ZUVudHJ5AQUWYnN0U3VyZkFzc2V0U3RvcmFnZUtleQkAzAgCCQELQmluYXJ5RW50cnkCBRZic3RVc2R0QXNzZXRTdG9yYWdlS2V5BQ5ic3RVc2R0QXNzZXRJZAkAzAgCCQELQmluYXJ5RW50cnkCBRZic3RTdXJmQXNzZXRTdG9yYWdlS2V5BQ5ic3RTdXJmQXNzZXRJZAkAzAgCBQdic3RVc2R0CQDMCAIFB2JzdFN1cmYFA25pbAFpAR1zZW5kSW50ZXJuYWxBc3NldHNUb1RoZUNhbGxlcgICaWQGYW1vdW50BAdhc3NldElkAwkAAAIFAmlkAAAJAQZ1bndyYXABCQChCAEFFmJzdFVzZHRBc3NldFN0b3JhZ2VLZXkDCQAAAgUCaWQAAQkBBnVud3JhcAEJAKEIAQUWYnN0U3VyZkFzc2V0U3RvcmFnZUtleQkAAgECDldyb25nIEFzc2V0IElkBAdiYWxhbmNlCQDwBwIFBHRoaXMFB2Fzc2V0SWQDCQBnAgUHYmFsYW5jZQUGYW1vdW50CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUGYW1vdW50BQdhc3NldElkBQNuaWwJAMwIAgkBB1JlaXNzdWUDBQdhc3NldElkBQZhbW91bnQGCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUGYW1vdW50BQdhc3NldElkBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5WVm1RQ==", "height": 2468152, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 54y3zxTKCsTaGVavBfiJja7zr2977ojrTzVunUJig2xZ Next: 2V6JEWnj7NfZBPdBHPgTJNn2Tste5tL3YHPQbtMKT9Yk Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let bstUsdtAssetStorageKey = "bstUsdtAssetId" | |
5 | 5 | ||
6 | - | let | |
6 | + | let bstSurfAssetStorageKey = "bstSurfAssetId" | |
7 | 7 | ||
8 | - | let usdtAssetId = base58'6rJsnE4NsDjdJdk1qvYiPGKSdURV8g4XedTkipyskmh7' | |
8 | + | func unwrap (data) = match data { | |
9 | + | case v: ByteVector => | |
10 | + | v | |
11 | + | case _ => | |
12 | + | throw("Expected that data will be string") | |
13 | + | } | |
14 | + | ||
9 | 15 | ||
10 | 16 | @Callable(i) | |
11 | - | func requestUSDT (amount) = { | |
12 | - | let res = invoke(Address(assetIssuerAddress), "sendInternalAssetsToTheCaller", [0, amount], nil) | |
13 | - | if ((res == res)) | |
14 | - | then if ((res == res)) | |
15 | - | then nil | |
16 | - | else throw("Strict value is not equal to itself.") | |
17 | - | else throw("Strict value is not equal to itself.") | |
17 | + | func issueAssets () = { | |
18 | + | let bstUsdt = Issue("bstUsdtTest1", "", 10000000, 6, true, unit, 0) | |
19 | + | let bstUsdtAssetId = calculateAssetId(bstUsdt) | |
20 | + | let bstSurf = Issue("bstSurfTest1", "", 10000000, 6, true, unit, 1) | |
21 | + | let bstSurfAssetId = calculateAssetId(bstSurf) | |
22 | + | [DeleteEntry(bstUsdtAssetStorageKey), DeleteEntry(bstSurfAssetStorageKey), BinaryEntry(bstUsdtAssetStorageKey, bstUsdtAssetId), BinaryEntry(bstSurfAssetStorageKey, bstSurfAssetId), bstUsdt, bstSurf] | |
18 | 23 | } | |
19 | 24 | ||
20 | 25 | ||
21 | 26 | ||
22 | 27 | @Callable(i) | |
23 | - | func stakeInViresFinance (amount) = { | |
24 | - | let res = invoke(Address(viresFinanceAddress), "deposit", [this, false], [AttachedPayment(usdtAssetId, amount)]) | |
25 | - | if ((res == res)) | |
26 | - | then if ((res == res)) | |
27 | - | then nil | |
28 | - | else throw("Strict value is not equal to itself.") | |
29 | - | else throw("Strict value is not equal to itself.") | |
28 | + | func sendInternalAssetsToTheCaller (id,amount) = { | |
29 | + | let assetId = if ((id == 0)) | |
30 | + | then unwrap(getBinary(bstUsdtAssetStorageKey)) | |
31 | + | else if ((id == 1)) | |
32 | + | then unwrap(getBinary(bstSurfAssetStorageKey)) | |
33 | + | else throw("Wrong Asset Id") | |
34 | + | let balance = assetBalance(this, assetId) | |
35 | + | if ((balance >= amount)) | |
36 | + | then [ScriptTransfer(i.caller, amount, assetId)] | |
37 | + | else [Reissue(assetId, amount, true), ScriptTransfer(i.caller, amount, assetId)] | |
30 | 38 | } | |
31 | 39 | ||
32 | 40 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let bstUsdtAssetStorageKey = "bstUsdtAssetId" | |
5 | 5 | ||
6 | - | let | |
6 | + | let bstSurfAssetStorageKey = "bstSurfAssetId" | |
7 | 7 | ||
8 | - | let usdtAssetId = base58'6rJsnE4NsDjdJdk1qvYiPGKSdURV8g4XedTkipyskmh7' | |
8 | + | func unwrap (data) = match data { | |
9 | + | case v: ByteVector => | |
10 | + | v | |
11 | + | case _ => | |
12 | + | throw("Expected that data will be string") | |
13 | + | } | |
14 | + | ||
9 | 15 | ||
10 | 16 | @Callable(i) | |
11 | - | func requestUSDT (amount) = { | |
12 | - | let res = invoke(Address(assetIssuerAddress), "sendInternalAssetsToTheCaller", [0, amount], nil) | |
13 | - | if ((res == res)) | |
14 | - | then if ((res == res)) | |
15 | - | then nil | |
16 | - | else throw("Strict value is not equal to itself.") | |
17 | - | else throw("Strict value is not equal to itself.") | |
17 | + | func issueAssets () = { | |
18 | + | let bstUsdt = Issue("bstUsdtTest1", "", 10000000, 6, true, unit, 0) | |
19 | + | let bstUsdtAssetId = calculateAssetId(bstUsdt) | |
20 | + | let bstSurf = Issue("bstSurfTest1", "", 10000000, 6, true, unit, 1) | |
21 | + | let bstSurfAssetId = calculateAssetId(bstSurf) | |
22 | + | [DeleteEntry(bstUsdtAssetStorageKey), DeleteEntry(bstSurfAssetStorageKey), BinaryEntry(bstUsdtAssetStorageKey, bstUsdtAssetId), BinaryEntry(bstSurfAssetStorageKey, bstSurfAssetId), bstUsdt, bstSurf] | |
18 | 23 | } | |
19 | 24 | ||
20 | 25 | ||
21 | 26 | ||
22 | 27 | @Callable(i) | |
23 | - | func stakeInViresFinance (amount) = { | |
24 | - | let res = invoke(Address(viresFinanceAddress), "deposit", [this, false], [AttachedPayment(usdtAssetId, amount)]) | |
25 | - | if ((res == res)) | |
26 | - | then if ((res == res)) | |
27 | - | then nil | |
28 | - | else throw("Strict value is not equal to itself.") | |
29 | - | else throw("Strict value is not equal to itself.") | |
28 | + | func sendInternalAssetsToTheCaller (id,amount) = { | |
29 | + | let assetId = if ((id == 0)) | |
30 | + | then unwrap(getBinary(bstUsdtAssetStorageKey)) | |
31 | + | else if ((id == 1)) | |
32 | + | then unwrap(getBinary(bstSurfAssetStorageKey)) | |
33 | + | else throw("Wrong Asset Id") | |
34 | + | let balance = assetBalance(this, assetId) | |
35 | + | if ((balance >= amount)) | |
36 | + | then [ScriptTransfer(i.caller, amount, assetId)] | |
37 | + | else [Reissue(assetId, amount, true), ScriptTransfer(i.caller, amount, assetId)] | |
30 | 38 | } | |
31 | 39 | ||
32 | 40 | ||
33 | 41 | @Verifier(tx) | |
34 | 42 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
35 | 43 |
github/deemru/w8io/026f985 25.12 ms ◑