tx · hrLVF4kc2FT7Zm9T3hMe8CBipcXJ9CNA3bRhY5ZTtUg 3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S: -0.01400000 Waves 2021.04.03 20:20 [1466552] smart account 3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S > SELF 0.00000000 Waves
{ "type": 13, "id": "hrLVF4kc2FT7Zm9T3hMe8CBipcXJ9CNA3bRhY5ZTtUg", "fee": 1400000, "feeAssetId": null, "timestamp": 1617470485945, "version": 2, "chainId": 84, "sender": "3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S", "senderPublicKey": "CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M", "proofs": [ "32ZsVtUd2WaXbU6otjvCuqjpHXyqWqmCiupdc2gjJGGbC6E2XWydSPwKkjQ3WxYBp2d89am61yVJD15AyiKVYuMM" ], "script": "base64:AAIEAAAAAAAAAAYIAhIAEgAAAAAPAAAAABJ1c2RuRHl6QUJhbGFuY2VLZXkCAAAAGHVzZG5fZHl6X2FfYXNzZXRfYmFsYW5jZQAAAAASdXNkbkR5ekJCYWxhbmNlS2V5AgAAABh1c2RuX2R5el9iX2Fzc2V0X2JhbGFuY2UAAAAAEWV0aER5ekFCYWxhbmNlS2V5AgAAABdldGhfZHl6X2FfYXNzZXRfYmFsYW5jZQAAAAARZXRoRHl6QkJhbGFuY2VLZXkCAAAAF2V0aF9keXpfYl9hc3NldF9iYWxhbmNlAAAAABZ1c2RuRHl6UGFpcklzQWN0aXZlS2V5AgAAABJ1c2RuX2R5el9pc19hY3RpdmUAAAAAFWV0aER5elBhaXJJc0FjdGl2ZUtleQIAAAARZXRoX2R5el9pc19hY3RpdmUAAAAABmZlZUtleQIAAAADZmVlAAAAAA5keXpyYXB0QXNzZXRJZAEAAAAgnxnpc9km71BHiGYaP3+jsvIwnjyNE9APQJ48k4SnBCMAAAAACmV0aEFzc2V0SWQBAAAAICImU7qSm/1VgN3CrHN9jStFD2u0cA4g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AAAgUAAAAGZmVlS2V5AAAAAAAAAAEsBQAAAANuaWwAAAABaQEAAAAPZXhjaGFuZ2VVc2RuRHl6AAAAAAMJAQAAAAEhAAAAAQkBAAAACWlzRGVmaW5lZAAAAAEJAAQbAAAAAgUAAAAEdGhpcwUAAAAWdXNkbkR5elBhaXJJc0FjdGl2ZUtleQkAAAIAAAABAgAAABJQYWlyIGlzIG5vdCBhY3RpdmUEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAHYXNzZXRJZAgFAAAAA3BtdAAAAAdhc3NldElkBAAAAAZhbW91bnQIBQAAAANwbXQAAAAGYW1vdW50AwMJAQAAAAIhPQAAAAIFAAAAB2Fzc2V0SWQFAAAAC3VzZG5Bc3NldElkCQEAAAACIT0AAAACBQAAAAdhc3NldElkBQAAAA5keXpyYXB0QXNzZXRJZAcJAAACAAAAAQIAAAAkT25seSB1c2RuIGFuZCBkeXpydXB0IGFyZSBzdXBwb3J0aW5nBAAAAAdyQW1vdW50CQEAAAAQZ2V0VXNkbkR5ekFtb3VudAAAAAIFAAAAB2Fzc2V0SWQFAAAABmFtb3VudAkAAAIAAAABBQAAAAdyQW1vdW50AAAAAFh+Cvk=", "height": 1466552, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DTXZSavHbD7XNupjK79uVK2din6iMMFcnajdDa5gnDsQ Next: F7sszg7zi8vtKwNZREWFriFtcBpqi2R8ZUZHf5zQC7RJ Diff:
Old | New | Differences | |
---|---|---|---|
41 | 41 | func getUsdnDyzAmount (assetId,amount) = { | |
42 | 42 | let feeAmount = getFeeAmount(amount) | |
43 | 43 | let amountWithoutFee = (amount - feeAmount) | |
44 | - | throw(toString( | |
44 | + | throw(toString(feeAmount)) | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
51 | 51 | else if ((i.callerPublicKey != adminPublicKey)) | |
52 | 52 | then throw("Only admin can activate pair") | |
53 | 53 | else { | |
54 | - | let $ | |
55 | - | let pmtAmountA = $ | |
56 | - | let pmtAssetIdA = $ | |
57 | - | let $ | |
58 | - | let pmtAmountB = $ | |
59 | - | let pmtAssetIdB = $ | |
54 | + | let $t014841561 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
55 | + | let pmtAmountA = $t014841561._1 | |
56 | + | let pmtAssetIdA = $t014841561._2 | |
57 | + | let $t015701647 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
58 | + | let pmtAmountB = $t015701647._1 | |
59 | + | let pmtAssetIdB = $t015701647._2 | |
60 | 60 | if ((pmtAssetIdA != usdnAssetId)) | |
61 | 61 | then throw("A asset is not a usdn") | |
62 | 62 | else if ((pmtAssetIdB != dyzraptAssetId)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let usdnDyzABalanceKey = "usdn_dyz_a_asset_balance" | |
5 | 5 | ||
6 | 6 | let usdnDyzBBalanceKey = "usdn_dyz_b_asset_balance" | |
7 | 7 | ||
8 | 8 | let ethDyzABalanceKey = "eth_dyz_a_asset_balance" | |
9 | 9 | ||
10 | 10 | let ethDyzBBalanceKey = "eth_dyz_b_asset_balance" | |
11 | 11 | ||
12 | 12 | let usdnDyzPairIsActiveKey = "usdn_dyz_is_active" | |
13 | 13 | ||
14 | 14 | let ethDyzPairIsActiveKey = "eth_dyz_is_active" | |
15 | 15 | ||
16 | 16 | let feeKey = "fee" | |
17 | 17 | ||
18 | 18 | let dyzraptAssetId = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA' | |
19 | 19 | ||
20 | 20 | let ethAssetId = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp' | |
21 | 21 | ||
22 | 22 | let usdnAssetId = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5' | |
23 | 23 | ||
24 | 24 | let adminPublicKey = base58'7zDUSbBXZtec3E333b1fC2wR2MPrnzh69ZrH3rwpQj9S' | |
25 | 25 | ||
26 | 26 | let feeAddress = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB') | |
27 | 27 | ||
28 | 28 | func getIntKeyDataOrError (key) = { | |
29 | 29 | let v = valueOrErrorMessage(getInteger(this, key), "unable to read key") | |
30 | 30 | v | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getFeeAmount (amount) = { | |
35 | 35 | let fee = getIntKeyDataOrError(feeKey) | |
36 | 36 | let feeAmount = fraction(amount, fee, 10000) | |
37 | 37 | fee | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func getUsdnDyzAmount (assetId,amount) = { | |
42 | 42 | let feeAmount = getFeeAmount(amount) | |
43 | 43 | let amountWithoutFee = (amount - feeAmount) | |
44 | - | throw(toString( | |
44 | + | throw(toString(feeAmount)) | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(i) | |
49 | 49 | func initUsdnDyzPair () = if (isDefined(getBoolean(this, usdnDyzPairIsActiveKey))) | |
50 | 50 | then throw("Pair is already active") | |
51 | 51 | else if ((i.callerPublicKey != adminPublicKey)) | |
52 | 52 | then throw("Only admin can activate pair") | |
53 | 53 | else { | |
54 | - | let $ | |
55 | - | let pmtAmountA = $ | |
56 | - | let pmtAssetIdA = $ | |
57 | - | let $ | |
58 | - | let pmtAmountB = $ | |
59 | - | let pmtAssetIdB = $ | |
54 | + | let $t014841561 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
55 | + | let pmtAmountA = $t014841561._1 | |
56 | + | let pmtAssetIdA = $t014841561._2 | |
57 | + | let $t015701647 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
58 | + | let pmtAmountB = $t015701647._1 | |
59 | + | let pmtAssetIdB = $t015701647._2 | |
60 | 60 | if ((pmtAssetIdA != usdnAssetId)) | |
61 | 61 | then throw("A asset is not a usdn") | |
62 | 62 | else if ((pmtAssetIdB != dyzraptAssetId)) | |
63 | 63 | then throw("B asset is not a dyzrupt") | |
64 | 64 | else [BooleanEntry(usdnDyzPairIsActiveKey, true), IntegerEntry(usdnDyzABalanceKey, pmtAmountA), IntegerEntry(usdnDyzBBalanceKey, pmtAmountB), IntegerEntry(feeKey, 300)] | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func exchangeUsdnDyz () = if (!(isDefined(getBoolean(this, usdnDyzPairIsActiveKey)))) | |
71 | 71 | then throw("Pair is not active") | |
72 | 72 | else { | |
73 | 73 | let pmt = value(i.payments[0]) | |
74 | 74 | let assetId = pmt.assetId | |
75 | 75 | let amount = pmt.amount | |
76 | 76 | if (if ((assetId != usdnAssetId)) | |
77 | 77 | then (assetId != dyzraptAssetId) | |
78 | 78 | else false) | |
79 | 79 | then throw("Only usdn and dyzrupt are supporting") | |
80 | 80 | else { | |
81 | 81 | let rAmount = getUsdnDyzAmount(assetId, amount) | |
82 | 82 | throw(rAmount) | |
83 | 83 | } | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 |
github/deemru/w8io/169f3d6 25.79 ms ◑