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