tx · 4i1yD1SHJt1d9mFag9GBM2GLozbM8REQagurGnH4mdk1 3MqkoGVxf9wAeNTiksudck7HuNKruh3W9yg: -0.04000000 Waves 2021.08.24 01:15 [1671563] smart account 3MqkoGVxf9wAeNTiksudck7HuNKruh3W9yg > SELF 0.00000000 Waves
{ "type": 13, "id": "4i1yD1SHJt1d9mFag9GBM2GLozbM8REQagurGnH4mdk1", "fee": 4000000, "feeAssetId": null, "timestamp": 1629757002431, "version": 2, "chainId": 84, "sender": "3MqkoGVxf9wAeNTiksudck7HuNKruh3W9yg", "senderPublicKey": "4adRtnahFnRGxzn67XppfF97pKLyUFPtNw5aCZ4NM9UV", "proofs": [ "43Fra1jYmXgnKcVsofffznPQu1ZJgRAZD2pyD1ao6r9d1sM1pXAvNd7wFsf9gLEfAFhKXzcDyy6hNQ7uiens6zyL" ], "script": "base64:AAIFAAAAAAAAABgIAhIECgIIGBIDCgEIEgMKAQgSBAoCCAQAAAAHAAAAAAZjb25maWcJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAABmNvbmZpZwIAAAAAAAAAAAVhZG1pbgMJAQAAAAIhPQAAAAIFAAAABmNvbmZpZwIAAAAACQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAAZjb25maWcCAAAABWFkbWluAgAAAAACAAAAAAAAAAAFcG9vbHMJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAAVwb29scwIAAAAWTm8ga2V5IGFkbWluIHdhcyBmb3VuZAEAAAAHaXNBZG1pbgAAAAEAAAANY2FsbGVyQWRkcmVzcwMJAAAAAAAAAgUAAAANY2FsbGVyQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAFYWRtaW4G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2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAF0CQACWQAAAAEFAAAAB3Rva2VuSWQFAAAAA25pbAkAAAIAAAABAgAAABhJbmNvcnJlY3QgaW52b2tlIHJlc3VsdCEJAAACAAAAAQIAAAAUTm8gcGF5bWVudCBhdHRhY2hlZCEJAAACAAAAAQIAAAAXUG9vbCBhZGRyZXNzIG5vdCBmb3VuZCEAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlee78Oa8=", "height": 1671563, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3mq7iRczuz5gY9dc4mpYpZhMZu5p7Qkrid46Hp71C2x7 Next: 4Uh1wmrHXoMKXfQd6i6M8CvWta84kmeSo3U5FSjtnNiA Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let config = valueOrElse(getStringValue(this, "config"), "") | |
5 | 5 | ||
6 | - | let admin = valueOrElse(getStringValue(addressFromStringValue(config), "admin"), "") | |
6 | + | let admin = if ((config != "")) | |
7 | + | then valueOrElse(getStringValue(addressFromStringValue(config), "admin"), "") | |
8 | + | else "" | |
7 | 9 | ||
8 | 10 | let pools = valueOrErrorMessage(getString(this, "pools"), "No key admin was found") | |
9 | 11 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let config = valueOrElse(getStringValue(this, "config"), "") | |
5 | 5 | ||
6 | - | let admin = valueOrElse(getStringValue(addressFromStringValue(config), "admin"), "") | |
6 | + | let admin = if ((config != "")) | |
7 | + | then valueOrElse(getStringValue(addressFromStringValue(config), "admin"), "") | |
8 | + | else "" | |
7 | 9 | ||
8 | 10 | let pools = valueOrErrorMessage(getString(this, "pools"), "No key admin was found") | |
9 | 11 | ||
10 | 12 | func isAdmin (callerAddress) = if ((callerAddress == addressFromStringValue(admin))) | |
11 | 13 | then true | |
12 | 14 | else false | |
13 | 15 | ||
14 | 16 | ||
15 | 17 | func checkPool (poolAdd) = if (contains(pools, poolAdd)) | |
16 | 18 | then true | |
17 | 19 | else false | |
18 | 20 | ||
19 | 21 | ||
20 | 22 | func writeString (key,stringValue) = StringEntry(key, stringValue) | |
21 | 23 | ||
22 | 24 | ||
23 | 25 | func writeInteger (key,integerValue) = IntegerEntry(key, integerValue) | |
24 | 26 | ||
25 | 27 | ||
26 | 28 | @Callable(i) | |
27 | 29 | func setup (configAddress,pools) = if (if (isAdmin(i.caller)) | |
28 | 30 | then true | |
29 | 31 | else (0 >= size(admin))) | |
30 | 32 | then [writeString("config", configAddress), writeString("poolsStrg", makeString(pools, ";"))] | |
31 | 33 | else throw("Address does not match with admin address!") | |
32 | 34 | ||
33 | 35 | ||
34 | 36 | ||
35 | 37 | @Callable(i) | |
36 | 38 | func addPool (poolAddress) = if (isAdmin(i.caller)) | |
37 | 39 | then { | |
38 | 40 | let poolList = split(pools, ";") | |
39 | 41 | if ((containsElement(poolList, poolAddress) == false)) | |
40 | 42 | then { | |
41 | 43 | let newPools = (poolList :+ poolAddress) | |
42 | 44 | [writeString("pools", makeString(newPools, ";"))] | |
43 | 45 | } | |
44 | 46 | else throw("Pool already exists!") | |
45 | 47 | } | |
46 | 48 | else throw("Address does not match with admin address!") | |
47 | 49 | ||
48 | 50 | ||
49 | 51 | ||
50 | 52 | @Callable(i) | |
51 | 53 | func updateConfig (configAddress) = if (isAdmin(i.caller)) | |
52 | 54 | then [writeString("config", configAddress)] | |
53 | 55 | else throw("Address does not match with admin address!") | |
54 | 56 | ||
55 | 57 | ||
56 | 58 | ||
57 | 59 | @Callable(i) | |
58 | 60 | func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress)) | |
59 | 61 | then if ((size(i.payments) > 0)) | |
60 | 62 | then { | |
61 | 63 | let user = toBase58String(i.caller.bytes) | |
62 | 64 | let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments) | |
63 | 65 | let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId") | |
64 | 66 | match tokenAmount { | |
65 | 67 | case t: Int => | |
66 | 68 | [ScriptTransfer(i.caller, t, fromBase58String(tokenId))] | |
67 | 69 | case _ => | |
68 | 70 | throw("Incorrect invoke result!") | |
69 | 71 | } | |
70 | 72 | } | |
71 | 73 | else throw("No payment attached!") | |
72 | 74 | else throw("Pool address not found!") | |
73 | 75 | ||
74 | 76 | ||
75 | 77 | @Verifier(tx) | |
76 | 78 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
77 | 79 |
github/deemru/w8io/169f3d6 33.96 ms ◑