tx · FbxSSCJJ9pmqn3eEJuyCGiLQQJzcFGnBAqxLbUh1HTAz 3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J: -0.01400000 Waves 2021.10.24 23:23 [1760874] smart account 3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J > SELF 0.00000000 Waves
{ "type": 13, "id": "FbxSSCJJ9pmqn3eEJuyCGiLQQJzcFGnBAqxLbUh1HTAz", "fee": 1400000, "feeAssetId": null, "timestamp": 1635107090360, "version": 1, "sender": "3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J", "senderPublicKey": "B7ayemTreAJnAMuzH9P3MnVXhpL6PTtRBrV29h7EUS1H", "proofs": [ "2VDXzAKAPF32vjYYkNgEmiuSMkxGUuMU17WtLbjdPndUyvNY9Pssono4dgBYoqTWH4UPKfGPwNoLazeaNSbbpTq6" ], "script": "base64:AAIFAAAAAAAAACAIAhIFCgMICAESBAoCCAQSAwoBARIDCgEBEgMKAQgSAAAAAAkAAAAADlNXT1Bnb3Zlcm5hbmNlCQAEJgAAAAEJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAPU1dPUF9nb3Zlcm5hbmNlAgAAACFFbXB0eSBrZXkgU1dPUF9nb3Zlcm5hbmNlX2FkZHJlc3MAAAAADVdhdmVzVXNkblBvb2wJAAQmAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAA9XQVZFU19VU0ROX1Bvb2wCAAAAIUVtcHR5IGtleSBTV09QX2dvdmVybmFuY2VfYWRkcmVzcwAAAAAXZGVmaWhlbHBlck1hbmFnZXJQdWJLZXkJAAJZAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAABlkZWZpaGVscGVyX21hbmFnZXJfUHViS2V5AgAAACNFbXB0eSBrZXkgZGVmaWhlbHBlcl9tYW5hZ2VyX1B1YktleQAAAAAMYW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EwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgIAAAAQaXNQcm90b2NvbEFjdGl2ZQcFAAAAA25pbAAAAAB/rvsE", "chainId": 84, "height": 1760874, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8w2dYL4G25Yq1hgK5CHrqUdiiYCVraaQuHu9Gsk8K9QM Next: E8TuKQ2h8UuVi6usdWantyLgbjsMit3rZhvqS4ohqgyy Diff:
Old | New | Differences | |
---|---|---|---|
24 | 24 | then true | |
25 | 25 | else isDefined(getString(this, "defihelper_manager_PubKey"))) | |
26 | 26 | then throw("Already initialized") | |
27 | - | else [StringEntry("defihelper_manager_PubKey", defihelperManagerPubKey), | |
27 | + | else [StringEntry("defihelper_manager_PubKey", defihelperManagerPubKey), StringEntry("WAVES_USDN_Pool", WavesUsdnPool), IntegerEntry("fee_in_usdn", newFeeInUSDN), BooleanEntry("isProtocolActive", true)] | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
66 | 66 | func replanishBalance (automateAddrStr) = if (!(isProtocolActive)) | |
67 | 67 | then throw("Protol stopped by admin") | |
68 | 68 | else { | |
69 | - | let $ | |
70 | - | let pmtAmount = $ | |
71 | - | let pmtAssetId = $ | |
69 | + | let $t029533028 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
70 | + | let pmtAmount = $t029533028._1 | |
71 | + | let pmtAssetId = $t029533028._2 | |
72 | 72 | if ((pmtAssetId != unit)) | |
73 | 73 | then throw("Only WAVES available for replanishment") | |
74 | 74 | else { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SWOPgovernance = addressFromString(valueOrElse(getString(this, "SWOP_governance"), "Empty key SWOP_governance_address")) | |
5 | 5 | ||
6 | 6 | let WavesUsdnPool = addressFromString(valueOrElse(getString(this, "WAVES_USDN_Pool"), "Empty key SWOP_governance_address")) | |
7 | 7 | ||
8 | 8 | let defihelperManagerPubKey = fromBase58String(valueOrElse(getString(this, "defihelper_manager_PubKey"), "Empty key defihelper_manager_PubKey")) | |
9 | 9 | ||
10 | 10 | let adminPubKey1 = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
11 | 11 | ||
12 | 12 | let adminPubKey2 = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
13 | 13 | ||
14 | 14 | let adminPubKey3 = base58'Aqj7onZFvn779uRCiW2zCmXG1RKsGeA6k3SWXmH7s5Lv' | |
15 | 15 | ||
16 | 16 | let keyBalance = "_balance" | |
17 | 17 | ||
18 | 18 | let keyFeeInUSDN = "fee_in_usdn" | |
19 | 19 | ||
20 | 20 | let isProtocolActive = valueOrErrorMessage(getBoolean(this, "isProtocolActive"), "Empty key isProtocolActive") | |
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | 23 | func init (defihelperManagerPubKey,WavesUsdnPool,newFeeInUSDN) = if (if (isDefined(getString(this, "WAVES_USDN_Pool"))) | |
24 | 24 | then true | |
25 | 25 | else isDefined(getString(this, "defihelper_manager_PubKey"))) | |
26 | 26 | then throw("Already initialized") | |
27 | - | else [StringEntry("defihelper_manager_PubKey", defihelperManagerPubKey), | |
27 | + | else [StringEntry("defihelper_manager_PubKey", defihelperManagerPubKey), StringEntry("WAVES_USDN_Pool", WavesUsdnPool), IntegerEntry("fee_in_usdn", newFeeInUSDN), BooleanEntry("isProtocolActive", true)] | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | 31 | @Callable(i) | |
32 | 32 | func updateAutomateStatus (automate,status) = if (!(isProtocolActive)) | |
33 | 33 | then throw("Protol stopped by admin") | |
34 | 34 | else if (!(containsElement([defihelperManagerPubKey], i.callerPublicKey))) | |
35 | 35 | then throw("Only admin can call this function") | |
36 | 36 | else [BooleanEntry(automate, status)] | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(i) | |
41 | 41 | func updateProtocolFee (newFeeInUSDN) = if (!(isProtocolActive)) | |
42 | 42 | then throw("Protol stopped by admin") | |
43 | 43 | else if (!(containsElement([defihelperManagerPubKey], i.callerPublicKey))) | |
44 | 44 | then throw("Only admin can call this function") | |
45 | 45 | else [IntegerEntry("protocol_fee_in_usdn", newFeeInUSDN)] | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Callable(i) | |
50 | 50 | func updateBalance (fee) = if (!(isProtocolActive)) | |
51 | 51 | then throw("Protol stopped by admin") | |
52 | 52 | else { | |
53 | 53 | let automateAddrStr = toString(i.caller) | |
54 | 54 | let isAutomateActive = valueOrErrorMessage(getBoolean(this, automateAddrStr), ("Empty key newUser: " + automateAddrStr)) | |
55 | 55 | if (!(isAutomateActive)) | |
56 | 56 | then throw("This automate is inactive") | |
57 | 57 | else { | |
58 | 58 | let automateBalance = valueOrErrorMessage(getInteger(this, (automateAddrStr + keyBalance)), (("Empty key automateAddrStr + keyBalance: " + automateAddrStr) + keyBalance)) | |
59 | 59 | [IntegerEntry(automateAddrStr, (automateBalance - fee))] | |
60 | 60 | } | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | ||
65 | 65 | @Callable(i) | |
66 | 66 | func replanishBalance (automateAddrStr) = if (!(isProtocolActive)) | |
67 | 67 | then throw("Protol stopped by admin") | |
68 | 68 | else { | |
69 | - | let $ | |
70 | - | let pmtAmount = $ | |
71 | - | let pmtAssetId = $ | |
69 | + | let $t029533028 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
70 | + | let pmtAmount = $t029533028._1 | |
71 | + | let pmtAssetId = $t029533028._2 | |
72 | 72 | if ((pmtAssetId != unit)) | |
73 | 73 | then throw("Only WAVES available for replanishment") | |
74 | 74 | else { | |
75 | 75 | let automateBalance = valueOrErrorMessage(getInteger(this, (automateAddrStr + keyBalance)), (("Empty key automateAddrStr + keyBalance: " + automateAddrStr) + keyBalance)) | |
76 | 76 | [IntegerEntry(automateAddrStr, (automateBalance + pmtAmount))] | |
77 | 77 | } | |
78 | 78 | } | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | 82 | @Callable(i) | |
83 | 83 | func shutdown () = if (!(isProtocolActive)) | |
84 | 84 | then throw("Protol stopped by admin") | |
85 | 85 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, defihelperManagerPubKey], i.callerPublicKey))) | |
86 | 86 | then throw("Only admin can call this function") | |
87 | 87 | else [BooleanEntry("isProtocolActive", false)] | |
88 | 88 | ||
89 | 89 |
github/deemru/w8io/169f3d6 39.53 ms ◑