41 | | - | @Callable(p) |
---|
42 | | - | func addAuction (q,r,s,t,u) = { |
---|
43 | | - | let v = toBase58String(p.transactionId) |
---|
44 | | - | let w = value(p.payments[0].assetId) |
---|
45 | | - | let x = value(s) |
---|
46 | | - | let y = (lastBlock.height + t) |
---|
47 | | - | let z = p.caller.bytes |
---|
48 | | - | let A = { |
---|
49 | | - | let n = getString(this, (((toBase58String(w) + a) + "nft_status_") + toBase58String(z))) |
---|
50 | | - | if ($isInstanceOf(n, "String")) |
---|
51 | | - | then { |
---|
52 | | - | let B = n |
---|
53 | | - | true |
---|
54 | | - | } |
---|
55 | | - | else false |
---|
56 | | - | } |
---|
57 | | - | if ((A == true)) |
---|
58 | | - | then throw("Already in auction list") |
---|
59 | | - | else if ((t > e)) |
---|
60 | | - | then throw(("Duration is too long. Must be less than or equal to 30 " + toString(e))) |
---|
61 | | - | else if ((p.payments[0].assetId == unit)) |
---|
62 | | - | then throw("NFT not attached") |
---|
63 | | - | else if ((p.payments[0].assetId == f)) |
---|
64 | | - | then throw("NFT not attached") |
---|
65 | | - | else [StringEntry(((v + "nft_start_auction_date") + toBase58String(z)), q), StringEntry(((v + "nft_end_auction_date") + toBase58String(z)), r), StringEntry((v + "_nft_start_price"), s), StringEntry((v + "_nft_owner"), toString(p.caller)), StringEntry((v + "_nft_on_auction"), toBase58String(w)), StringEntry((v + "_previous_bidder"), "none"), StringEntry((v + "_highest_bid"), "0"), StringEntry((v + "_winner_of_nft"), "0"), StringEntry((v + "_bidder_count"), "0"), StringEntry((v + "_nft_status"), "OPEN")] |
---|
66 | | - | } |
---|
67 | | - | |
---|
68 | | - | |
---|
69 | | - | |
---|
70 | | - | @Callable(p) |
---|
71 | | - | func placeBid (C,w,D,E,F) = { |
---|
72 | | - | let v = toBase58String(p.transactionId) |
---|
73 | | - | let z = p.caller.bytes |
---|
74 | | - | let m = fromBase58String(w) |
---|
75 | | - | let G = p.payments[0].assetId |
---|
76 | | - | let H = p.payments[0].amount |
---|
77 | | - | let I = getStringValue(this, (C + "_highest_bid")) |
---|
78 | | - | let J = getString(this, (C + "_previous_bidder")) |
---|
79 | | - | let K = getStringValue(this, (C + "_bidder_count")) |
---|
80 | | - | let L = getStringValue(this, (C + "_winner_of_nft")) |
---|
81 | | - | let A = getStringValue(this, (C + "_nft_status")) |
---|
82 | | - | if ((A != "OPEN")) |
---|
83 | | - | then throw("Not open for auction") |
---|
84 | | - | else if ((parseIntValue(I) >= H)) |
---|
85 | | - | then throw("Bid is less then starting/highest Bid") |
---|
86 | | - | else if ((I == "0")) |
---|
87 | | - | then [StringEntry((C + "_highest_bid"), toString(H)), StringEntry((C + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((C + "_bidder_count"), toString((parseIntValue(K) + 1))), StringEntry((C + "_nft_id"), toBase58String(m)), StringEntry((C + "_nft_owner"), D), StringEntry((((v + "_") + C) + "_highest_bid"), toString(H)), StringEntry((((v + "_") + C) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((v + "_") + C) + "_bidder_count"), toString((parseIntValue(K) + 1))), StringEntry((((v + "_") + C) + "_nft_id"), toBase58String(m)), StringEntry((((v + "_") + C) + "_nft_owner"), D), StringEntry((v + "_bid_for_nft_by"), toBase58String(z)), StringEntry((v + "_bid_price_place"), E), StringEntry((v + "_previous_bid_amount_refund_to_address"), L), StringEntry((v + "_prevoius_bid_amount_refund"), I)] |
---|
88 | | - | else if ((I != "0")) |
---|
89 | | - | then [ScriptTransfer(Address(fromBase58String(L)), parseIntValue(I), G), StringEntry((v + "_previous_bid_amount_refund_to_address"), L), StringEntry((v + "_prevoius_bid_amount_refund"), I), StringEntry((C + "_bidder_count"), toString((parseIntValue(K) + 1))), StringEntry((C + "_highest_bid"), toString(H)), StringEntry((C + "_winner_of_nft"), toBase58String(p.caller.bytes)), StringEntry((C + "_nft_id"), toBase58String(m)), StringEntry((C + "_nft_owner"), D), StringEntry((((v + "_") + C) + "_highest_bid"), toString(H)), StringEntry((((v + "_") + C) + "_winner"), toBase58String(p.caller.bytes)), StringEntry((((v + "_") + C) + "_bidder_count"), toString((parseIntValue(K) + 1))), StringEntry((((v + "_") + C) + "_nft_id"), toBase58String(m)), StringEntry((((v + "_") + C) + "_nft_owner"), D), StringEntry((v + "_bid_for_nft_by"), toBase58String(z)), StringEntry((v + "_bid_price_place"), E)] |
---|
90 | | - | else nil |
---|
91 | | - | } |
---|
92 | | - | |
---|
93 | | - | |
---|
94 | | - | |
---|
95 | | - | @Callable(p) |
---|
96 | | - | func acceptBidOffer (C,w,M,F) = { |
---|
97 | | - | let N = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
98 | | - | let v = toBase58String(p.transactionId) |
---|
99 | | - | let O = fromBase58String(F) |
---|
100 | | - | let z = p.caller.bytes |
---|
101 | | - | let m = fromBase58String(w) |
---|
102 | | - | let P = getStringValue(this, (C + "_highest_bid")) |
---|
103 | | - | let Q = ((parseIntValue(P) / 1000) * 975) |
---|
104 | | - | let R = ((parseIntValue(P) / 1000) * 25) |
---|
105 | | - | let S = getStringValue(this, (C + "_winner_of_nft")) |
---|
106 | | - | if ((F == N)) |
---|
107 | | - | then [ScriptTransfer(Address(z), Q, O), ScriptTransfer(Address(fromBase58String(S)), 1, m), StringEntry((v + "_amount_paid_to_owner"), P), StringEntry((v + "_nft_transfer_to"), S), StringEntry((v + "_nft_status"), "REWARDED"), StringEntry((C + "_amount_paid_to_owner"), P), StringEntry((C + "_nft_transfer_to"), S), StringEntry((C + "_nft_status"), "REWARDED")] |
---|
108 | | - | else if ((F == "WAVES")) |
---|
109 | | - | then [ScriptTransfer(Address(z), Q, unit), ScriptTransfer(Address(fromBase58String(S)), 1, m), StringEntry((v + "_amount_paid_to_owner"), P), StringEntry((v + "_nft_transfer_to"), S), StringEntry((v + "_nft_status"), "REWARDED"), StringEntry((C + "_amount_paid_to_owner"), P), StringEntry((C + "_nft_transfer_to"), S), StringEntry((C + "_nft_status"), "REWARDED")] |
---|
110 | | - | else nil |
---|
111 | | - | } |
---|
112 | | - | |
---|
113 | | - | |
---|
114 | | - | |
---|
115 | | - | @Callable(p) |
---|
116 | | - | func cancelAuction (C) = { |
---|
117 | | - | let v = toBase58String(p.transactionId) |
---|
118 | | - | let z = p.caller.bytes |
---|
119 | | - | let T = getStringValue(this, (C + "_nft_status")) |
---|
120 | | - | let U = getStringValue(this, (C + "_winner_of_nft")) |
---|
121 | | - | let V = getStringValue(this, (C + "_nft_owner")) |
---|
122 | | - | let w = getStringValue(this, (C + "_nft_on_auction")) |
---|
123 | | - | let W = getStringValue(this, (C + "_highest_bid")) |
---|
124 | | - | if ((U == "0")) |
---|
125 | | - | then [StringEntry(((v + C) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(V)), 1, fromBase58String(w))] |
---|
126 | | - | else if ((U != "0")) |
---|
127 | | - | then throw("soory you can't cancel it because already auction placed by someone") |
---|
128 | | - | else nil |
---|
129 | | - | } |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | |
---|
133 | | - | @Callable(p) |
---|
134 | | - | func nftback (C) = { |
---|
135 | | - | let z = p.caller.bytes |
---|
136 | | - | let w = getStringValue(this, (C + "_nft_on_auction")) |
---|
137 | | - | let V = getStringValue(this, (C + "_nft_owner")) |
---|
138 | | - | [StringEntry((C + "_nft_status"), "Auction_time over"), ScriptTransfer(Address(fromBase58String(V)), 1, fromBase58String(w))] |
---|
139 | | - | } |
---|
140 | | - | |
---|
141 | | - | |
---|
142 | | - | |
---|
143 | | - | @Callable(p) |
---|
144 | | - | func withdrawMoney (C,F) = { |
---|
145 | | - | let z = p.caller.bytes |
---|
146 | | - | let N = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
147 | | - | let v = toBase58String(p.transactionId) |
---|
148 | | - | let O = fromBase58String(F) |
---|
149 | | - | let X = getStringValue(this, (C + "_highest_bid")) |
---|
150 | | - | let Y = getStringValue(this, (C + "_winner")) |
---|
151 | | - | let Z = getStringValue(this, (C + "_nft_id")) |
---|
152 | | - | if ((F == N)) |
---|
153 | | - | then [StringEntry((C + "_nft_bid"), "WITHDRAW"), StringEntry((C + "_nft_id"), Z), StringEntry((C + "_bidding_price_refund_amount"), X), ScriptTransfer(p.caller, parseIntValue(X), O)] |
---|
154 | | - | else if ((F == "WAVES")) |
---|
155 | | - | then [StringEntry((C + "_nft_bid"), "WITHDRAW"), StringEntry((C + "_nft_id"), Z), StringEntry((C + "_bidding_price_refund_amount"), X), ScriptTransfer(p.caller, parseIntValue(X), unit)] |
---|
156 | | - | else nil |
---|
157 | | - | } |
---|
158 | | - | |
---|
159 | | - | |
---|
160 | | - | |
---|
161 | | - | @Callable(p) |
---|
162 | | - | func automateFunction (C,F) = { |
---|
163 | | - | let z = p.caller.bytes |
---|
164 | | - | let w = getStringValue(this, (C + "_nft_on_auction")) |
---|
165 | | - | let V = getStringValue(this, (C + "_nft_owner")) |
---|
166 | | - | let N = "9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq" |
---|
167 | | - | let O = fromBase58String(F) |
---|
168 | | - | let I = getStringValue(this, (C + "_highest_bid")) |
---|
169 | | - | let L = getStringValue(this, (C + "_winner_of_nft")) |
---|
170 | | - | let U = getStringValue(this, (C + "_winner_of_nft")) |
---|
171 | | - | if ((U == "0")) |
---|
172 | | - | then [ScriptTransfer(Address(fromBase58String(V)), 1, fromBase58String(w))] |
---|
173 | | - | else if (if ((U != "0")) |
---|
174 | | - | then (F == N) |
---|
175 | | - | else false) |
---|
176 | | - | then [ScriptTransfer(Address(fromBase58String(V)), 1, fromBase58String(w)), ScriptTransfer(Address(fromBase58String(L)), parseIntValue(I), O)] |
---|
177 | | - | else if (if ((U != "0")) |
---|
178 | | - | then (F == "WAVES") |
---|
179 | | - | else false) |
---|
180 | | - | then [ScriptTransfer(Address(fromBase58String(V)), 1, fromBase58String(w)), ScriptTransfer(Address(fromBase58String(L)), parseIntValue(I), unit)] |
---|
181 | | - | else nil |
---|
182 | | - | } |
---|
183 | | - | |
---|
| 15 | + | @Verifier(e) |
---|
| 16 | + | func f () = sigVerify(e.bodyBytes, e.proofs[0], e.senderPublicKey) |
---|