tx · 7JfPcsspC4RPEGrAVnAwneEaBVHG4196mtsFD1CHtsRT 3NALbZy5kRMnNmHrP7WUsgWUf3tCX7vsbAs: -0.00700000 Waves 2022.07.17 17:29 [2143879] smart account 3NALbZy5kRMnNmHrP7WUsgWUf3tCX7vsbAs > SELF 0.00000000 Waves
{ "type": 13, "id": "7JfPcsspC4RPEGrAVnAwneEaBVHG4196mtsFD1CHtsRT", "fee": 700000, "feeAssetId": null, "timestamp": 1658068181310, "version": 2, "chainId": 84, "sender": "3NALbZy5kRMnNmHrP7WUsgWUf3tCX7vsbAs", "senderPublicKey": "FCs6gVPFo4sbN8f7nW2gEm36jeUPWyYdt51xzCTY1Lgi", "proofs": [ "57mg1XU5ecRCLNXSCxoqsnaJ98sBmKexohEun8Jk1o7QnxMbJjVsiSoX3kR5M8JPMs3VNKD7yM4SGBYcEAN7TfZc" ], "script": "base64:AAIDAAAAAAAAAAsIARIHCgUICAgBAQAAACEAAAAAA1ZHVAEAAAAgAPs5y/R2CqiyWSxNldt26J/wx9NuUlms6dNVusQnAScAAAAADXN0YXJ0VG90YWxRdHkAAAAAAAAPQkAAAAAAA3d2cwAAAAAABfXhAAAAAAAETk9ORQIAAAAEbm9uZQAAAAAHbm9tdmd0dQAAAAAAAAAACgAAAAAFdXNkbncAAAAAAAAAAd4AAAAAC093bmVyUHViS2V5AQAAACDTDabcI8LzB9tWS9lEjmA4w1eYCLI6b207rRBMqkJEGwAAAAAKYWRtTjA4VkdUVwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVMp5OFCu+8OtYaQx5WnOCz/kWDHG7i+bOQAAAAARYWRtTjA4c3lzVkdUUGFpc1cJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQbjYxTyT8Q7+WwnaQm5Sj/Z1eJ0rcNywQBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAABy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dGFUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAE1RyYW5zZmVyVHJhbnNhY3Rpb24EAAAAAnR4BQAAAAckbWF0Y2gwBgfHQVeZ", "height": 2143879, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FV9d1YBDwV1JZd482PBtmStBhavETMCsGcYXRrzPxdig Next: 8yS4MxgrzC9oo39xkWNZihNLUpCSAK753D1bFjUzrxBP Diff:
Old | New | Differences | |
---|---|---|---|
139 | 139 | then throw("Payment Amount can't be less than item Purchase Order") | |
140 | 140 | else if ((pmt.amount > totalAmount)) | |
141 | 141 | then throw("Payment Amount can't be higher than item Purchase Order") | |
142 | - | else ScriptResult(WriteSet([DataEntry(getKeyEmisor(item), "Ecosistema Bit-CO2"), DataEntry(getKeyEmisionCountry(item), "E2E/N08PE"), DataEntry(getKeyEmisionCode(item), "E2E_N00-VGT-01"), DataEntry(getKeyNomTokenPrice(item), "10.00 USD"), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeystartTotalQty(item), startTotalQty), DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyUserCountry(item), userCountry), DataEntry(getKeyItemUserOrderQty(item), orderQty), DataEntry("Monto de Inversión | Participación, wvs", totalAmount), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeySaldoTokenQtyStartEtapa(item), (getValueSaldoTokenQtyStartEtapa(item) + orderQty)), DataEntry("Saldo de Tokens VGT", ((startTotalQty - getValueSaldoTokenQtyStartEtapa(item)) - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (getValueBalanceSupplier(supplier) + pmt.amount)), DataEntry("Cta. del | |
142 | + | else ScriptResult(WriteSet([DataEntry(getKeyEmisor(item), "Ecosistema Bit-CO2"), DataEntry(getKeyEmisionCountry(item), "E2E/N08PE"), DataEntry(getKeyEmisionCode(item), "E2E_N00-VGT-01"), DataEntry(getKeyNomTokenPrice(item), "10.00 USD"), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeystartTotalQty(item), startTotalQty), DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyUserCountry(item), userCountry), DataEntry(getKeyItemUserOrderQty(item), orderQty), DataEntry("Monto de Inversión | Participación, wvs", totalAmount), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeySaldoTokenQtyStartEtapa(item), (getValueSaldoTokenQtyStartEtapa(item) + orderQty)), DataEntry("Saldo de Tokens VGT", ((startTotalQty - getValueSaldoTokenQtyStartEtapa(item)) - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (getValueBalanceSupplier(supplier) + pmt.amount)), DataEntry("Cta. del System VGT del N08PE, blockchain:", "3MrRmb3ANQy1o15LbHRNhiNHjYvXnoSLMCo"), DataEntry("Cta. del Admin VGT del N08, blockchain:", "3N8NfVBXHM7yKRy92ghKc5MJYFuyFXhsDXn")]), TransferSet([ScriptTransfer(addressFromStringValue(userAddress), (10000 * orderQty), VGT), ScriptTransfer(admN08VGTW, ((75 * pmt.amount) / 100), unit), ScriptTransfer(admN08sysVGTPaisW, ((5 * pmt.amount) / 100), unit)])) | |
143 | 143 | } | |
144 | 144 | } | |
145 | 145 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let VGT = base58'14qBkVfMxkWyR4sjgXVfDanaemoCbhuwy9ptGtUt53Xc' | |
5 | 5 | ||
6 | 6 | let startTotalQty = 1000000 | |
7 | 7 | ||
8 | 8 | let wvs = 100000000 | |
9 | 9 | ||
10 | 10 | let NONE = "none" | |
11 | 11 | ||
12 | 12 | let nomvgtu = 10 | |
13 | 13 | ||
14 | 14 | let usdnw = 478 | |
15 | 15 | ||
16 | 16 | let OwnerPubKey = base58'FCs6gVPFo4sbN8f7nW2gEm36jeUPWyYdt51xzCTY1Lgi' | |
17 | 17 | ||
18 | 18 | let admN08VGTW = Address(base58'3N8NfVBXHM7yKRy92ghKc5MJYFuyFXhsDXn') | |
19 | 19 | ||
20 | 20 | let admN08sysVGTPaisW = Address(base58'3MrRmb3ANQy1o15LbHRNhiNHjYvXnoSLMCo') | |
21 | 21 | ||
22 | 22 | func getNumberByKey (key) = { | |
23 | 23 | let num = match getInteger(this, key) { | |
24 | 24 | case a: Int => | |
25 | 25 | a | |
26 | 26 | case _ => | |
27 | 27 | 0 | |
28 | 28 | } | |
29 | 29 | num | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getStrByKey (key) = { | |
34 | 34 | let str = match getString(this, key) { | |
35 | 35 | case a: String => | |
36 | 36 | a | |
37 | 37 | case _ => | |
38 | 38 | NONE | |
39 | 39 | } | |
40 | 40 | str | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func getKeyEmisor (item) = "Emisor:" | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func getValueEmisor (item) = getStrByKey(getKeyEmisor(item)) | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func getKeyItemSupplier (supplier) = (supplier + "Nodo-08") | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func getKeyEmisionCountry (item) = "Nodo-País:" | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func getValueEmisionCountry (item) = getStrByKey(getKeyEmisionCountry(item)) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func getKeyEmisionCode (item) = "Código:" | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func getValueEmisionCode (item) = getStrByKey(getKeyEmisionCode(item)) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getKeyNomTokenPrice (item) = "Precio Nominal, 1 VGT:" | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func getKeystartTotalQty (item) = "Cantidad de tokens emitidos:" | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func getValuestartTotalQty (item) = getStrByKey(getKeystartTotalQty(item)) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func getKeyBalanceSupplier (supplier) = "Fondos | Monto recaudado, wvs" | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func getValueBalanceSupplier (supplier) = getNumberByKey(getKeyBalanceSupplier(supplier)) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func getKeyUserItemCounter (user,item) = "Order_№:" | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func getKeyUserDocument (item) = "Documento Nacional de Identidad, DNI:" | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func getValueUserDocument (item) = getStrByKey(getKeyUserDocument(item)) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func getKeyUserCountry (item) = "País de Residencia del Usuario:" | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func getValueUserCountry (item) = getStrByKey(getKeyUserCountry(item)) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func getKeyItemUserOrderQty (item) = "Cantidad de tokens adquiridos:" | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func getValueItemUserOrderQty (item) = getNumberByKey(getKeyItemUserOrderQty(item)) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func getKeySaldoTokenQtyStartEtapa (item) = "Cantidad de tokens VGT realizados:" | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func getValueSaldoTokenQtyStartEtapa (item) = getNumberByKey(getKeySaldoTokenQtyStartEtapa(item)) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | @Callable(i) | |
111 | 111 | func purchaseVGT (item,userDocument,userCountry,orderQty,totalAmount) = { | |
112 | 112 | let pmt = extract(i.payment) | |
113 | 113 | if (isDefined(pmt.assetId)) | |
114 | 114 | then throw("Ud. puede adquirir tokens VGT usando WavesKeeper y su token de pago en Waves.") | |
115 | 115 | else { | |
116 | 116 | let supplier = match getString(this, getKeyItemSupplier(item)) { | |
117 | 117 | case a: String => | |
118 | 118 | a | |
119 | 119 | case _ => | |
120 | 120 | NONE | |
121 | 121 | } | |
122 | 122 | let preIcoQty = match getInteger(this, getKeySaldoTokenQtyStartEtapa(item)) { | |
123 | 123 | case a: Int => | |
124 | 124 | a | |
125 | 125 | case _ => | |
126 | 126 | 0 | |
127 | 127 | } | |
128 | 128 | let balanceSupplier = match getInteger(this, getKeyBalanceSupplier(supplier)) { | |
129 | 129 | case a: Int => | |
130 | 130 | a | |
131 | 131 | case _ => | |
132 | 132 | 0 | |
133 | 133 | } | |
134 | 134 | let userAddress = toBase58String(i.caller.bytes) | |
135 | 135 | let currentTokenPrice = ((nomvgtu * wvs) / usdnw) | |
136 | 136 | if ((0 >= ((startTotalQty - preIcoQty) - orderQty))) | |
137 | 137 | then throw("Lo sentimos, por ahora no hay oferta de tokens para su transacción") | |
138 | 138 | else if ((totalAmount > pmt.amount)) | |
139 | 139 | then throw("Payment Amount can't be less than item Purchase Order") | |
140 | 140 | else if ((pmt.amount > totalAmount)) | |
141 | 141 | then throw("Payment Amount can't be higher than item Purchase Order") | |
142 | - | else ScriptResult(WriteSet([DataEntry(getKeyEmisor(item), "Ecosistema Bit-CO2"), DataEntry(getKeyEmisionCountry(item), "E2E/N08PE"), DataEntry(getKeyEmisionCode(item), "E2E_N00-VGT-01"), DataEntry(getKeyNomTokenPrice(item), "10.00 USD"), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeystartTotalQty(item), startTotalQty), DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyUserCountry(item), userCountry), DataEntry(getKeyItemUserOrderQty(item), orderQty), DataEntry("Monto de Inversión | Participación, wvs", totalAmount), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeySaldoTokenQtyStartEtapa(item), (getValueSaldoTokenQtyStartEtapa(item) + orderQty)), DataEntry("Saldo de Tokens VGT", ((startTotalQty - getValueSaldoTokenQtyStartEtapa(item)) - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (getValueBalanceSupplier(supplier) + pmt.amount)), DataEntry("Cta. del | |
142 | + | else ScriptResult(WriteSet([DataEntry(getKeyEmisor(item), "Ecosistema Bit-CO2"), DataEntry(getKeyEmisionCountry(item), "E2E/N08PE"), DataEntry(getKeyEmisionCode(item), "E2E_N00-VGT-01"), DataEntry(getKeyNomTokenPrice(item), "10.00 USD"), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeystartTotalQty(item), startTotalQty), DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyUserDocument(item), userDocument), DataEntry(getKeyUserCountry(item), userCountry), DataEntry(getKeyItemUserOrderQty(item), orderQty), DataEntry("Monto de Inversión | Participación, wvs", totalAmount), DataEntry("Estado de su pedido, tokens:", "¡Adquisición Confirmada!"), DataEntry(getKeySaldoTokenQtyStartEtapa(item), (getValueSaldoTokenQtyStartEtapa(item) + orderQty)), DataEntry("Saldo de Tokens VGT", ((startTotalQty - getValueSaldoTokenQtyStartEtapa(item)) - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (getValueBalanceSupplier(supplier) + pmt.amount)), DataEntry("Cta. del System VGT del N08PE, blockchain:", "3MrRmb3ANQy1o15LbHRNhiNHjYvXnoSLMCo"), DataEntry("Cta. del Admin VGT del N08, blockchain:", "3N8NfVBXHM7yKRy92ghKc5MJYFuyFXhsDXn")]), TransferSet([ScriptTransfer(addressFromStringValue(userAddress), (10000 * orderQty), VGT), ScriptTransfer(admN08VGTW, ((75 * pmt.amount) / 100), unit), ScriptTransfer(admN08sysVGTPaisW, ((5 * pmt.amount) / 100), unit)])) | |
143 | 143 | } | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | @Verifier(tx) | |
148 | 148 | func verify () = match tx { | |
149 | 149 | case t: SetScriptTransaction => | |
150 | 150 | sigVerify(tx.bodyBytes, tx.proofs[0], OwnerPubKey) | |
151 | 151 | case d: DataTransaction => | |
152 | 152 | true | |
153 | 153 | case tx: TransferTransaction => | |
154 | 154 | true | |
155 | 155 | case _ => | |
156 | 156 | false | |
157 | 157 | } | |
158 | 158 |
github/deemru/w8io/169f3d6 54.91 ms ◑