tx · 3nDj8vL8VNFjdpnNPigMaEMsjiADdGwspsPfT5SznVKH 3N3mcmFcTNLfj78kMMjaYLAUkwUYh18meJs: -0.05000000 Waves 2023.07.12 15:24 [2662676] smart account 3N3mcmFcTNLfj78kMMjaYLAUkwUYh18meJs > SELF 0.00000000 Waves
{ "type": 13, "id": "3nDj8vL8VNFjdpnNPigMaEMsjiADdGwspsPfT5SznVKH", "fee": 5000000, "feeAssetId": null, "timestamp": 1689164703729, "version": 2, "chainId": 84, "sender": "3N3mcmFcTNLfj78kMMjaYLAUkwUYh18meJs", "senderPublicKey": "414MkiJeuGsTBdCNn4khZjfJYbrrrFb51FPKXHRwmgxN", "proofs": [ "5jAGmP9Z1HVLeMUiEvNhCBSrpde3me8xPHKSGySb1cvR5Wuqtncj1fcBGdvXhxLL1f3zV8w14YVLMoiSQVJhxTAQ" ], "script": "base64:BgKMAQgCEgASABIAEgMKAQEiCkFTU0VUX05BTUUiC0RFU0NSSVBUSU9OIghERUNJTUFMUyIJUFJFQ0lTSU9OIgRkaXZwIgJfeCICX3kiBG11bHAiAWkiBWFzc2V0Igdhc3NldElkIgdwYXltZW50IgRyYXRlIgZhbW91bnQiBV9yYXRlIgJ0eCIGdmVyaWZ5BgABYQIGc1dhdmVzAAFiAhFzV2F2ZXMgYXNzZXQgbW9jawABYwAIAAFkAICglKWNHQEBZQIBZgFnCQBuBAUBZgUBZAUBZwUISEFMRkVWRU4BAWgCAWYBZwkAbgQFAWYFAWcFAWQFCEhBTEZFVkVOBAFpAQppbml0aWFsaXplAAQBagkAwwgHBQFhBQFiAAAFAWMGBQR1bml0AAAEAWsJALgIAQUBagkAzAgCCQELU3RyaW5nRW50cnkCAgVBU1NFVAkA2AQBBQFrCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgRSQVRFBQFkCQDMCAIFAWoFA25pbAFpAQdkZXBvc2l0AAQBbAkAkQMCCAUBaQhwYXltZW50cwAABAFrCQDZBAEJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMCBUFTU0VUBAFtCQERQGV4dHJOYXRpdmUoMTA1MCkCBQR0aGlzAgRSQVRFBAFuCQEBZQIIBQFsBmFtb3VudAUBbQkAzAgCCQEHUmVpc3N1ZQMFAWsFAW4GCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUBbgUBawUDbmlsAWkBCHdpdGhkcmF3AAQBbAkAkQMCCAUBaQhwYXltZW50cwAABAFrCQDZBAEJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMCBUFTU0VUBAFtCQERQGV4dHJOYXRpdmUoMTA1MCkCBQR0aGlzAgRSQVRFBAFuCQEBaAIIBQFsBmFtb3VudAUBbQkAzAgCCQEEQnVybgIFAWsIBQFsBmFtb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFAW4FBHVuaXQFA25pbAFpAQdzZXRSYXRlAQFvCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgRSQVRFBQFvBQNuaWwBAXABAXEACQD0AwMIBQFwCWJvZHlCeXRlcwkAkQMCCAUBcAZwcm9vZnMAAAgFAXAPc2VuZGVyUHVibGljS2V5XlIoLg==", "height": 2662676, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ASSET_NAME = "sWaves" | |
5 | + | ||
6 | + | let DESCRIPTION = "sWaves asset mock" | |
7 | + | ||
8 | + | let DECIMALS = 8 | |
9 | + | ||
10 | + | let PRECISION = 1000000000000 | |
11 | + | ||
12 | + | func divp (_x,_y) = fraction(_x, PRECISION, _y, HALFEVEN) | |
13 | + | ||
14 | + | ||
15 | + | func mulp (_x,_y) = fraction(_x, _y, PRECISION, HALFEVEN) | |
16 | + | ||
17 | + | ||
18 | + | @Callable(i) | |
19 | + | func initialize () = { | |
20 | + | let asset = Issue(ASSET_NAME, DESCRIPTION, 0, DECIMALS, true, unit, 0) | |
21 | + | let assetId = calculateAssetId(asset) | |
22 | + | [StringEntry("ASSET", toBase58String(assetId)), IntegerEntry("RATE", PRECISION), asset] | |
23 | + | } | |
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | @Callable(i) | |
28 | + | func deposit () = { | |
29 | + | let payment = i.payments[0] | |
30 | + | let assetId = fromBase58String(getStringValue(this, "ASSET")) | |
31 | + | let rate = getIntegerValue(this, "RATE") | |
32 | + | let amount = divp(payment.amount, rate) | |
33 | + | [Reissue(assetId, amount, true), ScriptTransfer(i.caller, amount, assetId)] | |
34 | + | } | |
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | @Callable(i) | |
39 | + | func withdraw () = { | |
40 | + | let payment = i.payments[0] | |
41 | + | let assetId = fromBase58String(getStringValue(this, "ASSET")) | |
42 | + | let rate = getIntegerValue(this, "RATE") | |
43 | + | let amount = mulp(payment.amount, rate) | |
44 | + | [Burn(assetId, payment.amount), ScriptTransfer(i.caller, amount, unit)] | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | @Callable(i) | |
50 | + | func setRate (_rate) = [IntegerEntry("RATE", _rate)] | |
51 | + | ||
52 | + | ||
53 | + | @Verifier(tx) | |
54 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
55 | + |
github/deemru/w8io/026f985 13.88 ms ◑