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