tx · 9afy8uNjLNcJRQ7FvapHdLsSkF9a99tsfAo1ctEVaiCt 3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc: -0.01000000 Waves 2020.01.22 14:46 [865427] smart account 3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc > SELF 0.00000000 Waves
{ "type": 13, "id": "9afy8uNjLNcJRQ7FvapHdLsSkF9a99tsfAo1ctEVaiCt", "fee": 1000000, "feeAssetId": null, "timestamp": 1579693613673, "version": 1, "sender": "3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc", "senderPublicKey": "3n7vYRqT664Gwk9F1i5yM11opnuaH4yABXXnsxP6kxUQ", "proofs": [ "3DX1hpZbkbCBbBuihLPntjznWLmyb2rEt5JqrStc84W6zswNEUdJ7MuXKVETkHLBvNYpFGhdtx49w7bTidsJjPA2" ], "script": "base64:AAIDAAAAAAAAABYIARIAEgQKAgEIEgQKAggBEgQKAggBAAAAGgEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAAAxnZXRCb29sQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEHAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2FkZHJlc3MAAAADa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AAAAEFAAAADGV4cGFpckhlaWdodAgFAAAAAWkAAAAPY2FsbGVyUHVibGljS2V5AwkBAAAAAiE9AAAAAgkBAAAAEGdldE93bmVyUHJvcG9zYWwAAAABBQAAAARoYXNoAgAAAAAJAAACAAAAAQIAAAARcHJvcG9zYWwgaXMgZXhpc3QJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABRnZXRFeHBpcmVQcm9wb3NhbEtleQAAAAEFAAAABGhhc2gFAAAADGV4cGFpckhlaWdodAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAE2dldE93bmVyUHJvcG9zYWxLZXkAAAABBQAAAARoYXNoCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAF2dldEFyZ3VtZW50c1Byb3Bvc2FsS2V5AAAAAQUAAAAEaGFzaAUAAAAJYXJndW1lbnRzBQAAAANuaWwAAAAAtOjbOQ==", "chainId": 84, "height": 865427, "spentComplexity": 0 } View: original | compacted Prev: 2KQpAPEEvcWKN1wnzKmM9TGpXeoT3pysb9s54sY4de7n Next: ADtAH7WeiUBvWZKApwzgc6BvosAMN8AhHqhVA6BuFNzc Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
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 = "3MujEudRyS2JzmpKhyosnj7fU4rYS2dFnxX" | |
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 | + |
github/deemru/w8io/026f985 19.28 ms ◑