tx · Ebb9yS2gdVCoyMnW4Dz3BLX1dLKDettp8FiS96LAsdEE 3Myes5WidGyaEZamrigMnHxSp7jofp75MKg: -0.01000000 Waves 2020.10.16 19:04 [1223354] smart account 3Myes5WidGyaEZamrigMnHxSp7jofp75MKg > SELF 0.00000000 Waves
{ "type": 13, "id": "Ebb9yS2gdVCoyMnW4Dz3BLX1dLKDettp8FiS96LAsdEE", "fee": 1000000, "feeAssetId": null, "timestamp": 1602864279833, "version": 2, "chainId": 84, "sender": "3Myes5WidGyaEZamrigMnHxSp7jofp75MKg", "senderPublicKey": "EHphUnoiuXaNVNoUnDN4jPnVYzBfCN8WmL8KKYE2YGLF", "proofs": [ "23r7hJCruX1WB1pY7KDJivh97Z1qRhsEHhwkAL24MvRJvAVShqszj82PX6UpVHiCtiy9et5aza2T41EdUN3Asj2B" ], "script": "base64:AAIDAAAAAAAAAAsIARIAEgMKAQESAAAAAAAAAAADAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAA9Db2xsYXRlcmFsVG9rZW4BAAAAIEXAbIcI8kUexOI20CBj9o7wm7aY+dhr4NqLF5bb9v1DBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAAAAAAIJAQAAAAdleHRyYWN0AAAAAQgFAAAAA3BtdAAAAAdhc3NldElkBQAAAA9Db2xsYXRlcmFsVG9rZW4HBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAANY3Vycm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kBAAAACHBheVlpZWxkAAAAAAQAAAALR292ZXJuVG9rZW4BAAAAILwGcs1MfvnNj/zmkpODdw6L0NFGCtmpE9Lm+8s8aDzNBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABlAAAAAgUAAAANY3VycmVudEFtb3VudAAAAAAAAAAACgMJAABmAAAAAgAAAAAAAAAAAAUAAAAJbmV3QW1vdW50CQAAAgAAAAECAAAALU5vdCBlbm91Z2ggR292ZXJuYW5jZSBiYWxhbmNlIGluIHRoZSBDb250cmFjdAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAACgUAAAALR292ZXJuVG9rZW4FAAAAA25pbAAAAAAKc+I/", "height": 1223354, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 3df1uov6jKwcgW9c8qBGWTzjjnu31QhygjgsyyuKkTob Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func deposit () = { | |
8 | + | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
9 | + | let pmt = extract(i.payment) | |
10 | + | if (if (isDefined(pmt.assetId)) | |
11 | + | then (extract(pmt.assetId) == CollateralToken) | |
12 | + | else false) | |
13 | + | then { | |
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 | + | let newAmount = (currentAmount + pmt.amount) | |
22 | + | WriteSet([DataEntry(currentKey, newAmount)]) | |
23 | + | } | |
24 | + | else throw("Can deposit only MyToken") | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | @Callable(i) | |
30 | + | func withdraw (amount) = { | |
31 | + | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
32 | + | let currentKey = toBase58String(i.caller.bytes) | |
33 | + | let currentAmount = match getInteger(this, currentKey) { | |
34 | + | case a: Int => | |
35 | + | a | |
36 | + | case _ => | |
37 | + | 0 | |
38 | + | } | |
39 | + | let newAmount = (currentAmount - amount) | |
40 | + | if ((0 > amount)) | |
41 | + | then throw("Can't withdraw negative amount") | |
42 | + | else if ((0 > newAmount)) | |
43 | + | then throw("Not enough balance") | |
44 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, CollateralToken)])) | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | @Callable(i) | |
50 | + | func payYield () = { | |
51 | + | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
52 | + | let currentKey = toBase58String(i.caller.bytes) | |
53 | + | let currentAmount = match getInteger(this, currentKey) { | |
54 | + | case a: Int => | |
55 | + | a | |
56 | + | case _ => | |
57 | + | 0 | |
58 | + | } | |
59 | + | let newAmount = (currentAmount - 10) | |
60 | + | if ((0 > newAmount)) | |
61 | + | then throw("Not enough Governance balance in the Contract") | |
62 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)])) | |
63 | + | } | |
64 | + | ||
65 | + |
github/deemru/w8io/169f3d6 15.71 ms ◑