tx · FrVvPTCtnqpJUSNCojefZuno4FbUdRoMNqhbj6Y1iX9j
3N58U7hA1kzMTCUqHiJGdcPdjxAKspMgGNp: -0.01000000 Waves
2021.07.16 16:30 [1616223] smart account 3N58U7hA1kzMTCUqHiJGdcPdjxAKspMgGNp > SELF 0.00000000 Waves
{
"type": 13,
"id": "FrVvPTCtnqpJUSNCojefZuno4FbUdRoMNqhbj6Y1iX9j",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1626442259653,
"version": 2,
"chainId": 84,
"sender": "3N58U7hA1kzMTCUqHiJGdcPdjxAKspMgGNp",
"senderPublicKey": "85gydchvWB9gMPFCKM6kfLPWFSATbtGog2Y6rUjhtQKT",
"proofs": [
"3rmpM64M4bLa8NG9VirCAuRFZF62RUYumx1xfbT9545NSgrWW2DBZQTK5HYQHFHWxH9tzeghBHYtqygBRVSV3pAx"
],
"script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAAJc3dhcFRva2VuAQAAABoBVKbhhw1lumsjC/7Bb+h6XQQxRSS4GArgRQQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIWNhbiBob2RsIHdhdmVzIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZAAAAAIFAAAADWN1cnJlbnRBbW91bnQIBQAAAANwbXQAAAAGYW1vdW50CQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAJbmV3QW1vdW50BQAAAAlzd2FwVG9rZW4FAAAAA25pbAAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAAlzd2FwVG9rZW4BAAAAGgFUpuGHDWW6ayML/sFv6HpdBDFFJLgYCuBFBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABlAAAAAgUAAAANY3VycmVudEFtb3VudAUAAAAGYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAluZXdBbW91bnQJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAACXN3YXBUb2tlbgUAAAADbmlsAAAAAGsQhtk=",
"height": 1616223,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: CA6LK4LYrSMQzVjJLnBu8tGtmTJ9dWJJNYTVfRGE1WAM
Next: 8bwq8FdCd7WLjzR7LavyAy8jvmsyZLq8jRBvQi9HGH9F
Diff:
Old | New | | Differences |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func deposit () = { |
---|
| 8 | + | let swapToken = base58'3N58U7hA1kzMTCUqHiJGdcPdjxAKspMgGNp' |
---|
8 | 9 | | let pmt = extract(i.payment) |
---|
9 | 10 | | if (isDefined(pmt.assetId)) |
---|
10 | 11 | | then throw("can hodl waves only at the moment") |
---|
|
17 | 18 | | 0 |
---|
18 | 19 | | } |
---|
19 | 20 | | let newAmount = (currentAmount + pmt.amount) |
---|
20 | | - | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
| 21 | + | TransferSet([ScriptTransfer(i.caller, newAmount, swapToken)]) |
---|
21 | 22 | | } |
---|
22 | 23 | | } |
---|
23 | 24 | | |
---|
|
25 | 26 | | |
---|
26 | 27 | | @Callable(i) |
---|
27 | 28 | | func withdraw (amount) = { |
---|
| 29 | + | let swapToken = base58'3N58U7hA1kzMTCUqHiJGdcPdjxAKspMgGNp' |
---|
28 | 30 | | let currentKey = toBase58String(i.caller.bytes) |
---|
29 | 31 | | let currentAmount = match getInteger(this, currentKey) { |
---|
30 | 32 | | case a: Int => |
---|
|
37 | 39 | | then throw("Can't withdraw negative amount") |
---|
38 | 40 | | else if ((0 > newAmount)) |
---|
39 | 41 | | then throw("Not enough balance") |
---|
40 | | - | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) |
---|
| 42 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, swapToken)])) |
---|
41 | 43 | | } |
---|
42 | 44 | | |
---|
43 | 45 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func deposit () = { |
---|
| 8 | + | let swapToken = base58'3N58U7hA1kzMTCUqHiJGdcPdjxAKspMgGNp' |
---|
8 | 9 | | let pmt = extract(i.payment) |
---|
9 | 10 | | if (isDefined(pmt.assetId)) |
---|
10 | 11 | | then throw("can hodl waves only at the moment") |
---|
11 | 12 | | else { |
---|
12 | 13 | | let currentKey = toBase58String(i.caller.bytes) |
---|
13 | 14 | | let currentAmount = match getInteger(this, currentKey) { |
---|
14 | 15 | | case a: Int => |
---|
15 | 16 | | a |
---|
16 | 17 | | case _ => |
---|
17 | 18 | | 0 |
---|
18 | 19 | | } |
---|
19 | 20 | | let newAmount = (currentAmount + pmt.amount) |
---|
20 | | - | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
| 21 | + | TransferSet([ScriptTransfer(i.caller, newAmount, swapToken)]) |
---|
21 | 22 | | } |
---|
22 | 23 | | } |
---|
23 | 24 | | |
---|
24 | 25 | | |
---|
25 | 26 | | |
---|
26 | 27 | | @Callable(i) |
---|
27 | 28 | | func withdraw (amount) = { |
---|
| 29 | + | let swapToken = base58'3N58U7hA1kzMTCUqHiJGdcPdjxAKspMgGNp' |
---|
28 | 30 | | let currentKey = toBase58String(i.caller.bytes) |
---|
29 | 31 | | let currentAmount = match getInteger(this, currentKey) { |
---|
30 | 32 | | case a: Int => |
---|
31 | 33 | | a |
---|
32 | 34 | | case _ => |
---|
33 | 35 | | 0 |
---|
34 | 36 | | } |
---|
35 | 37 | | let newAmount = (currentAmount - amount) |
---|
36 | 38 | | if ((0 > amount)) |
---|
37 | 39 | | then throw("Can't withdraw negative amount") |
---|
38 | 40 | | else if ((0 > newAmount)) |
---|
39 | 41 | | then throw("Not enough balance") |
---|
40 | | - | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) |
---|
| 42 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, swapToken)])) |
---|
41 | 43 | | } |
---|
42 | 44 | | |
---|
43 | 45 | | |
---|