tx · 89xC877h4LzjUaB1X9AHVS8BqoeqV2mFYeKHFdoJv331

3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv:  -0.05000000 Waves

2020.06.21 11:10 [1053096] smart account 3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv > SELF 0.00000000 Waves

{ "type": 13, "id": "89xC877h4LzjUaB1X9AHVS8BqoeqV2mFYeKHFdoJv331", "fee": 5000000, "feeAssetId": null, "timestamp": 1592727056667, "version": 1, "sender": "3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv", "senderPublicKey": "CCEAkP4AnTM1HmKyRheQLmgNxPKACsL5hcH72JUeCiDJ", "proofs": [ "4A7AoVc6bSYHPX2iyguZuisfyA7sGUjYLwQAHo3dhGoypqbS9MzP5A5GEKsNABqn9NuYQd5p2wFhagDBCN4sX13e" ], "script": "base64:AAIDAAAAAAAAABoIARIHCgUIAQEICBIDCgEIEgMKAQgSAwoBCAAAAAMAAAAADm93bmVyUHVibGljS2V5AQAAACCmUNWS0Pf/tmct+/B/I05Ro9F4HTOauOin2of4SgTvNQEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAARyYW5kCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIIBQAAAANpbnYAAAANdHJhbnNhY3Rpb25JZAgFAAAAA2ludgAAAA9jYWxsZXJQdWJsaWNLZXkIBQAAAAlsYXN0QmxvY2sAAAATZ2VuZXJhdGlvblNpZ25hdHVyZQkAAZoAAAABCAUAAAAJbGFzdEJsb2NrAAAACXRpbWVzdGFtcAkAAZoAAAABCAUAAAAJbGFzdEJsb2NrAAAABmhlaWdodAkAAfcAAAABBQAAAARyYW5kAQAAABFvZmZlckVycm9ySGFuZGxlcgAAAAYAAAAFdG9rZW4AAAAGYW1vdW50AAAABXByaWNlAAAABHR5cGUAAAAFYXNzZXQAAAADaW52AwMDAwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQUAAAAFdG9rZW4G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CeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24JAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BynhNPI=", "chainId": 84, "height": 1053096, "spentComplexity": 0 } View: original | compacted Prev: 7vPGputtfknr59s8Eainp7rfAcCK5rNuQ2VbAwCdjZJQ Next: 5bcfpdH6gcBw4fbcnxDqQtvdgqv2dtYYGi47WudZb9A9 Diff:
OldNewDifferences
3939 func postOffer (tokenIn,amountIn,priceIn,typeIn,assetIn) = if (offerErrorHandler(tokenIn, amountIn, priceIn, typeIn, assetIn, i))
4040 then {
4141 let offerId = toBase64String(randomizer(i))
42- WriteSet([DataEntry(offerId, "op en"), DataEntry((offerId + "_tokenId"), tokenIn), DataEntry((offerId + "_amount"), amountIn), DataEntry((offerId + "_price"), priceIn), DataEntry((offerId + "_type"), typeIn), DataEntry((offerId + "_firstParty"), toBase58String(i.caller.bytes)), DataEntry((offerId + "_assetId"), assetIn)])
42+ 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)), DataEntry((offerId + "_assetId"), assetIn)])
4343 }
4444 else throw("Conditions not met")
4545
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,asset,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))
3030 then throw("Payment amount insufficient")
3131 else if ((toBase58String(value(payment.assetId)) != asset))
3232 then throw("AssetId invalid")
3333 else true
3434 }
3535 else true
3636
3737
3838 @Callable(i)
3939 func postOffer (tokenIn,amountIn,priceIn,typeIn,assetIn) = if (offerErrorHandler(tokenIn, amountIn, priceIn, typeIn, assetIn, i))
4040 then {
4141 let offerId = toBase64String(randomizer(i))
42- WriteSet([DataEntry(offerId, "op en"), DataEntry((offerId + "_tokenId"), tokenIn), DataEntry((offerId + "_amount"), amountIn), DataEntry((offerId + "_price"), priceIn), DataEntry((offerId + "_type"), typeIn), DataEntry((offerId + "_firstParty"), toBase58String(i.caller.bytes)), DataEntry((offerId + "_assetId"), assetIn)])
42+ 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)), DataEntry((offerId + "_assetId"), assetIn)])
4343 }
4444 else throw("Conditions not met")
4545
4646
4747
4848 @Callable(i)
4949 func acceptOffer (offerId) = {
5050 let offerType = getString(this, (offerId + "_type"))
5151 let offerStatus = getString(this, offerId)
5252 let assetId = getString(this, (offerId + "_assetId"))
5353 let offerAmount = getInteger(this, (offerId + "_amount"))
5454 if ((offerStatus == "open"))
5555 then if ((offerType == "buy"))
5656 then if (!(isDefined(i.payment)))
5757 then throw("Payment needed for buy offer")
5858 else {
5959 let payment = extract(i.payment)
6060 if ((payment.amount != offerAmount))
6161 then throw("Insufficient Payment Amount")
6262 else if ((payment.assetId != assetId))
6363 then throw("AssetId invalid")
6464 else WriteSet([DataEntry(offerId, "accepted"), DataEntry((offerId + "_secondParty"), toBase58String(i.caller.bytes))])
6565 }
6666 else if ((offerType == "sell"))
6767 then WriteSet([DataEntry(offerId, "accepted"), DataEntry((offerId + "_secondParty"), toBase58String(i.caller.bytes))])
6868 else throw("Offer Type Error")
6969 else throw("Wrong offer status - forbidden")
7070 }
7171
7272
7373
7474 @Callable(i)
7575 func signOffer (offerId) = {
7676 let offerStatus = getString(this, offerId)
7777 let firstParty = getString(this, (offerId + "_firstParty"))
7878 let secondParty = getStringValue(this, (offerId + "_secondParty"))
7979 let offerType = getString(this, (offerId + "_type"))
8080 let amount = getIntegerValue(this, (offerId + "_amount"))
8181 let assetId = getStringValue(this, (offerId + "_assetId"))
8282 if ((offerStatus == "accepted"))
8383 then if ((firstParty != toBase58String(i.caller.bytes)))
8484 then throw("User not allowed to sign")
8585 else if ((offerType == "buy"))
8686 then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(i.caller, amount, toBytes(assetId))]))
8787 else if ((offerType == "sell"))
8888 then ScriptResult(WriteSet([DataEntry(offerId, "closed")]), TransferSet([ScriptTransfer(addressFromStringValue(secondParty), amount, toBytes(assetId))]))
8989 else throw("Offer Type Error")
9090 else throw("Wrong offer status - forbidden")
9191 }
9292
9393
9494
9595 @Callable(i)
9696 func deleteOffer (offerId) = {
9797 let firstParty = getString(this, (offerId + "_firstParty"))
9898 if ((firstParty != toBase58String(i.caller.bytes)))
9999 then throw("User not allowed to sign")
100100 else WriteSet([DataEntry(offerId, "deleted")])
101101 }
102102
103103
104104 @Verifier(tx)
105105 func verify () = match tx {
106106 case _: SetScriptTransaction =>
107107 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
108108 case _: InvokeScriptTransaction =>
109109 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
110110 case _ =>
111111 false
112112 }
113113

github/deemru/w8io/169f3d6 
30.22 ms