tx · 2KQpAPEEvcWKN1wnzKmM9TGpXeoT3pysb9s54sY4de7n

3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc:  -0.01400000 Waves

2020.01.22 14:38 [865419] smart account 3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc > SELF 0.00000000 Waves

{ "type": 13, "id": "2KQpAPEEvcWKN1wnzKmM9TGpXeoT3pysb9s54sY4de7n", "fee": 1400000, "feeAssetId": null, "timestamp": 1579693100720, "version": 1, "sender": "3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc", "senderPublicKey": "3n7vYRqT664Gwk9F1i5yM11opnuaH4yABXXnsxP6kxUQ", "proofs": [ "CabaxB8yBSN8RnyWLpW1mMe1orgR6mRMfis1uJy58roJ35HTns32AXV9XLJxjmPcbsb9V4z11N3YDGyyRYw5ez6" ], "script": null, "chainId": 84, "height": 865419, "spentComplexity": 0 } View: original | compacted Prev: BjURkQ97Ae4NXFnpFT1LqhrSmNu7QYyBgUkdhuLr591b Next: 9afy8uNjLNcJRQ7FvapHdLsSkF9a99tsfAo1ctEVaiCt Full:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-func getNumberByKey (key) = match getInteger(this, key) {
5- case a: Int =>
6- a
7- case _ =>
8- 0
9-}
10-
11-
12-func getStringByKey (key) = match getString(this, key) {
13- case a: String =>
14- a
15- case _ =>
16- ""
17-}
18-
19-
20-func getBoolByKey (key) = match getBoolean(this, key) {
21- case a: Boolean =>
22- a
23- case _ =>
24- false
25-}
26-
27-
28-func getNumberByAddressAndKey (address,key) = match getInteger(addressFromStringValue(address), key) {
29- case a: Int =>
30- a
31- case _ =>
32- 0
33-}
34-
35-
36-func getStringByAddressAndKey (address,key) = match getString(address, key) {
37- case a: String =>
38- a
39- case _ =>
40- ""
41-}
42-
43-
44-let NeutrinoAssetIdKey = "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC"
45-
46-let NeutrinoContractKey = "3n7vYRqT664Gwk9F1i5yM11opnuaH4yABXXnsxP6kxUQ"
47-
48-let BalanceKey = "rpd_balance"
49-
50-let ControlContractKey = "control_contract"
51-
52-let AdminsKey = "admins"
53-
54-func getUserBalanceKey (owner,assetId) = ((((BalanceKey + "_") + assetId) + "_") + owner)
55-
56-
57-func getContractBalanceKey (assetId) = ((BalanceKey + "_") + assetId)
58-
59-
60-func getExpireProposalKey (hash) = (("proposal_expire" + "_") + hash)
61-
62-
63-func getOwnerProposalKey (hash) = (("proposal_owner" + "_") + hash)
64-
65-
66-func getArgumentsProposalKey (hash) = (("proposal_arguments" + "_") + hash)
67-
68-
69-func getVoteKey (owner,hash) = (((("proposal_vote" + "_") + owner) + "_") + hash)
70-
71-
72-func convertJsonArrayToList (jsonArray) = split(jsonArray, ",")
73-
74-
75-let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey))
76-
77-let controlContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, ControlContractKey))
78-
79-let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey))
80-
81-func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId))
82-
83-
84-func getUserBalance (owner,assetId) = getNumberByKey(getUserBalanceKey(owner, assetId))
85-
86-
87-func getExpireProposal (hash) = getNumberByKey(getExpireProposalKey(hash))
88-
89-
90-func getOwnerProposal (hash) = getStringByKey(getOwnerProposalKey(hash))
91-
92-
93-func getArgumentsProposal (hash) = getStringByKey(getArgumentsProposalKey(hash))
94-
95-
96-func getVote (owner,hash) = getStringByKey(getVoteKey(owner, hash))
97-
98-
99-@Callable(i)
100-func lockNeutrino () = {
101- let pmt = extract(i.payment)
102- if ((pmt.assetId != neutrinoAssetId))
103- then throw("can use neutrino")
104- else {
105- let account = toString(i.caller)
106- let assetIdString = toBase58String(value(pmt.assetId))
107- WriteSet([DataEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) + pmt.amount)), DataEntry(getUserBalanceKey(account, assetIdString), (getUserBalance(account, assetIdString) + pmt.amount))])
108- }
109- }
110-
111-
112-
113-@Callable(i)
114-func unlockNeutrino (unlockAmount,assetIdString) = {
115- let account = toString(i.caller)
116- let assetId = fromBase58String(assetIdString)
117- let balance = (getUserBalance(account, assetIdString) - unlockAmount)
118- if ((0 > balance))
119- then throw("invalid amount")
120- else if ((assetId != neutrinoAssetId))
121- then throw("can use neutrino")
122- else ScriptResult(WriteSet([DataEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) - unlockAmount)), DataEntry(getUserBalanceKey(account, assetIdString), balance)]), TransferSet([ScriptTransfer(addressFromStringValue(account), unlockAmount, neutrinoAssetId)]))
123- }
124-
125-
126-
127-@Callable(i)
128-func vote (hash,indexArgument) = {
129- let arguments = split(getArgumentsProposal(hash), ",")
130- let argument = arguments[indexArgument]
131- if ((height > getExpireProposal(hash)))
132- then throw("proposal is expired")
133- else WriteSet([DataEntry(getVoteKey(toString(i.caller), hash), argument)])
134- }
135-
136-
137-
138-@Callable(i)
139-func createProposal (arguments,expairHeight) = {
140- let hash = toBase58String(keccak256(((toBytes(arguments) + toBytes(expairHeight)) + i.callerPublicKey)))
141- if ((getOwnerProposal(hash) != ""))
142- then throw("proposal is exist")
143- else WriteSet([DataEntry(getExpireProposalKey(hash), expairHeight), DataEntry(getOwnerProposalKey(hash), toString(i.caller)), DataEntry(getArgumentsProposalKey(hash), arguments)])
144- }
145-
146-
1+# no script

github/deemru/w8io/169f3d6 
34.33 ms