tx · 9Chji9wTDe5hDf7xqswUrzf7ZZaZe7ctvaporPGrFEgC
3MzinmzqK3LhSD6wTCDeHtGWkQpek88jsPJ: -0.01000000 Waves
2020.05.22 15:06 [1009466] smart account 3MzinmzqK3LhSD6wTCDeHtGWkQpek88jsPJ > SELF 0.00000000 Waves
{
"type": 13,
"id": "9Chji9wTDe5hDf7xqswUrzf7ZZaZe7ctvaporPGrFEgC",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1590149204618,
"version": 1,
"sender": "3MzinmzqK3LhSD6wTCDeHtGWkQpek88jsPJ",
"senderPublicKey": "2YnsZ9Cc6o9Tcf4JRVbKRrmhNW9XYQHoGksQRoohHyAA",
"proofs": [
"3YFG2gZCrx4yCvzA64HTYCA7JRv7fiPzvVkRpa1h39RmsJieg8sSDHEeUo2kZpf7x4gWKTaWi8p5xGHfGvJwwB5C"
],
"script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAgY2FuIHVzZSBXQVZFUyBvbmx5IGF0IHRoZSBtb21lbnQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNpdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAABXByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC9wdXJjaGFzZSBhbW91aW50IGNhbm5vdCBiZSBsZXNzIHRoYW4gaXRlbSBwcmljZQMJAABmAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAAMHB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgaGlnaGVyIHRoYW4gaXRlbSBwcmljZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAACBzdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAfcHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsAAAAADVkcI0=",
"chainId": 84,
"height": 1009466,
"spentComplexity": 0
}
View: original | compacted
Prev: none
Next: none
Full:
Old | New | | Differences |
---|
1 | | - | # no script |
---|
| 1 | + | {-# STDLIB_VERSION 3 #-} |
---|
| 2 | + | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
| 3 | + | {-# CONTENT_TYPE DAPP #-} |
---|
| 4 | + | |
---|
| 5 | + | |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func purchase () = { |
---|
| 8 | + | let b = extract(a.payment) |
---|
| 9 | + | if (isDefined(b.assetId)) |
---|
| 10 | + | then throw("can use WAVES only at the moment") |
---|
| 11 | + | else { |
---|
| 12 | + | let c = toBase58String(a.caller.bytes) |
---|
| 13 | + | let d = { |
---|
| 14 | + | let e = getInteger(this, "item_A_coupon_price") |
---|
| 15 | + | if ($isInstanceOf(e, "Int")) |
---|
| 16 | + | then { |
---|
| 17 | + | let f = e |
---|
| 18 | + | f |
---|
| 19 | + | } |
---|
| 20 | + | else 0 |
---|
| 21 | + | } |
---|
| 22 | + | if ((d > b.amount)) |
---|
| 23 | + | then throw("purchase amouint cannot be less than item price") |
---|
| 24 | + | else if ((b.amount > d)) |
---|
| 25 | + | then throw("purchase amount cannot be higher than item price") |
---|
| 26 | + | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + c), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + c), d)]) |
---|
| 27 | + | } |
---|
| 28 | + | } |
---|
| 29 | + | |
---|
| 30 | + | |
---|