3 | | - | let heightDiff = 2 |
---|
4 | | - | let priceDiffConst = 123456 |
---|
5 | | - | let expirationHours = 24 |
---|
6 | | - | let maxExpiration = (((expirationHours * 60) * 60) * 1000) |
---|
7 | | - | let startHeight = 505050 |
---|
8 | | - | let cycles = ((height - startHeight) / heightDiff) |
---|
9 | | - | let priceDiff = (priceDiffConst * cycles) |
---|
10 | | - | let startBuyPrice = 12345655 |
---|
11 | | - | let minBuyPrice = (startBuyPrice + priceDiff) |
---|
12 | | - | let maxBuyAmount = 6000000000 |
---|
13 | | - | let startSellPrice = 12345666 |
---|
14 | | - | let minSellPrice = (startSellPrice + priceDiff) |
---|
15 | | - | let minSellAmount = 600000000 |
---|
16 | | - | let expirationError = "Expiration must be <= 24 hours" |
---|
17 | | - | let buyAmountError = ("Buy amount must be <= " + toString((maxBuyAmount / 100000000))) |
---|
18 | | - | let buyPriceError = (((("Buy price must be <= " + toString(minBuyPrice)) + " wavelets (Cycle #") + toString(cycles)) + ")") |
---|
19 | | - | let sellAmountError = ("Sell amount must be >= " + toString((minSellAmount / 100000000))) |
---|
20 | | - | let sellPriceError = (((("Sell price must be >= " + toString(minSellPrice)) + " wavelets (Cycle #") + toString(cycles)) + ") Wait next Cycle...") |
---|
21 | | - | let expiration = 1552064400000 |
---|
23 | | - | case e: ExchangeTransaction => |
---|
24 | | - | if (((e.sellOrder.expiration - e.sellOrder.timestamp) > maxExpiration)) |
---|
25 | | - | then throw(expirationError) |
---|
26 | | - | else { |
---|
27 | | - | let sell = sigVerify(e.sellOrder.bodyBytes, e.sellOrder.proofs[0], e.sellOrder.senderPublicKey) |
---|
28 | | - | let buy = sigVerify(e.buyOrder.bodyBytes, e.buyOrder.proofs[0], e.buyOrder.senderPublicKey) |
---|
29 | | - | if (sell) |
---|
30 | | - | then if ((minSellAmount > e.sellOrder.amount)) |
---|
31 | | - | then throw(sellAmountError) |
---|
32 | | - | else if (if ((minSellPrice > e.sellOrder.price)) |
---|
33 | | - | then true |
---|
34 | | - | else isDefined(e.sellOrder.assetPair.priceAsset)) |
---|
35 | | - | then throw(sellPriceError) |
---|
36 | | - | else true |
---|
37 | | - | else if (buy) |
---|
38 | | - | then if ((e.buyOrder.amount > maxBuyAmount)) |
---|
39 | | - | then throw(buyAmountError) |
---|
40 | | - | else if (if ((e.buyOrder.price > minBuyPrice)) |
---|
41 | | - | then true |
---|
42 | | - | else isDefined(e.buyOrder.assetPair.priceAsset)) |
---|
43 | | - | then throw(buyPriceError) |
---|
44 | | - | else true |
---|
45 | | - | else false |
---|
46 | | - | } |
---|
47 | | - | case b: TransferTransaction => |
---|
48 | | - | (b.timestamp > expiration) |
---|
49 | | - | case _: MassTransferTransaction|BurnTransaction => |
---|
50 | | - | true |
---|
| 4 | + | case mtt: MassTransferTransaction => |
---|
| 5 | + | let firstRecipient = mtt.transfers[0].recipient |
---|
| 6 | + | let firstAmount = mtt.transfers[0].amount |
---|
| 7 | + | let assetId = extract(mtt.assetId) |
---|
| 8 | + | let issueTransaction = transactionById(assetId) |
---|
| 9 | + | match issueTransaction { |
---|
| 10 | + | case issueTx: IssueTransaction => |
---|
| 11 | + | let issuerAddress = addressFromPublicKey(issueTx.senderPublicKey) |
---|
| 12 | + | let taxSize = extract(getInteger(issuerAddress, toBase58String(assetId))) |
---|
| 13 | + | if ((firstRecipient == issuerAddress)) |
---|
| 14 | + | then (firstAmount >= ((mtt.totalAmount / 100) * taxSize)) |
---|
| 15 | + | else false |
---|
| 16 | + | case _ => |
---|
| 17 | + | false |
---|
| 18 | + | } |
---|