tx · AUY8vDbsnmQXSAfZgdeMvYcNvwrKSPfuGr2HU57ChpPn

3N6DXdP8fmfcpzoUgkvr2mvt8KchnLHdzGm:  -0.03400000 Waves

2023.04.17 20:10 [2538845] smart account 3N6DXdP8fmfcpzoUgkvr2mvt8KchnLHdzGm > SELF 0.00000000 Waves

{ "type": 13, "id": "AUY8vDbsnmQXSAfZgdeMvYcNvwrKSPfuGr2HU57ChpPn", "fee": 3400000, "feeAssetId": null, "timestamp": 1681751520571, "version": 2, "chainId": 84, "sender": "3N6DXdP8fmfcpzoUgkvr2mvt8KchnLHdzGm", "senderPublicKey": "FxuVfnCFZoDkRsejprz4rdvP5sUdXYsJx4rBDXbkuyyR", "proofs": [ "2wrUZpF7mimZfvYdcFm3GHAV4ozLKJTcEtXjm8naXTvCRthS6mzZGWU4Ku32dJH93ZhJhnKmKTVHK3V6vbrDAtzj" ], "script": "base64:BgIKCAISBAoCCAgSAA0AFGtfY29vcmRpbmF0b3JBZGRyZXNzAhRrX2Nvb3JkaW5hdG9yQWRkcmVzcwAOa19yZXdhcmRfYXNzZXQCDmtfcmV3YXJkX2Fzc2V0AA1rX3F1b3RlX2Fzc2V0Ag1rX3F1b3RlX2Fzc2V0AA5rX3N3YXBfYWRkcmVzcwIOa19zd2FwX2FkZHJlc3MAD2tfYWRtaW5fYWRkcmVzcwIPa19hZG1pbl9hZGRyZXNzAAhrX3RhcmdldAIIa190YXJnZXQADWtfaW5pdGlhbGl6ZWQCDWtfaW5pdGlhbGl6ZWQBC2Nvb3JkaW5hdG9yAAkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCmCAEJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBRRrX2Nvb3JkaW5hdG9yQWRkcmVzcwITQ29vcmRpbmF0b3Igbm90IHNldAIbQ29vcmRpbmF0b3IgYWRkcmVzcyBpbnZhbGlkAQtyZXdhcmRBc3NldAAJANkEAQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2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bmFibGUgdG8gdmVyaWZ5OiBhZG1pbiBub3Qgc2V0IGluIGNvb3JkaW5hdG9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V52fuUbg==", "height": 2538845, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let k_coordinatorAddress = "k_coordinatorAddress"
5+
6+let k_reward_asset = "k_reward_asset"
7+
8+let k_quote_asset = "k_quote_asset"
9+
10+let k_swap_address = "k_swap_address"
11+
12+let k_admin_address = "k_admin_address"
13+
14+let k_target = "k_target"
15+
16+let k_initialized = "k_initialized"
17+
18+func coordinator () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, k_coordinatorAddress), "Coordinator not set")), "Coordinator address invalid")
19+
20+
21+func rewardAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_reward_asset), "Reward asset not set"))
22+
23+
24+func quoteAsset () = fromBase58String(valueOrErrorMessage(getString(coordinator(), k_quote_asset), "Quote asset not set"))
25+
26+
27+func swapAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_swap_address), "Swap address not set")), "Swap address invalid")
28+
29+
30+func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
31+
32+
33+func getTarget () = addressFromStringValue(valueOrErrorMessage(getString(this, k_target), "Target rewards address not set"))
34+
35+
36+@Callable(i)
37+func initialize (_coordinator,_target) = if (if (initialized())
38+ then true
39+ else (i.caller != this))
40+ then throw("Unable to initialize")
41+ else [StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator))), StringEntry(k_target, toString(addressFromStringValue(_target))), BooleanEntry(k_initialized, true)]
42+
43+
44+
45+@Callable(i)
46+func ackRewards () = {
47+ let rewardsInQuoteAsset = assetBalance(this, quoteAsset())
48+ if ((rewardsInQuoteAsset == rewardsInQuoteAsset))
49+ then {
50+ let doSwap = invoke(swapAddress(), "swap", [toBase58String(rewardAsset()), 0], [AttachedPayment(quoteAsset(), rewardsInQuoteAsset)])
51+ if ((doSwap == doSwap))
52+ then {
53+ let rewards = assetBalance(this, rewardAsset())
54+ if ((rewards == rewards))
55+ then [ScriptTransfer(getTarget(), rewards, rewardAsset())]
56+ else throw("Strict value is not equal to itself.")
57+ }
58+ else throw("Strict value is not equal to itself.")
59+ }
60+ else throw("Strict value is not equal to itself.")
61+ }
62+
63+
64+@Verifier(tx)
65+func verify () = {
66+ let coordinatorStr = getString(this, k_coordinatorAddress)
67+ if (isDefined(coordinatorStr))
68+ then {
69+ let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address)
70+ if (isDefined(admin))
71+ then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false)
72+ else throw("unable to verify: admin not set in coordinator")
73+ }
74+ else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
75+ }
76+

github/deemru/w8io/169f3d6 
23.10 ms