tx · 8jSxQqL33eMYYrkGFpGcNJ2w1f83qRvmjZXrw5KzpXHb

3MyMC1oyYfZhnak1Qksw3ej7T9sg6SX3UXt:  -0.01000000 Waves

2024.12.06 12:48 [3402623] smart account 3MyMC1oyYfZhnak1Qksw3ej7T9sg6SX3UXt > SELF 0.00000000 Waves

{ "type": 13, "id": "8jSxQqL33eMYYrkGFpGcNJ2w1f83qRvmjZXrw5KzpXHb", "fee": 1000000, "feeAssetId": null, "timestamp": 1733478565876, "version": 2, "chainId": 84, "sender": "3MyMC1oyYfZhnak1Qksw3ej7T9sg6SX3UXt", "senderPublicKey": "EFDfQebmbkF8GGi4koUSZCKmRHdSsRCwfN14QBjdrmqp", "proofs": [ "3rPawaq7EhVrWfnw3WExWmKTBT1uTeWxUEuQktqUY2HRMPBrfgvkc2au1YM8ZdreL7uGS58qG9z2fQzoBBZLGWVT" ], "script": "base64:CAIcCAISBwoFCAEBCAgSAwoBCBIGCgQICAEIEgASACIABk9SQUNMRQkBEUBleHRyTmF0aXZlKDEwNjIpAQkBEUBleHRyTmF0aXZlKDEwNTMpAgUEdGhpcwIGb3JhY2xlAAdrQWN0aXZlAgZhY3RpdmUAC2tBY3RpdmVHbG9iAhRhY3RpdmVfYWxsX2NvbnRyYWN0cwAGa0NhdXNlAg5zaHV0ZG93bl9jYXVzZQAIa0Zhcm1pbmcCD2Zhcm1pbmdfYWRkcmVzcwAHa1NXT1BpZAIHU1dPUF9pZAAOa01pblN3b3BBbW91bnQCF21pbl9wYXltbmV0X3N3b3BfYW1vdW50ABBrQnJpZGdlRmVlQW1vdW50AgpicmlkZ2VfZmVlAA9rVW5pdHNUb0FkZHJlc3MCDXVuaXRzX3NlbmRfdG8ADmtVbml0c1RvQW1vdW50AhR1bml0c19zZW5kX3RvX2Ftb3VudAAOa1N3b3BXYXZlc1Bvb2wCD3N3b3Bfd2F2ZXNfcG9vbAAMa1NlbmRUb1dhdmVzAgt0eF9pZF91bml0XwAJa1ZlcmlmaWVyAhF0b193Y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NpZ25lZAUSYWRtaW5QdWJLZXkyU2lnbmVkBRJhZG1pblB1YktleTNTaWduZWQFF2FkbWluUHViS2V5SW52b2tlU2lnbmVkAAEDAwMFDWlzU2VuZFRvV2F2ZXMFCmlzUmlnaHRGZWUHBRBzaWduZWRCeU9uZUFkbWluBwYFCG11bHRpc2lnBQhtdWx0aXNpZ4ex6R4=", "height": 3402623, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 8 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let ORACLE = addressFromStringValue(getStringValue(this, "oracle"))
5+
6+let kActive = "active"
7+
8+let kActiveGlob = "active_all_contracts"
9+
10+let kCause = "shutdown_cause"
11+
12+let kFarming = "farming_address"
13+
14+let kSWOPid = "SWOP_id"
15+
16+let kMinSwopAmount = "min_paymnet_swop_amount"
17+
18+let kBridgeFeeAmount = "bridge_fee"
19+
20+let kUnitsToAddress = "units_send_to"
21+
22+let kUnitsToAmount = "units_send_to_amount"
23+
24+let kSwopWavesPool = "swop_waves_pool"
25+
26+let kSendToWaves = "tx_id_unit_"
27+
28+let kVerifier = "to_waves_verifier"
29+
30+let kAdminPubKey1 = "admin_pub_1"
31+
32+let kAdminPubKey2 = "admin_pub_2"
33+
34+let kAdminPubKey3 = "admin_pub_3"
35+
36+let kAdminInvokePubKey = "admin_invoke_pub"
37+
38+func getBase58FromOracle (key) = match getString(ORACLE, key) {
39+ case string: String =>
40+ fromBase58String(string)
41+ case nothing =>
42+ throw((key + "is empty"))
43+}
44+
45+
46+let adminPubKey1 = getBase58FromOracle(kAdminPubKey1)
47+
48+let adminPubKey2 = getBase58FromOracle(kAdminPubKey2)
49+
50+let adminPubKey3 = getBase58FromOracle(kAdminPubKey3)
51+
52+let adminInvoke = getBase58FromOracle(kAdminInvokePubKey)
53+
54+let FARMING = addressFromStringValue(getStringValue(ORACLE, kFarming))
55+
56+let SWOP = fromBase58String(getStringValue(FARMING, kSWOPid))
57+
58+let MIN_PAY_SWOP_AMOUNT = getIntegerValue(this, kMinSwopAmount)
59+
60+let SWPOOL = addressFromStringValue(getStringValue(this, kSwopWavesPool))
61+
62+let bridgeFee = getIntegerValue(this, kBridgeFeeAmount)
63+
64+let active = valueOrElse(getBoolean(this, kActive), true)
65+
66+let activeGlob = valueOrElse(getBoolean(ORACLE, kActiveGlob), true)
67+
68+func isActive () = if (if (active)
69+ then activeGlob
70+ else false)
71+ then unit
72+ else throw("DApp is inactive at this moment")
73+
74+
75+func isSelfCall (i) = if ((i.caller == this))
76+ then unit
77+ else throw("Only contract itself can call this function")
78+
79+
80+func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))
81+ then unit
82+ else throw("Only admin can call this function")
83+
84+
85+func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
86+
87+
88+func exchangeFeeToWaves (amount) = invoke(SWPOOL, "callFunction", ["exchange", [1]], [AttachedPayment(SWOP, amount)])
89+
90+
91+@Callable(i)
92+func init (oracle,minSwopPaymentAmount,bridgeFeeAmount,swopWavesPool,verifier) = if (isDefined(getString(this, "oracle")))
93+ then throw("already inited")
94+ else [StringEntry("oracle", oracle), IntegerEntry(kMinSwopAmount, minSwopPaymentAmount), IntegerEntry(kBridgeFeeAmount, bridgeFeeAmount), StringEntry(kSwopWavesPool, swopWavesPool), BinaryEntry(kVerifier, fromBase58String(verifier)), BooleanEntry(kActive, true)]
95+
96+
97+
98+@Callable(i)
99+func sendToUnit (address) = if ((size(i.payments) != 1))
100+ then throw("Need 1 paymnet with SWOP token")
101+ else {
102+ let $t028312912 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
103+ let paymentAmount = $t028312912._1
104+ let paymentAsset = $t028312912._2
105+ if ((paymentAsset != SWOP))
106+ then throw("You can pay only with SWOP token")
107+ else if ((size(address) != 42))
108+ then throw("Wrong Unit0 adddress")
109+ else if ((indexOf(address, "0x") != 0))
110+ then throw("Wrong Unit0 adddress it must be started from 0x")
111+ else if ((MIN_PAY_SWOP_AMOUNT > paymentAmount))
112+ then throw(("Min bridge amount is " + toString(MIN_PAY_SWOP_AMOUNT)))
113+ else {
114+ let amountToSend = (paymentAmount - bridgeFee)
115+ let inv = exchangeFeeToWaves(bridgeFee)
116+ if ((inv == inv))
117+ then [StringEntry(kUnitsToAddress, address), IntegerEntry(kUnitsToAmount, amountToSend)]
118+ else throw("Strict value is not equal to itself.")
119+ }
120+ }
121+
122+
123+
124+@Callable(i)
125+func sendToWaves (address,txId,amount,sign) = valueOrElse(isSelfCall(i), if (isDefined(getBoolean(this, (kSendToWaves + txId))))
126+ then throw("Already send")
127+ else {
128+ let m = toBytes(((address + txId) + toString(amount)))
129+ if (!(sigVerify(m, fromBase58String(sign), getBinaryValue(this, kVerifier))))
130+ then throw("Wrong signature")
131+ else {
132+ let addr = addressFromStringValue(address)
133+[ScriptTransfer(addr, amount, unit), BooleanEntry((kSendToWaves + txId), true)]
134+ }
135+ })
136+
137+
138+
139+@Callable(i)
140+func shutdown () = valueOrElse(isAdminCall(i), if (!(active))
141+ then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
142+ else suspend("Paused by admin"))
143+
144+
145+
146+@Callable(i)
147+func activate () = valueOrElse(isAdminCall(i), if (active)
148+ then throw("DApp is already active")
149+ else [BooleanEntry(kActive, true), DeleteEntry(kCause)])
150+
151+
152+@Verifier(tx)
153+func verify () = {
154+ let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1))
155+ then 1
156+ else 0
157+ let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2))
158+ then 1
159+ else 0
160+ let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3))
161+ then 1
162+ else 0
163+ let multisig = (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2)
164+ match tx {
165+ case inv: InvokeScriptTransaction =>
166+ let isRightFee = if ((inv.fee == 900000))
167+ then (inv.feeAssetId == unit)
168+ else false
169+ let isSendToWaves = (inv.function == "sendToWaves")
170+ let adminPubKeyInvokeSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminInvoke))
171+ then 1
172+ else 0
173+ let signedByOneAdmin = ((((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) + adminPubKeyInvokeSigned) >= 1)
174+ if (if (if (isSendToWaves)
175+ then isRightFee
176+ else false)
177+ then signedByOneAdmin
178+ else false)
179+ then true
180+ else multisig
181+ case _ =>
182+ multisig
183+ }
184+ }
185+

github/deemru/w8io/026f985 
13.87 ms