tx · 8gHkNkGLT1BJLFhdMqDk2sNaz4oEQ82wuM8K85ewycDE

3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx:  -0.00600000 Waves

2024.12.11 04:48 [3409304] smart account 3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx > SELF 0.00000000 Waves

{ "type": 13, "id": "8gHkNkGLT1BJLFhdMqDk2sNaz4oEQ82wuM8K85ewycDE", "fee": 600000, "feeAssetId": null, "timestamp": 1733881728445, "version": 2, "chainId": 84, "sender": "3N3nfqFcxXfd3T18V9icDdh58MJ9wQ2k2xx", "senderPublicKey": "UGqkWsCpv7xRVXkQRXyLd6pWPDtYGXmPip7FxSd1pAu", "proofs": [ "64kEhaYSMRpJMQP9KcM49pHAAaPLFQTviAEKjwwgWoasma7JfBkE8BJpmThBxHDGdDLQAF7TDqG5cQ6u6zpZrXv6" ], "script": "base64:BgIWCAISAwoBCBIDCgEBEgMKAQgSAwoBCBcAA1NFUAICX18ABWNoYWluCQDJAQIJAMoBAggFBHRoaXMFYnl0ZXMAAQABABZkZWZhdWx0UmVzdDJBZGRyZXNzU3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUEZ3WXRhOGJpRXozMXpwZUZlNURKSzh3RTV0clNwUVZGOAMJAAACAQFUBQckbWF0Y2gwAiMzTjdVdVlhcjYyNjRQNThGQmhWV0tQUUFoNFl1YTJoZ25ndgkAAgECDVVua25vd24gY2hhaW4BD2dldFN0cmluZ09yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZmluZWQFA25pbAIAABBJZHhDZmdBY3JlczJEYXBwAAEADUlkeENmZ1dsZ0RhcHAAAgEKa2V5UmVzdENmZ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wJAJQKAgkAzggCCQDMCAIFCmxpc3RBY3Rpb24JAMwIAgkBC0RlbGV0ZUVudHJ5AQkBEmtleVNlbGxlckJ5QXNzZXRJZAEFCmFzc2V0SWRTdHIJAMwIAgkBC0RlbGV0ZUVudHJ5AQkBEWtleVByaWNlQnlBc3NldElkAQUKYXNzZXRJZFN0cgkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQERQGV4dHJOYXRpdmUoMTA2MikBBQZzZWxsZXIFBXByaWNlBQp3bGdBc3NldElkCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJARFAZXh0ck5hdGl2ZSgxMDYyKQEJARFAZXh0ck5hdGl2ZSgxMDUzKQIFC3dsZ0NvbnRyYWN0BQt0ZWFtQWRkcktleQUHZm9yVGVhbQUKd2xnQXNzZXRJZAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQkA2QQBBQphc3NldElkU3RyBQNuaWwFDWNoYW5nZUFjdGlvbnMFDHByb2xvZ1Jlc3VsdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAFcNG0", "height": 3409304, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BA8AULfhgW1nv4c5pdyScPwqMnybGt3UbdN3TYoN9jH4 Next: G7pT9pBJ4LG7FMkT6rUYr3ou9jvsUetXM27REm4w9iXW Diff:
OldNewDifferences
149149 then StringEntry(nftsKey, makeString_11C(removeByIndex(nfts, value(idx)), "_"))
150150 else DeleteEntry(nftsKey)
151151 let price = valueOrErrorMessage(getInteger(keyPriceByAssetId(assetIdStr)), ("You don't have sell order for " + assetIdStr))
152- $Tuple2([listAction, DeleteEntry(keySellerByAssetId(assetIdStr)), DeleteEntry(keyPriceByAssetId(assetIdStr)), ScriptTransfer(i.caller, (price / 20), wlgAssetId)], prologResult)
152+ $Tuple2([listAction, DeleteEntry(keySellerByAssetId(assetIdStr)), DeleteEntry(keyPriceByAssetId(assetIdStr)), ScriptTransfer(i.caller, 1, fromBase58String(assetIdStr)), ScriptTransfer(i.caller, (price / 20), wlgAssetId)], prologResult)
153153 }
154154 }
155155 else throw("Strict value is not equal to itself.")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let chain = take(drop(this.bytes, 1), 1)
77
88 let defaultRest2AddressStr = match chain {
99 case _ =>
1010 if ((base58'2W' == $match0))
1111 then "3PFwYta8biEz31zpeFe5DJK8wE5trSpQVF8"
1212 else if ((base58'2T' == $match0))
1313 then "3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv"
1414 else throw("Unknown chain")
1515 }
1616
1717 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
1818
1919
2020 let IdxCfgAcres2Dapp = 1
2121
2222 let IdxCfgWlgDapp = 2
2323
2424 func keyRestCfg () = "%s__restConfig"
2525
2626
2727 func keyRest2Address () = "%s__rest2Addr"
2828
2929
3030 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
3131
3232
3333 func getContractAddressOrFail (rest2Cfg,idx) = valueOrErrorMessage(addressFromString(rest2Cfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
3434
3535
3636 let rest2Contract = addressFromStringValue(valueOrElse(getString(this, keyRest2Address()), defaultRest2AddressStr))
3737
3838 let rest2Cfg = readRestCfgOrFail(rest2Contract)
3939
4040 let acres2Contract = getContractAddressOrFail(rest2Cfg, IdxCfgAcres2Dapp)
4141
4242 let wlgContract = getContractAddressOrFail(rest2Cfg, IdxCfgWlgDapp)
4343
4444 let wlgAssetIdKey = "wlg_assetId"
4545
4646 let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "WLGOLD is not issued yet")
4747
4848 func keySellerByAssetId (assetId) = ("seller_" + assetId)
4949
5050
5151 func keyPriceByAssetId (assetId) = ("price_" + assetId)
5252
5353
5454 func keyAssetIdsBySeller (addr) = ("assetIds_" + addr)
5555
5656
5757 func asInt (v) = match v {
5858 case n: Int =>
5959 n
6060 case _ =>
6161 throw("fail to cast into Int")
6262 }
6363
6464
6565 func fixedPoint (val,decimals) = {
6666 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
6767 let lowPart = toString((val % tenPow))
6868 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
6969 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
7070 }
7171
7272
7373 let teamAddrKey = "teamAddr"
7474
7575 func prolog2 () = asInt(reentrantInvoke(acres2Contract, "saveLastTx", nil, nil))
7676
7777
7878 @Callable(i)
7979 func constructorV1 (rest2Addr) = if ((i.caller != this))
8080 then throw("Permission denied")
8181 else [StringEntry(keyRest2Address(), rest2Addr)]
8282
8383
8484
8585 @Callable(i)
8686 func placeSellOrder (price) = {
8787 let prologResult = prolog2()
8888 if ((prologResult == prologResult))
8989 then if ((0 >= price))
9090 then throw("Price should be positive")
9191 else if ((size(i.payments) != 2))
9292 then throw("Exactly 2 payments required: NFT and 5% fee in WLGOLD")
9393 else {
9494 let pmt = value(i.payments[0])
9595 if ((pmt.amount != 1))
9696 then throw("NFT token should be attached as 1st payment")
9797 else {
9898 let pmt1 = value(i.payments[1])
9999 let wAssetId = valueOrErrorMessage(pmt1.assetId, "No WAVES payments allowed")
100100 if ((wAssetId != wlgAssetId))
101101 then throw("Only WLGOLD payments are accepted as 2nd payment")
102102 else {
103103 let change = (pmt1.amount - (price / 20))
104104 if ((0 > change))
105105 then throw("5% fee should be attached as 2nd payment")
106106 else {
107107 let changeActions = if ((change > 0))
108108 then [ScriptTransfer(i.caller, change, wlgAssetId)]
109109 else nil
110110 let assetId = valueOrErrorMessage(pmt.assetId, "No WAVES payments allowed")
111111 let asset = value(assetInfo(assetId))
112112 let assetIdStr = toBase58String(assetId)
113113 let addr = toString(i.caller)
114114 if ((asset.issuer != acres2Contract))
115115 then throw("Only WavesLands NFT tokens are accepted")
116116 else {
117117 let nftsKey = keyAssetIdsBySeller(addr)
118118 let nftsStr = valueOrElse(getString(nftsKey), "")
119119 let nfts = if ((nftsStr != ""))
120120 then split_51C(value(nftsStr), "_")
121121 else nil
122122 $Tuple2(([IntegerEntry(keyPriceByAssetId(assetIdStr), price), StringEntry(keySellerByAssetId(assetIdStr), addr), StringEntry(nftsKey, makeString_11C((nfts :+ assetIdStr), "_"))] ++ changeActions), prologResult)
123123 }
124124 }
125125 }
126126 }
127127 }
128128 else throw("Strict value is not equal to itself.")
129129 }
130130
131131
132132
133133 @Callable(i)
134134 func cancelSellOrder (assetIdStr) = {
135135 let prologResult = prolog2()
136136 if ((prologResult == prologResult))
137137 then {
138138 let addr = toString(i.caller)
139139 let nftsKey = keyAssetIdsBySeller(addr)
140140 let nftsStr = valueOrElse(getString(nftsKey), "")
141141 let nfts = if ((nftsStr != ""))
142142 then split_51C(value(nftsStr), "_")
143143 else nil
144144 let idx = indexOf(nfts, assetIdStr)
145145 if (!(isDefined(idx)))
146146 then throw(("Your don't have sell order for " + assetIdStr))
147147 else {
148148 let listAction = if ((size(nfts) > 1))
149149 then StringEntry(nftsKey, makeString_11C(removeByIndex(nfts, value(idx)), "_"))
150150 else DeleteEntry(nftsKey)
151151 let price = valueOrErrorMessage(getInteger(keyPriceByAssetId(assetIdStr)), ("You don't have sell order for " + assetIdStr))
152- $Tuple2([listAction, DeleteEntry(keySellerByAssetId(assetIdStr)), DeleteEntry(keyPriceByAssetId(assetIdStr)), ScriptTransfer(i.caller, (price / 20), wlgAssetId)], prologResult)
152+ $Tuple2([listAction, DeleteEntry(keySellerByAssetId(assetIdStr)), DeleteEntry(keyPriceByAssetId(assetIdStr)), ScriptTransfer(i.caller, 1, fromBase58String(assetIdStr)), ScriptTransfer(i.caller, (price / 20), wlgAssetId)], prologResult)
153153 }
154154 }
155155 else throw("Strict value is not equal to itself.")
156156 }
157157
158158
159159
160160 @Callable(i)
161161 func acceptSellOrder (assetIdStr) = {
162162 let prologResult = prolog2()
163163 if ((prologResult == prologResult))
164164 then if ((size(i.payments) != 1))
165165 then throw("exactly 1 payment must be attached")
166166 else {
167167 let pmt = i.payments[0]
168168 if (if (!(isDefined(pmt.assetId)))
169169 then true
170170 else (value(pmt.assetId) != wlgAssetId))
171171 then throw("WLGOLD payments only!")
172172 else {
173173 let price = valueOrErrorMessage(getInteger(keyPriceByAssetId(assetIdStr)), (("NFT " + assetIdStr) + " is not selling"))
174174 let change = (pmt.amount - price)
175175 if ((0 > change))
176176 then throw((("Payment attached doesn't cover sell price of " + fixedPoint(price, 8)) + " WLGOLD"))
177177 else {
178178 let changeActions = if ((change > 0))
179179 then [ScriptTransfer(i.caller, change, wlgAssetId)]
180180 else nil
181181 let seller = valueOrErrorMessage(getString(keySellerByAssetId(assetIdStr)), (("NFT " + assetIdStr) + " is not selling"))
182182 let nftsKey = keyAssetIdsBySeller(seller)
183183 let nftsStr = valueOrElse(getString(nftsKey), "")
184184 let nfts = if ((nftsStr != ""))
185185 then split_51C(value(nftsStr), "_")
186186 else nil
187187 let idx = indexOf(nfts, assetIdStr)
188188 if (!(isDefined(idx)))
189189 then throw(("Seller don't have sell order for " + assetIdStr))
190190 else {
191191 let listAction = if ((size(nfts) > 1))
192192 then StringEntry(nftsKey, makeString_11C(removeByIndex(nfts, value(idx)), "_"))
193193 else DeleteEntry(nftsKey)
194194 let fee = (price / 20)
195195 let forTeam = (fee / 2)
196196 let wlgRemain = asInt(invoke(wlgContract, "burnWlgold", [(fee - forTeam)], nil))
197197 $Tuple2(([listAction, DeleteEntry(keySellerByAssetId(assetIdStr)), DeleteEntry(keyPriceByAssetId(assetIdStr)), ScriptTransfer(addressFromStringValue(seller), price, wlgAssetId), ScriptTransfer(addressFromStringValue(getStringValue(wlgContract, teamAddrKey)), forTeam, wlgAssetId), ScriptTransfer(i.caller, 1, fromBase58String(assetIdStr))] ++ changeActions), prologResult)
198198 }
199199 }
200200 }
201201 }
202202 else throw("Strict value is not equal to itself.")
203203 }
204204
205205

github/deemru/w8io/169f3d6 
32.81 ms