tx · 9a53RapyiUTXEWnT95QYo359hReWk5rfrvay1eUmssis 3N6D1fPBTu4QuZenU7hKNuxEKsxd13USum8: -0.01000000 Waves 2021.10.26 14:45 [1763213] smart account 3N6D1fPBTu4QuZenU7hKNuxEKsxd13USum8 > SELF 0.00000000 Waves
{ "type": 13, "id": "9a53RapyiUTXEWnT95QYo359hReWk5rfrvay1eUmssis", "fee": 1000000, "feeAssetId": null, "timestamp": 1635248768015, "version": 2, "chainId": 84, "sender": "3N6D1fPBTu4QuZenU7hKNuxEKsxd13USum8", "senderPublicKey": "8xCH82jKi2DM7HXXD45fmftPUDjr3TJpjanUATKMK37U", "proofs": [ "3C8xYYz5ZSpT1ysXMsdBCCRzrGoPZnPG1bMgiSwuUBBJBz43LtrTXiN67Gy4SMEKDGsAdSvZcsxnCjjwPMSrcUaM" ], "script": "base64:AAIDAAAAAAAAAAwIARIICgYBCAgICAgAAAAtAAAAAAd5Qml0Q08yAQAAACBpjNT/200BfejLeLffs4/BXDw5W+kMeWgNIY5n6ZtLrQAAAAAQVG9rVG9WZW5kZWRvclF0eQAAAAAAAAAnEAAAAAAETk9ORQIAAAAEbm9uZQAAAAALT3duZXJQdWJLZXkBAAAAIHYlgUf22Lk37u4at3MrCWteEN5n68yQc4q5Um14SA8PAAAAABZlY3hhY2h4a2FwYXdpeDAxcHJlaWNvCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFU3xPba43MIrTdBzkj1KIh5RJhI+0VJu6nAAAAABxlTTN4TjA4eE4wOHBleHByb2R4YWNBcHB4d3ZzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUZXtlAwFojd9til2zY8ueY3NTvHmic+ofAAAAAAp0eGFjeE4wOHBlCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFU2H+zv6hoVfC6umL2/Iw6/XNeoYjeAvgKAAAAAApOMDhwZXhwcm9kCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUoSOcBtKbP7i/nEoP0XqHwB6tn5KM3xRVAA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wBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAACdHgFAAAAByRtYXRjaDAGB/Sk7Ic=", "height": 1763213, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6JoXhuKF6cCoAR5oJwWieDXWj3UQk36snkU5xDh5ZT6a Next: AB1eNr1bqVfFAGCZceTR7jKtU2CFugSSqD4GDqh2FndW Diff:
Old | New | Differences | |
---|---|---|---|
173 | 173 | if ((saldoTienda1 >= (TokToVendedorQty * 10000))) | |
174 | 174 | then throw("Lo sentimos, por ahora no hay oferta de tokens para su transacción") | |
175 | 175 | else { | |
176 | - | let amountBCO2 = (TokToVendedorQty * 10000) | |
176 | + | let amountBCO2 = ((TokToVendedorQty * 10000) - saldoTienda1) | |
177 | 177 | if ((totalAmount > pmt.amount)) | |
178 | 178 | then throw("Payment Amount can't be less than item Purchase Order") | |
179 | 179 | else if ((pmt.amount > totalAmount)) | |
180 | 180 | then throw("Payment Amount can't be higher than item Purchase Order") | |
181 | - | else ScriptResult(WriteSet([DataEntry(getKeyUserItemGtsCounter(userAddress, item), (getValueUserItemGtsCounter(userAddress, item) + 1)), DataEntry("Apoyo Ecológico, wvls", totalAmount), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyprojectName(item), projectName), DataEntry(getKeyItemName(item), itemName), DataEntry(getKeyTName(item), tName), DataEntry(getKeySupplier(item), item), DataEntry("usdn", usdnw), DataEntry("eurou", eurou), DataEntry("1 Bit-CO2 con dscto, usd x10e-4", bco2menosdcto), DataEntry("Total bit-co2 a distribuir, x10e-4", subTotalb), DataEntry(("Order_Status:_" + userAddress), "Transacción Confirmada!"), DataEntry("Balance del Proyecto, anterior, wvls", saldoProj), DataEntry(getKeyBalanceProyecto(proyecto), (getValueBalanceProyecto(proyecto) + pIw)), DataEntry("Saldo Tienda1, anterior, bco2", | |
181 | + | else ScriptResult(WriteSet([DataEntry(getKeyUserItemGtsCounter(userAddress, item), (getValueUserItemGtsCounter(userAddress, item) + 1)), DataEntry("Apoyo Ecológico, wvls", totalAmount), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyprojectName(item), projectName), DataEntry(getKeyItemName(item), itemName), DataEntry(getKeyTName(item), tName), DataEntry(getKeySupplier(item), item), DataEntry("usdn", usdnw), DataEntry("eurou", eurou), DataEntry("1 Bit-CO2 con dscto, usd x10e-4", bco2menosdcto), DataEntry("Total bit-co2 a distribuir, x10e-4", subTotalb), DataEntry(("Order_Status:_" + userAddress), "Transacción Confirmada!"), DataEntry("Balance del Proyecto, anterior, wvls", saldoProj), DataEntry(getKeyBalanceProyecto(proyecto), (getValueBalanceProyecto(proyecto) + pIw)), DataEntry("Saldo en Tienda1, inicial o anterior, bco2", saldoTienda1), DataEntry(getKeyBalanToken(tienda), (getValueBalanToken(tienda) + subTotalb)), DataEntry("Saldo BCO2 en oferta, x10e-04", (amountBCO2 - ((getValueBalanToken(tienda) - saldoTienda1) + subTotalb)))]), TransferSet([ScriptTransfer(ecxachxkapawix01preico, pIw, unit), ScriptTransfer(eM3xN08xN08pexprodxacAppxwvs, eIw, unit), ScriptTransfer(i.caller, uIb, yBitCO2), ScriptTransfer(txacxN08pe, sIb, yBitCO2), ScriptTransfer(N08pexprod, eIb, yBitCO2)])) | |
182 | 182 | } | |
183 | 183 | } | |
184 | 184 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let yBitCO2 = base58'872MvpMoQx7SnV58HMcR9hd6vBWDtQvqmt5javCmYwpx' | |
5 | 5 | ||
6 | 6 | let TokToVendedorQty = 10000 | |
7 | 7 | ||
8 | 8 | let NONE = "none" | |
9 | 9 | ||
10 | 10 | let OwnerPubKey = base58'8xCH82jKi2DM7HXXD45fmftPUDjr3TJpjanUATKMK37U' | |
11 | 11 | ||
12 | 12 | let ecxachxkapawix01preico = Address(base58'3NAFcFPrj1wWrVMcsJMLvWBzmBt93oLh6w8') | |
13 | 13 | ||
14 | 14 | let eM3xN08xN08pexprodxacAppxwvs = Address(base58'3MyAfquD1K4mvWJNDLVPRG4BWiAW3RQUpXG') | |
15 | 15 | ||
16 | 16 | let txacxN08pe = Address(base58'3N9epiFphbL3Sf25xMASL1jAPxDH5D8vX85') | |
17 | 17 | ||
18 | 18 | let N08pexprod = Address(base58'3N4c7DzgBcyVWTEv9N11vNpg4B1bfg5ryfJ') | |
19 | 19 | ||
20 | 20 | let eurou = 116 | |
21 | 21 | ||
22 | 22 | let usdnw = 2539 | |
23 | 23 | ||
24 | 24 | let bco2e = 100000 | |
25 | 25 | ||
26 | 26 | let bitdscto = 3 | |
27 | 27 | ||
28 | 28 | let pIP = 10 | |
29 | 29 | ||
30 | 30 | let eIP = 1 | |
31 | 31 | ||
32 | 32 | let uBP = 7 | |
33 | 33 | ||
34 | 34 | let sBP = 2 | |
35 | 35 | ||
36 | 36 | let eBP = 2 | |
37 | 37 | ||
38 | 38 | let relacdcto = 11 | |
39 | 39 | ||
40 | 40 | func getNumberByKey (key) = { | |
41 | 41 | let num = match getInteger(this, key) { | |
42 | 42 | case a: Int => | |
43 | 43 | a | |
44 | 44 | case _ => | |
45 | 45 | 0 | |
46 | 46 | } | |
47 | 47 | num | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getStrByKey (key) = { | |
52 | 52 | let str = match getString(this, key) { | |
53 | 53 | case a: String => | |
54 | 54 | a | |
55 | 55 | case _ => | |
56 | 56 | NONE | |
57 | 57 | } | |
58 | 58 | str | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func getKeyUserItemGtsCounter (user,item) = "Order_№:" | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getValueUserItemGtsCounter (user,item) = getNumberByKey(getKeyUserItemGtsCounter(user, item)) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func getKeyprojectName (item) = "Proyecto de Apoyo | Inversión" | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func getValueprojectName (item) = getStrByKey(getKeyprojectName(item)) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func getKeyUserDocument (item) = "№ de Documento | DNI del Comprador:" | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func getValueUserDocument (item) = getStrByKey(getKeyUserDocument(item)) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func getKeyItemName (item) = "Producto-GTS adquirido | Categoría:" | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func getValueItemName (item) = getStrByKey(getKeyItemName(item)) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func getKeyTName (item) = "Tienda | Vendedor-GTS:" | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func getValueTName (item) = getStrByKey(getKeyTName(item)) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func getKeySupplier (item) = "Nodo-Activo Participante" | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func getKeyUI (item) = "UI, x10e-04 bit:" | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func getValueUI (item) = getNumberByKey(getKeyUI(item)) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func getKeyPI (item) = "PI, wvls:" | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func getValuePI (item) = getNumberByKey(getKeyPI(item)) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func getKeySI (item) = "SI, x10e-04 bit:" | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func getValueSI (item) = getNumberByKey(getKeySI(item)) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func getKeyNIb (item) = "NIb, x10e-04 bit:" | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func getValueNIb (item) = getNumberByKey(getKeyNIb(item)) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func getKeyNIw (item) = "NIw, wvls:" | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func getValueNIw (item) = getNumberByKey(getKeyNIw(item)) | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func getKeyBalanToken (tienda) = "Saldo en Tienda1 actual para restar del Balance, ytok:" | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func getValueBalanToken (tienda) = getNumberByKey(getKeyBalanToken(tienda)) | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func getKeyBalanceProyecto (proyecto) = "Balance del Proyecto, wvls:" | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func getValueBalanceProyecto (proyecto) = getNumberByKey(getKeyBalanceProyecto(proyecto)) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | @Callable(i) | |
138 | 138 | func purchaseGTS (totalAmount,userDocument,projectName,itemName,tName,item) = { | |
139 | 139 | let pmt = extract(i.payment) | |
140 | 140 | if (isDefined(pmt.assetId)) | |
141 | 141 | then throw("El Precio en waves.") | |
142 | 142 | else { | |
143 | 143 | let supplier = match getString(this, getKeySupplier(item)) { | |
144 | 144 | case a: String => | |
145 | 145 | a | |
146 | 146 | case _ => | |
147 | 147 | NONE | |
148 | 148 | } | |
149 | 149 | let tienda = toBase58String(txacxN08pe.bytes) | |
150 | 150 | let saldoTienda1 = match getInteger(this, getKeyBalanToken(tienda)) { | |
151 | 151 | case a: Int => | |
152 | 152 | a | |
153 | 153 | case _ => | |
154 | 154 | 0 | |
155 | 155 | } | |
156 | 156 | let proyecto = toBase58String(ecxachxkapawix01preico.bytes) | |
157 | 157 | let saldoProj = match getInteger(this, getKeyBalanceProyecto(proyecto)) { | |
158 | 158 | case a: Int => | |
159 | 159 | a | |
160 | 160 | case _ => | |
161 | 161 | 0 | |
162 | 162 | } | |
163 | 163 | let userAddress = toBase58String(i.caller.bytes) | |
164 | 164 | let subTotal = totalAmount | |
165 | 165 | let pIw = ((pIP * subTotal) / relacdcto) | |
166 | 166 | let eIw = ((eIP * subTotal) / relacdcto) | |
167 | 167 | let bco2menosdcto = (((100 - bitdscto) * (eurou * bco2e)) / 10000) | |
168 | 168 | let subTotalb = (((totalAmount * usdnw) / 100) / bco2menosdcto) | |
169 | 169 | let totalb = (subTotalb * 10000) | |
170 | 170 | let uIb = ((uBP * subTotalb) / relacdcto) | |
171 | 171 | let sIb = ((sBP * subTotalb) / relacdcto) | |
172 | 172 | let eIb = ((eBP * subTotalb) / relacdcto) | |
173 | 173 | if ((saldoTienda1 >= (TokToVendedorQty * 10000))) | |
174 | 174 | then throw("Lo sentimos, por ahora no hay oferta de tokens para su transacción") | |
175 | 175 | else { | |
176 | - | let amountBCO2 = (TokToVendedorQty * 10000) | |
176 | + | let amountBCO2 = ((TokToVendedorQty * 10000) - saldoTienda1) | |
177 | 177 | if ((totalAmount > pmt.amount)) | |
178 | 178 | then throw("Payment Amount can't be less than item Purchase Order") | |
179 | 179 | else if ((pmt.amount > totalAmount)) | |
180 | 180 | then throw("Payment Amount can't be higher than item Purchase Order") | |
181 | - | else ScriptResult(WriteSet([DataEntry(getKeyUserItemGtsCounter(userAddress, item), (getValueUserItemGtsCounter(userAddress, item) + 1)), DataEntry("Apoyo Ecológico, wvls", totalAmount), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyprojectName(item), projectName), DataEntry(getKeyItemName(item), itemName), DataEntry(getKeyTName(item), tName), DataEntry(getKeySupplier(item), item), DataEntry("usdn", usdnw), DataEntry("eurou", eurou), DataEntry("1 Bit-CO2 con dscto, usd x10e-4", bco2menosdcto), DataEntry("Total bit-co2 a distribuir, x10e-4", subTotalb), DataEntry(("Order_Status:_" + userAddress), "Transacción Confirmada!"), DataEntry("Balance del Proyecto, anterior, wvls", saldoProj), DataEntry(getKeyBalanceProyecto(proyecto), (getValueBalanceProyecto(proyecto) + pIw)), DataEntry("Saldo Tienda1, anterior, bco2", | |
181 | + | else ScriptResult(WriteSet([DataEntry(getKeyUserItemGtsCounter(userAddress, item), (getValueUserItemGtsCounter(userAddress, item) + 1)), DataEntry("Apoyo Ecológico, wvls", totalAmount), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyprojectName(item), projectName), DataEntry(getKeyItemName(item), itemName), DataEntry(getKeyTName(item), tName), DataEntry(getKeySupplier(item), item), DataEntry("usdn", usdnw), DataEntry("eurou", eurou), DataEntry("1 Bit-CO2 con dscto, usd x10e-4", bco2menosdcto), DataEntry("Total bit-co2 a distribuir, x10e-4", subTotalb), DataEntry(("Order_Status:_" + userAddress), "Transacción Confirmada!"), DataEntry("Balance del Proyecto, anterior, wvls", saldoProj), DataEntry(getKeyBalanceProyecto(proyecto), (getValueBalanceProyecto(proyecto) + pIw)), DataEntry("Saldo en Tienda1, inicial o anterior, bco2", saldoTienda1), DataEntry(getKeyBalanToken(tienda), (getValueBalanToken(tienda) + subTotalb)), DataEntry("Saldo BCO2 en oferta, x10e-04", (amountBCO2 - ((getValueBalanToken(tienda) - saldoTienda1) + subTotalb)))]), TransferSet([ScriptTransfer(ecxachxkapawix01preico, pIw, unit), ScriptTransfer(eM3xN08xN08pexprodxacAppxwvs, eIw, unit), ScriptTransfer(i.caller, uIb, yBitCO2), ScriptTransfer(txacxN08pe, sIb, yBitCO2), ScriptTransfer(N08pexprod, eIb, yBitCO2)])) | |
182 | 182 | } | |
183 | 183 | } | |
184 | 184 | } | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | @Verifier(tx) | |
188 | 188 | func verify () = match tx { | |
189 | 189 | case t: SetScriptTransaction => | |
190 | 190 | sigVerify(tx.bodyBytes, tx.proofs[0], OwnerPubKey) | |
191 | 191 | case d: ReissueTransaction|DataTransaction => | |
192 | 192 | true | |
193 | 193 | case tx: TransferTransaction => | |
194 | 194 | true | |
195 | 195 | case _ => | |
196 | 196 | false | |
197 | 197 | } | |
198 | 198 |
github/deemru/w8io/026f985 62.79 ms ◑