tx · 8Q2hfFUEPB6bRbkozvMoe2tQMRhGC1u871s49R8Kdccf 3MwwNAS3s7KWEHUDWqJweEunEUFFbFc2wy3: -0.03400000 Waves 2022.06.29 18:10 [2117887] smart account 3MwwNAS3s7KWEHUDWqJweEunEUFFbFc2wy3 > SELF 0.00000000 Waves
{ "type": 13, "id": "8Q2hfFUEPB6bRbkozvMoe2tQMRhGC1u871s49R8Kdccf", "fee": 3400000, "feeAssetId": null, "timestamp": 1656515410183, "version": 2, "chainId": 84, "sender": "3MwwNAS3s7KWEHUDWqJweEunEUFFbFc2wy3", "senderPublicKey": "Fu3i4An4joTi1K9yh95ggZZtnGDAoDhdWCnKa1NHNoPF", "proofs": [ "2PCqbhgqKiGygmNSGem8nPgGiRKNyHRPggaMedxMHZZokP5ouodY1Ho4b3VxKzmpSataWjDmXH4eavg8Z5PM6Lcb" ], "script": "base64:AAIFAAAAAAAAACcIAhIDCgEIEgMKAQgSBAoCCAgSAwoBCBIECgIICBIDCgEIEgMKAQgAAAAQAAAAABNrX2luc3VyYW5jZV9hZGRyZXNzAgAAABNrX2luc3VyYW5jZV9hZGRyZXNzAAAAAA9rX2FkbWluX2FkZHJlc3MCAAAAD2tfYWRtaW5fYWRkcmVzcwAAAAASa19hZG1pbl9wdWJsaWNfa2V5AgAAABJrX2FkbWluX3B1YmxpY19rZXkAAAAADWtfcXVvdGVfYXNzZXQCAAAADWtfcXVvdGVfYXNzZXQAAAAAD2tfcXVvdGVfc3Rha2luZwIAAAAPa19xdW90ZV9zdGFraW5nAAAAABFrX3N0YWtpbmdfYWRkcmVzcwIAAAARa19zdGFraW5nX2FkZHJlc3MAAAAABWtfYW1tAgAAAAVrX2FtbQAAAAAKa19hbW1fZGF0YQIAAAAKa19hbW1fZGF0YQAAAAASa19nb3Zlcm5hbmNlX2Fzc2V0AgAAAAtrX2dvdl9hc3NldAEAAAAOdG9Db21wb3NpdGVLZXkAAAACAAAABF9rZXkAAAAIX2FkZHJlc3MJAAEsAAAAAgkAAS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JZAkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkBAAAAB2lzQWRtaW4AAAABBQAAAAFpBAAAAAphc3NldEJ5dGVzCQACWQAAAAEFAAAACF9hc3NldElkBAAAAAckbWF0Y2gwCQAD7AAAAAEFAAAACmFzc2V0Qnl0ZXMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABUFzc2V0BAAAAAVhc3NldAUAAAAHJG1hdGNoMAMJAQAAAAIhPQAAAAIIBQAAAAVhc3NldAAAAAhkZWNpbWFscwAAAAAAAAAACAkAAAIAAAABAgAAACJJbnZhbGlkIGFzc2V0IGRlY2ltYWxzLCBzaG91bCBiZSA4CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIFAAAAEmtfZ292ZXJuYW5jZV9hc3NldAUAAAAIX2Fzc2V0SWQFAAAAA25pbAkAAAIAAAABAgAAABBDYW4ndCBmaW5kIGFzc2V0AAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAJAAJZAAAAAQkBAAAADmFkbWluUHVibGljS2V5AAAAAPraG3w=", "height": 2117887, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let k_insurance_address = "k_insurance_address" | |
5 | + | ||
6 | + | let k_admin_address = "k_admin_address" | |
7 | + | ||
8 | + | let k_admin_public_key = "k_admin_public_key" | |
9 | + | ||
10 | + | let k_quote_asset = "k_quote_asset" | |
11 | + | ||
12 | + | let k_quote_staking = "k_quote_staking" | |
13 | + | ||
14 | + | let k_staking_address = "k_staking_address" | |
15 | + | ||
16 | + | let k_amm = "k_amm" | |
17 | + | ||
18 | + | let k_amm_data = "k_amm_data" | |
19 | + | ||
20 | + | let k_governance_asset = "k_gov_asset" | |
21 | + | ||
22 | + | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
23 | + | ||
24 | + | ||
25 | + | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
26 | + | ||
27 | + | ||
28 | + | func adminPublicKey () = getStringValue(this, k_admin_public_key) | |
29 | + | ||
30 | + | ||
31 | + | func isNoAdmin () = (getString(this, k_admin_address) == unit) | |
32 | + | ||
33 | + | ||
34 | + | func admin () = addressFromStringValue(valueOrErrorMessage(getString(this, k_admin_address), "Admin not defined")) | |
35 | + | ||
36 | + | ||
37 | + | func isNoAdminOrAdmin (i) = if (if (isNoAdmin()) | |
38 | + | then true | |
39 | + | else (i.caller == admin())) | |
40 | + | then unit | |
41 | + | else throw("Only the Admin itself can invoke this function") | |
42 | + | ||
43 | + | ||
44 | + | func isAdmin (i) = if ((i.caller == admin())) | |
45 | + | then unit | |
46 | + | else throw("Only the Admin itself can invoke this function") | |
47 | + | ||
48 | + | ||
49 | + | @Callable(i) | |
50 | + | func setAdmin (_adminPublicKey) = valueOrElse(isNoAdminOrAdmin(i), { | |
51 | + | let bytes = fromBase58String(_adminPublicKey) | |
52 | + | let address = addressFromPublicKey(bytes) | |
53 | + | [StringEntry(k_admin_address, toString(address)), StringEntry(k_admin_public_key, _adminPublicKey)] | |
54 | + | }) | |
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | @Callable(i) | |
59 | + | func setInsuranceFund (_insuranceFund) = valueOrElse(isAdmin(i), { | |
60 | + | let address = getAddressIfValid(_insuranceFund) | |
61 | + | [StringEntry(k_insurance_address, address)] | |
62 | + | }) | |
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | @Callable(i) | |
67 | + | func setQuoteAsset (_assetId,_stakingAddress) = valueOrElse(isAdmin(i), { | |
68 | + | let stakingAddress = getAddressIfValid(_stakingAddress) | |
69 | + | [StringEntry(k_quote_asset, _assetId), StringEntry(k_quote_staking, _stakingAddress)] | |
70 | + | }) | |
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | @Callable(i) | |
75 | + | func setStakingAddress (_stakingAddress) = valueOrElse(isAdmin(i), { | |
76 | + | let stakingAddress = getAddressIfValid(_stakingAddress) | |
77 | + | [StringEntry(k_staking_address, _stakingAddress)] | |
78 | + | }) | |
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | @Callable(i) | |
83 | + | func addAmm (_ammAddress,_data) = valueOrElse(isAdmin(i), { | |
84 | + | let ammAddress = getAddressIfValid(_ammAddress) | |
85 | + | [BooleanEntry(toCompositeKey(k_amm, _ammAddress), true), StringEntry(toCompositeKey(k_amm_data, _ammAddress), _data)] | |
86 | + | }) | |
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func removeAmm (_ammAddress) = valueOrElse(isAdmin(i), [DeleteEntry(toCompositeKey(k_amm, _ammAddress))]) | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(i) | |
96 | + | func setGovernanceAsset (_assetId) = valueOrElse(isAdmin(i), { | |
97 | + | let assetBytes = fromBase58String(_assetId) | |
98 | + | match assetInfo(assetBytes) { | |
99 | + | case asset: Asset => | |
100 | + | if ((asset.decimals != 8)) | |
101 | + | then throw("Invalid asset decimals, shoul be 8") | |
102 | + | else [StringEntry(k_governance_asset, _assetId)] | |
103 | + | case _ => | |
104 | + | throw("Can't find asset") | |
105 | + | } | |
106 | + | }) | |
107 | + | ||
108 | + | ||
109 | + | @Verifier(tx) | |
110 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(adminPublicKey())) | |
111 | + |
github/deemru/w8io/026f985 22.90 ms ◑