tx · 3yANSBmze9oATX4WXgRxqTfjhGcaQEY1qj7tzrXmSnCA 3NBujbTTXmHhDfxd7GFXTA7nsaBDZDYauS1: -0.01000000 Waves 2019.12.28 04:29 [828240] smart account 3NBujbTTXmHhDfxd7GFXTA7nsaBDZDYauS1 > SELF 0.00000000 Waves
{ "type": 13, "id": "3yANSBmze9oATX4WXgRxqTfjhGcaQEY1qj7tzrXmSnCA", "fee": 1000000, "feeAssetId": null, "timestamp": 1577496529819, "version": 1, "sender": "3NBujbTTXmHhDfxd7GFXTA7nsaBDZDYauS1", "senderPublicKey": "7wGSAbWg6Wd5Q4iDn9JaBNkj787S1jbH8JpV6WUrwc9v", "proofs": [ "rwV7PRioRmistKjx734Y7TDByicSQG8VUtUNJ2bsCLRkNYAEc7pUNBeYPSVVA6VEyZ45UfotX6MHyx5XhrzeB1n" ], "script": "base64:AAIDAAAAAAAAABQIARIAEgMKAQESAwoBARIECgIBCAAAAAAAAAAEAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAAdERGVtb0lEAQAAACBzBnFM/NFFv0XnmUBTVuVksKOTm22/7Zd7q27jmJaiewQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAdERGVtb0lECQAAAgAAAAECAAAAHmNhbiBob2RsIEREZW1vIGFuZCAgV2F2ZXMgb25seQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAABJ4eHhJbnZlc3RvckJhbGFuY2UJAAEsAAAAAgkAASwAAAACBQAAAApjdXJyZW50S2V5AgAAAAFfAgAAAAJpYgQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAABJ4eHhJbnZlc3RvckJhbGFuY2UDCQAAAQAAAAIFAAAAByRtYXRj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AABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAAAQAAACBnDO+34YQUpPu8aB0/S+9M4Y/NmRVskfPBzpis2vPCEQdDYET2", "chainId": 84, "height": 828240, "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 DDemoID = base58'8k1apXbyeYfC11PEFw6r9Ngd2oep79uHmmyeMGpGgVQn' | |
9 | + | let pmt = extract(i.payment) | |
10 | + | if (isDefined((pmt.assetId != DDemoID))) | |
11 | + | then throw("can hodl DDemo and Waves only") | |
12 | + | else { | |
13 | + | let currentKey = toBase58String(i.caller.bytes) | |
14 | + | let xxxInvestorBalance = ((currentKey + "_") + "ib") | |
15 | + | let currentAmount = match getInteger(this, xxxInvestorBalance) { | |
16 | + | case a: Int => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | let newAmount = (currentAmount + pmt.amount) | |
22 | + | WriteSet([DataEntry(xxxInvestorBalance, newAmount)]) | |
23 | + | } | |
24 | + | } | |
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | @Callable(i) | |
29 | + | func withdraw (amount) = { | |
30 | + | let currentKey = toBase58String(i.caller.bytes) | |
31 | + | let xxxInvestorBalance = ((currentKey + "_") + "ib") | |
32 | + | let currentAmount = match getInteger(this, xxxInvestorBalance) { | |
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(xxxInvestorBalance, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
44 | + | } | |
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | @Callable(i) | |
49 | + | func getFunds (amount) = { | |
50 | + | let quorum = 2 | |
51 | + | let currentKey = toBase58String(i.caller.bytes) | |
52 | + | let xxxStartupFund = ((currentKey + "_") + "sf") | |
53 | + | let xxxStartupVotes = ((currentKey + "_") + "sv") | |
54 | + | let currentAmount = match getInteger(this, xxxStartupFund) { | |
55 | + | case a: Int => | |
56 | + | a | |
57 | + | case _ => | |
58 | + | 0 | |
59 | + | } | |
60 | + | let totalVotes = match getInteger(this, xxxStartupVotes) { | |
61 | + | case a: Int => | |
62 | + | a | |
63 | + | case _ => | |
64 | + | 0 | |
65 | + | } | |
66 | + | let newAmount = (currentAmount - amount) | |
67 | + | if ((0 > amount)) | |
68 | + | then throw("Can't withdraw negative amount") | |
69 | + | else if ((0 > newAmount)) | |
70 | + | then throw("Not enough balance") | |
71 | + | else if ((quorum > totalVotes)) | |
72 | + | then throw("Not enough votes. At least 2 votes required!") | |
73 | + | else ScriptResult(WriteSet([DataEntry(xxxStartupFund, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | @Callable(i) | |
79 | + | func vote (amount,address) = { | |
80 | + | let currentKey = toBase58String(i.caller.bytes) | |
81 | + | let xxxInvestorBalance = ((currentKey + "_") + "ib") | |
82 | + | let xxxStartupFund = ((address + "_") + "sf") | |
83 | + | let xxxStartupVotes = ((address + "_") + "sv") | |
84 | + | let flagKey = ((address + "_") + currentKey) | |
85 | + | let flag = match getInteger(this, flagKey) { | |
86 | + | case a: Int => | |
87 | + | a | |
88 | + | case _ => | |
89 | + | 0 | |
90 | + | } | |
91 | + | let currentAmount = match getInteger(this, xxxInvestorBalance) { | |
92 | + | case a: Int => | |
93 | + | a | |
94 | + | case _ => | |
95 | + | 0 | |
96 | + | } | |
97 | + | let currentVotes = match getInteger(this, xxxStartupVotes) { | |
98 | + | case a: Int => | |
99 | + | a | |
100 | + | case _ => | |
101 | + | 0 | |
102 | + | } | |
103 | + | let currentFund = match getInteger(this, xxxStartupFund) { | |
104 | + | case a: Int => | |
105 | + | a | |
106 | + | case _ => | |
107 | + | 0 | |
108 | + | } | |
109 | + | if ((0 >= amount)) | |
110 | + | then throw("Can't withdraw negative amount") | |
111 | + | else if ((amount > currentAmount)) | |
112 | + | then throw("Not enough balance!") | |
113 | + | else if ((flag > 0)) | |
114 | + | then throw("Only one vote per project is possible!") | |
115 | + | else WriteSet([DataEntry(xxxInvestorBalance, (currentAmount - amount)), DataEntry(xxxStartupVotes, (currentVotes + 1)), DataEntry(flagKey, 1), DataEntry(xxxStartupFund, (currentFund + amount))]) | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | @Verifier(tx) | |
120 | + | func verify () = match tx { | |
121 | + | case d: SetScriptTransaction => | |
122 | + | sigVerify(tx.bodyBytes, tx.proofs[0], base58'7wGSAbWg6Wd5Q4iDn9JaBNkj787S1jbH8JpV6WUrwc9v') | |
123 | + | case _ => | |
124 | + | false | |
125 | + | } | |
126 | + |
github/deemru/w8io/026f985 19.45 ms ◑