tx · 8SALX1ha7bkpGdEABvRuym5YaAmEnCKypqCV94DEYzer
3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC: -0.01400000 Waves
2020.04.10 12:10 [948049] smart account 3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC > SELF 0.00000000 Waves
{
"type": 13,
"id": "8SALX1ha7bkpGdEABvRuym5YaAmEnCKypqCV94DEYzer",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1586509862774,
"version": 1,
"sender": "3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC",
"senderPublicKey": "BNrrKkZSXXCbcCtXLT3VMQnSAJt2jt8TLnZWaB5US3Ci",
"proofs": [
"5GqH8KJJiSuRxLwGww7jbajVJeVkhGbfBN1dt9oo7vNSjYMYHzpd4Vh4x8Va3gpZvosdb1C1wAHStPo1kjk4tcML"
],
"script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAACAAAAAAR1c2RuAQAAACAiZD8evmBG6RFqExPcpjP+Fn4H+Xfps/IV/JlJKjAKNwEAAAAKZ2V0QmFsYW5jZQAAAAEAAAAHYWRkcmVzcwQAAAABYgkABBoAAAACBQAAAAR0aGlzBQAAAAdhZGRyZXNzBAAAAAckbWF0Y2gwBQAAAAFiAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAFAAAAAXQAAAAAAAAAAAAAAAACAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAAdhZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAA2JhbAkBAAAACmdldEJhbGFuY2UAAAABBQAAAAdhZGRyZXNzBAAAAAdwYXltZW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQAAAAAAAAIIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQFAAAABHVzZG4JAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAdhZGRyZXNzCQAAZAAAAAIFAAAAA2JhbAgFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAkAAAIAAAABAgAAAA5TaG91bGQgYmUgVVNETgAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAAdhZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAA2JhbAkBAAAACmdldEJhbGFuY2UAAAABBQAAAAdhZGRyZXNzAwkAAGcAAAACBQAAAANiYWwFAAAABmFtb3VudAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAB2FkZHJlc3MJAABlAAAAAgUAAAADYmFsBQAAAAZhbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdXNkbgUAAAADbmlsCQAAAgAAAAEJAAEsAAAAAgIAAAAQWW91ciBiYWxhbmNlIGlzIAkAAaQAAAABBQAAAANiYWwAAAAAcjpsxQ==",
"chainId": 84,
"height": 948049,
"spentComplexity": 0
}
View: original | compacted
Prev: 6MVLChFtXfrDvSKFzXN1rumyVzq1xG6BAXw193QihaWS
Next: A23sR2sNWSQDrFEB3io77bLk2Tp2sMkJp3119GQDj5go
Diff:
Old | New | | Differences |
---|
25 | 25 | | } |
---|
26 | 26 | | |
---|
27 | 27 | | |
---|
| 28 | + | |
---|
| 29 | + | @Callable(i) |
---|
| 30 | + | func withdraw (amount) = { |
---|
| 31 | + | let address = toBase58String(i.caller.bytes) |
---|
| 32 | + | let bal = getBalance(address) |
---|
| 33 | + | if ((bal >= amount)) |
---|
| 34 | + | then ScriptResult(WriteSet([DataEntry(address, (bal - amount))]), TransferSet([ScriptTransfer(i.caller, amount, usdn)])) |
---|
| 35 | + | else throw(("Your balance is " + toString(bal))) |
---|
| 36 | + | } |
---|
| 37 | + | |
---|
| 38 | + | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let usdn = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC' |
---|
5 | 5 | | |
---|
6 | 6 | | func getBalance (address) = { |
---|
7 | 7 | | let b = getInteger(this, address) |
---|
8 | 8 | | match b { |
---|
9 | 9 | | case t: Int => |
---|
10 | 10 | | t |
---|
11 | 11 | | case _ => |
---|
12 | 12 | | 0 |
---|
13 | 13 | | } |
---|
14 | 14 | | } |
---|
15 | 15 | | |
---|
16 | 16 | | |
---|
17 | 17 | | @Callable(i) |
---|
18 | 18 | | func deposit () = { |
---|
19 | 19 | | let address = toBase58String(i.caller.bytes) |
---|
20 | 20 | | let bal = getBalance(address) |
---|
21 | 21 | | let payment = extract(i.payment) |
---|
22 | 22 | | if ((payment.assetId == usdn)) |
---|
23 | 23 | | then ScriptResult(WriteSet([DataEntry(address, (bal + payment.amount))]), TransferSet(nil)) |
---|
24 | 24 | | else throw("Should be USDN") |
---|
25 | 25 | | } |
---|
26 | 26 | | |
---|
27 | 27 | | |
---|
| 28 | + | |
---|
| 29 | + | @Callable(i) |
---|
| 30 | + | func withdraw (amount) = { |
---|
| 31 | + | let address = toBase58String(i.caller.bytes) |
---|
| 32 | + | let bal = getBalance(address) |
---|
| 33 | + | if ((bal >= amount)) |
---|
| 34 | + | then ScriptResult(WriteSet([DataEntry(address, (bal - amount))]), TransferSet([ScriptTransfer(i.caller, amount, usdn)])) |
---|
| 35 | + | else throw(("Your balance is " + toString(bal))) |
---|
| 36 | + | } |
---|
| 37 | + | |
---|
| 38 | + | |
---|