8 | | - | let c = base58'' |
---|
9 | | - | |
---|
10 | | - | let d = base58'' |
---|
11 | | - | |
---|
12 | | - | let e = [""] |
---|
13 | | - | |
---|
14 | | - | func f (g) = { |
---|
15 | | - | let h = getInteger(this, g) |
---|
16 | | - | if ($isInstanceOf(h, "Int")) |
---|
17 | | - | then { |
---|
18 | | - | let i = h |
---|
19 | | - | i |
---|
20 | | - | } |
---|
21 | | - | else 0 |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func sellart (b,c,d,e,f) = { |
---|
| 8 | + | let g = toBase58String(a.transactionId) |
---|
| 9 | + | let h = lastBlock.height |
---|
| 10 | + | let i = extract(a.payment) |
---|
| 11 | + | WriteSet([DataEntry(g, h), DataEntry((g + "_organizer"), toBase58String(a.caller.bytes)), DataEntry((g + "_lot_assetId"), if (isDefined(i.assetId)) |
---|
| 12 | + | then toBase58String(value(i.assetId)) |
---|
| 13 | + | else "WAVES"), DataEntry((g + "_lot_amount"), i.amount), DataEntry((g + "_startPrice"), c), DataEntry((g + "_priceAssetId"), e)]) |
---|
24 | | - | |
---|
25 | | - | func j (g) = { |
---|
26 | | - | let h = getBoolean(Address(d), g) |
---|
27 | | - | if ($isInstanceOf(h, "Boolean")) |
---|
28 | | - | then { |
---|
29 | | - | let i = h |
---|
30 | | - | i |
---|
31 | | - | } |
---|
32 | | - | else false |
---|
33 | | - | } |
---|
34 | | - | |
---|
35 | | - | |
---|
36 | | - | func k (l) = { |
---|
37 | | - | let h = addressFromString(l) |
---|
38 | | - | if ($isInstanceOf(h, "Address")) |
---|
39 | | - | then { |
---|
40 | | - | let m = h |
---|
41 | | - | true |
---|
42 | | - | } |
---|
43 | | - | else false |
---|
44 | | - | } |
---|
45 | | - | |
---|
46 | | - | |
---|
47 | | - | func n (g) = { |
---|
48 | | - | let h = getString(this, g) |
---|
49 | | - | if ($isInstanceOf(h, "String")) |
---|
50 | | - | then { |
---|
51 | | - | let m = h |
---|
52 | | - | m |
---|
53 | | - | } |
---|
54 | | - | else "" |
---|
55 | | - | } |
---|
56 | | - | |
---|
57 | | - | |
---|
58 | | - | func o (p) = if ((indexOf(e, p) != unit)) |
---|
59 | | - | then 4 |
---|
60 | | - | else 1 |
---|
61 | | - | |
---|
62 | | - | |
---|
63 | | - | @Callable(q) |
---|
64 | | - | func addgatewayKey (p,r) = if ((q.caller != this)) |
---|
65 | | - | then throw("admin only") |
---|
66 | | - | else { |
---|
67 | | - | let s = (("key_" + r) + "_refererAddress") |
---|
68 | | - | if ((n(s) == "")) |
---|
69 | | - | then [StringEntry(s, p), StringEntry(((("address_" + p) + "_refererKey_") + r), r)] |
---|
70 | | - | else throw((("The ref key \"" + r) + "\" is already registered")) |
---|
71 | | - | } |
---|
72 | | - | |
---|
73 | | - | |
---|
74 | | - | |
---|
75 | | - | @Callable(q) |
---|
76 | | - | func gatewayreward (t) = { |
---|
77 | | - | let u = toString(q.originCaller) |
---|
78 | | - | if (if ((q.caller.bytes != b)) |
---|
79 | | - | then (q.caller.bytes != c) |
---|
80 | | - | else false) |
---|
81 | | - | then throw("This method can be called only by farming and incubator dApps") |
---|
82 | | - | else if (if ((t == "")) |
---|
83 | | - | then (n((("address_" + u) + "_referedBy")) == "") |
---|
84 | | - | else false) |
---|
85 | | - | then nil |
---|
86 | | - | else if (j(("gateway_" + u))) |
---|
87 | | - | then nil |
---|
88 | | - | else { |
---|
89 | | - | let v = { |
---|
90 | | - | let h = getString(this, (("key_" + t) + "_refererAddress")) |
---|
91 | | - | if ($isInstanceOf(h, "String")) |
---|
92 | | - | then { |
---|
93 | | - | let w = h |
---|
94 | | - | w |
---|
95 | | - | } |
---|
96 | | - | else t |
---|
97 | | - | } |
---|
98 | | - | let x = { |
---|
99 | | - | let h = getString(this, (("address_" + u) + "_referedBy")) |
---|
100 | | - | if ($isInstanceOf(h, "String")) |
---|
101 | | - | then { |
---|
102 | | - | let w = h |
---|
103 | | - | w |
---|
104 | | - | } |
---|
105 | | - | else v |
---|
106 | | - | } |
---|
107 | | - | let y = (q.payments[0].amount * o(x)) |
---|
108 | | - | if ((addressFromString(x) == unit)) |
---|
109 | | - | then nil |
---|
110 | | - | else { |
---|
111 | | - | let z = addressFromStringValue(x) |
---|
112 | | - | let A = addressFromStringValue(u) |
---|
113 | | - | let B = y |
---|
114 | | - | let C = (("address_" + x) + "_earnedReward") |
---|
115 | | - | let D = (((("referer_" + x) + "_referal_") + u) + "_deliveredReward") |
---|
116 | | - | if ((x == u)) |
---|
117 | | - | then nil |
---|
118 | | - | else [StringEntry((("address_" + u) + "_referedBy"), x), IntegerEntry(C, (f(C) + B)), IntegerEntry(D, (f(D) + B)), IntegerEntry((((("referer_" + x) + "_referal_") + u) + "_amount"), (f((((("referer_" + x) + "_referal_") + u) + "_amount")) + 1)), ScriptTransfer(z, B, c)] |
---|
119 | | - | } |
---|
120 | | - | } |
---|
121 | | - | } |
---|
122 | | - | |
---|
123 | | - | |
---|
124 | | - | @Verifier(E) |
---|
125 | | - | func F () = sigVerify(E.bodyBytes, E.proofs[0], E.senderPublicKey) |
---|