tx · AWE2Puoc6oeGKB8TjoakwSxfg7P3nEUdgrgzjf9xvHYk 3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4: -0.01400000 Waves 2020.03.10 13:06 [902893] smart account 3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4 > SELF 0.00000000 Waves
{ "type": 13, "id": "AWE2Puoc6oeGKB8TjoakwSxfg7P3nEUdgrgzjf9xvHYk", "fee": 1400000, "feeAssetId": null, "timestamp": 1583834525896, "version": 1, "sender": "3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4", "senderPublicKey": "4AHsCbS9QYVdKNvxrPWwsMwwy3KqXaCMXeAscExJZk9L", "proofs": [ "3vAehheJFr5db7nFiA7HVHyaHycRrgSeR4JodUsqRqJBdGgdC7M5YPAkFdrCcC7L9xzmzSWCD6sRVvnYRyHJsFn" ], "script": "base64:AAIDAAAAAAAAABAIARIFCgMIAQgSBQoDCAgIAAAAJQAAAAAHYUJpdENPMgEAAAAgx/h6AJ03UJ8qMmy7JIhz3VjOE4OL3ofCGi0oG2fBKJYAAAAACHN0YXJ0UXR5AAAAAAAABRQAAAAAAAhub21QcmljZQAAAAAABfXhAAAAAAAWZGlzY291bnRQcmVJY29TdXBwbGllcgAAAAAAAAAADAAAAAAOT3duZXJFY29QdWJLZXkBAAAAIC70W6NACRoO8DcwW0R46ze+bNGLr0tg3cAkNP8WNkAfAAAAAAN3dnMAAAAAAAX14QAAAAAABE5PTkUCAAAABG5vbmUAAAAABmlzc3VlcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVMr3Oz7nL9FV4g+t+EWzLN77jdANRWt9bwEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAA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gAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADk93bmVyRWNvUHViS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAJ0eAUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE0V4Y2hhbmdlVHJhbnNhY3Rpb24EAAAAAnR4BQAAAAckbWF0Y2gwBAAAAAl3aXRoV2F2ZXMDCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABCAgIBQAAAAJ0eAAAAAlzZWxsT3JkZXIAAAAJYXNzZXRQYWlyAAAACnByaWNlQXNzZXQGCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABCAgIBQAAAAJ0eAAAAAlzZWxsT3JkZXIAAAAJYXNzZXRQYWlyAAAAC2Ftb3VudEFzc2V0BQAAAAl3aXRoV2F2ZXMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAAFjBQAAAAckbWF0Y2gwBgc9V75h", "chainId": 84, "height": 902893, "spentComplexity": 0 } View: original | compacted Prev: 2XQSuNGWvp7kKVcnTwe3PPyEKqqK6ayu1NgW9CBHYTYa Next: 52XBai7eLEAek4cwq7M4q79WGNcm2tDGsaVujEJj9M64 Diff:
Old | New | Differences | |
---|---|---|---|
96 | 96 | func getValueItemUserOrderQty (item) = getNumberByKey(getKeyItemUserOrderQty(item)) | |
97 | 97 | ||
98 | 98 | ||
99 | - | func getKeyBalanceSupplier ( | |
99 | + | func getKeyBalanceSupplier (supplier) = (supplier + "_seller_balance") | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
126 | 126 | let item = getKeyItem(supplier, title) | |
127 | 127 | if ((0 >= preIcoQty)) | |
128 | 128 | then throw("Sorry, insufficient token offer") | |
129 | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplier), DataEntry(("Saldo_tokens:_" + getKeyBalanceQtySupplier(item)), preIcoQty), DataEntry(("Precio_Nominal_ | |
129 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplier), DataEntry(("Saldo_tokens:_" + getKeyBalanceQtySupplier(item)), preIcoQty), DataEntry(("Precio_Nominal_1_BitCO2:_" + getKeyItemPriceSupplier(item)), nomPrice), DataEntry(getKeyItemDiscountSupplier(item), discountPreIcoSupplier), DataEntry(getKeyItemData(item), supplierData), DataEntry(getKeyBalanceSupplier(supplier), 0)]) | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let aBitCO2 = base58'ETbtNp6MBuSM9EfjmLDwctrYEBBiq8CZ7ti7zbwTktry' | |
5 | 5 | ||
6 | 6 | let startQty = 332800 | |
7 | 7 | ||
8 | 8 | let nomPrice = 100000000 | |
9 | 9 | ||
10 | 10 | let discountPreIcoSupplier = 12 | |
11 | 11 | ||
12 | 12 | let OwnerEcoPubKey = base58'4AHsCbS9QYVdKNvxrPWwsMwwy3KqXaCMXeAscExJZk9L' | |
13 | 13 | ||
14 | 14 | let wvs = 100000000 | |
15 | 15 | ||
16 | 16 | let NONE = "none" | |
17 | 17 | ||
18 | 18 | let issuer = Address(base58'3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4') | |
19 | 19 | ||
20 | 20 | func getNumberByKey (key) = { | |
21 | 21 | let num = match getInteger(this, key) { | |
22 | 22 | case a: Int => | |
23 | 23 | a | |
24 | 24 | case _ => | |
25 | 25 | 0 | |
26 | 26 | } | |
27 | 27 | num | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getStrByKey (key) = { | |
32 | 32 | let str = match getString(this, key) { | |
33 | 33 | case a: String => | |
34 | 34 | a | |
35 | 35 | case _ => | |
36 | 36 | NONE | |
37 | 37 | } | |
38 | 38 | str | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func getKeyItem (supplier,title) = ("BitCO2:_" + toBase58String(sha256(toBytes((supplier + title))))) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func getKeyItemSupplier (item) = (item + "_Amaz") | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getKeyItemQty (item) = (item + "_tok.amount") | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func getValueItemQty (item) = getNumberByKey(getKeyItemQty(item)) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getKeyBalanceQtySupplier (item) = (item + "_tokens") | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getValueBalanceQtySupplier (item) = getNumberByKey(getKeyBalanceQtySupplier(item)) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getKeyItemData (item) = (item + "_description") | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func getKeyItemUserData (item) = (item + "_userdata") | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func getKeyBalanceUser (item) = (item + "_saldwvsuser") | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func getValueBalanceUser (item) = getNumberByKey(getKeyBalanceUser(item)) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func getKeyPaymentUser (item) = (item + "_user.pmt") | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func getValuePaymentUser (item) = getNumberByKey(getKeyPaymentUser(item)) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func getKeyBalanceQtyUser (item) = (item + "_saldqty") | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func getValueBalanceQtyUser (item) = getNumberByKey(getKeyBalanceQtyUser(item)) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func getKeyItemUserOrderQty (item) = (item + "_qty") | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func getValueItemUserOrderQty (item) = getNumberByKey(getKeyItemUserOrderQty(item)) | |
97 | 97 | ||
98 | 98 | ||
99 | - | func getKeyBalanceSupplier ( | |
99 | + | func getKeyBalanceSupplier (supplier) = (supplier + "_seller_balance") | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func getKeyItemUser (item) = (("name:_" + item) + "_") | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getValueItemUser (item) = getStrByKey(getKeyItemUser(item)) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func getKeyItemDiscountSupplier (item) = (("disc:_" + item) + "_") | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func getValueItemDiscountSupplier (item) = getNumberByKey(getKeyItemDiscountSupplier(item)) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func getKeyItemPriceSupplier (item) = (("Nom:_" + item) + "_") | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func getValueItemPriceSupplier (item) = getNumberByKey(getKeyItemPriceSupplier(item)) | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | @Callable(i) | |
124 | 124 | func AddSupplierToken (title,preIcoQty,supplierData) = { | |
125 | 125 | let supplier = toBase58String(i.caller.bytes) | |
126 | 126 | let item = getKeyItem(supplier, title) | |
127 | 127 | if ((0 >= preIcoQty)) | |
128 | 128 | then throw("Sorry, insufficient token offer") | |
129 | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplier), DataEntry(("Saldo_tokens:_" + getKeyBalanceQtySupplier(item)), preIcoQty), DataEntry(("Precio_Nominal_ | |
129 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplier), DataEntry(("Saldo_tokens:_" + getKeyBalanceQtySupplier(item)), preIcoQty), DataEntry(("Precio_Nominal_1_BitCO2:_" + getKeyItemPriceSupplier(item)), nomPrice), DataEntry(getKeyItemDiscountSupplier(item), discountPreIcoSupplier), DataEntry(getKeyItemData(item), supplierData), DataEntry(getKeyBalanceSupplier(supplier), 0)]) | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | 134 | @Callable(i) | |
135 | 135 | func PurchaseToken (item,projectName,userData) = { | |
136 | 136 | let pmt = extract(i.payment) | |
137 | 137 | if (isDefined(pmt.assetId)) | |
138 | 138 | then throw("you can adquire cBitCO2 only by Waves tokens") | |
139 | 139 | else { | |
140 | 140 | let account = getValueItemSupplier(item) | |
141 | 141 | let preIcoQty = match getInteger(this, getKeyBalanceQtySupplier(item)) { | |
142 | 142 | case a: Int => | |
143 | 143 | a | |
144 | 144 | case _ => | |
145 | 145 | startQty | |
146 | 146 | } | |
147 | 147 | let userAddress = toBase58String(i.caller.bytes) | |
148 | 148 | let buyerTokenPrice = ((nomPrice * (100 - discountPreIcoSupplier)) / 100) | |
149 | 149 | let orderAmount = (pmt.amount / buyerTokenPrice) | |
150 | 150 | let newQty = (preIcoQty - orderAmount) | |
151 | 151 | let totalAmount = (orderAmount * buyerTokenPrice) | |
152 | 152 | if ((totalAmount > pmt.amount)) | |
153 | 153 | then throw("Payment Amount cannot be less than item Purchase Order") | |
154 | 154 | else if ((pmt.amount > totalAmount)) | |
155 | 155 | then throw("Payment Amount can't be higher than item Purchase Order") | |
156 | 156 | else ScriptResult(WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyItemSupplier(item), projectName), DataEntry(getKeyItemUserData(item), userData), DataEntry("Cantidad_de_tokens_a_comprar:_", orderAmount), DataEntry(("Suma_a_invertir:_" + getKeyBalanceUser(item)), pmt.amount), DataEntry(("Request_Status:_" + userAddress), "sold"), DataEntry(("User_Balance:_" + getKeyBalanceQtyUser(item)), (getValueBalanceQtyUser(item) + orderAmount)), DataEntry(("Saldo_tokens:_" + getKeyBalanceQtySupplier(item)), newQty), DataEntry(("Saldo_Seller:_" + getKeyBalanceSupplier(account)), (getValueBalanceSupplier(account) + pmt.amount))]), TransferSet([ScriptTransfer(addressFromStringValue(userAddress), orderAmount, aBitCO2)])) | |
157 | 157 | } | |
158 | 158 | } | |
159 | 159 | ||
160 | 160 | ||
161 | 161 | @Verifier(tx) | |
162 | 162 | func verify () = match tx { | |
163 | 163 | case t: SetScriptTransaction => | |
164 | 164 | sigVerify(tx.bodyBytes, tx.proofs[0], OwnerEcoPubKey) | |
165 | 165 | case d: DataTransaction => | |
166 | 166 | true | |
167 | 167 | case tx: TransferTransaction => | |
168 | 168 | true | |
169 | 169 | case tx: ExchangeTransaction => | |
170 | 170 | let withWaves = if (!(isDefined(tx.sellOrder.assetPair.priceAsset))) | |
171 | 171 | then true | |
172 | 172 | else !(isDefined(tx.sellOrder.assetPair.amountAsset)) | |
173 | 173 | withWaves | |
174 | 174 | case c: InvokeScriptTransaction => | |
175 | 175 | true | |
176 | 176 | case _ => | |
177 | 177 | false | |
178 | 178 | } | |
179 | 179 |
github/deemru/w8io/169f3d6 44.40 ms ◑