tx · E2AYH9iR5teHM54BQBnsut7vra1dEtDS9zwSorEAccuK

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.30 09:13 [2512311] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "E2AYH9iR5teHM54BQBnsut7vra1dEtDS9zwSorEAccuK", "fee": 5000000, "feeAssetId": null, "timestamp": 1680156845873, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "5pKsew2hsLqjxE86VvJFKr6o2wCwgeTQnGUuBhSv3NPPhj9W6EMgL2mFaCoENWT49AEE4qrfN5CkvxEmLZFsiL5i" ], "script": "base64:BgIHCAISAwoBCA0AA1NFUAICX18ADGNvbnRyYWN0RmlsZQIOcmViYWxhbmNlLnJpZGUAEWtleUZhY3RvcnlBZGRyZXNzAgslc19fZmFjdG9yeQEUa2V5QWRkaXRpb25hbEJhbGFuY2UBB2Fzc2V0SWQJALkJAgkAzAgCAgQlcyVzCQDMCAICEWFkZGl0aW9uYWxCYWxhbmNlCQDMCAIFB2Fzc2V0SWQFA25pbAUDU0VQARZrZXlTdGFraW5nQXNzZXRCYWxhbmNlAQdhc3NldElkCQC5CQIJAMwIAgIEJXMlcwkAzAgCAhNzdGFraW5nQXNzZXRCYWxhbmNlCQDMCAIFB2Fzc2V0SWQFA25pbAUDU0VQARRnZXRBZGRpdGlvbmFsQmFsYW5jZQEHYXNzZXRJZAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzCQEUa2V5QWRkaXRpb25hbEJhbGFuY2UBBQdhc3NldElkAAABFmdldFN0YWtpbmdBc3NldEJhbGFuY2UBB2Fzc2V0SWQJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwkBFmtleVN0YWtpbmdBc3NldEJhbG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0SWQIBQskdDA0MzU2NDQ2NQJfNQQMcHJveHlSYXRlTXVsCAULJHQwNDM1NjQ0NjUCXzYEFHN0YWtpbmdQcm9maXRBZGRyZXNzCAULJHQwNDM1NjQ0NjUCXzcDBQppc0xlYXNhYmxlCQERcmViYWxhbmNlSW50ZXJuYWwGBQtsZWFzZWRSYXRpbwUHYXNzZXRJZAUMcHJveHlBc3NldElkBQptaW5CYWxhbmNlCQERQGV4dHJOYXRpdmUoMTA2MikBBQxwcm94eUFkZHJlc3MFDHByb3h5UmF0ZU11bAUDbmlsCQEKdGhyb3dFcnJvcgEJAKwCAgkArAICAgFbBQdhc3NldElkAhFdIFJlYmFsYW5jZSBlcnJvcgB7PO6B", "height": 2512311, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6qjiGmkGnHy9XM3BQwo6xgVdGx6go2qGNUPJvCvpBFnS Next: GctJ3TsQsEVdWkAXm937qNffDjiqwhJPuXKd1N9vyGes Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
6-let contractFile = "rebalance"
6+let contractFile = "rebalance.ride"
77
88 let keyFactoryAddress = "%s__factory"
99
1919 func getStakingAssetBalance (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
2020
2121
22+func throwError (errorMsg) = throw(((contractFile + ": ") + errorMsg))
23+
24+
2225 func getRate (proxy) = {
2326 let inv = invoke(proxy, "getRate", nil, nil)
2427 if ((inv == inv))
2629 case s: String =>
2730 parseIntValue(s)
2831 case _ =>
29- throw("Rate is zero (0)")
32+ throwError("getRate() returned zero")
3033 }
3134 else throw("Strict value is not equal to itself.")
3235 }
142145
143146
144147 @Callable(i)
145-func rebalance () = {
146- let asset1 = "WAVES"
147- match getLeaseProxyConfig(asset1) {
148- case a: (Boolean, Int, Int, String, String, Int, String) =>
149- let $t042604369 = a
150- let isLeasable = $t042604369._1
151- let leasedRatio = $t042604369._2
152- let minBalance = $t042604369._3
153- let proxyAddress = $t042604369._4
154- let proxyAssetId = $t042604369._5
155- let proxyRateMul = $t042604369._6
156- let stakingProfitAddress = $t042604369._7
157- if (isLeasable)
158- then rebalanceInternal(leasedRatio, asset1, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
159- else nil
160- case _ =>
161- throw("BRR")
162- }
163- }
148+func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
149+ case a: (Boolean, Int, Int, String, String, Int, String) =>
150+ let $t043564465 = a
151+ let isLeasable = $t043564465._1
152+ let leasedRatio = $t043564465._2
153+ let minBalance = $t043564465._3
154+ let proxyAddress = $t043564465._4
155+ let proxyAssetId = $t043564465._5
156+ let proxyRateMul = $t043564465._6
157+ let stakingProfitAddress = $t043564465._7
158+ if (isLeasable)
159+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
160+ else nil
161+ case _ =>
162+ throwError((("[" + assetId) + "] Rebalance error"))
163+}
164164
165165
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
6-let contractFile = "rebalance"
6+let contractFile = "rebalance.ride"
77
88 let keyFactoryAddress = "%s__factory"
99
1010 func keyAdditionalBalance (assetId) = makeString(["%s%s", "additionalBalance", assetId], SEP)
1111
1212
1313 func keyStakingAssetBalance (assetId) = makeString(["%s%s", "stakingAssetBalance", assetId], SEP)
1414
1515
1616 func getAdditionalBalance (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
1717
1818
1919 func getStakingAssetBalance (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
2020
2121
22+func throwError (errorMsg) = throw(((contractFile + ": ") + errorMsg))
23+
24+
2225 func getRate (proxy) = {
2326 let inv = invoke(proxy, "getRate", nil, nil)
2427 if ((inv == inv))
2528 then match inv {
2629 case s: String =>
2730 parseIntValue(s)
2831 case _ =>
29- throw("Rate is zero (0)")
32+ throwError("getRate() returned zero")
3033 }
3134 else throw("Strict value is not equal to itself.")
3235 }
3336
3437
3538 func getLeaseProxyConfig (assetId) = {
3639 let factory = addressFromStringValue(valueOrElse(getString(keyFactoryAddress), ""))
3740 let myAddressString = toString(this)
3841 invoke(factory, "getPoolLeaseConfigREADONLY", [myAddressString, assetId], nil)
3942 }
4043
4144
4245 func deposit (assetId,amount,stakingAssetId,proxy) = {
4346 let currentAdditionalBalance = getAdditionalBalance(assetId)
4447 if ((currentAdditionalBalance == currentAdditionalBalance))
4548 then {
4649 let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
4750 if ((currentStakingAssetBalance == currentStakingAssetBalance))
4851 then {
4952 let asset = if ((assetId == "WAVES"))
5053 then unit
5154 else fromBase58String(assetId)
5255 if ((amount > 0))
5356 then {
5457 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
5558 if ((depositInvoke == depositInvoke))
5659 then match depositInvoke {
5760 case receivedStakingAsset: Int =>
5861 let newAdditionalBalance = (currentAdditionalBalance + amount)
5962 let newSWavesBalance = (currentStakingAssetBalance + receivedStakingAsset)
6063 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newSWavesBalance)]
6164 case _ =>
6265 nil
6366 }
6467 else throw("Strict value is not equal to itself.")
6568 }
6669 else nil
6770 }
6871 else throw("Strict value is not equal to itself.")
6972 }
7073 else throw("Strict value is not equal to itself.")
7174 }
7275
7376
7477 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul) = {
7578 let currentAdditionalBalance = getAdditionalBalance(assetId)
7679 if ((currentAdditionalBalance == currentAdditionalBalance))
7780 then {
7881 let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
7982 if ((currentStakingAssetBalance == currentStakingAssetBalance))
8083 then {
8184 let currentProxyRate = getRate(proxy)
8285 if ((currentProxyRate == currentProxyRate))
8386 then {
8487 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
8588 if ((sendStakingAssetAmount > 0))
8689 then {
8790 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(fromBase58String(stakingAssetId), sendStakingAssetAmount)])
8891 if ((withdrawInvoke == withdrawInvoke))
8992 then match withdrawInvoke {
9093 case receivedAssets: Int =>
9194 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
9295 let newSWavesBalance = (currentStakingAssetBalance - sendStakingAssetAmount)
9396 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newSWavesBalance)]
9497 case _ =>
9598 nil
9699 }
97100 else throw("Strict value is not equal to itself.")
98101 }
99102 else nil
100103 }
101104 else throw("Strict value is not equal to itself.")
102105 }
103106 else throw("Strict value is not equal to itself.")
104107 }
105108 else throw("Strict value is not equal to itself.")
106109 }
107110
108111
109112 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul) = {
110113 let currentAdditionalBalance = getAdditionalBalance(assetId)
111114 if ((currentAdditionalBalance == currentAdditionalBalance))
112115 then {
113116 let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
114117 if ((currentStakingAssetBalance == currentStakingAssetBalance))
115118 then {
116119 let availableBalance = if ((assetId == "WAVES"))
117120 then wavesBalance(this).available
118121 else assetBalance(this, fromBase58String(assetId))
119122 if ((availableBalance == availableBalance))
120123 then {
121124 let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
122125 let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
123126 let diff = (currentAdditionalBalance - targetAdditionalBalance)
124127 if ((diff == 0))
125128 then nil
126129 else if ((0 > diff))
127130 then {
128131 let sendAssetAmount = -(diff)
129132 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
130133 }
131134 else {
132135 let getAssetAmount = diff
133136 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul)
134137 }
135138 }
136139 else throw("Strict value is not equal to itself.")
137140 }
138141 else throw("Strict value is not equal to itself.")
139142 }
140143 else throw("Strict value is not equal to itself.")
141144 }
142145
143146
144147 @Callable(i)
145-func rebalance () = {
146- let asset1 = "WAVES"
147- match getLeaseProxyConfig(asset1) {
148- case a: (Boolean, Int, Int, String, String, Int, String) =>
149- let $t042604369 = a
150- let isLeasable = $t042604369._1
151- let leasedRatio = $t042604369._2
152- let minBalance = $t042604369._3
153- let proxyAddress = $t042604369._4
154- let proxyAssetId = $t042604369._5
155- let proxyRateMul = $t042604369._6
156- let stakingProfitAddress = $t042604369._7
157- if (isLeasable)
158- then rebalanceInternal(leasedRatio, asset1, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
159- else nil
160- case _ =>
161- throw("BRR")
162- }
163- }
148+func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
149+ case a: (Boolean, Int, Int, String, String, Int, String) =>
150+ let $t043564465 = a
151+ let isLeasable = $t043564465._1
152+ let leasedRatio = $t043564465._2
153+ let minBalance = $t043564465._3
154+ let proxyAddress = $t043564465._4
155+ let proxyAssetId = $t043564465._5
156+ let proxyRateMul = $t043564465._6
157+ let stakingProfitAddress = $t043564465._7
158+ if (isLeasable)
159+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
160+ else nil
161+ case _ =>
162+ throwError((("[" + assetId) + "] Rebalance error"))
163+}
164164
165165

github/deemru/w8io/026f985 
28.51 ms