tx · FHF5FKAXpSvdXWszKWj1wUKEUJetHXDAorCXymAchgdg 3MqqcLhm76wiWz5KLfLDST8MXPufuunLUMN: -0.01100000 Waves 2024.09.20 06:36 [3291437] smart account 3MqqcLhm76wiWz5KLfLDST8MXPufuunLUMN > SELF 0.00000000 Waves
{ "type": 13, "id": "FHF5FKAXpSvdXWszKWj1wUKEUJetHXDAorCXymAchgdg", "fee": 1100000, "feeAssetId": null, "timestamp": 1726803407549, "version": 2, "chainId": 84, "sender": "3MqqcLhm76wiWz5KLfLDST8MXPufuunLUMN", "senderPublicKey": "7Ho7tSsDi1wFzsLjrEXbGRtsfps2kpEqLkQiDtJ1KbUf", "proofs": [ "5AyxFUfWMMu4uatJJWM8hAbvvnppgC2vPeTHxZvKq7ozq1NPhj4kv4AAG2qPkuk76CXvUpjDhwkAYN7MG7ytRZYM" ], "script": "base64:AAIFAAAAAAAAACcIAhIECgIICBIECgIECBIECgIICBIECgIICBIGCgQBCAgIEgMKAQgAAAAQAQAAAAlnZXRTdHJCeUsAAAABAAAAA2tleQkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkBAAAACWdldEludEJ5SwAAAAEAAAADa2V5CQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQAAAAALYmFpX2Fzc2V0aWQBAAAAIJPhcjhxBJtq6JpjHwQkt2RTlyw+vGYLg3SvaLskjeJCAAAAAAphZG1pbl9hZGRyCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUTLfve1EjrcSTZbnarq+rhHq1VvziySxAAAAAAA9ub25fY2lyY3VsYXRpbmcJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVTsajDaiz3SDMXD/foB97kPVKepkwKDR7sAAAAADmRhcHBSdW5uaW5nS2V5AgAAABRjb25mX2RhcHBfaXNfcnVubmluZwAAAAARbWFpbnRlbmFuY2VNU0dLZXkCAAAAFGNvbmZfbWFpbnRlbmFuY2VfbXNnAAAAAAtkYXBwUnVubmluZwkBAAAAC3ZhbHVlT3JFbHNl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AAALZGVsZXRlRW50cnkAAAABAAAABWVudHJ5BAAAAAskdDA1MzI0NTM2MwkBAAAADGlkQ2FsbGVyRGF0ZQAAAAEFAAAAAWkEAAAAAmlkCAUAAAALJHQwNTMyNDUzNjMAAAACXzEEAAAABmNhbGxlcggFAAAACyR0MDUzMjQ1MzYzAAAAAl8yBAAAAARkYXRlCAUAAAALJHQwNTMyNDUzNjMAAAACXzMDCQAAAAAAAAIFAAAABmNhbGxlcgkABCUAAAABBQAAAAphZG1pbl9hZGRyCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAABWVudHJ5BQAAAANuaWwJAAACAAAAAQIAAAACbm8AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlef+RfBo=", "height": 3291437, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 82o3UoXUbf2eN7u4yo4VTuKTwTfKPyCzTTPtewRY5u2a Next: 6B7zNTGW948CF2DomoPr8N8yT3adK3pkiLT5oUjg87kh Diff:
Old | New | Differences | |
---|---|---|---|
85 | 85 | then throw("Cannot bridge non positive amount!") | |
86 | 86 | else if (!(containsElement(supported_recipients_network, recipient_network))) | |
87 | 87 | then throw("Recipient network not supported") | |
88 | - | else [StringEntry(((((((((id + "_") + caller) + "_") + recipient_address) + "_") + recipient_network) + "_") + STATUS_PENDING), ((((((((caller + "_") + toString((amount - service_fee))) + "_") + recipient_address) + "_") + recipient_network) + "_") + toString(height)))] | |
88 | + | else [StringEntry(((((((((("DEPOSIT_" + id) + "_") + caller) + "_") + recipient_address) + "_") + recipient_network) + "_") + STATUS_PENDING), ((((((((caller + "_") + toString((amount - service_fee))) + "_") + recipient_address) + "_") + recipient_network) + "_") + toString(height)))] | |
89 | 89 | } | |
90 | 90 | } | |
91 | 91 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func finalize (data_key_without_status,recipient_tx_txhash) = { | |
96 | - | let $ | |
97 | - | let id = $ | |
98 | - | let caller = $ | |
99 | - | let date = $ | |
96 | + | let $t031813220 = idCallerDate(i) | |
97 | + | let id = $t031813220._1 | |
98 | + | let caller = $t031813220._2 | |
99 | + | let date = $t031813220._3 | |
100 | 100 | if (containsElement([toString(admin_addr), toString(this)], caller)) | |
101 | 101 | then { | |
102 | 102 | let data = valueOrElse(getStrByK(((data_key_without_status + "_") + STATUS_PENDING)), "") | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(i) | |
123 | + | func withdraw (amount,recipient_address,sourceChain,sourceChainDepositTxId) = if ((valueOrElse(getStrByK(((((("WITHDRAW_" + sourceChainDepositTxId) + "_") + recipient_address) + "_") + sourceChain)), "") != "")) | |
124 | + | then throw("Withdraw already processed.") | |
125 | + | else { | |
126 | + | let $t045044543 = idCallerDate(i) | |
127 | + | let id = $t045044543._1 | |
128 | + | let caller = $t045044543._2 | |
129 | + | let date = $t045044543._3 | |
130 | + | if (containsElement([toString(admin_addr), toString(this)], caller)) | |
131 | + | then { | |
132 | + | let bai_balance_before = valueOrElse(assetBalance(this, bai_assetid), 0) | |
133 | + | if ((bai_balance_before == bai_balance_before)) | |
134 | + | then { | |
135 | + | let swap = invoke(non_circulating, "withdraw", [amount], nil) | |
136 | + | if ((swap == swap)) | |
137 | + | then { | |
138 | + | let bai_balance_after = valueOrElse(assetBalance(this, bai_assetid), 0) | |
139 | + | if ((bai_balance_after == bai_balance_after)) | |
140 | + | then if (((bai_balance_after - bai_balance_before) == amount)) | |
141 | + | then [ScriptTransfer(Address(fromBase58String(recipient_address)), amount, bai_assetid), IntegerEntry(((((("WITHDRAW_" + sourceChainDepositTxId) + "_") + recipient_address) + "_") + sourceChain), amount)] | |
142 | + | else throw("Something went wrong during non circulating amount withdraw.") | |
143 | + | else throw("Strict value is not equal to itself.") | |
144 | + | } | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | else throw("You are not allowed to change this") | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | @Callable(i) | |
123 | 155 | func deleteEntry (entry) = { | |
124 | - | let $ | |
125 | - | let id = $ | |
126 | - | let caller = $ | |
127 | - | let date = $ | |
156 | + | let $t053245363 = idCallerDate(i) | |
157 | + | let id = $t053245363._1 | |
158 | + | let caller = $t053245363._2 | |
159 | + | let date = $t053245363._3 | |
128 | 160 | if ((caller == toString(admin_addr))) | |
129 | 161 | then [DeleteEntry(entry)] | |
130 | 162 | else throw("no") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStrByK (key) = getString(this, key) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getIntByK (key) = getInteger(this, key) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | let bai_assetid = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
11 | 11 | ||
12 | 12 | let admin_addr = Address(base58'3MvujUZTtoANRzrKYKzx99Vtb9TUh6VPCDm') | |
13 | 13 | ||
14 | 14 | let non_circulating = Address(base58'3NBU8TThHH5YUSk26iGEGU1jHM7vSR3ZTPx') | |
15 | 15 | ||
16 | 16 | let dappRunningKey = "conf_dapp_is_running" | |
17 | 17 | ||
18 | 18 | let maintenanceMSGKey = "conf_maintenance_msg" | |
19 | 19 | ||
20 | 20 | let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true) | |
21 | 21 | ||
22 | 22 | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "") | |
23 | 23 | ||
24 | 24 | let STATUS_PENDING = "PENDING" | |
25 | 25 | ||
26 | 26 | let STATUS_PROCESSED = "PROCESSED" | |
27 | 27 | ||
28 | 28 | let supported_recipients_network = split(valueOrElse(getStrByK("supported_recipients_network"), "bnb_base"), "_") | |
29 | 29 | ||
30 | 30 | let confirmations_required = valueOrElse(getIntByK("confirmations_required"), 5) | |
31 | 31 | ||
32 | 32 | let service_fee = valueOrElse(getIntByK("service_fee"), 25000000) | |
33 | 33 | ||
34 | 34 | func getPaymentData (i) = if ((size(i.payments) == 0)) | |
35 | 35 | then throw("No payment attached") | |
36 | 36 | else { | |
37 | 37 | let payment = value(i.payments[0]) | |
38 | 38 | let amount = value(payment.amount) | |
39 | 39 | let asset = value(payment.assetId) | |
40 | 40 | $Tuple2(amount, asset) | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func idCallerDate (i) = if (!(dappRunning)) | |
45 | 45 | then throw(maintenanceMSG) | |
46 | 46 | else $Tuple3(toBase58String(i.transactionId), toBase58String(i.caller.bytes), lastBlock.timestamp) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Callable(invoke) | |
50 | 50 | func setConf (key,val) = { | |
51 | 51 | let caller = toString(invoke.caller) | |
52 | 52 | if (containsElement([toString(admin_addr), toString(this)], caller)) | |
53 | 53 | then [StringEntry(key, val)] | |
54 | 54 | else throw("You are not allowed to change this") | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(i) | |
60 | 60 | func appRunning (isLive,message) = { | |
61 | 61 | let $t021182157 = idCallerDate(i) | |
62 | 62 | let id = $t021182157._1 | |
63 | 63 | let caller = $t021182157._2 | |
64 | 64 | let date = $t021182157._3 | |
65 | 65 | if (containsElement([toString(admin_addr), toString(this)], caller)) | |
66 | 66 | then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)] | |
67 | 67 | else throw("You are not allowed to change this") | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | 72 | @Callable(i) | |
73 | 73 | func deposit (recipient_address,recipient_network) = { | |
74 | 74 | let $t024862525 = getPaymentData(i) | |
75 | 75 | let amount = $t024862525._1 | |
76 | 76 | let asset = $t024862525._2 | |
77 | 77 | if ((asset != bai_assetid)) | |
78 | 78 | then throw("Only BAI token accepted") | |
79 | 79 | else { | |
80 | 80 | let $t026082647 = idCallerDate(i) | |
81 | 81 | let id = $t026082647._1 | |
82 | 82 | let caller = $t026082647._2 | |
83 | 83 | let date = $t026082647._3 | |
84 | 84 | if ((0 >= (amount - service_fee))) | |
85 | 85 | then throw("Cannot bridge non positive amount!") | |
86 | 86 | else if (!(containsElement(supported_recipients_network, recipient_network))) | |
87 | 87 | then throw("Recipient network not supported") | |
88 | - | else [StringEntry(((((((((id + "_") + caller) + "_") + recipient_address) + "_") + recipient_network) + "_") + STATUS_PENDING), ((((((((caller + "_") + toString((amount - service_fee))) + "_") + recipient_address) + "_") + recipient_network) + "_") + toString(height)))] | |
88 | + | else [StringEntry(((((((((("DEPOSIT_" + id) + "_") + caller) + "_") + recipient_address) + "_") + recipient_network) + "_") + STATUS_PENDING), ((((((((caller + "_") + toString((amount - service_fee))) + "_") + recipient_address) + "_") + recipient_network) + "_") + toString(height)))] | |
89 | 89 | } | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func finalize (data_key_without_status,recipient_tx_txhash) = { | |
96 | - | let $ | |
97 | - | let id = $ | |
98 | - | let caller = $ | |
99 | - | let date = $ | |
96 | + | let $t031813220 = idCallerDate(i) | |
97 | + | let id = $t031813220._1 | |
98 | + | let caller = $t031813220._2 | |
99 | + | let date = $t031813220._3 | |
100 | 100 | if (containsElement([toString(admin_addr), toString(this)], caller)) | |
101 | 101 | then { | |
102 | 102 | let data = valueOrElse(getStrByK(((data_key_without_status + "_") + STATUS_PENDING)), "") | |
103 | 103 | if ((data == "")) | |
104 | 104 | then throw("Request not found") | |
105 | 105 | else { | |
106 | 106 | let amount = valueOrElse(parseInt(split(data, "_")[1]), 0) | |
107 | 107 | if ((0 > amount)) | |
108 | 108 | then throw("Cannot transfer non positive amount") | |
109 | 109 | else { | |
110 | 110 | let deposit_height = valueOrElse(parseInt(split(data, "_")[4]), 0) | |
111 | 111 | if ((confirmations_required > (height - deposit_height))) | |
112 | 112 | then throw("Required confirmation not reached.") | |
113 | 113 | else [DeleteEntry(((data_key_without_status + "_") + STATUS_PENDING)), StringEntry(((data_key_without_status + "_") + STATUS_PROCESSED), ((data + "_") + recipient_tx_txhash)), ScriptTransfer(non_circulating, amount, bai_assetid)] | |
114 | 114 | } | |
115 | 115 | } | |
116 | 116 | } | |
117 | 117 | else throw("You are not allowed to change this") | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(i) | |
123 | + | func withdraw (amount,recipient_address,sourceChain,sourceChainDepositTxId) = if ((valueOrElse(getStrByK(((((("WITHDRAW_" + sourceChainDepositTxId) + "_") + recipient_address) + "_") + sourceChain)), "") != "")) | |
124 | + | then throw("Withdraw already processed.") | |
125 | + | else { | |
126 | + | let $t045044543 = idCallerDate(i) | |
127 | + | let id = $t045044543._1 | |
128 | + | let caller = $t045044543._2 | |
129 | + | let date = $t045044543._3 | |
130 | + | if (containsElement([toString(admin_addr), toString(this)], caller)) | |
131 | + | then { | |
132 | + | let bai_balance_before = valueOrElse(assetBalance(this, bai_assetid), 0) | |
133 | + | if ((bai_balance_before == bai_balance_before)) | |
134 | + | then { | |
135 | + | let swap = invoke(non_circulating, "withdraw", [amount], nil) | |
136 | + | if ((swap == swap)) | |
137 | + | then { | |
138 | + | let bai_balance_after = valueOrElse(assetBalance(this, bai_assetid), 0) | |
139 | + | if ((bai_balance_after == bai_balance_after)) | |
140 | + | then if (((bai_balance_after - bai_balance_before) == amount)) | |
141 | + | then [ScriptTransfer(Address(fromBase58String(recipient_address)), amount, bai_assetid), IntegerEntry(((((("WITHDRAW_" + sourceChainDepositTxId) + "_") + recipient_address) + "_") + sourceChain), amount)] | |
142 | + | else throw("Something went wrong during non circulating amount withdraw.") | |
143 | + | else throw("Strict value is not equal to itself.") | |
144 | + | } | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | else throw("You are not allowed to change this") | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | @Callable(i) | |
123 | 155 | func deleteEntry (entry) = { | |
124 | - | let $ | |
125 | - | let id = $ | |
126 | - | let caller = $ | |
127 | - | let date = $ | |
156 | + | let $t053245363 = idCallerDate(i) | |
157 | + | let id = $t053245363._1 | |
158 | + | let caller = $t053245363._2 | |
159 | + | let date = $t053245363._3 | |
128 | 160 | if ((caller == toString(admin_addr))) | |
129 | 161 | then [DeleteEntry(entry)] | |
130 | 162 | else throw("no") | |
131 | 163 | } | |
132 | 164 | ||
133 | 165 | ||
134 | 166 | @Verifier(tx) | |
135 | 167 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
136 | 168 |
github/deemru/w8io/026f985 39.79 ms ◑