tx · 3T7LNxXKTGAKyXcJ7sdvUBvU7tBeQn7duZiTqX8vQCQk 3N9hKwuwtECrpiMAfy6krVKf2ovU1Si9ssu: -1.10000000 Waves 2019.03.17 23:55 [540724] smart asset 3N9hKwuwtECrpiMAfy6krVKf2ovU1Si9ssu > SELF 0.00000000 SMTH
{ "type": 15, "id": "3T7LNxXKTGAKyXcJ7sdvUBvU7tBeQn7duZiTqX8vQCQk", "fee": 110000000, "feeAssetId": null, "timestamp": 1552856129766, "version": 1, "sender": "3N9hKwuwtECrpiMAfy6krVKf2ovU1Si9ssu", "senderPublicKey": "B1jCjJgfsJPUci2LqspvGwEFV7jFKVNf2NwRdVpWJkAb", "proofs": [ "9555tBzLKPuXHmp39kzNBy3y2n4Ak1a5xVensPMiPcFHzRhuSRwm64sCtF491qxr98dfzvLo9hJmi8GTtHgd5H7" ], "assetId": "5aC18jdnA4KLsrtWQP3RuU9QhWvnmaMAFQq5fQjwJ49T", "script": "base64:AQQAAAAObWF0Y2hlckFkZHJlc3MJAQAAABFhZGRyZXNzRnJvbVN0cmluZwAAAAECAAAAIzNOQzJEUlVaRHNCYTRVeFZ1Wm9ldUxBckFoNVhuQ3VuV1lNBAAAAA5nYXRld2F5QWRkcmVzcwkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM045aEt3dXd0RUNycGlNQWZ5NmtyVktmMm92VTFTaTlzc3UEAAAADVdoaXRlbGlzdEFkZHIJAQAAABFhZGRyZXNzRnJvbVN0cmluZwAAAAECAAAAIzNON1RtUEZFMVFSS0V0S05CY1F2UGlIcUdkdm03UkthNlY5BAAAAAp2YWxpZFN0YXRlAAAAAAAAAAPoBAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXTWFzc1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAAnR4BQAAAAckbWF0Y2gwBwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFu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mNlBQAAABBvdXRjb21pbmcyQW1vdW50AwUAAAAKYW1vdW50MWVycgkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAB9FcnJvcjogbG9ja2VkIGJhbGFuY2Ugb2YgYXNzZXQgBQAAAAlhc3NldDFUeHQCAAAABCBpcyAJAAGkAAAAAQkBAAAAB2V4dHJhY3QAAAABBQAAAAptaW4xQW1vdW50AwUAAAAKYW1vdW50MmVycgkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAB9FcnJvcjogbG9ja2VkIGJhbGFuY2Ugb2YgYXNzZXQgBQAAAAlhc3NldDJUeHQCAAAABCBpcyAJAAGkAAAAAQkBAAAAB2V4dHJhY3QAAAABBQAAAAptaW4yQW1vdW50BgbtPKw+", "chainId": 84, "height": 540724, "spentComplexity": 0 } View: original | compacted Prev: DKBgGhtuM8iQnZW4rkRJQ5NXnWz2xc3SpVXYa5MmNZJA Next: none Diff:
Old | New | Differences | |
---|---|---|---|
41 | 41 | let outcoming2Account = tx.sellOrder.sender | |
42 | 42 | let outcoming1Amount = tx.amount | |
43 | 43 | let outcoming2Amount = fraction(tx.amount, tx.price, 100000000) | |
44 | - | let white1List = toBase58String(outcoming1Account.bytes) | |
45 | - | let white1ListAsset = if (isDefined(outcoming1AssetId)) | |
46 | - | then (white1List + toBase58String(extract(outcoming1AssetId))) | |
47 | - | else (white1List + "_WAVES") | |
48 | - | let white2List = toBase58String(outcoming2Account.bytes) | |
49 | - | let white2ListAsset = if (isDefined(outcoming2AssetId)) | |
50 | - | then (white2List + toBase58String(extract(outcoming2AssetId))) | |
51 | - | else (white2List + "_WAVES") | |
44 | + | let asset1Txt = if (!(isDefined(outcoming1AssetId))) | |
45 | + | then "_WAVES" | |
46 | + | else toBase58String(extract(outcoming1AssetId)) | |
47 | + | let asset2Txt = if (!(isDefined(outcoming2AssetId))) | |
48 | + | then "_WAVES" | |
49 | + | else toBase58String(extract(outcoming2AssetId)) | |
52 | 50 | let is1Waves = !(isDefined(outcoming1AssetId)) | |
53 | 51 | let is2Waves = !(isDefined(outcoming2AssetId)) | |
52 | + | let white1List = toBase58String(outcoming1Account.bytes) | |
53 | + | let white1ListAsset = (white1List + asset1Txt) | |
54 | + | let white2List = toBase58String(outcoming2Account.bytes) | |
55 | + | let white2ListAsset = (white2List + asset2Txt) | |
54 | 56 | let white1ListEntry = getInteger(extract(WhitelistAddr), toBase58String(outcoming1Account.bytes)) | |
55 | 57 | let white2ListEntry = getInteger(extract(WhitelistAddr), toBase58String(outcoming2Account.bytes)) | |
56 | 58 | if (if (!(isDefined(white1ListEntry))) | |
76 | 78 | let amount2err = if (!(isDefined(min2Amount))) | |
77 | 79 | then false | |
78 | 80 | else (extract(min2Amount) > (cur2Balance - outcoming2Amount)) | |
79 | - | throw(((((((("a1err=" + toString(amount1err)) + ",a2err=") + toString(amount2err)) + ",isdef1=") + toString(isDefined(min1Amount))) + ",isdef2=") + toString(isDefined(min2Amount)))) | |
81 | + | if (amount1err) | |
82 | + | then throw(((("Error: locked balance of asset " + asset1Txt) + " is ") + toString(extract(min1Amount)))) | |
83 | + | else if (amount2err) | |
84 | + | then throw(((("Error: locked balance of asset " + asset2Txt) + " is ") + toString(extract(min2Amount)))) | |
85 | + | else true | |
80 | 86 | } | |
81 | 87 | case _ => | |
82 | 88 | true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 1 #-} | |
2 | 2 | {-# CONTENT_TYPE EXPRESSION #-} | |
3 | 3 | let matcherAddress = addressFromString("3NC2DRUZDsBa4UxVuZoeuLArAh5XnCunWYM") | |
4 | 4 | let gatewayAddress = addressFromString("3N9hKwuwtECrpiMAfy6krVKf2ovU1Si9ssu") | |
5 | 5 | let WhitelistAddr = addressFromString("3N7TmPFE1QRKEtKNBcQvPiHqGdvm7RKa6V9") | |
6 | 6 | let validState = 1000 | |
7 | 7 | match tx { | |
8 | 8 | case tx: MassTransferTransaction => | |
9 | 9 | false | |
10 | 10 | case tx: TransferTransaction => | |
11 | 11 | if (if ((tx.sender != gatewayAddress)) | |
12 | 12 | then (tx.recipient != gatewayAddress) | |
13 | 13 | else false) | |
14 | 14 | then false | |
15 | 15 | else if ((tx.sender == gatewayAddress)) | |
16 | 16 | then true | |
17 | 17 | else { | |
18 | 18 | let white1List = toBase58String(tx.sender.bytes) | |
19 | 19 | let white1ListAsset = (white1List + toBase58String(extract(tx.assetId))) | |
20 | 20 | let white1ListEntry = getInteger(extract(WhitelistAddr), white1List) | |
21 | 21 | if (!(isDefined(white1ListEntry))) | |
22 | 22 | then throw("Sender not in white list") | |
23 | 23 | else if ((white1ListEntry != validState)) | |
24 | 24 | then throw("Sender not in valid state") | |
25 | 25 | else { | |
26 | 26 | let white1ListAssetEntry = getInteger(extract(WhitelistAddr), white1ListAsset) | |
27 | 27 | if (!(isDefined(white1ListAssetEntry))) | |
28 | 28 | then true | |
29 | 29 | else { | |
30 | 30 | let cur1Balance = assetBalance(tx.sender, tx.assetId) | |
31 | 31 | if ((extract(white1ListAssetEntry) > (cur1Balance - tx.amount))) | |
32 | 32 | then throw("Cannot send amount: under restrictions") | |
33 | 33 | else true | |
34 | 34 | } | |
35 | 35 | } | |
36 | 36 | } | |
37 | 37 | case tx: ExchangeTransaction => | |
38 | 38 | let outcoming1AssetId = tx.buyOrder.assetPair.amountAsset | |
39 | 39 | let outcoming1Account = tx.buyOrder.sender | |
40 | 40 | let outcoming2AssetId = tx.sellOrder.assetPair.priceAsset | |
41 | 41 | let outcoming2Account = tx.sellOrder.sender | |
42 | 42 | let outcoming1Amount = tx.amount | |
43 | 43 | let outcoming2Amount = fraction(tx.amount, tx.price, 100000000) | |
44 | - | let white1List = toBase58String(outcoming1Account.bytes) | |
45 | - | let white1ListAsset = if (isDefined(outcoming1AssetId)) | |
46 | - | then (white1List + toBase58String(extract(outcoming1AssetId))) | |
47 | - | else (white1List + "_WAVES") | |
48 | - | let white2List = toBase58String(outcoming2Account.bytes) | |
49 | - | let white2ListAsset = if (isDefined(outcoming2AssetId)) | |
50 | - | then (white2List + toBase58String(extract(outcoming2AssetId))) | |
51 | - | else (white2List + "_WAVES") | |
44 | + | let asset1Txt = if (!(isDefined(outcoming1AssetId))) | |
45 | + | then "_WAVES" | |
46 | + | else toBase58String(extract(outcoming1AssetId)) | |
47 | + | let asset2Txt = if (!(isDefined(outcoming2AssetId))) | |
48 | + | then "_WAVES" | |
49 | + | else toBase58String(extract(outcoming2AssetId)) | |
52 | 50 | let is1Waves = !(isDefined(outcoming1AssetId)) | |
53 | 51 | let is2Waves = !(isDefined(outcoming2AssetId)) | |
52 | + | let white1List = toBase58String(outcoming1Account.bytes) | |
53 | + | let white1ListAsset = (white1List + asset1Txt) | |
54 | + | let white2List = toBase58String(outcoming2Account.bytes) | |
55 | + | let white2ListAsset = (white2List + asset2Txt) | |
54 | 56 | let white1ListEntry = getInteger(extract(WhitelistAddr), toBase58String(outcoming1Account.bytes)) | |
55 | 57 | let white2ListEntry = getInteger(extract(WhitelistAddr), toBase58String(outcoming2Account.bytes)) | |
56 | 58 | if (if (!(isDefined(white1ListEntry))) | |
57 | 59 | then true | |
58 | 60 | else (white1ListEntry != validState)) | |
59 | 61 | then throw((("Account " + toBase58String(outcoming1Account.bytes)) + " not in white list")) | |
60 | 62 | else if (if (!(isDefined(white2ListEntry))) | |
61 | 63 | then true | |
62 | 64 | else (white2ListEntry != validState)) | |
63 | 65 | then throw((("Account " + toBase58String(outcoming2Account.bytes)) + " not in white list")) | |
64 | 66 | else { | |
65 | 67 | let min1Amount = getInteger(extract(WhitelistAddr), white1ListAsset) | |
66 | 68 | let min2Amount = getInteger(extract(WhitelistAddr), white2ListAsset) | |
67 | 69 | let cur1Balance = if (is1Waves) | |
68 | 70 | then wavesBalance(outcoming1Account) | |
69 | 71 | else assetBalance(outcoming1Account, outcoming1AssetId) | |
70 | 72 | let cur2Balance = if (is2Waves) | |
71 | 73 | then wavesBalance(outcoming2Account) | |
72 | 74 | else assetBalance(outcoming2Account, outcoming2AssetId) | |
73 | 75 | let amount1err = if (!(isDefined(min1Amount))) | |
74 | 76 | then false | |
75 | 77 | else (extract(min1Amount) > (cur1Balance - outcoming1Amount)) | |
76 | 78 | let amount2err = if (!(isDefined(min2Amount))) | |
77 | 79 | then false | |
78 | 80 | else (extract(min2Amount) > (cur2Balance - outcoming2Amount)) | |
79 | - | throw(((((((("a1err=" + toString(amount1err)) + ",a2err=") + toString(amount2err)) + ",isdef1=") + toString(isDefined(min1Amount))) + ",isdef2=") + toString(isDefined(min2Amount)))) | |
81 | + | if (amount1err) | |
82 | + | then throw(((("Error: locked balance of asset " + asset1Txt) + " is ") + toString(extract(min1Amount)))) | |
83 | + | else if (amount2err) | |
84 | + | then throw(((("Error: locked balance of asset " + asset2Txt) + " is ") + toString(extract(min2Amount)))) | |
85 | + | else true | |
80 | 86 | } | |
81 | 87 | case _ => | |
82 | 88 | true | |
83 | 89 | } |
github/deemru/w8io/169f3d6 40.98 ms ◑