tx · 5YRSkvKCoaWLTcMa66jE9RFQFiruP4SbBUUA96RKw8KQ 3NBwZbvD45CscLGF78qTaDRBZ7mDBHt3Yib: -0.01400000 Waves 2022.06.02 11:32 [2078486] smart account 3NBwZbvD45CscLGF78qTaDRBZ7mDBHt3Yib > SELF 0.00000000 Waves
{ "type": 13, "id": "5YRSkvKCoaWLTcMa66jE9RFQFiruP4SbBUUA96RKw8KQ", "fee": 1400000, "feeAssetId": null, "timestamp": 1654158790581, "version": 2, "chainId": 84, "sender": "3NBwZbvD45CscLGF78qTaDRBZ7mDBHt3Yib", "senderPublicKey": "3q3N8Kv49DbzNHyTB4A87UYz2DdquXCgP3GNCcD9Zj66", "proofs": [ "34Q85q4Y2FL9McFxXqppcEJ1T3MXFmbCaeweLHYpZPataXbWMxhYRFg57RYDAyNiBEwGmtnaP94vHgwWmbays4Ey" ], "script": "base64:AAIFAAAAAAAAACEIAhIFCgMICAgSBAoCCAgSBAoCCAgSBAoCCAgSBAoCBAgAAAAcAAAAAAtDT05GX0lOSVRfSwIAAAALY29uZmlnX2luaXQAAAAAC0NPTkZfQU1JTl9LAgAAAAxjb25maWdfYWRtaW4AAAAADUNPTkZfT1JBQ0xFX0sCAAAADWNvbmZpZ19vcmFjbGUAAAAAE0NPTkZfQVJUV09SS19EQVBQX0sCAAAAE2NvbmZpZ19hcnR3b3JrX2RhcHAAAAAADmRhcHBSdW5uaW5nS2V5AgAAABRjb25mX2RhcHBfaXNfcnVubmluZwAAAAARbWFpbnRlbmFuY2VNU0dLZXkCAAAAFGNvbmZfbWFpbnRlbmFuY2VfbXNnAAAAAAtkYXBwUnVubmluZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAR0aGlzBQAAAA5kYXBwUnVubmluZ0tleQYAAAAADm1haW50ZW5hbmNlTVNHCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAEW1haW50ZW5hbmNlTVNHS2V5AgAAAAAAAAAADX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IGxvY2tlZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAAMa2V5TkZUc3RhdHVzAAAAAQUAAAAFbmZ0SWQFAAAAD3N0YXR1c19VTkxPQ0tFRAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAHQWRkcmVzcwAAAAEJAAJZAAAAAQUAAAAJcmVjaXBpZW50AAAAAAAAAAABCQACWQAAAAEFAAAABW5mdElkBQAAAANuaWwJAAACAAAAAQIAAAALTm90IGFsbG93ZWQAAAABaQEAAAAKYXBwUnVubmluZwAAAAIAAAAGaXNMaXZlAAAAB21lc3NhZ2UDCQEAAAABIQAAAAEFAAAABmlzSW5pdAkAAAIAAAABAgAAAA5kQXBwIG5vdCByZWFkeQMJAQAAAAlvd25lck9ubHkAAAABBQAAAAFpCQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACBQAAAA5kYXBwUnVubmluZ0tleQUAAAAGaXNMaXZlCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIFAAAAEW1haW50ZW5hbmNlTVNHS2V5BQAAAAdtZXNzYWdlBQAAAANuaWwJAAACAAAAAQIAAAAiWW91IGFyZSBub3QgYWxsb3dlZCB0byBjaGFuZ2UgdGhpcwAAAAB9P9qz", "height": 2078486, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2P2QEJsy7nMsbB7D4viQtLEzGp3jfWFyJxfubYvBjfGP Next: 6AxGwZiYtYUPJHGrnr4ipykByvmedSvHP1uYc1bvh9Sx Diff:
Old | New | Differences | |
---|---|---|---|
42 | 42 | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
43 | 43 | ||
44 | 44 | ||
45 | - | let admin = value(addressFromString(getStringByKey(CONF_AMIN_K))) | |
45 | + | let admin = value(addressFromString(valueOrElse(getStringByKey(CONF_AMIN_K), ""))) | |
46 | 46 | ||
47 | 47 | let artworksDapp = value(addressFromString(getStringByKey(CONF_ARTWORK_DAPP_K))) | |
48 | 48 | ||
106 | 106 | else if (!(containsElement(NETWORKS, network))) | |
107 | 107 | then throw("Network not supported") | |
108 | 108 | else { | |
109 | - | let $ | |
110 | - | let id = $ | |
111 | - | let caller = $ | |
112 | - | let date = $ | |
113 | - | let $ | |
114 | - | let nft_payment = $ | |
115 | - | let nft_amount = $ | |
116 | - | let gateway_payment = $ | |
117 | - | let gateway_amount = $ | |
109 | + | let $t030553094 = idCallerDate(i) | |
110 | + | let id = $t030553094._1 | |
111 | + | let caller = $t030553094._2 | |
112 | + | let date = $t030553094._3 | |
113 | + | let $t030973174 = isPayment(i) | |
114 | + | let nft_payment = $t030973174._1 | |
115 | + | let nft_amount = $t030973174._2 | |
116 | + | let gateway_payment = $t030973174._3 | |
117 | + | let gateway_amount = $t030973174._4 | |
118 | 118 | if ((nft_amount != 1)) | |
119 | 119 | then throw("No NFT attached") | |
120 | 120 | else { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let CONF_INIT_K = "config_init" | |
5 | 5 | ||
6 | 6 | let CONF_AMIN_K = "config_admin" | |
7 | 7 | ||
8 | 8 | let CONF_ORACLE_K = "config_oracle" | |
9 | 9 | ||
10 | 10 | let CONF_ARTWORK_DAPP_K = "config_artwork_dapp" | |
11 | 11 | ||
12 | 12 | let dappRunningKey = "conf_dapp_is_running" | |
13 | 13 | ||
14 | 14 | let maintenanceMSGKey = "conf_maintenance_msg" | |
15 | 15 | ||
16 | 16 | let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true) | |
17 | 17 | ||
18 | 18 | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "") | |
19 | 19 | ||
20 | 20 | let status_LOCKED = "LOCKED" | |
21 | 21 | ||
22 | 22 | let status_UNLOCKED = "UNLOCKED" | |
23 | 23 | ||
24 | 24 | let status_PENDING = "PENDING" | |
25 | 25 | ||
26 | 26 | let status_CLOSED = "CLOSED" | |
27 | 27 | ||
28 | 28 | let NETWORKS = ["ETH", "POLYGON"] | |
29 | 29 | ||
30 | 30 | func keyNFTstatus (nftId) = (("nft_" + nftId) + "_status") | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func keyTransferNFT (nftId,txid) = ((((("transfer_" + nftId) + "_") + txid) + "_") + status_PENDING) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
43 | 43 | ||
44 | 44 | ||
45 | - | let admin = value(addressFromString(getStringByKey(CONF_AMIN_K))) | |
45 | + | let admin = value(addressFromString(valueOrElse(getStringByKey(CONF_AMIN_K), ""))) | |
46 | 46 | ||
47 | 47 | let artworksDapp = value(addressFromString(getStringByKey(CONF_ARTWORK_DAPP_K))) | |
48 | 48 | ||
49 | 49 | let oracleAddr = value(addressFromString(getStringByKey(CONF_ORACLE_K))) | |
50 | 50 | ||
51 | 51 | func getIntegerByKeyFromOracle (key) = valueOrErrorMessage(getInteger(oracleAddr, key), "Integer undefine or 0 in oracle") | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func assetIsValid (assetDetails) = if (if (if ((assetDetails.quantity == 1)) | |
55 | 55 | then (assetDetails.decimals == 0) | |
56 | 56 | else false) | |
57 | 57 | then (assetDetails.reissuable == false) | |
58 | 58 | else false) | |
59 | 59 | then (assetDetails.issuer == artworksDapp) | |
60 | 60 | else false | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func isSignArtNFT (id) = { | |
64 | 64 | let assetDetails = value(assetInfo(id)) | |
65 | 65 | assetIsValid(assetDetails) | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func isPayment (i) = if ((size(i.payments) == 0)) | |
70 | 70 | then throw("No payment attached") | |
71 | 71 | else { | |
72 | 72 | let nft_payment = value(i.payments[0]) | |
73 | 73 | let nft_amount = value(nft_payment.amount) | |
74 | 74 | let gateway_payment = value(i.payments[1]) | |
75 | 75 | let gateway_amount = value(gateway_payment.amount) | |
76 | 76 | $Tuple4(nft_payment, nft_amount, gateway_payment, gateway_amount) | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | let isInit = valueOrElse(getBooleanByKey(CONF_INIT_K), false) | |
81 | 81 | ||
82 | 82 | func ownerOnly (i) = { | |
83 | 83 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
84 | 84 | let id = toBase58String(i.transactionId) | |
85 | 85 | if (containsElement([admin, toString(this)], caller)) | |
86 | 86 | then true | |
87 | 87 | else false | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func idCallerDate (i) = if (!(dappRunning)) | |
92 | 92 | then throw(maintenanceMSG) | |
93 | 93 | else $Tuple3(toBase58String(i.transactionId), toBase58String(i.caller.bytes), lastBlock.timestamp) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(i) | |
97 | 97 | func init (adminAddr,oracleAddr,artworksDapp) = if (ownerOnly(i)) | |
98 | 98 | then [StringEntry(CONF_AMIN_K, adminAddr), StringEntry(CONF_ORACLE_K, oracleAddr), StringEntry(CONF_ARTWORK_DAPP_K, artworksDapp), BooleanEntry(CONF_INIT_K, true)] | |
99 | 99 | else throw("Not allowed") | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | @Callable(i) | |
104 | 104 | func lock (recipient,network) = if (!(isInit)) | |
105 | 105 | then throw("dApp not ready") | |
106 | 106 | else if (!(containsElement(NETWORKS, network))) | |
107 | 107 | then throw("Network not supported") | |
108 | 108 | else { | |
109 | - | let $ | |
110 | - | let id = $ | |
111 | - | let caller = $ | |
112 | - | let date = $ | |
113 | - | let $ | |
114 | - | let nft_payment = $ | |
115 | - | let nft_amount = $ | |
116 | - | let gateway_payment = $ | |
117 | - | let gateway_amount = $ | |
109 | + | let $t030553094 = idCallerDate(i) | |
110 | + | let id = $t030553094._1 | |
111 | + | let caller = $t030553094._2 | |
112 | + | let date = $t030553094._3 | |
113 | + | let $t030973174 = isPayment(i) | |
114 | + | let nft_payment = $t030973174._1 | |
115 | + | let nft_amount = $t030973174._2 | |
116 | + | let gateway_payment = $t030973174._3 | |
117 | + | let gateway_amount = $t030973174._4 | |
118 | 118 | if ((nft_amount != 1)) | |
119 | 119 | then throw("No NFT attached") | |
120 | 120 | else { | |
121 | 121 | let nftId = if (if (isDefined(nft_payment.assetId)) | |
122 | 122 | then isSignArtNFT(value(nft_payment.assetId)) | |
123 | 123 | else false) | |
124 | 124 | then toBase58String(value(nft_payment.assetId)) | |
125 | 125 | else throw("Only SIGN Art NFT accepted.") | |
126 | 126 | let nftStatus = getStringByKey(keyNFTstatus(nftId)) | |
127 | 127 | if ((nftStatus == status_LOCKED)) | |
128 | 128 | then throw("NFT already locked") | |
129 | 129 | else [StringEntry(keyNFTstatus(nftId), status_LOCKED), StringEntry(((keyTransferNFT(nftId, id) + "_") + status_PENDING), ((((((((recipient + "_") + network) + "_") + caller) + "_") + id) + "_") + toString(date)))] | |
130 | 130 | } | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(i) | |
136 | 136 | func processedLock (nftId,transferId) = if (!(isInit)) | |
137 | 137 | then throw("dApp not ready") | |
138 | 138 | else if (ownerOnly(i)) | |
139 | 139 | then { | |
140 | 140 | let nftStatus = getStringByKey(keyNFTstatus(nftId)) | |
141 | 141 | if ((nftStatus != status_LOCKED)) | |
142 | 142 | then throw("NFT not locked") | |
143 | 143 | else { | |
144 | 144 | let val = getStringByKey(keyTransferNFT(nftId, transferId)) | |
145 | 145 | let newKey = ((keyTransferNFT(nftId, transferId) + "_") + status_CLOSED) | |
146 | 146 | [DeleteEntry(((keyTransferNFT(nftId, transferId) + "_") + status_PENDING)), StringEntry(newKey, val)] | |
147 | 147 | } | |
148 | 148 | } | |
149 | 149 | else throw("Not allowed") | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | ||
153 | 153 | @Callable(i) | |
154 | 154 | func unlock (recipient,nftId) = if (!(isInit)) | |
155 | 155 | then throw("dApp not ready") | |
156 | 156 | else if (ownerOnly(i)) | |
157 | 157 | then { | |
158 | 158 | let nftStatus = getStringByKey(keyNFTstatus(nftId)) | |
159 | 159 | if ((nftStatus != status_LOCKED)) | |
160 | 160 | then throw("NFT not locked") | |
161 | 161 | else [StringEntry(keyNFTstatus(nftId), status_UNLOCKED), ScriptTransfer(Address(fromBase58String(recipient)), 1, fromBase58String(nftId))] | |
162 | 162 | } | |
163 | 163 | else throw("Not allowed") | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | 167 | @Callable(i) | |
168 | 168 | func appRunning (isLive,message) = if (!(isInit)) | |
169 | 169 | then throw("dApp not ready") | |
170 | 170 | else if (ownerOnly(i)) | |
171 | 171 | then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)] | |
172 | 172 | else throw("You are not allowed to change this") | |
173 | 173 | ||
174 | 174 |
github/deemru/w8io/169f3d6 36.68 ms ◑