tx · 2Q2kDwvhqoDAExacxFGRrrDQSsxQob3qVNvvtE2mjAQ4

3N9GKCsktAL7oPFmaKsgPBoDfu3ijk23Vmm:  -0.01400000 Waves

2020.03.16 21:39 [912184] smart account 3N9GKCsktAL7oPFmaKsgPBoDfu3ijk23Vmm > SELF 0.00000000 Waves

{ "type": 13, "id": "2Q2kDwvhqoDAExacxFGRrrDQSsxQob3qVNvvtE2mjAQ4", "fee": 1400000, "feeAssetId": null, "timestamp": 1584384004958, "version": 1, "sender": "3N9GKCsktAL7oPFmaKsgPBoDfu3ijk23Vmm", "senderPublicKey": "BjzUYgMDny7cYArZdjtnVo62UoVZKiCEeCoKYFnevrWU", "proofs": [ "4LpwUxC8oF4xtwxgbMPX6jaYpZm4G1AzTBsmk7HsS6BnumphJNc2tV8bZqbDx3ZzLyAeHBCusyAzdUdk8Eri2Dra" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEBEgQKAggBAAAACgAAAAAHYUJpdENPMgEAAAAgx/h6AJ03UJ8qMmy7JIhz3VjOE4OL3ofCGi0oG2fBKJYAAAAACHN0YXJ0UXR5AAAAAAAAAknwAAAAAAROT05FAgAAAARub25lAAAAAAtPd25lclB1YktleQEAAAAgn5hAF5XTH/wY2Uluv2RH+5Oa9M+LYrB/BsNZzRqthEkAAAAABmlzc3VlcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVNQ9647ZjWnZOkr44fXhawO5UJXaNwwUVAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAA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AFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAALT3duZXJQdWJLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAAnR4BQAAAAckbWF0Y2gwBAAAAAlyZWNpcGllbnQJAAJYAAAAAQgJAAQkAAAAAQgFAAAAAnR4AAAACXJlY2lwaWVudAAAAAVieXRlcwMJAAAAAAAAAggFAAAAAnR4AAAABnNlbmRlcgUAAAAGaXNzdWVyBgkAAAIAAAABAgAAACBZb3UgY2FuJ3QgdHJhbnNmZXJyZWQgdGhpcyB0b2tlbgc/Zy4H", "chainId": 84, "height": 912184, "spentComplexity": 0 } View: original | compacted Prev: none Next: B7AEcg1RFioP3ZKTwYzs6ska3vb1tPfUm3XdDjPXLbGQ Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let aBitCO2 = base58'ETbtNp6MBuSM9EfjmLDwctrYEBBiq8CZ7ti7zbwTktry'
5+
6+let startQty = 150000
7+
8+let NONE = "none"
9+
10+let OwnerPubKey = base58'BjzUYgMDny7cYArZdjtnVo62UoVZKiCEeCoKYFnevrWU'
11+
12+let issuer = Address(base58'3N9GKCsktAL7oPFmaKsgPBoDfu3ijk23Vmm')
13+
14+func getNumberByKey (key) = {
15+ let num = match getInteger(this, key) {
16+ case a: Int =>
17+ a
18+ case _ =>
19+ 0
20+ }
21+ num
22+ }
23+
24+
25+func getStrByKey (key) = {
26+ let str = match getString(this, key) {
27+ case a: String =>
28+ a
29+ case _ =>
30+ NONE
31+ }
32+ str
33+ }
34+
35+
36+func getKeyItem (supplier,title) = ("tokens_Bit-CO2:_" + toBase58String(sha256(toBytes((supplier + title)))))
37+
38+
39+func getKeyBalanceQtySupplier (item) = "Tokens_ofertados,_Saldo"
40+
41+
42+func getValueBalanceQtySupplier (item) = getNumberByKey(getKeyBalanceQtySupplier(item))
43+
44+
45+@Callable(i)
46+func deposit (amount) = {
47+ let pmt = extract(i.payment)
48+ if ((pmt.assetId != aBitCO2))
49+ then throw("Use cBitCO2 tokens only for the wallet deposit")
50+ else {
51+ let supplier = toBase58String(i.caller.bytes)
52+ let currentAmount = match getInteger(this, supplier) {
53+ case a: Int =>
54+ a
55+ case _ =>
56+ startQty
57+ }
58+ let newAmount = (currentAmount + pmt.amount)
59+ WriteSet([DataEntry(supplier, newAmount)])
60+ }
61+ }
62+
63+
64+
65+@Callable(i)
66+func withdraw (title,amount) = {
67+ let supplier = toBase58String(i.caller.bytes)
68+ let item = getKeyItem(supplier, title)
69+ let preIcoQty = match getInteger(this, getKeyBalanceQtySupplier(item)) {
70+ case a: Int =>
71+ a
72+ case _ =>
73+ startQty
74+ }
75+ let newAmount = (preIcoQty - amount)
76+ if ((0 > amount))
77+ then throw("Can't withdraw negative amount")
78+ else if ((0 > newAmount))
79+ then throw("Not enought /suficiente balance")
80+ else ScriptResult(WriteSet([DataEntry(item, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, aBitCO2)]))
81+ }
82+
83+
84+@Verifier(tx)
85+func verify () = match tx {
86+ case t: SetScriptTransaction =>
87+ sigVerify(tx.bodyBytes, tx.proofs[0], OwnerPubKey)
88+ case d: DataTransaction =>
89+ true
90+ case tx: TransferTransaction =>
91+ let recipient = toBase58String(addressFromRecipient(tx.recipient).bytes)
92+ if ((tx.sender == issuer))
93+ then true
94+ else throw("You can't transferred this token")
95+ case _ =>
96+ false
97+}
98+

github/deemru/w8io/169f3d6 
36.03 ms