tx · Hpw2HzTc9AeAgqqague5z5AeLeWfYaxdNKV9TUYPpXXH
3MwXiQUfgfpCezrGWTowg9712x1QdUYURLr: -0.01000000 Waves
2021.06.18 10:19 [1575500] smart account 3MwXiQUfgfpCezrGWTowg9712x1QdUYURLr > SELF 0.00000000 Waves
{
"type": 13,
"id": "Hpw2HzTc9AeAgqqague5z5AeLeWfYaxdNKV9TUYPpXXH",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1624000804951,
"version": 2,
"chainId": 84,
"sender": "3MwXiQUfgfpCezrGWTowg9712x1QdUYURLr",
"senderPublicKey": "DGW2gVYMGhgqhMjxiy4aWMAnrpDYoqfxT7fzdTKjyLZZ",
"proofs": [
"2UrmgztFtx6FGSfoXgH8U2siKDdm8KDiMyp9HNmh8PvZ6cCkeSjJxe3qKb81ukTeEMxPfcUjxCojBLaT1ZrSzxYv"
],
"script": "base64:AAIEAAAAAAAAAAIIAgAAAAMAAAAAC2FsaWNlUHViS2V5AQAAACA9/itBySONqF6x4bRxaR4o1OTwuJ59XyBVbCaeVFq2AAAAAAAJYm9iUHViS2V5AQAAACATtbonqJAWoXj6HlareP7rG4Wl0avouRL7X7HQSCzbbgAAAAAMY29vcGVyUHViS2V5AQAAACDnzP6pMJH4uKXZ4HZ9fJ+csTcAqwTgQt4oVmhYOIFeMgAAAAAAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAthbGljZVNpZ25lZAMJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAthbGljZVB1YktleQAAAAAAAAAAAQAAAAAAAAAAAAQAAAAJYm9iU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAACWJvYlB1YktleQAAAAAAAAAAAQAAAAAAAAAAAAQAAAAMY29vcGVyU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIFAAAADGNvb3BlclB1YktleQAAAAAAAAAAAQAAAAAAAAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFzBQAAAAckbWF0Y2gwCQAAZwAAAAIJAABkAAAAAgkAAGQAAAACBQAAAAthbGljZVNpZ25lZAUAAAAJYm9iU2lnbmVkBQAAAAxjb29wZXJTaWduZWQAAAAAAAAAAAIHpzBQ8A==",
"height": 1575500,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 4pmMk77JTvuC4iiQmVC7U9SrJJiZEXWShL75b4SdvCTm
Next: none
Full:
Old | New | | Differences |
---|
1 | | - | {-# STDLIB_VERSION 3 #-} |
---|
| 1 | + | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
| 4 | + | let alicePubKey = base58'5AzfA9UfpWVYiwFwvdr77k6LWupSTGLb14b24oVdEpMM' |
---|
4 | 5 | | |
---|
| 6 | + | let bobPubKey = base58'2KwU4vzdgPmKyf7q354H9kSyX9NZjNiq4qbnH2wi2VDF' |
---|
5 | 7 | | |
---|
6 | | - | @Callable(i) |
---|
7 | | - | func purchase () = { |
---|
8 | | - | let pmt = extract(i.payment) |
---|
9 | | - | if (isDefined(pmt.assetId)) |
---|
10 | | - | then throw("Can use Waves only at the moment") |
---|
11 | | - | else { |
---|
12 | | - | let customerAddress = toBase58String(i.caller.bytes) |
---|
13 | | - | let price = match getInteger(this, "item_A_coupon_price") { |
---|
14 | | - | case a: Int => |
---|
15 | | - | a |
---|
16 | | - | case _ => |
---|
17 | | - | 0 |
---|
18 | | - | } |
---|
19 | | - | if ((price > pmt.amount)) |
---|
20 | | - | then throw("Purchase amount cannot be less than item price") |
---|
21 | | - | else if ((pmt.amount > price)) |
---|
22 | | - | then throw("Purchase amount cannot be higher than item price") |
---|
23 | | - | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)]) |
---|
24 | | - | } |
---|
25 | | - | } |
---|
| 8 | + | let cooperPubKey = base58'GbrUeGaBfmyFJjSQb9Z8uTCej5GzjXfRDVGJGrmgt5cD' |
---|
26 | 9 | | |
---|
27 | 10 | | |
---|
28 | 11 | | @Verifier(tx) |
---|
29 | | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
| 12 | + | func verify () = { |
---|
| 13 | + | let aliceSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], alicePubKey)) |
---|
| 14 | + | then 1 |
---|
| 15 | + | else 0 |
---|
| 16 | + | let bobSigned = if (sigVerify(tx.bodyBytes, tx.proofs[1], bobPubKey)) |
---|
| 17 | + | then 1 |
---|
| 18 | + | else 0 |
---|
| 19 | + | let cooperSigned = if (sigVerify(tx.bodyBytes, tx.proofs[2], cooperPubKey)) |
---|
| 20 | + | then 1 |
---|
| 21 | + | else 0 |
---|
| 22 | + | match tx { |
---|
| 23 | + | case d: DataTransaction => |
---|
| 24 | + | true |
---|
| 25 | + | case s: SetScriptTransaction => |
---|
| 26 | + | (((aliceSigned + bobSigned) + cooperSigned) >= 2) |
---|
| 27 | + | case _ => |
---|
| 28 | + | false |
---|
| 29 | + | } |
---|
| 30 | + | } |
---|
30 | 31 | | |
---|