tx · 6oKHoYqen3jz29SpjWYHWYtrn3aQcty9Yc9e5kERP2Qv 3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ: -0.01000000 Waves 2022.05.10 16:17 [2045618] smart account 3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ > SELF 0.00000000 Waves
{ "type": 13, "id": "6oKHoYqen3jz29SpjWYHWYtrn3aQcty9Yc9e5kERP2Qv", "fee": 1000000, "feeAssetId": null, "timestamp": 1652188685493, "version": 2, "chainId": 84, "sender": "3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ", "senderPublicKey": "BhRnrwd6wVHSkSaWXCjQRjaoXcpCdUW2hkJD6V7uVDxN", "proofs": [ "5A835Z2DTHJmc7k77JyYJcjG3fJayyWN9mqPkzzu8tWmdDA32SQs3qGYFBBCqFNjBB8kUr729jegBSaEUEYEzaaB" ], "script": "base64:AAIFAAAAAAAAACkIAhIAEgQKAggBEgMKAQESBQoDCAgBEgQKAggBEgQKAggBEgASAwoBGAAAAAsAAAAACnNoaW55d2dnaWQBAAAAIIlpzwL/trq51HGW13m4mXYmsHTQd3n0c26G8PRznwYmAAAAAAxhZG1pbkFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNNcE50aVBTUlNxNk5uYVFZazM4QmZXU3paY2dBWVR5clE5AAAAAA1hc3NldHNBZGRyZXNzAQAAABoBVMvmtMF31x0nLWsWEEvKkUjrKYsKGpWnmgAAAAAObmF0aW9uc0FkZHJlc3MBAAAAGgFUTYXo3vT4RGtZEDtwX8O3uWUOUfVERm2gAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAABAAAADXRyeUdldEJvb2xlYW4AAAABAAAAA2tleQ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AAAAAACcAAAAAAAAAACgAAAAAAAAAACkAAAAAAAAAACoAAAAAAAAAACsAAAAAAAAAACwAAAAAAAAAAC0AAAAAAAAAAC4AAAAAAAAAAC8AAAAAAAAAADAAAAAAAAAAADEAAAAAAAAAADIAAAAAAAAAADMAAAAAAAAAADQAAAAAAAAAADUAAAAAAAAAADYAAAAAAAAAADcAAAAAAAAAADgAAAAAAAAAADkAAAAAAAAAADoAAAAAAAAAADsAAAAAAAAAADwAAAAAkzKxLw==", "height": 2045618, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4nSvSdNHP1iq16ho7WSHcQvPrGV2jrwdBzxyHBjyefn7 Next: 3K92hmf8Uj3vdqpZ3seYndg43tegzPuGkPjprZbJiPJR Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
7 | 7 | ||
8 | 8 | let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb' | |
9 | + | ||
10 | + | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
9 | 11 | ||
10 | 12 | func tryGetInteger (key) = match getInteger(this, key) { | |
11 | 13 | case b: Int => | |
117 | 119 | ||
118 | 120 | ||
119 | 121 | @Callable(i) | |
120 | - | func arbitraryAddCoins (toAddress,amount) = if (if ((i.caller != adminAddress)) | |
122 | + | func arbitraryAddCoins (toAddress,amount) = if (if (if ((i.caller != adminAddress)) | |
121 | 123 | then (i.caller.bytes != assetsAddress) | |
124 | + | else false) | |
125 | + | then (i.caller.bytes != nationsAddress) | |
122 | 126 | else false) | |
123 | 127 | then throw("you are not authorized to perform this operation") | |
124 | 128 | else internalDeposit(toAddress, amount) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | 5 | ||
6 | 6 | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
7 | 7 | ||
8 | 8 | let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb' | |
9 | + | ||
10 | + | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
9 | 11 | ||
10 | 12 | func tryGetInteger (key) = match getInteger(this, key) { | |
11 | 13 | case b: Int => | |
12 | 14 | b | |
13 | 15 | case _ => | |
14 | 16 | 0 | |
15 | 17 | } | |
16 | 18 | ||
17 | 19 | ||
18 | 20 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
19 | 21 | case b: Boolean => | |
20 | 22 | b | |
21 | 23 | case _ => | |
22 | 24 | false | |
23 | 25 | } | |
24 | 26 | ||
25 | 27 | ||
26 | 28 | func internalDeposit (addressStr,amountIn) = { | |
27 | 29 | let amount = tryGetInteger((addressStr + "_Deposit")) | |
28 | 30 | [IntegerEntry((addressStr + "_Deposit"), (amount + amountIn))] | |
29 | 31 | } | |
30 | 32 | ||
31 | 33 | ||
32 | 34 | func internalPay (addressStr,amount) = { | |
33 | 35 | let deposited = tryGetInteger((addressStr + "_Deposit")) | |
34 | 36 | if ((0 > (deposited - amount))) | |
35 | 37 | then throw("Not enough deposit.") | |
36 | 38 | else if (((deposited - amount) == 0)) | |
37 | 39 | then [DeleteEntry((addressStr + "_Deposit"))] | |
38 | 40 | else [IntegerEntry((addressStr + "_Deposit"), (deposited - amount))] | |
39 | 41 | } | |
40 | 42 | ||
41 | 43 | ||
42 | 44 | func internalReserve (addressStr,amount) = { | |
43 | 45 | let reservedAmount = tryGetInteger((addressStr + "_Reserved")) | |
44 | 46 | [IntegerEntry((addressStr + "_Reserved"), (reservedAmount + amount))] | |
45 | 47 | } | |
46 | 48 | ||
47 | 49 | ||
48 | 50 | func internalTransfer (fromAddress,toAddress,amount) = (internalPay(fromAddress, amount) ++ internalDeposit(toAddress, amount)) | |
49 | 51 | ||
50 | 52 | ||
51 | 53 | func addRewardEntry (accum,nextValue) = { | |
52 | 54 | let L = split(nextValue, "_") | |
53 | 55 | let addressStr = L[0] | |
54 | 56 | let amount = parseIntValue(L[1]) | |
55 | 57 | let reservedAmount = tryGetInteger((addressStr + "_Reserved")) | |
56 | 58 | (accum :+ IntegerEntry((addressStr + "_Reserved"), (reservedAmount + amount))) | |
57 | 59 | } | |
58 | 60 | ||
59 | 61 | ||
60 | 62 | @Callable(i) | |
61 | 63 | func Deposit () = { | |
62 | 64 | let addressStr = toString(i.originCaller) | |
63 | 65 | let pmt = i.payments[0] | |
64 | 66 | if ((pmt == pmt)) | |
65 | 67 | then { | |
66 | 68 | let amountIn = value(i.payments[0].amount) | |
67 | 69 | if ((amountIn == amountIn)) | |
68 | 70 | then { | |
69 | 71 | let assetIn = pmt.assetId | |
70 | 72 | if ((assetIn == assetIn)) | |
71 | 73 | then if ((assetIn != shinywggid)) | |
72 | 74 | then throw("Only $HEG payments allowed") | |
73 | 75 | else { | |
74 | 76 | let amount = tryGetInteger((addressStr + "_Deposit")) | |
75 | 77 | $Tuple2(internalDeposit(addressStr, (amount + amountIn)), (amount + amountIn)) | |
76 | 78 | } | |
77 | 79 | else throw("Strict value is not equal to itself.") | |
78 | 80 | } | |
79 | 81 | else throw("Strict value is not equal to itself.") | |
80 | 82 | } | |
81 | 83 | else throw("Strict value is not equal to itself.") | |
82 | 84 | } | |
83 | 85 | ||
84 | 86 | ||
85 | 87 | ||
86 | 88 | @Callable(i) | |
87 | 89 | func Pay (addressStr,amount) = if (if (if ((i.caller != this)) | |
88 | 90 | then (i.caller != adminAddress) | |
89 | 91 | else false) | |
90 | 92 | then (i.caller.bytes != assetsAddress) | |
91 | 93 | else false) | |
92 | 94 | then throw("you are not authorized to perform this operation") | |
93 | 95 | else $Tuple2(internalPay(addressStr, amount), amount) | |
94 | 96 | ||
95 | 97 | ||
96 | 98 | ||
97 | 99 | @Callable(i) | |
98 | 100 | func CallerPay (amount) = { | |
99 | 101 | let callerAddr = toString(i.caller) | |
100 | 102 | internalPay(callerAddr, amount) | |
101 | 103 | } | |
102 | 104 | ||
103 | 105 | ||
104 | 106 | ||
105 | 107 | @Callable(i) | |
106 | 108 | func transferCoins (fromAddress,toAddress,amount) = if (if ((i.caller != adminAddress)) | |
107 | 109 | then (i.caller.bytes != assetsAddress) | |
108 | 110 | else false) | |
109 | 111 | then throw("you are not authorized to perform this operation") | |
110 | 112 | else internalTransfer(fromAddress, toAddress, amount) | |
111 | 113 | ||
112 | 114 | ||
113 | 115 | ||
114 | 116 | @Callable(i) | |
115 | 117 | func callerTransferCoins (toAddress,amount) = internalTransfer(toString(i.caller), toAddress, amount) | |
116 | 118 | ||
117 | 119 | ||
118 | 120 | ||
119 | 121 | @Callable(i) | |
120 | - | func arbitraryAddCoins (toAddress,amount) = if (if ((i.caller != adminAddress)) | |
122 | + | func arbitraryAddCoins (toAddress,amount) = if (if (if ((i.caller != adminAddress)) | |
121 | 123 | then (i.caller.bytes != assetsAddress) | |
124 | + | else false) | |
125 | + | then (i.caller.bytes != nationsAddress) | |
122 | 126 | else false) | |
123 | 127 | then throw("you are not authorized to perform this operation") | |
124 | 128 | else internalDeposit(toAddress, amount) | |
125 | 129 | ||
126 | 130 | ||
127 | 131 | ||
128 | 132 | @Callable(i) | |
129 | 133 | func Redeem () = { | |
130 | 134 | let addressStr = toString(i.caller) | |
131 | 135 | let reservedAmount = tryGetInteger((addressStr + "_Reserved")) | |
132 | 136 | if ((reservedAmount == 0)) | |
133 | 137 | then throw("Nothing to redeem") | |
134 | 138 | else [DeleteEntry((addressStr + "_Reserved")), ScriptTransfer(i.caller, reservedAmount, shinywggid)] | |
135 | 139 | } | |
136 | 140 | ||
137 | 141 | ||
138 | 142 | ||
139 | 143 | @Callable(i) | |
140 | 144 | func setRewards (rewards) = if (if ((i.caller != adminAddress)) | |
141 | 145 | then (i.caller.bytes != assetsAddress) | |
142 | 146 | else false) | |
143 | 147 | then throw("you are not authorized to perform this operation") | |
144 | 148 | else { | |
145 | 149 | let it = size(rewards) | |
146 | 150 | if ((it > 60)) | |
147 | 151 | then throw("you can write max 60 records per call") | |
148 | 152 | else { | |
149 | 153 | let $l = rewards | |
150 | 154 | let $s = size($l) | |
151 | 155 | let $acc0 = nil | |
152 | 156 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
153 | 157 | then $a | |
154 | 158 | else addRewardEntry($a, $l[$i]) | |
155 | 159 | ||
156 | 160 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
157 | 161 | then $a | |
158 | 162 | else throw("List size exceeds 60") | |
159 | 163 | ||
160 | 164 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60) | |
161 | 165 | } | |
162 | 166 | } | |
163 | 167 | ||
164 | 168 |
github/deemru/w8io/169f3d6 45.01 ms ◑