tx · nyCXdJe5uWsQ39Kwqdry5Uqc1jLVhqKRGEnFtx19rtm 3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J: -0.01400000 Waves 2021.10.25 00:10 [1760918] smart account 3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J > SELF 0.00000000 Waves
{ "type": 13, "id": "nyCXdJe5uWsQ39Kwqdry5Uqc1jLVhqKRGEnFtx19rtm", "fee": 1400000, "feeAssetId": null, "timestamp": 1635109805868, "version": 1, "sender": "3N4ngEpA29qJdUKnRto5zUzXvJJLwUuNs5J", "senderPublicKey": "B7ayemTreAJnAMuzH9P3MnVXhpL6PTtRBrV29h7EUS1H", "proofs": [ "2TETyQxZLpK6Y2tzNa1tJQ99tyDv4d6eh3srNQfStsMV3FTbnm3nZfYmcXn6kyvmbxx7NqR1HQRotNopN67grxtZ" ], "script": "base64:AAIFAAAAAAAAAB0IAhIFCgMICAESBAoCCAQSAwoBARIDCgEBEgASAAAAAAoAAAAADlNXT1Bnb3Zlcm5hbmNlCQAEJgAAAAEJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAPU1dPUF9nb3Zlcm5hbmNlAgAAACFFbXB0eSBrZXkgU1dPUF9nb3Zlcm5hbmNlX2FkZHJlc3MAAAAADVdhdmVzVXNkblBvb2wJAAQmAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAA9XQVZFU19VU0ROX1Bvb2wCAAAAIUVtcHR5IGtleSBTV09QX2dvdmVybmFuY2VfYWRkcmVzcwAAAAAXZGVmaWhlbHBlck1hbmFnZXJQdWJLZXkJAAJZAAAAAQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAABlkZWZpaGVscGVyX21hbmFnZXJfUHViS2V5AgAAACNFbXB0eSBrZXkgZGVmaWhlbHBlcl9tYW5hZ2VyX1B1YktleQAAAAAMYWRtaW5Qd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GFkbWluUHViS2V5MgkABEwAAAACBQAAAAxhZG1pblB1YktleTMJAARMAAAAAgUAAAAXZGVmaWhlbHBlck1hbmFnZXJQdWJLZXkFAAAAA25pbAgFAAAAAWkAAAAPY2FsbGVyUHVibGljS2V5CQAAAgAAAAECAAAAIU9ubHkgYWRtaW4gY2FuIGNhbGwgdGhpcyBmdW5jdGlvbgkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgIAAAAQaXNQcm90b2NvbEFjdGl2ZQcFAAAAA25pbAAAAAD/zCLL", "chainId": 84, "height": 1760918, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HRqTUWjfodSomdSZri9TyUbBLaeHKub3TKdGGxBNdAiv Next: FybcMDhK3CAF2ufBimTQuFdVvjTce5RypKofSsc6xDkU Diff:
Old | New | Differences | |
---|---|---|---|
87 | 87 | else { | |
88 | 88 | let callerStr = toString(i.caller) | |
89 | 89 | let callerBalance = getCallerBalance(callerStr) | |
90 | - | [IntegerEntry(callerStr, (callerBalance + pmtAmount))] | |
90 | + | [IntegerEntry((callerStr + keyBalance), (callerBalance + pmtAmount))] | |
91 | 91 | } | |
92 | 92 | } | |
93 | 93 |
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 | func getCallerBalance (callerStr) = { | |
23 | 23 | let callerBalance = match getInteger(this, (callerStr + keyBalance)) { | |
24 | 24 | case cb: Int => | |
25 | 25 | cb | |
26 | 26 | case empty: Unit => | |
27 | 27 | 0 | |
28 | 28 | case _ => | |
29 | 29 | throw("Match error") | |
30 | 30 | } | |
31 | 31 | callerBalance | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(i) | |
36 | 36 | func init (defihelperManagerPubKey,WavesUsdnPool,newFeeInUSDN) = if (if (isDefined(getString(this, "WAVES_USDN_Pool"))) | |
37 | 37 | then true | |
38 | 38 | else isDefined(getString(this, "defihelper_manager_PubKey"))) | |
39 | 39 | then throw("Already initialized") | |
40 | 40 | else [StringEntry("defihelper_manager_PubKey", defihelperManagerPubKey), StringEntry("WAVES_USDN_Pool", WavesUsdnPool), IntegerEntry("fee_in_usdn", newFeeInUSDN), BooleanEntry("isProtocolActive", true)] | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | @Callable(i) | |
45 | 45 | func updateAutomateStatus (automate,status) = if (!(isProtocolActive)) | |
46 | 46 | then throw("Protol stopped by admin") | |
47 | 47 | else if (!(containsElement([defihelperManagerPubKey], i.callerPublicKey))) | |
48 | 48 | then throw("Only admin can call this function") | |
49 | 49 | else [BooleanEntry(automate, status)] | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | ||
53 | 53 | @Callable(i) | |
54 | 54 | func updateProtocolFee (newFeeInUSDN) = if (!(isProtocolActive)) | |
55 | 55 | then throw("Protol stopped by admin") | |
56 | 56 | else if (!(containsElement([defihelperManagerPubKey], i.callerPublicKey))) | |
57 | 57 | then throw("Only admin can call this function") | |
58 | 58 | else [IntegerEntry("protocol_fee_in_usdn", newFeeInUSDN)] | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | ||
62 | 62 | @Callable(i) | |
63 | 63 | func updateBalance (fee) = if (!(isProtocolActive)) | |
64 | 64 | then throw("Protol stopped by admin") | |
65 | 65 | else { | |
66 | 66 | let automateAddrStr = toString(i.caller) | |
67 | 67 | let isAutomateActive = valueOrErrorMessage(getBoolean(this, automateAddrStr), ("Empty key newUser: " + automateAddrStr)) | |
68 | 68 | if (!(isAutomateActive)) | |
69 | 69 | then throw("This automate is inactive") | |
70 | 70 | else { | |
71 | 71 | let automateBalance = valueOrErrorMessage(getInteger(this, (automateAddrStr + keyBalance)), (("Empty key automateAddrStr + keyBalance: " + automateAddrStr) + keyBalance)) | |
72 | 72 | [IntegerEntry(automateAddrStr, (automateBalance - fee))] | |
73 | 73 | } | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | 78 | @Callable(i) | |
79 | 79 | func replanishBalance () = if (!(isProtocolActive)) | |
80 | 80 | then throw("Protol stopped by admin") | |
81 | 81 | else { | |
82 | 82 | let $t031233198 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
83 | 83 | let pmtAmount = $t031233198._1 | |
84 | 84 | let pmtAssetId = $t031233198._2 | |
85 | 85 | if ((pmtAssetId != unit)) | |
86 | 86 | then throw("Only WAVES available for replanishment") | |
87 | 87 | else { | |
88 | 88 | let callerStr = toString(i.caller) | |
89 | 89 | let callerBalance = getCallerBalance(callerStr) | |
90 | - | [IntegerEntry(callerStr, (callerBalance + pmtAmount))] | |
90 | + | [IntegerEntry((callerStr + keyBalance), (callerBalance + pmtAmount))] | |
91 | 91 | } | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(i) | |
97 | 97 | func shutdown () = if (!(isProtocolActive)) | |
98 | 98 | then throw("Protol stopped by admin") | |
99 | 99 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, defihelperManagerPubKey], i.callerPublicKey))) | |
100 | 100 | then throw("Only admin can call this function") | |
101 | 101 | else [BooleanEntry("isProtocolActive", false)] | |
102 | 102 | ||
103 | 103 |
github/deemru/w8io/169f3d6 47.81 ms ◑