tx · 85iKRZVSPmoyb4Z1JMrvgD8HC6xeHk3Bf1gkbiaiimtf 3N19jxhEYkphA6vga9hXTPsU5YfRMR27YoE: -0.04000000 Waves 2022.05.04 22:28 [2037366] smart account 3N19jxhEYkphA6vga9hXTPsU5YfRMR27YoE > SELF 0.00000000 Waves
{ "type": 13, "id": "85iKRZVSPmoyb4Z1JMrvgD8HC6xeHk3Bf1gkbiaiimtf", "fee": 4000000, "feeAssetId": null, "timestamp": 1651692601627, "version": 2, "chainId": 84, "sender": "3N19jxhEYkphA6vga9hXTPsU5YfRMR27YoE", "senderPublicKey": "B3JNxLE1zmVDjs6MqSA1d3N7V6dS5Rq2wvxZqqVHo1fK", "proofs": [ "4FmfkXcMMs1AXSjFQsc5zxWjtJaTMwkusTvDp9S1T8gX3APTuzBSb6gBWySYf5s4mnFh7f2AJB9YNmWu4QjbugUf" ], "script": "base64:AAIFAAAAAAAAACQIAhIDCgEIEggKBggICAgICBIDCgEEEgcKBQgICAgIEgMKAQgAAAASAAAAAARtYWluAgAAAAptYWluX2Fzc2V0AAAAAAFsAgAAAAlscF9hc3NldF8AAAAAAmExAgAAAAxzd2FwX2Fzc2V0MV8AAAAAAnN0AgAAAA9hZGRyZXNzX3N0YWtlcl8AAAAAA3NzdAIAAAANYWRkcmVzc19wb29sXwAAAAADc3dwAgAAAA1hZGRyZXNzX3N3YXBfAAAAAAJhMgIAAAAMc3dhcF9hc3NldDJfAAAAAANhYTECAAAAB3Bvb2xfMV8AAAAAA2FhMgIAAAAHcG9vbF8yXwAAAAADc3QxAgAAAA5zdGFrZXJfYWRkcmVzcwAAAAAEdHlwZQIAAAAFdHlwZV8AAAAACWxlYXNlUG9vbAkBAAAAB0FkZHJlc3MAAAABCAUAAAAEdGhpcwAAAAVieXRlcwAAAAACc2ECAAAAD1NUQUtJTkdfQU1PVU5UXwAAAAACbGECAAAADUxFQVNFX0FNT1VOVF8AAAAAAml4AgAAAANJRF8AAAAADGV4Y2hhbmdlUmF0ZQAAAAA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bGV0ZUVudHJ5AAAAAQkAASwAAAACBQAAAAJhMQUAAAAHYWRkcmVzcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAIFAAAAAmEyBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAACWRlbGV0RW50eQQAAAAHYmJlbnRyeQkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAAdhZGRyZXNzCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAAEsAAAAAgIAAAAFUE9PTF8FAAAABFBNQUEJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAASwAAAACAgAAAAlscF9hc3NldF8FAAAABFBNQUEJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAASwAAAACBQAAAANhYTEFAAAAB2FkZHJlc3MJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAASwAAAACBQAAAANhYTIFAAAAB2FkZHJlc3MJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAASwAAAACBQAAAAR0eXBlBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAAB2JiZW50cnkJAAACAAAAAQIAAAAuT25seSB0aGUgQWRtaW4gaXRzZWxmIGNhbiBpbnZva2UgdGhpcyBmdW5jdGlvbgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4CQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleRVVlK8=", "height": 2037366, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: eqbcHuimumrFQy33VSYmh2ENB5VF31jmJac5miPvo4Y Next: none Diff:
Old | New | Differences | |
---|---|---|---|
59 | 59 | then throw("The pool has been previously added.") | |
60 | 60 | else if ((addres == staker)) | |
61 | 61 | then throw("Pool address cannot be the same as staker") | |
62 | - | else [StringEntry(address, pair), StringEntry(("POOL_" + pair), staker), StringEntry((l + pair), lp), StringEntry((aa1 + address), asset1), StringEntry((aa2 + address), asset2), StringEntry((type + address), "pools")] | |
62 | + | else if ((asset1 == asset2)) | |
63 | + | then throw("Asset1 cannot be equal to Asset2 and vice versa") | |
64 | + | else [StringEntry(address, pair), StringEntry(("POOL_" + pair), staker), StringEntry((l + pair), lp), StringEntry((aa1 + address), asset1), StringEntry((aa2 + address), asset2), StringEntry((type + address), "pools")] | |
63 | 65 | else throw("Only the Admin itself can invoke this function") | |
64 | 66 | } | |
65 | 67 | ||
73 | 75 | ||
74 | 76 | ||
75 | 77 | @Callable(i) | |
76 | - | func addSwap (addres,stake,pair, | |
78 | + | func addSwap (addres,stake,pair,asset11,asset22) = { | |
77 | 79 | let address = getAddressIfValid(addres) | |
78 | 80 | let staker = getAddressIfValid(stake) | |
79 | 81 | let PMAA = getString(this, address) | |
82 | + | let asset1 = getAssetIfValid(asset11) | |
83 | + | let asset2 = getAssetIfValid(asset22) | |
80 | 84 | if ((i.caller == this)) | |
81 | 85 | then if (isDefined(PMAA)) | |
82 | 86 | then throw("The address for this swap has been previously added.") | |
83 | 87 | else if ((addres == staker)) | |
84 | 88 | then throw("Swap address cannot be the same as staker") | |
85 | - | else [StringEntry(("swap_" + pair), staker), StringEntry(address, pair), StringEntry((a1 + address), asset1), StringEntry((a2 + address), asset2), StringEntry((type + address), "swap")] | |
89 | + | else if ((asset1 == asset2)) | |
90 | + | then throw("Asset1 cannot be equal to Asset2 and vice versa") | |
91 | + | else [StringEntry(("swap_" + pair), staker), StringEntry(address, pair), StringEntry((a1 + address), asset1), StringEntry((a2 + address), asset2), StringEntry((type + address), "swap")] | |
86 | 92 | else throw("Only the Admin itself can invoke this function") | |
87 | 93 | } | |
88 | 94 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let main = "main_asset" | |
5 | 5 | ||
6 | 6 | let l = "lp_asset_" | |
7 | 7 | ||
8 | 8 | let a1 = "swap_asset1_" | |
9 | 9 | ||
10 | 10 | let st = "address_staker_" | |
11 | 11 | ||
12 | 12 | let sst = "address_pool_" | |
13 | 13 | ||
14 | 14 | let swp = "address_swap_" | |
15 | 15 | ||
16 | 16 | let a2 = "swap_asset2_" | |
17 | 17 | ||
18 | 18 | let aa1 = "pool_1_" | |
19 | 19 | ||
20 | 20 | let aa2 = "pool_2_" | |
21 | 21 | ||
22 | 22 | let st1 = "staker_address" | |
23 | 23 | ||
24 | 24 | let type = "type_" | |
25 | 25 | ||
26 | 26 | let leasePool = Address(this.bytes) | |
27 | 27 | ||
28 | 28 | let sa = "STAKING_AMOUNT_" | |
29 | 29 | ||
30 | 30 | let la = "LEASE_AMOUNT_" | |
31 | 31 | ||
32 | 32 | let ix = "ID_" | |
33 | 33 | ||
34 | 34 | let exchangeRate = 5 | |
35 | 35 | ||
36 | 36 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse " + address) + " as address"))) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid."))) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | 43 | func addMainAsset (id) = if ((i.caller == this)) | |
44 | 44 | then [StringEntry(main, id)] | |
45 | 45 | else throw("Only the Admin itself can invoke this function") | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Callable(i) | |
50 | 50 | func addPool (addres,pair,llp,stake,asset11,asset22) = { | |
51 | 51 | let address = getAddressIfValid(addres) | |
52 | 52 | let staker = getAddressIfValid(stake) | |
53 | 53 | let lp = getAssetIfValid(llp) | |
54 | 54 | let asset1 = getAssetIfValid(asset11) | |
55 | 55 | let asset2 = getAssetIfValid(asset22) | |
56 | 56 | let PMAA = getString(this, address) | |
57 | 57 | if ((i.caller == this)) | |
58 | 58 | then if (isDefined(PMAA)) | |
59 | 59 | then throw("The pool has been previously added.") | |
60 | 60 | else if ((addres == staker)) | |
61 | 61 | then throw("Pool address cannot be the same as staker") | |
62 | - | else [StringEntry(address, pair), StringEntry(("POOL_" + pair), staker), StringEntry((l + pair), lp), StringEntry((aa1 + address), asset1), StringEntry((aa2 + address), asset2), StringEntry((type + address), "pools")] | |
62 | + | else if ((asset1 == asset2)) | |
63 | + | then throw("Asset1 cannot be equal to Asset2 and vice versa") | |
64 | + | else [StringEntry(address, pair), StringEntry(("POOL_" + pair), staker), StringEntry((l + pair), lp), StringEntry((aa1 + address), asset1), StringEntry((aa2 + address), asset2), StringEntry((type + address), "pools")] | |
63 | 65 | else throw("Only the Admin itself can invoke this function") | |
64 | 66 | } | |
65 | 67 | ||
66 | 68 | ||
67 | 69 | ||
68 | 70 | @Callable(i) | |
69 | 71 | func activate (v) = if ((i.caller == this)) | |
70 | 72 | then [BooleanEntry("activate", v)] | |
71 | 73 | else throw("Only the Admin itself can invoke this function") | |
72 | 74 | ||
73 | 75 | ||
74 | 76 | ||
75 | 77 | @Callable(i) | |
76 | - | func addSwap (addres,stake,pair, | |
78 | + | func addSwap (addres,stake,pair,asset11,asset22) = { | |
77 | 79 | let address = getAddressIfValid(addres) | |
78 | 80 | let staker = getAddressIfValid(stake) | |
79 | 81 | let PMAA = getString(this, address) | |
82 | + | let asset1 = getAssetIfValid(asset11) | |
83 | + | let asset2 = getAssetIfValid(asset22) | |
80 | 84 | if ((i.caller == this)) | |
81 | 85 | then if (isDefined(PMAA)) | |
82 | 86 | then throw("The address for this swap has been previously added.") | |
83 | 87 | else if ((addres == staker)) | |
84 | 88 | then throw("Swap address cannot be the same as staker") | |
85 | - | else [StringEntry(("swap_" + pair), staker), StringEntry(address, pair), StringEntry((a1 + address), asset1), StringEntry((a2 + address), asset2), StringEntry((type + address), "swap")] | |
89 | + | else if ((asset1 == asset2)) | |
90 | + | then throw("Asset1 cannot be equal to Asset2 and vice versa") | |
91 | + | else [StringEntry(("swap_" + pair), staker), StringEntry(address, pair), StringEntry((a1 + address), asset1), StringEntry((a2 + address), asset2), StringEntry((type + address), "swap")] | |
86 | 92 | else throw("Only the Admin itself can invoke this function") | |
87 | 93 | } | |
88 | 94 | ||
89 | 95 | ||
90 | 96 | ||
91 | 97 | @Callable(i) | |
92 | 98 | func removeSwapOrPool (address) = { | |
93 | 99 | let PAA = getStringValue(this, (type + address)) | |
94 | 100 | let PMAA = getStringValue(this, address) | |
95 | 101 | if ((i.caller == this)) | |
96 | 102 | then if ((PAA == "swap")) | |
97 | 103 | then { | |
98 | 104 | let deletEnty = [DeleteEntry(("swap_" + PMAA)), DeleteEntry(address), DeleteEntry((type + address)), DeleteEntry((a1 + address)), DeleteEntry((a2 + address))] | |
99 | 105 | deletEnty | |
100 | 106 | } | |
101 | 107 | else { | |
102 | 108 | let bbentry = [DeleteEntry(address), DeleteEntry(("POOL_" + PMAA)), DeleteEntry(("lp_asset_" + PMAA)), DeleteEntry((aa1 + address)), DeleteEntry((aa2 + address)), DeleteEntry((type + address))] | |
103 | 109 | bbentry | |
104 | 110 | } | |
105 | 111 | else throw("Only the Admin itself can invoke this function") | |
106 | 112 | } | |
107 | 113 | ||
108 | 114 | ||
109 | 115 | @Verifier(tx) | |
110 | 116 | func verify () = match tx { | |
111 | 117 | case _ => | |
112 | 118 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
113 | 119 | } | |
114 | 120 |
github/deemru/w8io/169f3d6 31.89 ms ◑