tx · EsReM4XWYiefaggUJevHyUvvpKGRBhqnpWutAe9U8Fw4 3MyYckPLvxVKaoywB9DyoUQpy4rPbG44W2G: -0.04200000 Waves 2022.06.21 14:06 [2106072] smart account 3MyYckPLvxVKaoywB9DyoUQpy4rPbG44W2G > SELF 0.00000000 Waves
{ "type": 13, "id": "EsReM4XWYiefaggUJevHyUvvpKGRBhqnpWutAe9U8Fw4", "fee": 4200000, "feeAssetId": null, "timestamp": 1655809657037, "version": 2, "chainId": 84, "sender": "3MyYckPLvxVKaoywB9DyoUQpy4rPbG44W2G", "senderPublicKey": "GSE3xef7yPJM86RK98TTRpNp7C67yeMHAkciapPuU56K", "proofs": [ "26TAVKRjPxdq2qdaR9ky7G7MQa845D5Fg2eUCxJ6fDjad4dKq27ftqDMbTX8ZJjMzUfVeyRmTnv8rpLABJxECRoQ" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAEAAAAAAJ0dwEAAAAaAVQ+7YEH8mRvE3c0tbqpeHlZj6y6IMZvhw8AAAAAAkJBAQAAACCMCWI0B6uy2aH1YA8IDoXmh9Ymmpl0HityIO+TCT8VJQAAAAADVENJAQAAACC+QxgAujAmMp9Bgik1StjQaVZeQEXcnOB8P3E0N8Qy/AAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAkJBCQAAAgAAAAECAAAAGFlvdSBjYW4gc3Rha2Ugc05TQlQgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAkJBBAAAAAt0b3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AABnAAAAAgAAAAAAAAAAAAUAAAAHYmFsYW5jZQkAAAIAAAABAgAAABtVbnN1ZmljaWVudCBhY2NvdW50IGJhbGFuY2UEAAAACVRDSUFtb3VudAQAAAAHJG1hdGNoMAkAA+wAAAABBQAAAANUQ0kDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABUFzc2V0BAAAAAFxBQAAAAckbWF0Y2gwCAUAAAABcQAAAAhxdWFudGl0eQAAAAAAAAAAAAQAAAACdnAJAABrAAAAAwkAA/AAAAACBQAAAAR0aGlzBQAAAAJCQQAAAAAABfXhAAUAAAAJVENJQW1vdW50BAAAAAV0b1JlcAkAAGsAAAADBQAAAAJ2cAUAAAAGYW1vdW50AAAAAAAF9eEABAAAAAJ0YwkAAGsAAAADBQAAAAV0b1JlcAAAAAAABfXhAAAAAAACVAvkAAQAAAADYnJuCQEAAAAEQnVybgAAAAIFAAAAA1RDSQUAAAAGYW1vdW50BAAAAAN0cmIJAABlAAAAAgUAAAAFdG9SZXAFAAAAAnRjBAAAAAR0cnNmCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAA3RyYgUAAAACQkEEAAAAA3R0cgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABBQAAAAJ0dwUAAAACdGMFAAAAAkJBCQAETAAAAAIFAAAAA2JybgkABEwAAAACBQAAAAR0cnNmCQAETAAAAAIFAAAAA3R0cgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlw7SdL", "height": 2106072, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BG4k9JGedSbTfMmd43MsDer4cnGBHv54hoAksapcjqaw Next: none Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let tw = base58'3MuepBtBCjoxHzt6z8cSKhcg7hps7AR9DoL' | |
5 | 5 | ||
6 | - | let BA = base58' | |
6 | + | let BA = base58'AReNqsLEzTufx73ftawaLcsDVAnvFjD2iVzzAE2CPXsS' | |
7 | 7 | ||
8 | 8 | let TCI = base58'DohoSLuGMXvefNR5eZmQbmas5amzdCkNY6DmfqgjfZ7q' | |
9 | 9 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let tw = base58'3MuepBtBCjoxHzt6z8cSKhcg7hps7AR9DoL' | |
5 | 5 | ||
6 | - | let BA = base58' | |
6 | + | let BA = base58'AReNqsLEzTufx73ftawaLcsDVAnvFjD2iVzzAE2CPXsS' | |
7 | 7 | ||
8 | 8 | let TCI = base58'DohoSLuGMXvefNR5eZmQbmas5amzdCkNY6DmfqgjfZ7q' | |
9 | 9 | ||
10 | 10 | let isStopped = false | |
11 | 11 | ||
12 | 12 | @Callable(i) | |
13 | 13 | func stake () = { | |
14 | 14 | let pmt = value(i.payments[0]) | |
15 | 15 | let pmtAmount = pmt.amount | |
16 | 16 | if ((pmt.assetId != BA)) | |
17 | 17 | then throw("You can stake sNSBT only") | |
18 | 18 | else if (isStopped) | |
19 | 19 | then throw("smart contract is on lock") | |
20 | 20 | else { | |
21 | 21 | let inTreasury = assetBalance(this, BA) | |
22 | 22 | let totalIssued = match assetInfo(TCI) { | |
23 | 23 | case asset: Asset => | |
24 | 24 | asset.quantity | |
25 | 25 | case _ => | |
26 | 26 | throw("Can't find asset") | |
27 | 27 | } | |
28 | 28 | let treasury = (inTreasury - pmtAmount) | |
29 | 29 | let singleTCIinValue = fraction(totalIssued, 100000000, treasury) | |
30 | 30 | let amountToIssue = fraction(pmtAmount, singleTCIinValue, 100000000) | |
31 | 31 | let TCIIssue = Reissue(TCI, amountToIssue, true) | |
32 | 32 | let transfer = ScriptTransfer(i.caller, amountToIssue, TCI) | |
33 | 33 | [TCIIssue, transfer] | |
34 | 34 | } | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | ||
39 | 39 | @Callable(i) | |
40 | 40 | func withdraw () = { | |
41 | 41 | let w = value(i.payments[0]) | |
42 | 42 | let amount = w.amount | |
43 | 43 | let balance = assetBalance(i.caller, TCI) | |
44 | 44 | if ((w.assetId != TCI)) | |
45 | 45 | then throw("sdasda") | |
46 | 46 | else if ((0 >= amount)) | |
47 | 47 | then throw("Can't withdraw 0 or negative ammount") | |
48 | 48 | else if ((0 >= balance)) | |
49 | 49 | then throw("Unsuficient account balance") | |
50 | 50 | else { | |
51 | 51 | let TCIAmount = match assetInfo(TCI) { | |
52 | 52 | case q: Asset => | |
53 | 53 | q.quantity | |
54 | 54 | case _ => | |
55 | 55 | 0 | |
56 | 56 | } | |
57 | 57 | let vp = fraction(assetBalance(this, BA), 100000000, TCIAmount) | |
58 | 58 | let toRep = fraction(vp, amount, 100000000) | |
59 | 59 | let tc = fraction(toRep, 100000000, 10000000000) | |
60 | 60 | let brn = Burn(TCI, amount) | |
61 | 61 | let trb = (toRep - tc) | |
62 | 62 | let trsf = ScriptTransfer(i.caller, trb, BA) | |
63 | 63 | let ttr = ScriptTransfer(Address(tw), tc, BA) | |
64 | 64 | [brn, trsf, ttr] | |
65 | 65 | } | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Verifier(tx) | |
70 | 70 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
71 | 71 |
github/deemru/w8io/169f3d6 29.40 ms ◑