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