tx · EQcHPLm8dctLmTrRBKKAzynJnyoa61my9Tko9ynRRnLJ 3Mvjrd9jd9BEQvHoiHnPKR2WqtZnvxopDcx: -0.10000000 Waves 2022.04.08 21:24 [1999939] smart account 3Mvjrd9jd9BEQvHoiHnPKR2WqtZnvxopDcx > SELF 0.00000000 Waves
{ "type": 13, "id": "EQcHPLm8dctLmTrRBKKAzynJnyoa61my9Tko9ynRRnLJ", "fee": 10000000, "feeAssetId": null, "timestamp": 1649442269296, "version": 2, "chainId": 84, "sender": "3Mvjrd9jd9BEQvHoiHnPKR2WqtZnvxopDcx", "senderPublicKey": "B37Jiw5CgfjxqxYgkAGeJpTmiCa4Cb6a9mh9fynZppFR", "proofs": [ "i6Yh2md4G9QGbPkSQSfX51Uu5DjTxZcBa75EPzdTe9M9d51B3uCrBTaN9JsGw5WERNEq2RSRvWxS3niFVHNBr6X" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAAAgAAAAAHYXNzZXRJZAEAAAAgYdTHJtpm4GwuO67Z7w+Qg9eAml6YMFJTv4sCKXVeLDUAAAAACXVuaXRQcmljZQAAAAAAAAAD6AAAAAEAAAABaQEAAAAHYnV5TEtSVAAAAAEAAAAGYW1vdW50AwkAAGcAAAACCAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAAAAAZhbW91bnQJAABoAAAAAgUAAAAJdW5pdFByaWNlBQAAAAZhbW91bnQDCQAAZwAAAAIJAAPwAAAAAgUAAAAEdGhpcwUAAAAHYXNzZXRJZAUAAAAGYW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMFAAAABmFtb3VudAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAHQWRkcmVzcwAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMFAAAABmFtb3VudAUAAAAHYXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAIENhbid0IGNhbGwgb3Igbm90IGVub3VnaCBiYWxhbmNlCQAAAgAAAAECAAAAE25vdCBlbm91Z2ggcGF5bWVudHMAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleffmoyQ=", "height": 1999939, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5WAPtDmHTURR8nrV2Wk86aPpUp9ZfBNmfZQhLbB8p4Na Next: 3QeVF3DBaScYaVot5kvbWDZr3yndCeE6knweYt7eu3jd Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let assetId = base58'7atjFuUvDnCqsg8uNC5PYEgg3UXAv94St5zuA6vSjMVE' | |
4 | 5 | ||
6 | + | let unitPrice = 1000 | |
5 | 7 | ||
6 | 8 | @Callable(i) | |
7 | - | func createMuthuToken () = if ((i.caller == this)) | |
8 | - | then { | |
9 | - | let issue = Issue("LKRT", "A test token by K.Muthu for testing purpose", 100000000000, 3, false) | |
10 | - | let id = calculateAssetId(issue) | |
11 | - | $Tuple2([issue, BinaryEntry("id", id)], unit) | |
12 | - | } | |
13 | - | else throw("Token already issued") | |
9 | + | func buyLKRT (amount) = if ((value(i.payments[0]).amount >= (unitPrice * amount))) | |
10 | + | then if ((assetBalance(this, assetId) >= amount)) | |
11 | + | then [IntegerEntry(toBase58String(i.caller.bytes), amount), ScriptTransfer(Address(i.caller.bytes), amount, assetId)] | |
12 | + | else throw("Can't call or not enough balance") | |
13 | + | else throw("not enough payments") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let assetId = base58'7atjFuUvDnCqsg8uNC5PYEgg3UXAv94St5zuA6vSjMVE' | |
4 | 5 | ||
6 | + | let unitPrice = 1000 | |
5 | 7 | ||
6 | 8 | @Callable(i) | |
7 | - | func createMuthuToken () = if ((i.caller == this)) | |
8 | - | then { | |
9 | - | let issue = Issue("LKRT", "A test token by K.Muthu for testing purpose", 100000000000, 3, false) | |
10 | - | let id = calculateAssetId(issue) | |
11 | - | $Tuple2([issue, BinaryEntry("id", id)], unit) | |
12 | - | } | |
13 | - | else throw("Token already issued") | |
9 | + | func buyLKRT (amount) = if ((value(i.payments[0]).amount >= (unitPrice * amount))) | |
10 | + | then if ((assetBalance(this, assetId) >= amount)) | |
11 | + | then [IntegerEntry(toBase58String(i.caller.bytes), amount), ScriptTransfer(Address(i.caller.bytes), amount, assetId)] | |
12 | + | else throw("Can't call or not enough balance") | |
13 | + | else throw("not enough payments") | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | @Verifier(tx) | |
17 | 17 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
18 | 18 |
github/deemru/w8io/026f985 17.84 ms ◑