tx · wBSNTnWS4ZUHhVQsJ2CwiMGtiyUaivUiH2KCPVDjYRA 3N9k318h2ENuEEpdnbbCutHFturyWV5cYbS: -0.00400000 Waves 2022.12.20 11:41 [2368387] smart account 3N9k318h2ENuEEpdnbbCutHFturyWV5cYbS > SELF 0.00000000 Waves
{ "type": 13, "id": "wBSNTnWS4ZUHhVQsJ2CwiMGtiyUaivUiH2KCPVDjYRA", "fee": 400000, "feeAssetId": null, "timestamp": 1671525709003, "version": 2, "chainId": 84, "sender": "3N9k318h2ENuEEpdnbbCutHFturyWV5cYbS", "senderPublicKey": "9rYc4nEfXVoMDuyU1cQ4HvuBthy5hcmFNjVBgiJ29EWv", "proofs": [ "5VCjFNzR9WX2X7FJaYM5r6isSJR5Y11gRQW35iLBcTSzVintqHAC1asjCHv1nbwE58X3j1YnRszrjxrjvKoTgVvQ" ], "script": "base64:BgIhCAISBAoCAQgSBAoCCAgSAwoBBBIDCgEIEgMKAQgSABIAEwAPa1ByZWZpeFBvb2xOYW1lAgVwb29sXwAFa1BhaXICBXBhaXJfAAlrQXNzZXRJZEECCkFfYXNzZXRfaWQACWtBc3NldElkQgIKQl9hc3NldF9pZAAfa0xhdW5jaHBhZERhdGFUcmFuc2FjdGlvblN0YXR1cwIhbGF1bmNocGFkX2RhdGFfdHJhbnNhY3Rpb25fc3RhdHVzABNrQWN0aXZlQWxsQ29udHJhY3RzAhRhY3RpdmVfYWxsX2NvbnRyYWN0cwAMa0FkbWluUHViS2V5AgphZG1pbl9wdWJfAA1rQWRtaW5QdWJLZXkxAgthZG1pbl9wdWJfMQANa0FkbWluUHViS2V5MgILYWRtaW5fcHViXzIADWtBZG1pblB1YktleTMCC2FkbWluX3B1Yl8zABRrQWNoaWV2ZW1lbnRzV3JpdGVycwIUYWNoaWV2ZW1lbnRzX3dyaXRlcnMADGFkbWluUHViS2V5MQkA2QQBCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBQ1rQWRtaW5QdWJLZXkxAAxhZG1pblB1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xpc3QJAMwIAgkBC1N0cmluZ0VudHJ5AgUUa0FjaGlldmVtZW50c1dyaXRlcnMJALkJAgkA0QgCBQd3cml0ZXJzBQVpbmRleAIBLAUDbmlsAWkBFHNodXRkb3duQWxsQ29udHJhY3RzAAkBC3ZhbHVlT3JFbHNlAgkBC2lzQWRtaW5DYWxsAQUBaQMJAQEhAQUSYWN0aXZlQWxsQ29udHJhY3RzCQACAQIeQWxsIGNvbnRyYWN0cyBhbHJlYWR5IHNodXRkb3duCQDMCAIJAQxCb29sZWFuRW50cnkCBRNrQWN0aXZlQWxsQ29udHJhY3RzBwUDbmlsAWkBFGFjdGl2YXRlQWxsQ29udHJhY3RzAAkBC3ZhbHVlT3JFbHNlAgkBC2lzQWRtaW5DYWxsAQUBaQMFEmFjdGl2ZUFsbENvbnRyYWN0cwkAAgECHEFsbCBjb250cmFjdHMgYWxyZWFkeSBhY3RpdmUJAMwIAgkBDEJvb2xlYW5FbnRyeQIFE2tBY3RpdmVBbGxDb250cmFjdHMGBQNuaWwBAnR4AQZ2ZXJpZnkABBJhZG1pblB1YktleTFTaWduZWQDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQxhZG1pblB1YktleTEAAQAABBJhZG1pblB1YktleTJTaWduZWQDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwABBQxhZG1pblB1YktleTIAAQAABBJhZG1pblB1YktleTNTaWduZWQDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwACBQxhZG1pblB1YktleTMAAQAACQBnAgkAZAIJAGQCBRJhZG1pblB1YktleTFTaWduZWQFEmFkbWluUHViS2V5MlNpZ25lZAUSYWRtaW5QdWJLZXkzU2lnbmVkAALx0cxr", "height": 2368387, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let kPrefixPoolName = "pool_" | |
5 | + | ||
6 | + | let kPair = "pair_" | |
7 | + | ||
8 | + | let kAssetIdA = "A_asset_id" | |
9 | + | ||
10 | + | let kAssetIdB = "B_asset_id" | |
11 | + | ||
12 | + | let kLaunchpadDataTransactionStatus = "launchpad_data_transaction_status" | |
13 | + | ||
14 | + | let kActiveAllContracts = "active_all_contracts" | |
15 | + | ||
16 | + | let kAdminPubKey = "admin_pub_" | |
17 | + | ||
18 | + | let kAdminPubKey1 = "admin_pub_1" | |
19 | + | ||
20 | + | let kAdminPubKey2 = "admin_pub_2" | |
21 | + | ||
22 | + | let kAdminPubKey3 = "admin_pub_3" | |
23 | + | ||
24 | + | let kAchievementsWriters = "achievements_writers" | |
25 | + | ||
26 | + | let adminPubKey1 = fromBase58String(getStringValue(this, kAdminPubKey1)) | |
27 | + | ||
28 | + | let adminPubKey2 = fromBase58String(getStringValue(this, kAdminPubKey2)) | |
29 | + | ||
30 | + | let adminPubKey3 = fromBase58String(getStringValue(this, kAdminPubKey3)) | |
31 | + | ||
32 | + | let activeAllContracts = getBooleanValue(this, kActiveAllContracts) | |
33 | + | ||
34 | + | func isSelfCall (i) = if ((i.caller == this)) | |
35 | + | then unit | |
36 | + | else throw("Only the Oracle itself can invoke this function") | |
37 | + | ||
38 | + | ||
39 | + | func getPoolType (poolAddress) = { | |
40 | + | let version = valueOrErrorMessage(getString(poolAddress, "version"), "Pool is not initialized") | |
41 | + | if ((version == "1.0.0")) | |
42 | + | then "cpmm" | |
43 | + | else if ((version == "2.0.0")) | |
44 | + | then "flat" | |
45 | + | else if ((version == "3.0.0")) | |
46 | + | then "multycurve" | |
47 | + | else throw("Unknown version of pool") | |
48 | + | } | |
49 | + | ||
50 | + | ||
51 | + | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
52 | + | ||
53 | + | ||
54 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
55 | + | then unit | |
56 | + | else throw("Only admin can call this function") | |
57 | + | ||
58 | + | ||
59 | + | @Callable(i) | |
60 | + | func setAdmin (adminId,adminPubKey) = valueOrElse(isSelfCall(i), if (if ((0 > adminId)) | |
61 | + | then (adminId > 3) | |
62 | + | else false) | |
63 | + | then throw("Wrong admin id") | |
64 | + | else [StringEntry((kAdminPubKey + toString(adminId)), adminPubKey)]) | |
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | @Callable(i) | |
69 | + | func addPool (poolAddress,poolName) = valueOrElse(isAdminCall(i), { | |
70 | + | let validatedAddress = getAddressIfValid(poolAddress) | |
71 | + | let keyName = (kPrefixPoolName + validatedAddress) | |
72 | + | let possiblyAlreadyAddedPool = getString(this, keyName) | |
73 | + | if (isDefined(possiblyAlreadyAddedPool)) | |
74 | + | then throw((((("Pool with address \"" + validatedAddress) + "\" is already defined with name \"") + value(possiblyAlreadyAddedPool)) + "\"")) | |
75 | + | else ([StringEntry(keyName, poolName)] ++ (if ((getPoolType(value(addressFromString(poolAddress))) == "multycurve")) | |
76 | + | then nil | |
77 | + | else { | |
78 | + | let assetIdA = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), kAssetIdA), "Asset id A is incorrect") | |
79 | + | let assetIdB = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), kAssetIdB), "Asset id B is incorrect") | |
80 | + | [StringEntry((((kPair + assetIdA) + "_") + assetIdB), poolAddress)] | |
81 | + | })) | |
82 | + | }) | |
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | @Callable(i) | |
87 | + | func launchpadDataTransactionStatus (status) = valueOrElse(isAdminCall(i), [BooleanEntry(kLaunchpadDataTransactionStatus, status)]) | |
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | @Callable(i) | |
92 | + | func addAchievementsWriter (address) = valueOrElse(isAdminCall(i), { | |
93 | + | let writers = valueOrElse(getString(this, kAchievementsWriters), "") | |
94 | + | let data = if ((writers == "")) | |
95 | + | then nil | |
96 | + | else split(writers, ",") | |
97 | + | [StringEntry(kAchievementsWriters, makeString((data :+ address), ","))] | |
98 | + | }) | |
99 | + | ||
100 | + | ||
101 | + | ||
102 | + | @Callable(i) | |
103 | + | func removeAchievementsWriter (address) = valueOrElse(isAdminCall(i), { | |
104 | + | let writers = split(valueOrElse(getString(this, kAchievementsWriters), ""), ",") | |
105 | + | let index = valueOrErrorMessage(indexOf(writers, address), "Can't find address in the list") | |
106 | + | [StringEntry(kAchievementsWriters, makeString(removeByIndex(writers, index), ","))] | |
107 | + | }) | |
108 | + | ||
109 | + | ||
110 | + | ||
111 | + | @Callable(i) | |
112 | + | func shutdownAllContracts () = valueOrElse(isAdminCall(i), if (!(activeAllContracts)) | |
113 | + | then throw("All contracts already shutdown") | |
114 | + | else [BooleanEntry(kActiveAllContracts, false)]) | |
115 | + | ||
116 | + | ||
117 | + | ||
118 | + | @Callable(i) | |
119 | + | func activateAllContracts () = valueOrElse(isAdminCall(i), if (activeAllContracts) | |
120 | + | then throw("All contracts already active") | |
121 | + | else [BooleanEntry(kActiveAllContracts, true)]) | |
122 | + | ||
123 | + | ||
124 | + | @Verifier(tx) | |
125 | + | func verify () = { | |
126 | + | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
127 | + | then 1 | |
128 | + | else 0 | |
129 | + | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
130 | + | then 1 | |
131 | + | else 0 | |
132 | + | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
133 | + | then 1 | |
134 | + | else 0 | |
135 | + | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
136 | + | } | |
137 | + |
github/deemru/w8io/169f3d6 19.88 ms ◑