tx · 71eERG5QVr4UrbPXczR13XjCNQVJrbkLM8Hd2Ke29EE1
3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD: -0.00100000 Waves
2022.07.16 17:27 [2142419] smart account 3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD > SELF 0.00000000 Waves
{
"type": 13,
"id": "71eERG5QVr4UrbPXczR13XjCNQVJrbkLM8Hd2Ke29EE1",
"fee": 100000,
"feeAssetId": null,
"timestamp": 1657981785493,
"version": 2,
"chainId": 84,
"sender": "3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD",
"senderPublicKey": "CU5wMqCBg4bC4Zgs8QGiqjjvmeMkSiKo3Ff6k5axJZwr",
"proofs": [
"2m1NXWp1LhAtadNjUArm1XXgZDRcTVY3SZxmLVyxU1ffmxo5FLHnkioQwxCvf35Yt7FQhXR9o7schBtVzV2trsgv"
],
"script": "base64:AAIFAAAAAAAAAAwIAhIDCgEBEgMKAQEAAAACAAAAAAVnd1VzZAEAAAAg1td3yV5SV/9sTRnPub7Z/8+5gW83ZtDAi9MIvEJ2JY0AAAAABHVzZG4BAAAAIA/yHBKs5MQ8muxGGqslqLDsugcrRsxtiHLwteKSSQG0AAAAAgAAAAFpAQAAAA9zd2FwR0d1c2RUb1VzZG4AAAABAAAABmFtb3VudAQAAAADcG10CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAVnd1VzZAkAAAIAAAABAgAAAClPbmx5IGd3VXNkIHRva2VuIGlzIGFsbG93ZWQgZm9yIHN3YXBwaW5nLgQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdXNkbgUAAAADbmlsAAAAAWkBAAAAD3N3YXBVc2RuVG9HR3VzZAAAAAEAAAAGYW1vdW50BAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAABHVzZG4JAAACAAAAAQIAAAApT25seSBnd1VzZCB0b2tlbiBpcyBhbGxvd2VkIGZvciBzd2FwcGluZy4EAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABWd3VXNkBQAAAANuaWwAAAAAXLGy8g==",
"height": 2142419,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: A2CC27i7kagL5XPhpvnUUDwFAEg9gk2kw9Vor2w4cNk8
Next: FEN1bvLwmpJ3LiRupWbMLXSeFsdWA4Cte2x1uXPSGxdp
Diff:
Old | New | | Differences |
---|
26 | 26 | | |
---|
27 | 27 | | @Callable(i) |
---|
28 | 28 | | func swapUsdnToGGusd (amount) = { |
---|
29 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
30 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
31 | | - | case a: Int => |
---|
32 | | - | a |
---|
33 | | - | case _ => |
---|
34 | | - | 0 |
---|
35 | | - | } |
---|
| 29 | + | let pmt = value(i.payments[0]) |
---|
| 30 | + | if ((pmt.assetId != usdn)) |
---|
| 31 | + | then throw("Only gwUsd token is allowed for swapping.") |
---|
| 32 | + | else { |
---|
| 33 | + | let currentKey = toBase58String(i.caller.bytes) |
---|
| 34 | + | let currentAmount = match getInteger(this, currentKey) { |
---|
| 35 | + | case a: Int => |
---|
| 36 | + | a |
---|
| 37 | + | case _ => |
---|
| 38 | + | 0 |
---|
| 39 | + | } |
---|
36 | 40 | | [ScriptTransfer(i.caller, amount, gwUsd)] |
---|
| 41 | + | } |
---|
37 | 42 | | } |
---|
38 | 43 | | |
---|
39 | 44 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let gwUsd = base58'FTeosv2BmZED7kBcGnqDy9tba1VdkeodQveSAATMQusJ' |
---|
5 | 5 | | |
---|
6 | 6 | | let usdn = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' |
---|
7 | 7 | | |
---|
8 | 8 | | @Callable(i) |
---|
9 | 9 | | func swapGGusdToUsdn (amount) = { |
---|
10 | 10 | | let pmt = value(i.payments[0]) |
---|
11 | 11 | | if ((pmt.assetId != gwUsd)) |
---|
12 | 12 | | then throw("Only gwUsd token is allowed for swapping.") |
---|
13 | 13 | | else { |
---|
14 | 14 | | let currentKey = toBase58String(i.caller.bytes) |
---|
15 | 15 | | let currentAmount = match getInteger(this, currentKey) { |
---|
16 | 16 | | case a: Int => |
---|
17 | 17 | | a |
---|
18 | 18 | | case _ => |
---|
19 | 19 | | 0 |
---|
20 | 20 | | } |
---|
21 | 21 | | [ScriptTransfer(i.caller, amount, usdn)] |
---|
22 | 22 | | } |
---|
23 | 23 | | } |
---|
24 | 24 | | |
---|
25 | 25 | | |
---|
26 | 26 | | |
---|
27 | 27 | | @Callable(i) |
---|
28 | 28 | | func swapUsdnToGGusd (amount) = { |
---|
29 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
30 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
31 | | - | case a: Int => |
---|
32 | | - | a |
---|
33 | | - | case _ => |
---|
34 | | - | 0 |
---|
35 | | - | } |
---|
| 29 | + | let pmt = value(i.payments[0]) |
---|
| 30 | + | if ((pmt.assetId != usdn)) |
---|
| 31 | + | then throw("Only gwUsd token is allowed for swapping.") |
---|
| 32 | + | else { |
---|
| 33 | + | let currentKey = toBase58String(i.caller.bytes) |
---|
| 34 | + | let currentAmount = match getInteger(this, currentKey) { |
---|
| 35 | + | case a: Int => |
---|
| 36 | + | a |
---|
| 37 | + | case _ => |
---|
| 38 | + | 0 |
---|
| 39 | + | } |
---|
36 | 40 | | [ScriptTransfer(i.caller, amount, gwUsd)] |
---|
| 41 | + | } |
---|
37 | 42 | | } |
---|
38 | 43 | | |
---|
39 | 44 | | |
---|