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