tx · GBeJ1L9rCZjwps4Wj8VmifAWSKqHiTeKXW7cDryaC14D 3N3sjhLSBU5duySKvnNuKe5S2YNebk2Pxye: -0.01300000 Waves 2023.05.10 13:07 [2571648] smart account 3N3sjhLSBU5duySKvnNuKe5S2YNebk2Pxye > SELF 0.00000000 Waves
{ "type": 13, "id": "GBeJ1L9rCZjwps4Wj8VmifAWSKqHiTeKXW7cDryaC14D", "fee": 1300000, "feeAssetId": null, "timestamp": 1683713318316, "version": 2, "chainId": 84, "sender": "3N3sjhLSBU5duySKvnNuKe5S2YNebk2Pxye", "senderPublicKey": "Cm17BFEPG286HnXKy3BbrJ8QYz8AbCqoWfUi8rKwHo12", "proofs": [ "2Q1JU4Q2eynXXDRRYCPZvq1tsXP7bRqigFapn4Q6CbebGEyf32thueZb3T5r3gEPYR7Q8CgGp3y7hiE5fWEo43gn" ], "script": "base64:BgIECAISAA0BE2tleUludmVzdFd4WHRuRGVsYXkAAhMlX19pbnZlc3RXeFh0bkRlbGF5ARdrZXlJbnZlc3RXeFh0bkFtb3VudFh0bgACFyVfX2ludmVzdFd4WHRuQW1vdW50WHRuAQxrZXlXeFh0blBvb2wAAgwlX193eFh0blBvb2wBDWtleVh0bkFzc2V0SWQAAg0lX194dG5Bc3NldElkAQprZXlXeFh0bkxwAAIKJV9fd3hYdG5McAEOa2V5THBUb0FkZHJlc3MAAg4lX19scFRvQWRkcmVzcwETa2V5TWFuYWdlclB1YmxpY0tleQACFCVzX19tYW5hZ2VyUHVibGljS2V5ARZrZXlNYW5hZ2VyVmF1bHRBZGRyZXNzAAIXJXNfX21hbmFnZXJWYXVsdEFkZHJlc3MBGGtleUludmVzdFd4WHRuTGFzdEhlaWdodAACGCVfX2ludmVzdFd4WHRuTGFzdEhlaWdodAEcZ2V0TWFuYWdlclZhdWx0QWRkcmVzc09yVGhpcwAEByRtYXRjaDAJAKIIAQkBFmtleU1hbmFnZXJWYXVsdEFkZHJlc3MAAwkAAQIFByRtYXRjaDACBlN0cmluZwQ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U3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQPdGFyZ2V0UHVibGljS2V5BAckbWF0Y2gwCQEWbWFuYWdlclB1YmxpY0tleU9yVW5pdAADCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCcGsFByRtYXRjaDAFAnBrAwkAAQIFByRtYXRjaDACBFVuaXQIBQJ0eA9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUPdGFyZ2V0UHVibGljS2V5fPlqYg==", "height": 2571648, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BYkD7ugUjVNmjnuadJaYqbnrfExy6gwx8FpUW9xNPwUp Next: none Diff:
Old | New | Differences | |
---|---|---|---|
28 | 28 | func keyInvestWxXtnLastHeight () = "%__investWxXtnLastHeight" | |
29 | 29 | ||
30 | 30 | ||
31 | - | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
31 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
32 | + | case s: String => | |
33 | + | addressFromStringValue(s) | |
34 | + | case _ => | |
35 | + | this | |
36 | + | } | |
32 | 37 | ||
33 | 38 | ||
34 | 39 | func managerPublicKeyOrUnit () = { | |
35 | - | let managerVaultAddress = | |
40 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
36 | 41 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
37 | 42 | case s: String => | |
38 | 43 | fromBase58String(s) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func keyInvestWxXtnDelay () = "%__investWxXtnDelay" | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func keyInvestWxXtnAmountXtn () = "%__investWxXtnAmountXtn" | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func keyWxXtnPool () = "%__wxXtnPool" | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func keyXtnAssetId () = "%__xtnAssetId" | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func keyWxXtnLp () = "%__wxXtnLp" | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func keyLpToAddress () = "%__lpToAddress" | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func keyInvestWxXtnLastHeight () = "%__investWxXtnLastHeight" | |
29 | 29 | ||
30 | 30 | ||
31 | - | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
31 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
32 | + | case s: String => | |
33 | + | addressFromStringValue(s) | |
34 | + | case _ => | |
35 | + | this | |
36 | + | } | |
32 | 37 | ||
33 | 38 | ||
34 | 39 | func managerPublicKeyOrUnit () = { | |
35 | - | let managerVaultAddress = | |
40 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
36 | 41 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
37 | 42 | case s: String => | |
38 | 43 | fromBase58String(s) | |
39 | 44 | case _: Unit => | |
40 | 45 | unit | |
41 | 46 | case _ => | |
42 | 47 | throw("Match error") | |
43 | 48 | } | |
44 | 49 | } | |
45 | 50 | ||
46 | 51 | ||
47 | 52 | func throwErr (msg) = throw(makeString(["investor.ride:", msg], " ")) | |
48 | 53 | ||
49 | 54 | ||
50 | 55 | func mustManager (i) = { | |
51 | 56 | let pd = throwErr("permission denied") | |
52 | 57 | match managerPublicKeyOrUnit() { | |
53 | 58 | case pk: ByteVector => | |
54 | 59 | if ((i.callerPublicKey == pk)) | |
55 | 60 | then true | |
56 | 61 | else pd | |
57 | 62 | case _: Unit => | |
58 | 63 | if ((i.caller == this)) | |
59 | 64 | then true | |
60 | 65 | else pd | |
61 | 66 | case _ => | |
62 | 67 | throw("Match error") | |
63 | 68 | } | |
64 | 69 | } | |
65 | 70 | ||
66 | 71 | ||
67 | 72 | @Callable(i) | |
68 | 73 | func investWxXtn () = { | |
69 | 74 | let checkCaller = mustManager(i) | |
70 | 75 | if ((checkCaller == checkCaller)) | |
71 | 76 | then { | |
72 | 77 | let lastCall = valueOrElse(getInteger(keyInvestWxXtnLastHeight()), 0) | |
73 | 78 | let delay = getIntegerValue(keyInvestWxXtnDelay()) | |
74 | 79 | let checks = [if ((height > (lastCall + delay))) | |
75 | 80 | then true | |
76 | 81 | else throwErr("wait to invest")] | |
77 | 82 | if ((checks == checks)) | |
78 | 83 | then { | |
79 | 84 | let lpAssetId = fromBase58String(getStringValue(keyWxXtnLp())) | |
80 | 85 | let lpBefore = assetBalance(this, lpAssetId) | |
81 | 86 | if ((lpBefore == lpBefore)) | |
82 | 87 | then { | |
83 | 88 | let inv = invoke(addressFromStringValue(getStringValue(keyWxXtnPool())), "putOneTkn", [0, false], [AttachedPayment(fromBase58String(getStringValue(keyXtnAssetId())), getIntegerValue(keyInvestWxXtnAmountXtn()))]) | |
84 | 89 | if ((inv == inv)) | |
85 | 90 | then { | |
86 | 91 | let lpAfter = assetBalance(this, lpAssetId) | |
87 | 92 | if ((lpAfter == lpAfter)) | |
88 | 93 | then { | |
89 | 94 | let lpGot = (lpAfter - lpBefore) | |
90 | 95 | let notZeroLp = if ((lpGot == 0)) | |
91 | 96 | then throwErr("lp to get is zero") | |
92 | 97 | else unit | |
93 | 98 | if ((notZeroLp == notZeroLp)) | |
94 | 99 | then [IntegerEntry(keyInvestWxXtnLastHeight(), height), ScriptTransfer(addressFromStringValue(getStringValue(keyLpToAddress())), lpGot, lpAssetId)] | |
95 | 100 | else throw("Strict value is not equal to itself.") | |
96 | 101 | } | |
97 | 102 | else throw("Strict value is not equal to itself.") | |
98 | 103 | } | |
99 | 104 | else throw("Strict value is not equal to itself.") | |
100 | 105 | } | |
101 | 106 | else throw("Strict value is not equal to itself.") | |
102 | 107 | } | |
103 | 108 | else throw("Strict value is not equal to itself.") | |
104 | 109 | } | |
105 | 110 | else throw("Strict value is not equal to itself.") | |
106 | 111 | } | |
107 | 112 | ||
108 | 113 | ||
109 | 114 | @Verifier(tx) | |
110 | 115 | func verify () = { | |
111 | 116 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
112 | 117 | case pk: ByteVector => | |
113 | 118 | pk | |
114 | 119 | case _: Unit => | |
115 | 120 | tx.senderPublicKey | |
116 | 121 | case _ => | |
117 | 122 | throw("Match error") | |
118 | 123 | } | |
119 | 124 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
120 | 125 | } | |
121 | 126 |
github/deemru/w8io/169f3d6 36.39 ms ◑