tx · 8PQMVS7g9AV4RvoyuqYE7X3c3U9schEvwo9st7Tm1eiV 3Mx8MESRpWxe1HLaq6vZKWQ3JxhVtz9KGvk: -0.01000000 Waves 2019.12.24 17:24 [823202] smart account 3Mx8MESRpWxe1HLaq6vZKWQ3JxhVtz9KGvk > SELF 0.00000000 Waves
{ "type": 13, "id": "8PQMVS7g9AV4RvoyuqYE7X3c3U9schEvwo9st7Tm1eiV", "fee": 1000000, "feeAssetId": null, "timestamp": 1577197465585, "version": 1, "sender": "3Mx8MESRpWxe1HLaq6vZKWQ3JxhVtz9KGvk", "senderPublicKey": "HfRCF7ETeT9HDKjk3iecTofHFBahfZUL1Yen86uZfgBY", "proofs": [ "4FiXYfo3en2mbjEFKGmLUrNPYhszNLWuoVGV162h7YJjKruRb5o3KVgdTSWdWmJjyi7q8kzSGSmEtgKLjTfsWrb3" ], "script": "base64:AAIDAAAAAAAAABYIARIAEgQKAgEIEgQKAggBEgQKAggBAAAAFgEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAAAxnZXRCb29sQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEHAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2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IJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAXZ2V0QXJndW1lbnRzUHJvcG9zYWxLZXkAAAABBQAAAARoYXNoBQAAAAlhcmd1bWVudHMFAAAAA25pbAAAAADgL/l7", "chainId": 84, "height": 823202, "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 | + | 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 = "neutrino_asset_id" | |
45 | + | ||
46 | + | let NeutrinoContractKey = "neutrino_contract" | |
47 | + | ||
48 | + | let BalanceKey = "rpd_balance" | |
49 | + | ||
50 | + | func getUserBalanceKey (owner,assetId) = ((((BalanceKey + "_") + assetId) + "_") + owner) | |
51 | + | ||
52 | + | ||
53 | + | func getContractBalanceKey (assetId) = ((BalanceKey + "_") + assetId) | |
54 | + | ||
55 | + | ||
56 | + | func getExpireProposalKey (hash) = (("proposal_expire" + "_") + hash) | |
57 | + | ||
58 | + | ||
59 | + | func getOwnerProposalKey (hash) = (("proposal_owner" + "_") + hash) | |
60 | + | ||
61 | + | ||
62 | + | func getArgumentsProposalKey (hash) = (("proposal_arguments" + "_") + hash) | |
63 | + | ||
64 | + | ||
65 | + | func getVoteKey (owner,hash) = (((("proposal_vote" + "_") + owner) + "_") + hash) | |
66 | + | ||
67 | + | ||
68 | + | let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey)) | |
69 | + | ||
70 | + | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey)) | |
71 | + | ||
72 | + | func getContractBalance (assetId) = getNumberByKey(getContractBalanceKey(assetId)) | |
73 | + | ||
74 | + | ||
75 | + | func getUserBalance (owner,assetId) = getNumberByKey(getUserBalanceKey(owner, assetId)) | |
76 | + | ||
77 | + | ||
78 | + | func getExpireProposal (hash) = getNumberByKey(getExpireProposalKey(hash)) | |
79 | + | ||
80 | + | ||
81 | + | func getOwnerProposal (hash) = getStringByKey(getOwnerProposalKey(hash)) | |
82 | + | ||
83 | + | ||
84 | + | func getArgumentsProposal (hash) = getStringByKey(getArgumentsProposalKey(hash)) | |
85 | + | ||
86 | + | ||
87 | + | func getVote (owner,hash) = getStringByKey(getVoteKey(owner, hash)) | |
88 | + | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func lockNeutrino () = { | |
92 | + | let pmt = extract(i.payment) | |
93 | + | if ((pmt.assetId != neutrinoAssetId)) | |
94 | + | then throw("can use neutrino") | |
95 | + | else { | |
96 | + | let account = toString(i.caller) | |
97 | + | let assetIdString = toBase58String(value(pmt.assetId)) | |
98 | + | WriteSet([DataEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) + pmt.amount)), DataEntry(getUserBalanceKey(account, assetIdString), (getUserBalance(account, assetIdString) + pmt.amount))]) | |
99 | + | } | |
100 | + | } | |
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | @Callable(i) | |
105 | + | func unlockNeutrino (unlockAmount,assetIdString) = { | |
106 | + | let account = toString(i.caller) | |
107 | + | let assetId = fromBase58String(assetIdString) | |
108 | + | let balance = (getUserBalance(account, assetIdString) - unlockAmount) | |
109 | + | if ((0 > balance)) | |
110 | + | then throw("invalid amount") | |
111 | + | else if ((assetId != neutrinoAssetId)) | |
112 | + | then throw("can use neutrino") | |
113 | + | else ScriptResult(WriteSet([DataEntry(getContractBalanceKey(assetIdString), (getContractBalance(assetIdString) - unlockAmount)), DataEntry(getUserBalanceKey(account, assetIdString), balance)]), TransferSet([ScriptTransfer(addressFromStringValue(account), unlockAmount, neutrinoAssetId)])) | |
114 | + | } | |
115 | + | ||
116 | + | ||
117 | + | ||
118 | + | @Callable(i) | |
119 | + | func vote (hash,indexArgument) = { | |
120 | + | let arguments = split(getArgumentsProposal(hash), ",") | |
121 | + | let argument = arguments[indexArgument] | |
122 | + | if ((height > getExpireProposal(hash))) | |
123 | + | then throw("proposal is expired") | |
124 | + | else WriteSet([DataEntry(getVoteKey(toString(i.caller), hash), argument)]) | |
125 | + | } | |
126 | + | ||
127 | + | ||
128 | + | ||
129 | + | @Callable(i) | |
130 | + | func createProposal (arguments,expairHeight) = { | |
131 | + | let hash = toBase58String(keccak256(((toBytes(arguments) + toBytes(expairHeight)) + i.callerPublicKey))) | |
132 | + | if ((getOwnerProposal(hash) != "")) | |
133 | + | then throw("proposal is exist") | |
134 | + | else WriteSet([DataEntry(getExpireProposalKey(hash), expairHeight), DataEntry(getOwnerProposalKey(hash), toString(i.caller)), DataEntry(getArgumentsProposalKey(hash), arguments)]) | |
135 | + | } | |
136 | + | ||
137 | + |
github/deemru/w8io/169f3d6 19.61 ms ◑