4 | | - | let d8 = 100000000 |
---|
5 | | - | |
---|
6 | | - | func tryGetInteger (address,key) = match getInteger(address, key) { |
---|
7 | | - | case b: Int => |
---|
8 | | - | b |
---|
9 | | - | case _ => |
---|
10 | | - | 0 |
---|
11 | | - | } |
---|
12 | | - | |
---|
13 | | - | |
---|
14 | | - | func tryGetString (address,key) = match getString(address, key) { |
---|
15 | | - | case b: String => |
---|
16 | | - | b |
---|
17 | | - | case _ => |
---|
18 | | - | "" |
---|
19 | | - | } |
---|
20 | | - | |
---|
21 | | - | |
---|
22 | | - | let burnxtn = base58'3SjxA2YLdfF9fTRbzLm9xFn27C6MW34W1YsdJ6Axefns' |
---|
23 | | - | |
---|
24 | | - | let PZ1 = base58'3PE7NtJdmVq4yo47LKDqurQ8RLDCouvJCPB' |
---|
25 | | - | |
---|
26 | | - | let PZ2 = base58'3PQHndCUVrv3wBuQjbvVP9SnGmfbfitGxfx' |
---|
27 | | - | |
---|
28 | | - | let PZ3 = base58'3PBiMQLnX8wd4bssXCgF8KuUqHv1H4zWHGi' |
---|
29 | | - | |
---|
30 | | - | let PZ4 = base58'3PDJPGn6vBEBqWN4E3fNcxoKBoDXbsmoaM7' |
---|
31 | | - | |
---|
32 | | - | let PZ5 = base58'3PCS1xhGQi2eM5mYcCBhUSHvB31Kk5gZoCm' |
---|
33 | | - | |
---|
34 | | - | let PZ6 = base58'3P8Quvmgt3VEWAjBR3bsfgCqzUh7zTmTC4q' |
---|
35 | | - | |
---|
36 | | - | let WXstake = base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV' |
---|
37 | | - | |
---|
38 | | - | let WX1 = base58'3P5vwLbXddLWpsRspftMxLuzfsjk3dLT3n5' |
---|
39 | | - | |
---|
40 | | - | let LP1 = "GyiHdcN59sZ46baFvj68ruLngrTPEvWDtsd6jHm4o46n" |
---|
41 | | - | |
---|
42 | | - | let WX2 = base58'3PKXseWa31VUSWUvm2YiRKxW2VM9RsVk3ry' |
---|
43 | | - | |
---|
44 | | - | let LP2 = "3MPHMJVwYGyeBLRsH1RsYhrTmemv752AEBwuFFV7g49Z" |
---|
45 | | - | |
---|
46 | | - | func PZbal (Pooladdress,address) = { |
---|
47 | | - | let burnxtnInPZ = tryGetInteger(Address(Pooladdress), (("global_" + toBase58String(burnxtn)) + "_balance")) |
---|
48 | | - | let addressStakePZ = tryGetInteger(Address(Pooladdress), (toString(address) + "_indexStaked")) |
---|
49 | | - | let totalStakePZ = tryGetInteger(Address(Pooladdress), "global_poolToken_amount") |
---|
50 | | - | fraction(burnxtnInPZ, addressStakePZ, totalStakePZ) |
---|
51 | | - | } |
---|
52 | | - | |
---|
53 | | - | |
---|
54 | | - | func WXbal (Pooladdress,address,LPstr) = { |
---|
55 | | - | let burnxtnInWX = assetBalance(Address(Pooladdress), burnxtn) |
---|
56 | | - | let addressStakeWX = tryGetInteger(Address(WXstake), ((("%s%s%s__staked__" + toString(address)) + "__") + LPstr)) |
---|
57 | | - | let totalStakeWX = tryGetInteger(Address(WXstake), ("%s%s%s__staked__total__" + LPstr)) |
---|
58 | | - | fraction(burnxtnInWX, addressStakeWX, totalStakeWX) |
---|
59 | | - | } |
---|
60 | | - | |
---|
61 | | - | |
---|
62 | | - | func totalBalance (address) = { |
---|
63 | | - | let burnxtnBalance = assetBalance(address, burnxtn) |
---|
64 | | - | let PZ1balance = PZbal(PZ1, address) |
---|
65 | | - | let PZ2balance = PZbal(PZ2, address) |
---|
66 | | - | let PZ3balance = PZbal(PZ3, address) |
---|
67 | | - | let PZ4balance = PZbal(PZ4, address) |
---|
68 | | - | let PZ5balance = PZbal(PZ5, address) |
---|
69 | | - | let PZ6balance = PZbal(PZ6, address) |
---|
70 | | - | let WX1balance = WXbal(WX1, address, LP1) |
---|
71 | | - | let WX2balance = WXbal(WX2, address, LP2) |
---|
72 | | - | let total = ((((((((burnxtnBalance + PZ1balance) + PZ2balance) + PZ3balance) + PZ4balance) + PZ5balance) + PZ6balance) + WX1balance) + WX2balance) |
---|
73 | | - | [IntegerEntry("burnxtnBalance", burnxtnBalance), IntegerEntry("PZ1balance", PZ1balance), IntegerEntry("PZ2balance", PZ2balance), IntegerEntry("PZ3balance", PZ3balance), IntegerEntry("PZ4balance", PZ4balance), IntegerEntry("PZ5balance", PZ5balance), IntegerEntry("PZ6balance", PZ6balance), IntegerEntry("WX1balance", WX1balance), IntegerEntry("WX2balance", WX2balance), IntegerEntry("total", total)] |
---|
74 | | - | } |
---|
78 | | - | func register () = if (contains(tryGetString(this, "Address registered"), toString(i.caller))) |
---|
79 | | - | then throw("already registered") |
---|
80 | | - | else if ((height > 1)) |
---|
81 | | - | then throw("registration closed") |
---|
82 | | - | else [IntegerEntry("Amount Registered", (tryGetInteger(this, "Amount Registered") + 1)), StringEntry(("Register address: " + toString((tryGetInteger(this, "Amount Registered") + 1))), toString(i.caller)), StringEntry("Address registered", ((tryGetString(this, "Address registered") + toString(i.caller)) + ","))] |
---|
83 | | - | |
---|
84 | | - | |
---|
85 | | - | |
---|
86 | | - | @Callable(i) |
---|
87 | | - | func makeList () = { |
---|
88 | | - | let addresses = dropRight(tryGetString(this, "Address registered"), 1) |
---|
89 | | - | let list = split(addresses, ",") |
---|
90 | | - | let listSize = size(list) |
---|
91 | | - | let requirement = (1 * d8) |
---|
92 | | - | func bal (accum,address) = if ((requirement > wavesBalance(addressFromStringValue(address)).available)) |
---|
93 | | - | then nil |
---|
94 | | - | else (accum ++ [IntegerEntry(address, wavesBalance(addressFromStringValue(address)).available)]) |
---|
95 | | - | |
---|
96 | | - | let enterIntegers = { |
---|
97 | | - | let $l = list |
---|
98 | | - | let $s = size($l) |
---|
99 | | - | let $acc0 = nil |
---|
100 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
101 | | - | then $a |
---|
102 | | - | else bal($a, $l[$i]) |
---|
103 | | - | |
---|
104 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
105 | | - | then $a |
---|
106 | | - | else throw("List size exceeds 100") |
---|
107 | | - | |
---|
108 | | - | $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($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), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) |
---|
109 | | - | } |
---|
110 | | - | func eli (accum,address) = if ((requirement > wavesBalance(addressFromStringValue(address)).available)) |
---|
111 | | - | then nil |
---|
112 | | - | else (accum + (address + ",")) |
---|
113 | | - | |
---|
114 | | - | let eligible = { |
---|
115 | | - | let $l = list |
---|
116 | | - | let $s = size($l) |
---|
117 | | - | let $acc0 = "" |
---|
118 | | - | func $f1_1 ($a,$i) = if (($i >= $s)) |
---|
119 | | - | then $a |
---|
120 | | - | else eli($a, $l[$i]) |
---|
121 | | - | |
---|
122 | | - | func $f1_2 ($a,$i) = if (($i >= $s)) |
---|
123 | | - | then $a |
---|
124 | | - | else throw("List size exceeds 100") |
---|
125 | | - | |
---|
126 | | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_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), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) |
---|
127 | | - | } |
---|
128 | | - | ([StringEntry("eligible", eligible)] ++ enterIntegers) |
---|
129 | | - | } |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | |
---|
133 | | - | @Callable(i) |
---|
134 | | - | func difference () = { |
---|
135 | | - | let addresses = dropRight(tryGetString(this, "eligible"), 1) |
---|
136 | | - | let list = split(addresses, ",") |
---|
137 | | - | let listSize = size(list) |
---|
138 | | - | let firstOfList = list[0] |
---|
139 | | - | let lastOfList = list[(listSize - 1)] |
---|
140 | | - | func dif (accum,address) = (accum ++ [IntegerEntry(("difference " + address), (wavesBalance(addressFromStringValue(address)).available - tryGetInteger(this, address)))]) |
---|
141 | | - | |
---|
142 | | - | let enterDif = { |
---|
143 | | - | let $l = list |
---|
144 | | - | let $s = size($l) |
---|
145 | | - | let $acc0 = nil |
---|
146 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
147 | | - | then $a |
---|
148 | | - | else dif($a, $l[$i]) |
---|
149 | | - | |
---|
150 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
151 | | - | then $a |
---|
152 | | - | else throw("List size exceeds 100") |
---|
153 | | - | |
---|
154 | | - | $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($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), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) |
---|
155 | | - | } |
---|
156 | | - | ([IntegerEntry("listSize", listSize), StringEntry("firstOfList", firstOfList), StringEntry("lastOfList", lastOfList)] ++ enterDif) |
---|
157 | | - | } |
---|
158 | | - | |
---|
159 | | - | |
---|
160 | | - | |
---|
161 | | - | @Callable(i) |
---|
162 | | - | func totalBalanceCaller () = (nil ++ totalBalance(i.caller)) |
---|
163 | | - | |
---|
164 | | - | |
---|
165 | | - | |
---|
166 | | - | @Callable(i) |
---|
167 | | - | func totalBalanceAddress (address) = (nil ++ totalBalance(value(addressFromString(address)))) |
---|
168 | | - | |
---|
169 | | - | |
---|
170 | | - | |
---|
171 | | - | @Callable(i) |
---|
172 | | - | func transfer (addresses) = { |
---|
173 | | - | let assetId = i.payments[0].assetId |
---|
174 | | - | let amount = i.payments[0].amount |
---|
175 | | - | let amountPerAddress = (amount / size(addresses)) |
---|
176 | | - | func f (accum,address) = (accum ++ [ScriptTransfer(addressFromStringValue(address), amountPerAddress, assetId)]) |
---|
177 | | - | |
---|
178 | | - | let $l = addresses |
---|
179 | | - | let $s = size($l) |
---|
180 | | - | let $acc0 = nil |
---|
181 | | - | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
182 | | - | then $a |
---|
183 | | - | else f($a, $l[$i]) |
---|
184 | | - | |
---|
185 | | - | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
186 | | - | then $a |
---|
187 | | - | else throw("List size exceeds 100") |
---|
188 | | - | |
---|
189 | | - | $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($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), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) |
---|
| 7 | + | func helloWorld (name) = { |
---|
| 8 | + | let intList = [1, 2, 3] |
---|
| 9 | + | let lowest = value(min(intList)) |
---|
| 10 | + | let element = intList[lowest] |
---|
| 11 | + | [IntegerEntry("lowest", lowest), StringEntry("element", toString(element))] |
---|