tx · 45Bt8N9suyfqKfoLjzTtKbPAHvzkQ3u9FUH9MKos9dZH 3NBwZbvD45CscLGF78qTaDRBZ7mDBHt3Yib: -0.01400000 Waves 2022.09.15 05:16 [2229602] smart account 3NBwZbvD45CscLGF78qTaDRBZ7mDBHt3Yib > SELF 0.00000000 Waves
{ "type": 13, "id": "45Bt8N9suyfqKfoLjzTtKbPAHvzkQ3u9FUH9MKos9dZH", "fee": 1400000, "feeAssetId": null, "timestamp": 1663208230453, "version": 2, "chainId": 84, "sender": "3NBwZbvD45CscLGF78qTaDRBZ7mDBHt3Yib", "senderPublicKey": "3q3N8Kv49DbzNHyTB4A87UYz2DdquXCgP3GNCcD9Zj66", "proofs": [ "24rHcxmtdW1E86nRyJgb1mCSzqX9wUidfSgebuCtATE5h18mHXq3vkCscHnXCo1KTGwh7M3pvWWKYHkPqghvVNCj" ], "script": "base64:BgJGCAISDQoLCAgICAgBCAgBAQQSBAoCCAgSBAoCCAESBAoCAQESAwoBBBIECgIICBIFCgMICAgSBAoCCAgSBAoCBAgSAwoBCD0AB3ZlcnNpb24CAzEuMAALQ09ORl9JTklUX0sCC2NvbmZpZ19pbml0AAtDT05GX0FNSU5fSwIMY29uZmlnX2FkbWluAA1DT05GX09SQUNMRV9LAg1jb25maWdfb3JhY2xlABNDT05GX0FSVFdPUktfREFQUF9LAhNjb25maWdfYXJ0d29ya19kYXBwABFDT05GX1VTRVJTX0RBUFBfSwIRY29uZmlnX3VzZXJzX2RhcHAAEENPTkZfRkVFX0FTU0VUX0sCEGNvbmZpZ19mZWVfYXNzZXQAEUNPTkZfRkVFX0FNT1VOVF9LAhFjb25maWdfZmVlX2Ftb3VudAAVQ09ORl9TV09QX1NJR05fREFQUF9LAhVjb25maWdfc3dvcF9zaWduX2RhcHAAFENPTkZfU1dPUF9FVEhfREFQUF9LAhRjb25maWdfc3dvcF9ldGhfZGFwcAAfQ09ORl9DT05GSVJNQVRJT05TX0ZST01fV0FWRVNfSwIfY29uZmlnX2NvbmZ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SW5pdAkAAgECDmRBcHAgbm90IHJlYWR5AwkBCW93bmVyT25seQEFAWkJAMwIAgkBDEJvb2xlYW5FbnRyeQIFDWRhcHBSdW5uaW5nX0sFBmlzTGl2ZQkAzAgCCQELU3RyaW5nRW50cnkCBRBtYWludGVuYW5jZU1TR19LBQdtZXNzYWdlBQNuaWwJAAIBAiJZb3UgYXJlIG5vdCBhbGxvd2VkIHRvIGNoYW5nZSB0aGlzAWkBC2RlbGV0ZUVudHJ5AQVlbnRyeQMJAQlvd25lck9ubHkBBQFpCQDMCAIJAQtEZWxldGVFbnRyeQEFBWVudHJ5BQNuaWwJAAIBAgJubwC6iG45", "height": 2229602, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2MBpJFiBayanqWMKJAbd5PozsxAJA2kqGJ7gqh2VrBNh Next: DALUtW1dMsRCquyWm8svBxVim3jk8AkrT2SUyGswHwZM Diff:
Old | New | Differences | |
---|---|---|---|
24 | 24 | let CONF_CONFIRMATIONS_FROM_WAVES_K = "config_confirmations_from_waves" | |
25 | 25 | ||
26 | 26 | let CONF_CONFIRMATIONS_FROM_ETH_K = "config_confirmations_from_eth" | |
27 | + | ||
28 | + | let CONF_AUTOSWAP_K = "config_autoswap" | |
27 | 29 | ||
28 | 30 | let dappRunning_K = "conf_dapp_is_running" | |
29 | 31 | ||
79 | 81 | let usersDapp = value(addressFromString(getStringByKey(CONF_USERS_DAPP_K))) | |
80 | 82 | ||
81 | 83 | let oracleAddr = value(addressFromString(getStringByKey(CONF_ORACLE_K))) | |
84 | + | ||
85 | + | let autoswap = valueOrElse(getBooleanByKey(CONF_AUTOSWAP_K), false) | |
82 | 86 | ||
83 | 87 | let feeAcceptedAsset = getStringByKey(CONF_FEE_ASSET_K) | |
84 | 88 | ||
184 | 188 | func setConfirmationsFunc (confirmfromWaves,confirmfromEth) = [IntegerEntry(CONF_CONFIRMATIONS_FROM_WAVES_K, confirmfromWaves), IntegerEntry(CONF_CONFIRMATIONS_FROM_ETH_K, confirmfromEth)] | |
185 | 189 | ||
186 | 190 | ||
191 | + | func setAutoSwapFunc (autoswap) = [BooleanEntry(CONF_AUTOSWAP_K, autoswap)] | |
192 | + | ||
193 | + | ||
187 | 194 | @Callable(i) | |
188 | - | func init (adminAddr,oracleAddr,artworksDapp,usersDapp,feeAsset,feeAmount,signDapp,ethDapp,confirmfromWaves,confirmfromEth) = if (ownerOnly(i)) | |
195 | + | func init (adminAddr,oracleAddr,artworksDapp,usersDapp,feeAsset,feeAmount,signDapp,ethDapp,confirmfromWaves,confirmfromEth,autoswap) = if (ownerOnly(i)) | |
189 | 196 | then { | |
190 | 197 | let setSwopDapps = setSwopDappsFunc(signDapp, ethDapp) | |
191 | 198 | let setFee = setFeeFunc(feeAsset, feeAmount) | |
192 | 199 | let setConfirmations = setConfirmationsFunc(confirmfromWaves, confirmfromEth) | |
193 | - | ((([StringEntry(CONF_AMIN_K, adminAddr), StringEntry(CONF_ORACLE_K, oracleAddr), StringEntry(CONF_ARTWORK_DAPP_K, artworksDapp), StringEntry(CONF_USERS_DAPP_K, usersDapp), BooleanEntry(CONF_INIT_K, true)] ++ setSwopDapps) ++ setFee) ++ setConfirmations) | |
200 | + | let setAutoSwap = setAutoSwapFunc(autoswap) | |
201 | + | (((([StringEntry(CONF_AMIN_K, adminAddr), StringEntry(CONF_ORACLE_K, oracleAddr), StringEntry(CONF_ARTWORK_DAPP_K, artworksDapp), StringEntry(CONF_USERS_DAPP_K, usersDapp), BooleanEntry(CONF_INIT_K, true)] ++ setSwopDapps) ++ setFee) ++ setConfirmations) ++ setAutoSwap) | |
194 | 202 | } | |
195 | 203 | else throw("Not allowed") | |
196 | 204 | ||
218 | 226 | ||
219 | 227 | ||
220 | 228 | @Callable(i) | |
229 | + | func setAutoswap (autoswap) = if (ownerOnly(i)) | |
230 | + | then setAutoSwapFunc(autoswap) | |
231 | + | else throw("Not allowed") | |
232 | + | ||
233 | + | ||
234 | + | ||
235 | + | @Callable(i) | |
221 | 236 | func lock (recipient,network) = if (!(isInit)) | |
222 | 237 | then throw("dApp not ready") | |
223 | 238 | else if (!(containsElement(NETWORKS, network))) | |
225 | 240 | else if (!(isEvmAddress(recipient))) | |
226 | 241 | then throw("Wrong recipient address") | |
227 | 242 | else { | |
228 | - | let $ | |
229 | - | let id = $ | |
230 | - | let caller = $ | |
231 | - | let date = $ | |
232 | - | let $ | |
233 | - | let nft_payment = $ | |
234 | - | let nft_amount = $ | |
235 | - | let gateway_payment = $ | |
236 | - | let gateway_amount = $ | |
243 | + | let $t072127251 = idCallerDate(i) | |
244 | + | let id = $t072127251._1 | |
245 | + | let caller = $t072127251._2 | |
246 | + | let date = $t072127251._3 | |
247 | + | let $t072547331 = isPayment(i) | |
248 | + | let nft_payment = $t072547331._1 | |
249 | + | let nft_amount = $t072547331._2 | |
250 | + | let gateway_payment = $t072547331._3 | |
251 | + | let gateway_amount = $t072547331._4 | |
237 | 252 | if ((nft_amount != 1)) | |
238 | 253 | then throw("No NFT attached") | |
239 | 254 | else { | |
242 | 257 | else false) | |
243 | 258 | then toBase58String(value(nft_payment.assetId)) | |
244 | 259 | else throw("Only SIGN Art NFT accepted.") | |
245 | - | let $ | |
246 | - | let creator = $ | |
247 | - | let artId = $ | |
260 | + | let $t076187700 = getCreatorFromNFTid(nftId) | |
261 | + | let creator = $t076187700._1 | |
262 | + | let artId = $t076187700._2 | |
248 | 263 | if (!(isValidCreator(getCreatorStatus(creator)))) | |
249 | 264 | then throw(("Creator status is :" + getCreatorStatus(creator))) | |
250 | 265 | else if (!(isValidArt(getArtStatus(artId, creator)))) | |
281 | 296 | let usdnToSwapForEth = if (isMinted) | |
282 | 297 | then gasFeeMinted | |
283 | 298 | else gasFeeNonMinted | |
284 | - | let swap_usdn_to_sign = invoke(addressFromStringValue(getStringByKey(CONF_SWOP_SIGN_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), feeAcceptedAmountForSign)]) | |
299 | + | let swap_usdn_to_sign = if (autoswap) | |
300 | + | then invoke(addressFromStringValue(getStringByKey(CONF_SWOP_SIGN_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), feeAcceptedAmountForSign)]) | |
301 | + | else unit | |
285 | 302 | if ((swap_usdn_to_sign == swap_usdn_to_sign)) | |
286 | 303 | then { | |
287 | - | let swap_usdn_to_eth = invoke(addressFromStringValue(getStringByKey(CONF_SWOP_ETH_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), usdnToSwapForEth)]) | |
304 | + | let swap_usdn_to_eth = if (autoswap) | |
305 | + | then invoke(addressFromStringValue(getStringByKey(CONF_SWOP_ETH_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), usdnToSwapForEth)]) | |
306 | + | else unit | |
288 | 307 | if ((swap_usdn_to_eth == swap_usdn_to_eth)) | |
289 | 308 | then [StringEntry(keyNFTstatus(nftId), status_PENDING), StringEntry(((keyTransferNFT(nftId, id, caller) + "_") + status_PENDING), ((((((((((((recipient + "_") + network) + "_") + caller) + "_") + id) + "_") + value(assetInfo(value(nft_payment.assetId))).name) + "_") + toString(date)) + "_") + toString(height)))] | |
290 | 309 | else throw("Strict value is not equal to itself.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "1.0" | |
5 | 5 | ||
6 | 6 | let CONF_INIT_K = "config_init" | |
7 | 7 | ||
8 | 8 | let CONF_AMIN_K = "config_admin" | |
9 | 9 | ||
10 | 10 | let CONF_ORACLE_K = "config_oracle" | |
11 | 11 | ||
12 | 12 | let CONF_ARTWORK_DAPP_K = "config_artwork_dapp" | |
13 | 13 | ||
14 | 14 | let CONF_USERS_DAPP_K = "config_users_dapp" | |
15 | 15 | ||
16 | 16 | let CONF_FEE_ASSET_K = "config_fee_asset" | |
17 | 17 | ||
18 | 18 | let CONF_FEE_AMOUNT_K = "config_fee_amount" | |
19 | 19 | ||
20 | 20 | let CONF_SWOP_SIGN_DAPP_K = "config_swop_sign_dapp" | |
21 | 21 | ||
22 | 22 | let CONF_SWOP_ETH_DAPP_K = "config_swop_eth_dapp" | |
23 | 23 | ||
24 | 24 | let CONF_CONFIRMATIONS_FROM_WAVES_K = "config_confirmations_from_waves" | |
25 | 25 | ||
26 | 26 | let CONF_CONFIRMATIONS_FROM_ETH_K = "config_confirmations_from_eth" | |
27 | + | ||
28 | + | let CONF_AUTOSWAP_K = "config_autoswap" | |
27 | 29 | ||
28 | 30 | let dappRunning_K = "conf_dapp_is_running" | |
29 | 31 | ||
30 | 32 | let maintenanceMSG_K = "conf_maintenance_msg" | |
31 | 33 | ||
32 | 34 | let dappRunning = valueOrElse(getBoolean(this, dappRunning_K), true) | |
33 | 35 | ||
34 | 36 | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSG_K), "") | |
35 | 37 | ||
36 | 38 | let status_LOCKED = "LOCKED" | |
37 | 39 | ||
38 | 40 | let status_UNLOCKED = "UNLOCKED" | |
39 | 41 | ||
40 | 42 | let status_PENDING = "PENDING" | |
41 | 43 | ||
42 | 44 | let status_CLOSED = "CLOSED" | |
43 | 45 | ||
44 | 46 | let creatorRegistered = "REGISTERED" | |
45 | 47 | ||
46 | 48 | let creatorVerified = "VERIFIED" | |
47 | 49 | ||
48 | 50 | let artFlagged = "FLAGGED" | |
49 | 51 | ||
50 | 52 | let artIllegal = "ILLEGAL" | |
51 | 53 | ||
52 | 54 | let artPending = "CHANGE_REQUIRED" | |
53 | 55 | ||
54 | 56 | let NETWORKS = ["ETH"] | |
55 | 57 | ||
56 | 58 | func keyNFTstatus (nftId) = (("nft_" + nftId) + "_status") | |
57 | 59 | ||
58 | 60 | ||
59 | 61 | func keyTransferNFT (nftId,txid,caller) = ((((("transfer_" + nftId) + "_") + txid) + "_") + caller) | |
60 | 62 | ||
61 | 63 | ||
62 | 64 | let keyFeeNonMinted = "cost_non_minted" | |
63 | 65 | ||
64 | 66 | let keyFeeMinted = "cost_minted" | |
65 | 67 | ||
66 | 68 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
67 | 69 | ||
68 | 70 | ||
69 | 71 | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
70 | 72 | ||
71 | 73 | ||
72 | 74 | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
73 | 75 | ||
74 | 76 | ||
75 | 77 | let admin = value(addressFromStringValue(getStringByKey(CONF_AMIN_K))) | |
76 | 78 | ||
77 | 79 | let artworksDapp = value(addressFromString(getStringByKey(CONF_ARTWORK_DAPP_K))) | |
78 | 80 | ||
79 | 81 | let usersDapp = value(addressFromString(getStringByKey(CONF_USERS_DAPP_K))) | |
80 | 82 | ||
81 | 83 | let oracleAddr = value(addressFromString(getStringByKey(CONF_ORACLE_K))) | |
84 | + | ||
85 | + | let autoswap = valueOrElse(getBooleanByKey(CONF_AUTOSWAP_K), false) | |
82 | 86 | ||
83 | 87 | let feeAcceptedAsset = getStringByKey(CONF_FEE_ASSET_K) | |
84 | 88 | ||
85 | 89 | let feeAcceptedAmountForSign = getIntegerByKey(CONF_FEE_AMOUNT_K) | |
86 | 90 | ||
87 | 91 | func getStringFromUsersByKey (key) = valueOrElse(getString(usersDapp, key), "") | |
88 | 92 | ||
89 | 93 | ||
90 | 94 | func getStringFromArtworksByKey (key) = valueOrElse(getString(artworksDapp, key), "") | |
91 | 95 | ||
92 | 96 | ||
93 | 97 | func getIntegerByKeyFromOracle (key) = valueOrErrorMessage(getInteger(oracleAddr, key), "Integer undefined in oracle") | |
94 | 98 | ||
95 | 99 | ||
96 | 100 | func assetIsValid (assetDetails) = if (if (if ((assetDetails.quantity == 1)) | |
97 | 101 | then (assetDetails.decimals == 0) | |
98 | 102 | else false) | |
99 | 103 | then (assetDetails.reissuable == false) | |
100 | 104 | else false) | |
101 | 105 | then (assetDetails.issuer == artworksDapp) | |
102 | 106 | else false | |
103 | 107 | ||
104 | 108 | ||
105 | 109 | func isSignArtNFT (id) = { | |
106 | 110 | let assetDetails = value(assetInfo(id)) | |
107 | 111 | assetIsValid(assetDetails) | |
108 | 112 | } | |
109 | 113 | ||
110 | 114 | ||
111 | 115 | func isPayment (i) = if ((size(i.payments) != 2)) | |
112 | 116 | then throw("Need to attach 2 payments") | |
113 | 117 | else { | |
114 | 118 | let nft_payment = value(i.payments[0]) | |
115 | 119 | let nft_amount = value(nft_payment.amount) | |
116 | 120 | let gateway_payment = value(i.payments[1]) | |
117 | 121 | let gateway_amount = value(gateway_payment.amount) | |
118 | 122 | $Tuple4(nft_payment, nft_amount, gateway_payment, gateway_amount) | |
119 | 123 | } | |
120 | 124 | ||
121 | 125 | ||
122 | 126 | let isInit = valueOrElse(getBooleanByKey(CONF_INIT_K), false) | |
123 | 127 | ||
124 | 128 | func ownerOnly (i) = { | |
125 | 129 | let caller = toString(i.caller) | |
126 | 130 | let id = toBase58String(i.transactionId) | |
127 | 131 | let allowedArr = if (isInit) | |
128 | 132 | then [toString(admin), toString(this)] | |
129 | 133 | else [toString(this)] | |
130 | 134 | containsElement(allowedArr, caller) | |
131 | 135 | } | |
132 | 136 | ||
133 | 137 | ||
134 | 138 | func idCallerDate (i) = if (!(dappRunning)) | |
135 | 139 | then throw(maintenanceMSG) | |
136 | 140 | else $Tuple3(toBase58String(i.transactionId), toBase58String(i.caller.bytes), lastBlock.timestamp) | |
137 | 141 | ||
138 | 142 | ||
139 | 143 | func getCreatorFromNFTid (nftid) = { | |
140 | 144 | let nftData = getStringFromArtworksByKey(("nft_" + nftid)) | |
141 | 145 | let creator = split(nftData, "_")[6] | |
142 | 146 | let artId = split(nftData, "_")[5] | |
143 | 147 | $Tuple2(creator, artId) | |
144 | 148 | } | |
145 | 149 | ||
146 | 150 | ||
147 | 151 | func getCreatorERC20Addr (addr) = getStringFromUsersByKey(("user_ERC20_" + addr)) | |
148 | 152 | ||
149 | 153 | ||
150 | 154 | func getCreatorStatus (addr) = getStringFromUsersByKey(("user_status_" + addr)) | |
151 | 155 | ||
152 | 156 | ||
153 | 157 | func getArtStatus (artId,addr) = getStringFromArtworksByKey(((("art_flag_" + artId) + "_") + addr)) | |
154 | 158 | ||
155 | 159 | ||
156 | 160 | func isValidCreator (status) = if ((status == creatorRegistered)) | |
157 | 161 | then true | |
158 | 162 | else (status == creatorVerified) | |
159 | 163 | ||
160 | 164 | ||
161 | 165 | func isValidArt (status) = if (if ((status != artFlagged)) | |
162 | 166 | then (status != artIllegal) | |
163 | 167 | else false) | |
164 | 168 | then (status != artPending) | |
165 | 169 | else false | |
166 | 170 | ||
167 | 171 | ||
168 | 172 | func isEvmAddress (addr) = if ((size(addr) == 42)) | |
169 | 173 | then (take(addr, 2) == "0x") | |
170 | 174 | else false | |
171 | 175 | ||
172 | 176 | ||
173 | 177 | func setSwopDappsFunc (signDapp,ethDapp) = [StringEntry(CONF_SWOP_SIGN_DAPP_K, signDapp), StringEntry(CONF_SWOP_ETH_DAPP_K, ethDapp)] | |
174 | 178 | ||
175 | 179 | ||
176 | 180 | func setFeeFunc (feeAsset,feeAmount) = { | |
177 | 181 | let assetDetails = assetInfo(fromBase58String(feeAsset)) | |
178 | 182 | let decimal = value(assetDetails).decimals | |
179 | 183 | let base10FeeAmount = pow(feeAmount, 0, 10, 1, decimal, HALFUP) | |
180 | 184 | [StringEntry(CONF_FEE_ASSET_K, feeAsset), IntegerEntry(CONF_FEE_AMOUNT_K, base10FeeAmount)] | |
181 | 185 | } | |
182 | 186 | ||
183 | 187 | ||
184 | 188 | func setConfirmationsFunc (confirmfromWaves,confirmfromEth) = [IntegerEntry(CONF_CONFIRMATIONS_FROM_WAVES_K, confirmfromWaves), IntegerEntry(CONF_CONFIRMATIONS_FROM_ETH_K, confirmfromEth)] | |
185 | 189 | ||
186 | 190 | ||
191 | + | func setAutoSwapFunc (autoswap) = [BooleanEntry(CONF_AUTOSWAP_K, autoswap)] | |
192 | + | ||
193 | + | ||
187 | 194 | @Callable(i) | |
188 | - | func init (adminAddr,oracleAddr,artworksDapp,usersDapp,feeAsset,feeAmount,signDapp,ethDapp,confirmfromWaves,confirmfromEth) = if (ownerOnly(i)) | |
195 | + | func init (adminAddr,oracleAddr,artworksDapp,usersDapp,feeAsset,feeAmount,signDapp,ethDapp,confirmfromWaves,confirmfromEth,autoswap) = if (ownerOnly(i)) | |
189 | 196 | then { | |
190 | 197 | let setSwopDapps = setSwopDappsFunc(signDapp, ethDapp) | |
191 | 198 | let setFee = setFeeFunc(feeAsset, feeAmount) | |
192 | 199 | let setConfirmations = setConfirmationsFunc(confirmfromWaves, confirmfromEth) | |
193 | - | ((([StringEntry(CONF_AMIN_K, adminAddr), StringEntry(CONF_ORACLE_K, oracleAddr), StringEntry(CONF_ARTWORK_DAPP_K, artworksDapp), StringEntry(CONF_USERS_DAPP_K, usersDapp), BooleanEntry(CONF_INIT_K, true)] ++ setSwopDapps) ++ setFee) ++ setConfirmations) | |
200 | + | let setAutoSwap = setAutoSwapFunc(autoswap) | |
201 | + | (((([StringEntry(CONF_AMIN_K, adminAddr), StringEntry(CONF_ORACLE_K, oracleAddr), StringEntry(CONF_ARTWORK_DAPP_K, artworksDapp), StringEntry(CONF_USERS_DAPP_K, usersDapp), BooleanEntry(CONF_INIT_K, true)] ++ setSwopDapps) ++ setFee) ++ setConfirmations) ++ setAutoSwap) | |
194 | 202 | } | |
195 | 203 | else throw("Not allowed") | |
196 | 204 | ||
197 | 205 | ||
198 | 206 | ||
199 | 207 | @Callable(i) | |
200 | 208 | func setSwopDapps (signDapp,ethDapp) = if (ownerOnly(i)) | |
201 | 209 | then setSwopDappsFunc(signDapp, ethDapp) | |
202 | 210 | else throw("Not allowed") | |
203 | 211 | ||
204 | 212 | ||
205 | 213 | ||
206 | 214 | @Callable(i) | |
207 | 215 | func setFee (feeAsset,feeAmount) = if (ownerOnly(i)) | |
208 | 216 | then setFeeFunc(feeAsset, feeAmount) | |
209 | 217 | else throw("Not allowed") | |
210 | 218 | ||
211 | 219 | ||
212 | 220 | ||
213 | 221 | @Callable(i) | |
214 | 222 | func setConfirmations (confirmfromWaves,confirmfromEth) = if (ownerOnly(i)) | |
215 | 223 | then setConfirmationsFunc(confirmfromWaves, confirmfromEth) | |
216 | 224 | else throw("Not allowed") | |
217 | 225 | ||
218 | 226 | ||
219 | 227 | ||
220 | 228 | @Callable(i) | |
229 | + | func setAutoswap (autoswap) = if (ownerOnly(i)) | |
230 | + | then setAutoSwapFunc(autoswap) | |
231 | + | else throw("Not allowed") | |
232 | + | ||
233 | + | ||
234 | + | ||
235 | + | @Callable(i) | |
221 | 236 | func lock (recipient,network) = if (!(isInit)) | |
222 | 237 | then throw("dApp not ready") | |
223 | 238 | else if (!(containsElement(NETWORKS, network))) | |
224 | 239 | then throw("Network not supported") | |
225 | 240 | else if (!(isEvmAddress(recipient))) | |
226 | 241 | then throw("Wrong recipient address") | |
227 | 242 | else { | |
228 | - | let $ | |
229 | - | let id = $ | |
230 | - | let caller = $ | |
231 | - | let date = $ | |
232 | - | let $ | |
233 | - | let nft_payment = $ | |
234 | - | let nft_amount = $ | |
235 | - | let gateway_payment = $ | |
236 | - | let gateway_amount = $ | |
243 | + | let $t072127251 = idCallerDate(i) | |
244 | + | let id = $t072127251._1 | |
245 | + | let caller = $t072127251._2 | |
246 | + | let date = $t072127251._3 | |
247 | + | let $t072547331 = isPayment(i) | |
248 | + | let nft_payment = $t072547331._1 | |
249 | + | let nft_amount = $t072547331._2 | |
250 | + | let gateway_payment = $t072547331._3 | |
251 | + | let gateway_amount = $t072547331._4 | |
237 | 252 | if ((nft_amount != 1)) | |
238 | 253 | then throw("No NFT attached") | |
239 | 254 | else { | |
240 | 255 | let nftId = if (if (isDefined(nft_payment.assetId)) | |
241 | 256 | then isSignArtNFT(value(nft_payment.assetId)) | |
242 | 257 | else false) | |
243 | 258 | then toBase58String(value(nft_payment.assetId)) | |
244 | 259 | else throw("Only SIGN Art NFT accepted.") | |
245 | - | let $ | |
246 | - | let creator = $ | |
247 | - | let artId = $ | |
260 | + | let $t076187700 = getCreatorFromNFTid(nftId) | |
261 | + | let creator = $t076187700._1 | |
262 | + | let artId = $t076187700._2 | |
248 | 263 | if (!(isValidCreator(getCreatorStatus(creator)))) | |
249 | 264 | then throw(("Creator status is :" + getCreatorStatus(creator))) | |
250 | 265 | else if (!(isValidArt(getArtStatus(artId, creator)))) | |
251 | 266 | then throw(("Artwork status is :" + getArtStatus(artId, creator))) | |
252 | 267 | else { | |
253 | 268 | let erc20Addr = getCreatorERC20Addr(creator) | |
254 | 269 | if ((size(erc20Addr) == 0)) | |
255 | 270 | then throw("This artist didn't allow crosschain transfer") | |
256 | 271 | else { | |
257 | 272 | let nftStatus = getStringByKey(keyNFTstatus(nftId)) | |
258 | 273 | if (if ((nftStatus == status_LOCKED)) | |
259 | 274 | then true | |
260 | 275 | else (nftStatus == status_PENDING)) | |
261 | 276 | then throw("NFT already locked") | |
262 | 277 | else { | |
263 | 278 | let gasFeeNonMinted = getIntegerByKeyFromOracle(keyFeeNonMinted) | |
264 | 279 | let gasFeeMinted = getIntegerByKeyFromOracle(keyFeeMinted) | |
265 | 280 | let isMinted = if ((nftStatus == status_UNLOCKED)) | |
266 | 281 | then true | |
267 | 282 | else false | |
268 | 283 | if (if (!(isDefined(gateway_payment.assetId))) | |
269 | 284 | then true | |
270 | 285 | else (toBase58String(value(gateway_payment.assetId)) != feeAcceptedAsset)) | |
271 | 286 | then throw("Wrong payment asset") | |
272 | 287 | else if (if (isMinted) | |
273 | 288 | then (gateway_amount > (gasFeeMinted + feeAcceptedAmountForSign)) | |
274 | 289 | else false) | |
275 | 290 | then throw("Wrong payment amount to unlock") | |
276 | 291 | else if (if (!(isMinted)) | |
277 | 292 | then (gateway_amount > (gasFeeNonMinted + feeAcceptedAmountForSign)) | |
278 | 293 | else false) | |
279 | 294 | then throw("Wrong payment amount to mint and unlock") | |
280 | 295 | else { | |
281 | 296 | let usdnToSwapForEth = if (isMinted) | |
282 | 297 | then gasFeeMinted | |
283 | 298 | else gasFeeNonMinted | |
284 | - | let swap_usdn_to_sign = invoke(addressFromStringValue(getStringByKey(CONF_SWOP_SIGN_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), feeAcceptedAmountForSign)]) | |
299 | + | let swap_usdn_to_sign = if (autoswap) | |
300 | + | then invoke(addressFromStringValue(getStringByKey(CONF_SWOP_SIGN_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), feeAcceptedAmountForSign)]) | |
301 | + | else unit | |
285 | 302 | if ((swap_usdn_to_sign == swap_usdn_to_sign)) | |
286 | 303 | then { | |
287 | - | let swap_usdn_to_eth = invoke(addressFromStringValue(getStringByKey(CONF_SWOP_ETH_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), usdnToSwapForEth)]) | |
304 | + | let swap_usdn_to_eth = if (autoswap) | |
305 | + | then invoke(addressFromStringValue(getStringByKey(CONF_SWOP_ETH_DAPP_K)), "exchange", [1], [AttachedPayment(fromBase58String(feeAcceptedAsset), usdnToSwapForEth)]) | |
306 | + | else unit | |
288 | 307 | if ((swap_usdn_to_eth == swap_usdn_to_eth)) | |
289 | 308 | then [StringEntry(keyNFTstatus(nftId), status_PENDING), StringEntry(((keyTransferNFT(nftId, id, caller) + "_") + status_PENDING), ((((((((((((recipient + "_") + network) + "_") + caller) + "_") + id) + "_") + value(assetInfo(value(nft_payment.assetId))).name) + "_") + toString(date)) + "_") + toString(height)))] | |
290 | 309 | else throw("Strict value is not equal to itself.") | |
291 | 310 | } | |
292 | 311 | else throw("Strict value is not equal to itself.") | |
293 | 312 | } | |
294 | 313 | } | |
295 | 314 | } | |
296 | 315 | } | |
297 | 316 | } | |
298 | 317 | } | |
299 | 318 | ||
300 | 319 | ||
301 | 320 | ||
302 | 321 | @Callable(i) | |
303 | 322 | func confirmLock (nftId,transferId,caller) = if (!(isInit)) | |
304 | 323 | then throw("dApp not ready") | |
305 | 324 | else if (ownerOnly(i)) | |
306 | 325 | then { | |
307 | 326 | let nftStatus = getStringByKey(keyNFTstatus(nftId)) | |
308 | 327 | if ((nftStatus != status_PENDING)) | |
309 | 328 | then throw("NFT not pending") | |
310 | 329 | else { | |
311 | 330 | let val = getStringByKey(((keyTransferNFT(nftId, transferId, caller) + "_") + status_PENDING)) | |
312 | 331 | let newKey = ((keyTransferNFT(nftId, transferId, caller) + "_") + status_CLOSED) | |
313 | 332 | [DeleteEntry(((keyTransferNFT(nftId, transferId, caller) + "_") + status_PENDING)), StringEntry(newKey, val), StringEntry(keyNFTstatus(nftId), status_LOCKED)] | |
314 | 333 | } | |
315 | 334 | } | |
316 | 335 | else throw("Not allowed") | |
317 | 336 | ||
318 | 337 | ||
319 | 338 | ||
320 | 339 | @Callable(i) | |
321 | 340 | func unlock (recipient,nftId) = if (!(isInit)) | |
322 | 341 | then throw("dApp not ready") | |
323 | 342 | else if (ownerOnly(i)) | |
324 | 343 | then { | |
325 | 344 | let nftStatus = getStringByKey(keyNFTstatus(nftId)) | |
326 | 345 | if ((nftStatus != status_LOCKED)) | |
327 | 346 | then throw("NFT not locked, finalize first if pending") | |
328 | 347 | else [StringEntry(keyNFTstatus(nftId), status_UNLOCKED), ScriptTransfer(Address(fromBase58String(recipient)), 1, fromBase58String(nftId))] | |
329 | 348 | } | |
330 | 349 | else throw("Not allowed") | |
331 | 350 | ||
332 | 351 | ||
333 | 352 | ||
334 | 353 | @Callable(i) | |
335 | 354 | func appRunning (isLive,message) = if (!(isInit)) | |
336 | 355 | then throw("dApp not ready") | |
337 | 356 | else if (ownerOnly(i)) | |
338 | 357 | then [BooleanEntry(dappRunning_K, isLive), StringEntry(maintenanceMSG_K, message)] | |
339 | 358 | else throw("You are not allowed to change this") | |
340 | 359 | ||
341 | 360 | ||
342 | 361 | ||
343 | 362 | @Callable(i) | |
344 | 363 | func deleteEntry (entry) = if (ownerOnly(i)) | |
345 | 364 | then [DeleteEntry(entry)] | |
346 | 365 | else throw("no") | |
347 | 366 | ||
348 | 367 |
github/deemru/w8io/026f985 47.23 ms ◑