tx · 5kF7Ca7cm9HrK1AtyGy4iwS7bjiwFNWNtudPFyeDcwrv

3N4wuN3EkqWtgA7gVe3apSLP3TviJU53NWJ:  -0.01000000 Waves

2019.09.09 12:26 [668363] smart account 3N4wuN3EkqWtgA7gVe3apSLP3TviJU53NWJ > SELF 0.00000000 Waves

{ "type": 13, "id": "5kF7Ca7cm9HrK1AtyGy4iwS7bjiwFNWNtudPFyeDcwrv", "fee": 1000000, "feeAssetId": null, "timestamp": 1568021251959, "version": 1, "sender": "3N4wuN3EkqWtgA7gVe3apSLP3TviJU53NWJ", "senderPublicKey": "F1jA72T4rwvbibNFBARNZcz4ZRodFSn7strF9JAMta72", "proofs": [ "i9u7gueEidoZcLXD6oUtZhdC7FnSZQp3gauK9razEVtwhD4S362smWAtWHP88FE6m51Xm95NoDmDqd2N1pWzB5V" ], "script": "base64:AAIDAAAAAAAAAAAAAAAZAAAAAAtvd25lclB1YktleQEAAAAgERnkECfdNazPn4bZIFHsiVPWceF7RmQ+9h+VEwCrLHYAAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAKZ2V0S2V5Um9vbQAAAAIAAAAGcm9vbWVyAAAABXRpdGxlCQABLAAAAAICAAAABXJvb21fCQACWAAAAAEJAAH3AAAAAQkAAZsAAAABCQABLAAAAAIFAAAAB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AALb3duZXJQdWJLZXkHeVdbeg==", "chainId": 84, "height": 668363, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let ownerPubKey = base58'29kq5MRmSABWBsf25a4nHQYBg3CAXkh146GcBpWTa1DP'
5+
6+let NONE = "none"
7+
8+func getNumberByKey (key) = {
9+ let num = match getInteger(this, key) {
10+ case a: Int =>
11+ a
12+ case _ =>
13+ 0
14+ }
15+ num
16+ }
17+
18+
19+func getStrByKey (key) = {
20+ let str = match getString(this, key) {
21+ case a: String =>
22+ a
23+ case _ =>
24+ NONE
25+ }
26+ str
27+ }
28+
29+
30+func getKeyRoom (roomer,title) = ("room_" + toBase58String(sha256(toBytes((roomer + title)))))
31+
32+
33+func getKeyRoomPrize (room) = (room + "_prize")
34+
35+
36+func getValueRoomPrize (room) = getNumberByKey(getKeyRoomPrize(room))
37+
38+
39+func getKeyRoomRoomer (room) = (room + "_roomer")
40+
41+
42+func getValueRoomRoomer (room) = getStrByKey(getKeyRoomRoomer(room))
43+
44+
45+func getKeyRoomLimit (room) = (room + "_limit")
46+
47+
48+func getValueRoomLimit (room) = getNumberByKey(getKeyRoomLimit(room))
49+
50+
51+func getKeyBalanceRoomer (account) = (account + "_balance")
52+
53+
54+func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceRoomer(account))
55+
56+
57+func getKeyPropose (contributor,outline) = ("propose_" + toBase58String(sha256(toBytes((contributor + outline)))))
58+
59+
60+func getKeyProposeContributor (propose) = (propose + "_contributor")
61+
62+
63+func getValueProposeContributor (propose) = getStrByKey(getKeyProposeContributor(propose))
64+
65+
66+func getKeyProposeData (propose) = (propose + "_data")
67+
68+
69+func getValueProposeData (propose) = getStrByKey(getKeyProposeData(propose))
70+
71+
72+func getKeyAdoption (room,propose) = ("adoption_" + toBase58String(sha256(toBytes((room + propose)))))
73+
74+
75+func getKeyAdoptionWinner (adoption) = (adoption + "_winner")
76+
77+
78+func getValueAdoptionWinner (adoption) = getStrByKey(getKeyAdoptionWinner(adoption))
79+
80+
81+func getKeyAdoptionPrize (adoption) = (adoption + "_prize")
82+
83+
84+func getValueAdoptionPrize (adoption) = getStrByKey(getKeyAdoptionPrize(adoption))
85+
86+
87+func getKeyBalanceUser (account) = (account + "_balance")
88+
89+
90+func getValueBalanceUser (account) = getNumberByKey(getKeyBalanceUser(account))
91+
92+
93+@Callable(i)
94+func createRoom (title,now,duration) = {
95+ let pmt = extract(i.payment)
96+ if (isDefined(pmt.assetId))
97+ then throw("can use WAVES only at the moment")
98+ else {
99+ let roomer = toBase58String(i.caller.bytes)
100+ let room = getKeyRoom(roomer, title)
101+ let prize = pmt.amount
102+ let limit = (now + duration)
103+ if ((0 >= prize))
104+ then throw("prize cannot be negative amount")
105+ else if ((360 >= duration))
106+ then throw("duration cannot be less than 6hours")
107+ else if ((getValueRoomRoomer(room) != NONE))
108+ then throw("the room is already exist")
109+ else WriteSet([DataEntry(getKeyRoomPrize(room), prize), DataEntry(getKeyRoomRoomer(room), roomer), DataEntry(getKeyRoomLimit(room), limit)])
110+ }
111+ }
112+
113+
114+
115+@Callable(i)
116+func createProposal (room,data,outline,now) = {
117+ let contributor = toBase58String(i.caller.bytes)
118+ let propose = getKeyPropose(contributor, outline)
119+ let roomer = getValueRoomRoomer(room)
120+ let limit = getValueRoomLimit(room)
121+ if ((data == NONE))
122+ then throw("your proposal is empty")
123+ else if ((roomer == NONE))
124+ then throw("room does not exist")
125+ else if ((now >= limit))
126+ then throw("propose to this room is already closed")
127+ else WriteSet([DataEntry(getKeyProposeContributor(propose), contributor), DataEntry(getKeyProposeData(propose), data)])
128+ }
129+
130+
131+
132+@Callable(i)
133+func createAdoption (room,propose) = {
134+ let adoption = getKeyAdoption(room, propose)
135+ let prize = getValueRoomPrize(room)
136+ let winner = getValueProposeContributor(propose)
137+ let roomer = getValueRoomRoomer(room)
138+ if ((roomer != toBase58String(i.caller.bytes)))
139+ then throw("only the Room's owner can do this transaction")
140+ else if ((winner == NONE))
141+ then throw("the winner doesn't exist")
142+ else WriteSet([DataEntry(getKeyBalanceUser(winner), (getValueBalanceUser(winner) + prize)), DataEntry(getKeyAdoptionWinner(adoption), winner), DataEntry(getKeyAdoptionPrize(adoption), prize)])
143+ }
144+
145+
146+
147+@Callable(i)
148+func withdraw () = {
149+ let user = toBase58String(i.caller.bytes)
150+ let balance = getValueBalanceUser(user)
151+ if ((0 >= balance))
152+ then throw("you have nothing to withdraw")
153+ else ScriptResult(WriteSet([DataEntry(getKeyBalanceUser(user), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(user), balance, unit)]))
154+ }
155+
156+
157+@Verifier(tx)
158+func varify () = match tx {
159+ case s: SetScriptTransaction =>
160+ sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey)
161+ case d: DataTransaction =>
162+ true
163+ case t: TransferTransaction =>
164+ sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey)
165+ case _ =>
166+ false
167+}
168+

github/deemru/w8io/169f3d6 
21.41 ms