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