tx · 3vs5DtLjRZYsWrTFW1X352ZgjAQbjS5uQNjyWBDRvZCq

3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv:  -0.05000000 Waves

2020.06.05 17:07 [1030053] smart account 3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv > SELF 0.00000000 Waves

{ "type": 13, "id": "3vs5DtLjRZYsWrTFW1X352ZgjAQbjS5uQNjyWBDRvZCq", "fee": 5000000, "feeAssetId": null, "timestamp": 1591366102525, "version": 1, "sender": "3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv", "senderPublicKey": "CCEAkP4AnTM1HmKyRheQLmgNxPKACsL5hcH72JUeCiDJ", "proofs": [ "5AJTuxyVTu63MCtVieAXTKzPS9UWebmGz7BYW2dgXvcBQzoovbpWHyhzTVPhPTHxrLGbnodNbKMxhuJypX6KEJnr" ], "script": "base64:AAIDAAAAAAAAABkIARIGCgQIAQEIEgMKAQgSAwoBCBIDCgEIAAAAAwAAAAAOb3duZXJQdWJsaWNLZXkBAAAAIKZQ1ZLQ9/+2Zy378H8jTlGj0XgdM5q46Kfah/hKBO81AQAAAApyYW5kb21pemVyAAAAAQAAAANpbnYEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAggFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAAADaW52AAAAD2NhbGxlclB1YmxpY0tleQgFAAAACWxhc3RCbG9jawAAABNnZW5lcmF0aW9uU2lnbmF0dXJlCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAJdGltZXN0YW1wCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0CQAB9wAAAAEFAAAABHJhbmQBAAAAEW9mZmVyRXJyb3JIYW5kbGVyAAAABQAAAAV0b2tlbgAAAAZhbW91bnQAAAAFcHJpY2UAAAAEdHlwZQAAAANpbnYDAwMDCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABBQAAAAV0b2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YWxsZXIAAAAFYnl0ZXMJAAACAAAAAQIAAAAYVXNlciBub3QgYWxsb3dlZCB0byBzaWduCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAdvZmZlcklkAgAAAAdkZWxldGVkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAXMFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWkFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5B2h37A8=", "chainId": 84, "height": 1030053, "spentComplexity": 0 } View: original | compacted Prev: DD82pjNvTvVN7CQCLSCtVrEydxZopuVC4exosqAhBdBK Next: 2otcT2EHUqs5uMKgUfezdb3tb1opCV1spPRK3Vbjf3xR Diff:
OldNewDifferences
7373 if ((firstParty != toBase58String(i.caller.bytes)))
7474 then throw("User not allowed to sign")
7575 else if ((offerType == "buy"))
76- then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(i.caller, (5 * 100000000), unit)]))
76+ then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(i.caller, (amount * 100000000), unit)]))
7777 else if ((offerType == "sell"))
78- then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(addressFromStringValue(secondParty), (5 * 100000000), unit)]))
78+ then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(i.caller, (amount * 100000000), unit)]))
7979 else throw("Offer Type Error")
8080 }
8181
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'CCEAkP4AnTM1HmKyRheQLmgNxPKACsL5hcH72JUeCiDJ'
55
66 func randomizer (inv) = {
77 let rand = ((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
88 sha256(rand)
99 }
1010
1111
1212 func offerErrorHandler (token,amount,price,type,inv) = if (if (if (if (!(isDefined(token)))
1313 then true
1414 else !(isDefined(amount)))
1515 then true
1616 else !(isDefined(price)))
1717 then true
1818 else !(isDefined(type)))
1919 then throw("Invalid Transaction")
2020 else if (if ((type == "sell"))
2121 then !(isDefined(inv.payment))
2222 else false)
2323 then throw("No payment attached")
2424 else if (if ((type == "sell"))
2525 then isDefined(inv.payment)
2626 else false)
2727 then {
2828 let payment = extract(inv.payment)
2929 if ((payment.amount != (amount * 100000000)))
3030 then throw("Payment amount insufficient")
3131 else true
3232 }
3333 else true
3434
3535
3636 @Callable(i)
3737 func postOffer (tokenIn,amountIn,priceIn,typeIn) = if (offerErrorHandler(tokenIn, amountIn, priceIn, typeIn, i))
3838 then {
3939 let offerId = toBase64String(randomizer(i))
4040 let offerDetails = ((((((tokenIn + ",") + toString(amountIn)) + ",") + toString(priceIn)) + ",") + typeIn)
4141 WriteSet([DataEntry(offerId, "open"), DataEntry((offerId + "_tokenId"), tokenIn), DataEntry((offerId + "_amount"), amountIn), DataEntry((offerId + "_price"), priceIn), DataEntry((offerId + "_type"), typeIn), DataEntry((offerId + "_firstParty"), toBase58String(i.caller.bytes))])
4242 }
4343 else throw("Conditions not met")
4444
4545
4646
4747 @Callable(i)
4848 func acceptOffer (offerId) = {
4949 let offerType = getString(this, (offerId + "_type"))
5050 let offerAmount = getInteger(this, (offerId + "_amount"))
5151 if ((offerType == "buy"))
5252 then if (!(isDefined(i.payment)))
5353 then throw("Payment needed for buy offer")
5454 else {
5555 let payment = extract(i.payment)
5656 if (((payment.amount / 100000000) != offerAmount))
5757 then throw("Insufficient Payment Amount")
5858 else WriteSet([DataEntry(offerId, "accepted"), DataEntry("_secondParty", toBase58String(i.caller.bytes))])
5959 }
6060 else if ((offerType == "sell"))
6161 then WriteSet([DataEntry(offerId, "accepted"), DataEntry("_secondParty", toBase58String(i.caller.bytes))])
6262 else throw("Offer Type Error")
6363 }
6464
6565
6666
6767 @Callable(i)
6868 func signOffer (offerId) = {
6969 let firstParty = getString(this, (offerId + "_firstParty"))
7070 let secondParty = getStringValue(this, (offerId + "_secondParty"))
7171 let offerType = getString(this, (offerId + "_type"))
7272 let amount = getIntegerValue(this, (offerId + "_amount"))
7373 if ((firstParty != toBase58String(i.caller.bytes)))
7474 then throw("User not allowed to sign")
7575 else if ((offerType == "buy"))
76- then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(i.caller, (5 * 100000000), unit)]))
76+ then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(i.caller, (amount * 100000000), unit)]))
7777 else if ((offerType == "sell"))
78- then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(addressFromStringValue(secondParty), (5 * 100000000), unit)]))
78+ then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(i.caller, (amount * 100000000), unit)]))
7979 else throw("Offer Type Error")
8080 }
8181
8282
8383
8484 @Callable(i)
8585 func deleteOffer (offerId) = {
8686 let firstParty = getString(this, (offerId + "_firstParty"))
8787 if ((firstParty != toBase58String(i.caller.bytes)))
8888 then throw("User not allowed to sign")
8989 else WriteSet([DataEntry(offerId, "deleted")])
9090 }
9191
9292
9393 @Verifier(tx)
9494 func verify () = match tx {
9595 case s: SetScriptTransaction =>
9696 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
9797 case i: InvokeScriptTransaction =>
9898 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
9999 case _ =>
100100 false
101101 }
102102

github/deemru/w8io/169f3d6 
63.99 ms