tx · 54y3zxTKCsTaGVavBfiJja7zr2977ojrTzVunUJig2xZ 3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6: -0.01000000 Waves 2023.02.27 16:01 [2468152] smart account 3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6 > SELF 0.00000000 Waves
{ "type": 13, "id": "54y3zxTKCsTaGVavBfiJja7zr2977ojrTzVunUJig2xZ", "fee": 1000000, "feeAssetId": null, "timestamp": 1677502898486, "version": 2, "chainId": 84, "sender": "3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6", "senderPublicKey": "3pW4h7e3NAcqGkvc1AyziZLMPSsG2eXvCGU7vLxPXkaq", "proofs": [ "5FK56xHWeDupuUpnjNyMpxFq4jngSF2uRZc8npYPmTgXihyP6WYcd1UkQYDJgo4MCNqsWeULV9W4NarYat1vtNVz" ], "script": "base64:AAIFAAAAAAAAAAwIAhIDCgEBEgMKAQEAAAADAAAAABJhc3NldElzc3VlckFkZHJlc3MBAAAAGgFUkMlk1eKK7BYyDb3r8xnUJHi0czqq901nAAAAABN2aXJlc0ZpbmFuY2VBZGRyZXNzAQAAABoBVAaIlieNH+JpYYyew7JYybnN4/xT/eZhegAAAAALdXNkdEFzc2V0SWQBAAAAIFbsGy7S7AG35zlDZ1wXJVeG/c1R4fpmOlxgdPdHs3NeAAAAAgAAAAFpAQAAAAtyZXF1ZXN0VVNEVAAAAAEAAAAGYW1vdW50BAAAAANyZXMJAAP8AAAABAkBAAAAB0FkZHJlc3MAAAABBQAAABJhc3NldElzc3VlckFkZHJlc3MCAAAAHXNlbmRJbnRlcm5hbEFzc2V0c1RvVGhlQ2FsbGVyCQAETAAAAAIAAAAAAAAAAAAJAARMAAAAAgUAAAAGYW1vdW50BQAAAANuaWwFAAAAA25pbAMJAAAAAAAAAgUAAAADcmVzBQAAAANyZXMDCQAAAAAAAAIFAAAAA3JlcwUAAAADcmVzBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAFpAQAAABNzdGFrZUluVmlyZXNGaW5hbmNlAAAAAQAAAAZhbW91bnQEAAAAA3JlcwkAA/wAAAAECQEAAAAHQWRkcmVzcwAAAAEFAAAAE3ZpcmVzRmluYW5jZUFkZHJlc3MCAAAAB2RlcG9zaXQJAARMAAAAAgUAAAAEdGhpcwkABEwAAAACBwUAAAADbmlsCQAETAAAAAIJAQAAAA9BdHRhY2hlZFBheW1lbnQAAAACBQAAAAt1c2R0QXNzZXRJZAUAAAAGYW1vdW50BQAAAANuaWwDCQAAAAAAAAIFAAAAA3JlcwUAAAADcmVzAwkAAAAAAAACBQAAAANyZXMFAAAAA3JlcwUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlec8SJ3Q=", "height": 2468152, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: oBAdq27BP79QYqV5tJoQQHvRwaBv5d3Q9QNvHK3Em7u Next: 6N6y16P3DaaaxaUQKcCC5WxEpJvRqL2rkUPpfWodXKk Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let assetIssuerAddress = base58'3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6' | |
5 | 5 | ||
6 | - | let | |
6 | + | let viresFinanceAddress = base58'3MpWdTGf7g4WqgCF16vRCm47r3jqWR4x3rH' | |
7 | 7 | ||
8 | - | func unwrap (data) = match data { | |
9 | - | case v: ByteVector => | |
10 | - | v | |
11 | - | case _ => | |
12 | - | throw("Expected that data will be string") | |
13 | - | } | |
14 | - | ||
8 | + | let usdtAssetId = base58'6rJsnE4NsDjdJdk1qvYiPGKSdURV8g4XedTkipyskmh7' | |
15 | 9 | ||
16 | 10 | @Callable(i) | |
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] | |
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.") | |
23 | 18 | } | |
24 | 19 | ||
25 | 20 | ||
26 | 21 | ||
27 | 22 | @Callable(i) | |
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)] | |
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.") | |
38 | 30 | } | |
39 | 31 | ||
40 | 32 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let assetIssuerAddress = base58'3N37eLdtWjhS31FGHvu2HpGLreF11i58Bv6' | |
5 | 5 | ||
6 | - | let | |
6 | + | let viresFinanceAddress = base58'3MpWdTGf7g4WqgCF16vRCm47r3jqWR4x3rH' | |
7 | 7 | ||
8 | - | func unwrap (data) = match data { | |
9 | - | case v: ByteVector => | |
10 | - | v | |
11 | - | case _ => | |
12 | - | throw("Expected that data will be string") | |
13 | - | } | |
14 | - | ||
8 | + | let usdtAssetId = base58'6rJsnE4NsDjdJdk1qvYiPGKSdURV8g4XedTkipyskmh7' | |
15 | 9 | ||
16 | 10 | @Callable(i) | |
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] | |
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.") | |
23 | 18 | } | |
24 | 19 | ||
25 | 20 | ||
26 | 21 | ||
27 | 22 | @Callable(i) | |
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)] | |
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.") | |
38 | 30 | } | |
39 | 31 | ||
40 | 32 | ||
41 | 33 | @Verifier(tx) | |
42 | 34 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
43 | 35 |
github/deemru/w8io/026f985 21.29 ms ◑