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:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let gwUsd = base58'FTeosv2BmZED7kBcGnqDy9tba1VdkeodQveSAATMQusJ'
77
88 @Callable(i)
99 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+ }
1823 }
1924
2025
2833 case _ =>
2934 0
3035 }
31- TransferSet([ScriptTransfer(i.caller, amount, gwUsd)])
36+[ScriptTransfer(i.caller, amount, gwUsd)]
3237 }
3338
3439
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let gwUsd = base58'FTeosv2BmZED7kBcGnqDy9tba1VdkeodQveSAATMQusJ'
55
66 let usdn = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
77
88 @Callable(i)
99 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+ }
1823 }
1924
2025
2126
2227 @Callable(i)
2328 func swapUsdnToGGusd (amount) = {
2429 let currentKey = toBase58String(i.caller.bytes)
2530 let currentAmount = match getInteger(this, currentKey) {
2631 case a: Int =>
2732 a
2833 case _ =>
2934 0
3035 }
31- TransferSet([ScriptTransfer(i.caller, amount, gwUsd)])
36+[ScriptTransfer(i.caller, amount, gwUsd)]
3237 }
3338
3439

github/deemru/w8io/026f985 
37.37 ms