tx · 58dQx1o1hZMQgtvtSheED8uUiKMUZn2G7KdQNBH1Ztb6
3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD: -0.00100000 Waves
2022.07.14 22:11 [2139795] smart account 3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD > SELF 0.00000000 Waves
{
"type": 13,
"id": "58dQx1o1hZMQgtvtSheED8uUiKMUZn2G7KdQNBH1Ztb6",
"fee": 100000,
"feeAssetId": null,
"timestamp": 1657825926624,
"version": 2,
"chainId": 84,
"sender": "3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD",
"senderPublicKey": "CU5wMqCBg4bC4Zgs8QGiqjjvmeMkSiKo3Ff6k5axJZwr",
"proofs": [
"5bVtMGUsocxc5evLEqAGmySFyGLyKTgrkbavjU2M5HPi1rCYsD62fVvosgJt3b33tAGEo2oTsEDWbt2gQPEBTuT5"
],
"script": "base64:AAIDAAAAAAAAAAwIARIDCgEBEgMKAQEAAAACAAAAAAVnd1VzZAEAAAAg1td3yV5SV/9sTRnPub7Z/8+5gW83ZtDAi9MIvEJ2JY0AAAAABHVzZG4BAAAAIA/yHBKs5MQ8muxGGqslqLDsugcrRsxtiHLwteKSSQG0AAAAAgAAAAFpAQAAAA9zd2FwR0d1c2RUb1VzZG4AAAABAAAABmFtb3VudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdXNkbgUAAAADbmlsAAAAAWkBAAAAD3N3YXBVc2RuVG9HR3VzZAAAAAEAAAAGYW1vdW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAACQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAVnd1VzZAUAAAADbmlsAAAAAPt+flo=",
"height": 2139795,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: BChH6EyfqYX3bdFzqQZpyYBe4LgJ8UpYabdXzG1xysqw
Next: A2CC27i7kagL5XPhpvnUUDwFAEg9gk2kw9Vor2w4cNk8
Diff:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let ggToken = base58'8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h' |
---|
| 4 | + | let gwUsd = base58'FTeosv2BmZED7kBcGnqDy9tba1VdkeodQveSAATMQusJ' |
---|
| 5 | + | |
---|
| 6 | + | let usdn = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' |
---|
5 | 7 | | |
---|
6 | 8 | | @Callable(i) |
---|
7 | | - | func deposit () = { |
---|
8 | | - | let pmt = extract(i.payment) |
---|
9 | | - | if ((pmt.assetId != ggToken)) |
---|
10 | | - | then throw("ggToken 8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h tokens only at the moment") |
---|
11 | | - | else { |
---|
12 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
13 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
14 | | - | case a: Int => |
---|
15 | | - | a |
---|
16 | | - | case _ => |
---|
17 | | - | 0 |
---|
18 | | - | } |
---|
19 | | - | let newAmount = (currentAmount + pmt.amount) |
---|
20 | | - | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
21 | | - | } |
---|
22 | | - | } |
---|
23 | | - | |
---|
24 | | - | |
---|
25 | | - | |
---|
26 | | - | @Callable(i) |
---|
27 | | - | func withdraw (amount) = { |
---|
| 9 | + | func swapGGusdToUsdn (amount) = { |
---|
28 | 10 | | let currentKey = toBase58String(i.caller.bytes) |
---|
29 | 11 | | let currentAmount = match getInteger(this, currentKey) { |
---|
30 | 12 | | case a: Int => |
---|
|
32 | 14 | | case _ => |
---|
33 | 15 | | 0 |
---|
34 | 16 | | } |
---|
35 | | - | let newAmount = (currentAmount + amount) |
---|
36 | | - | ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, base58'FTeosv2BmZED7kBcGnqDy9tba1VdkeodQveSAATMQusJ')])) |
---|
| 17 | + | TransferSet([ScriptTransfer(i.caller, amount, usdn)]) |
---|
| 18 | + | } |
---|
| 19 | + | |
---|
| 20 | + | |
---|
| 21 | + | |
---|
| 22 | + | @Callable(i) |
---|
| 23 | + | func swapUsdnToGGusd (amount) = { |
---|
| 24 | + | let currentKey = toBase58String(i.caller.bytes) |
---|
| 25 | + | let currentAmount = match getInteger(this, currentKey) { |
---|
| 26 | + | case a: Int => |
---|
| 27 | + | a |
---|
| 28 | + | case _ => |
---|
| 29 | + | 0 |
---|
| 30 | + | } |
---|
| 31 | + | TransferSet([ScriptTransfer(i.caller, amount, gwUsd)]) |
---|
37 | 32 | | } |
---|
38 | 33 | | |
---|
39 | 34 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let ggToken = base58'8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h' |
---|
| 4 | + | let gwUsd = base58'FTeosv2BmZED7kBcGnqDy9tba1VdkeodQveSAATMQusJ' |
---|
| 5 | + | |
---|
| 6 | + | let usdn = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' |
---|
5 | 7 | | |
---|
6 | 8 | | @Callable(i) |
---|
7 | | - | func deposit () = { |
---|
8 | | - | let pmt = extract(i.payment) |
---|
9 | | - | if ((pmt.assetId != ggToken)) |
---|
10 | | - | then throw("ggToken 8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h tokens only at the moment") |
---|
11 | | - | else { |
---|
12 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
13 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
14 | | - | case a: Int => |
---|
15 | | - | a |
---|
16 | | - | case _ => |
---|
17 | | - | 0 |
---|
18 | | - | } |
---|
19 | | - | let newAmount = (currentAmount + pmt.amount) |
---|
20 | | - | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
21 | | - | } |
---|
22 | | - | } |
---|
23 | | - | |
---|
24 | | - | |
---|
25 | | - | |
---|
26 | | - | @Callable(i) |
---|
27 | | - | func withdraw (amount) = { |
---|
| 9 | + | func swapGGusdToUsdn (amount) = { |
---|
28 | 10 | | let currentKey = toBase58String(i.caller.bytes) |
---|
29 | 11 | | let currentAmount = match getInteger(this, currentKey) { |
---|
30 | 12 | | case a: Int => |
---|
31 | 13 | | a |
---|
32 | 14 | | case _ => |
---|
33 | 15 | | 0 |
---|
34 | 16 | | } |
---|
35 | | - | let newAmount = (currentAmount + amount) |
---|
36 | | - | ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, base58'FTeosv2BmZED7kBcGnqDy9tba1VdkeodQveSAATMQusJ')])) |
---|
| 17 | + | TransferSet([ScriptTransfer(i.caller, amount, usdn)]) |
---|
| 18 | + | } |
---|
| 19 | + | |
---|
| 20 | + | |
---|
| 21 | + | |
---|
| 22 | + | @Callable(i) |
---|
| 23 | + | func swapUsdnToGGusd (amount) = { |
---|
| 24 | + | let currentKey = toBase58String(i.caller.bytes) |
---|
| 25 | + | let currentAmount = match getInteger(this, currentKey) { |
---|
| 26 | + | case a: Int => |
---|
| 27 | + | a |
---|
| 28 | + | case _ => |
---|
| 29 | + | 0 |
---|
| 30 | + | } |
---|
| 31 | + | TransferSet([ScriptTransfer(i.caller, amount, gwUsd)]) |
---|
37 | 32 | | } |
---|
38 | 33 | | |
---|
39 | 34 | | |
---|