tx · 6BcPgKBDTgLuyj2oE1NLXPY4VPw3vfUDieJc8DgpsBan 3N4LzC1y7z1TCGFsHcCPczYTB1gWPxoS1qR: -0.01000000 Waves 2020.10.16 18:54 [1223342] smart account 3N4LzC1y7z1TCGFsHcCPczYTB1gWPxoS1qR > SELF 0.00000000 Waves
{ "type": 13, "id": "6BcPgKBDTgLuyj2oE1NLXPY4VPw3vfUDieJc8DgpsBan", "fee": 1000000, "feeAssetId": null, "timestamp": 1602863715246, "version": 2, "chainId": 84, "sender": "3N4LzC1y7z1TCGFsHcCPczYTB1gWPxoS1qR", "senderPublicKey": "7U1B1sCXB8iUTh12FbZUspDfnVQVeQhU45UjAhZbUfUm", "proofs": [ "3PWmeeCbP6JEy9rxxDhiwYf38T44C3gAEUxHAhAfa2wAg9UdStQWg4vHnqhRiLJy6rieN24oVjxEcVn62LYCLwF2" ], "script": "base64:AAIDAAAAAAAAAAsIARIAEgMKAQESAAAAAAAAAAADAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAA9Db2xsYXRlcmFsVG9rZW4BAAAAIEXAbIcI8kUexOI20CBj9o7wm7aY+dhr4NqLF5bb9v1DBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAAAAAAIJAQAAAAdleHRyYWN0AAAAAQgFAAAAA3BtdAAAAAdhc3NldElkBQAAAA9Db2xsYXRlcmFsVG9rZW4HBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABk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rZqRPS5vvLPGg8zQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZQAAAAIFAAAADWN1cnJlbnRBbW91bnQAAAAAAAAAAAoDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAAC1Ob3QgZW5vdWdoIEdvdmVybmFuY2UgYmFsYW5jZSBpbiB0aGUgQ29udHJhY3QJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAoFAAAAC0dvdmVyblRva2VuBQAAAANuaWwAAAAAaKdk8w==", "height": 1223342, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none 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 currentKey = toBase58String(i.caller.bytes) | |
32 | + | let currentAmount = match getInteger(this, currentKey) { | |
33 | + | case a: Int => | |
34 | + | a | |
35 | + | case _ => | |
36 | + | 0 | |
37 | + | } | |
38 | + | let newAmount = (currentAmount - amount) | |
39 | + | if ((0 > amount)) | |
40 | + | then throw("Can't withdraw negative amount") | |
41 | + | else if ((0 > newAmount)) | |
42 | + | then throw("Not enough balance") | |
43 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
44 | + | } | |
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | @Callable(i) | |
49 | + | func payYield () = { | |
50 | + | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
51 | + | let currentKey = toBase58String(i.caller.bytes) | |
52 | + | let currentAmount = match getInteger(this, currentKey) { | |
53 | + | case a: Int => | |
54 | + | a | |
55 | + | case _ => | |
56 | + | 0 | |
57 | + | } | |
58 | + | let newAmount = (currentAmount - 10) | |
59 | + | if ((0 > newAmount)) | |
60 | + | then throw("Not enough Governance balance in the Contract") | |
61 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)])) | |
62 | + | } | |
63 | + | ||
64 | + |
github/deemru/w8io/169f3d6 15.18 ms ◑