tx · FjHrTUeTBVtd8d51Uo6NSBhru8fgRdHosCPMKozSxPoV 3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4: -0.01400000 Waves 2020.03.14 14:20 [908796] smart account 3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4 > SELF 0.00000000 Waves
{ "type": 13, "id": "FjHrTUeTBVtd8d51Uo6NSBhru8fgRdHosCPMKozSxPoV", "fee": 1400000, "feeAssetId": null, "timestamp": 1584184804272, "version": 1, "sender": "3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4", "senderPublicKey": "4AHsCbS9QYVdKNvxrPWwsMwwy3KqXaCMXeAscExJZk9L", "proofs": [ "2Mk8DoPKmfHnemTXutKF7VQhcZTrZ8db7KobAGFgtfcAE28Tt2t8fDcwUXoU6PZ84inw9QbnS24aotE7NNpwQeQE" ], "script": "base64:AAIDAAAAAAAAABQIARIGCgQIAQEIEggKBggICAEBAQAAAB0AAAAAB2FCaXRDTzIBAAAAIMf4egCdN1CfKjJsuySIc91YzhODi96HwhotKBtnwSiWAAAAAAhzdGFydFF0eQAAAAAAAAUUAAAAAAAIbm9tUHJpY2UAAAAAAAX14QAAAAAAEHN1cHBsaWVyRGlzY291bnQAAAAAAAAAAAwAAAAADk93bmVyRWNvUHViS2V5AQAAACAu9FujQAkaDvA3MFtEeOs3vmzRi69LYN3AJDT/FjZAHwAAAAADd3ZzAAAAAAAF9eEAAAAAAAROT05FAgAAAARub25lAAAAAAZpc3N1ZXIJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVTK9zs+5y/RVeIPrfhFsyze+43QDUVrfW8BAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUt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LWEQ7A2d1 Next: AXTkw6VvDUd4QUXxQnx6sdrBpHqHarBNn8gD2SA7zbxi Diff:
Old | New | Differences | |
---|---|---|---|
138 | 138 | then throw("Payment Amount cannot be less than item Purchase Order") | |
139 | 139 | else if ((pmt.amount > totalAmount)) | |
140 | 140 | then throw("Payment Amount can't be higher than item Purchase Order") | |
141 | - | else ScriptResult(WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyItemUser(item), projectName), DataEntry(getKeyItemUserData(item), userData), DataEntry(("Cantidad_solicitada:" + getKeyItemUserOrderQty(item)), orderQty), DataEntry(("Request_Status:_" + userAddress), "confirmed"), DataEntry(getKeyBalanceQtySupplier(item), (preIcoQty - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (balanceSupplier + pmt.amount))]), TransferSet( | |
141 | + | else ScriptResult(WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyItemUser(item), projectName), DataEntry(getKeyItemUserData(item), userData), DataEntry(("Cantidad_solicitada:" + getKeyItemUserOrderQty(item)), orderQty), DataEntry(("Request_Status:_" + userAddress), "confirmed"), DataEntry(getKeyBalanceQtySupplier(item), (preIcoQty - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (balanceSupplier + pmt.amount))]), TransferSet(nil)) | |
142 | 142 | } | |
143 | 143 | } | |
144 | 144 |
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 supplierDiscount = 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) = ("tokens_Bit-CO2:_" + toBase58String(sha256(toBytes((supplier + title))))) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func getKeyItemSupplier (item) = (item + "_to_Amazonian_Conservation") | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getKeyBalanceQtySupplier (item) = "Tokens_ofertados,_Saldo" | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func getValueBalanceQtySupplier (item) = getNumberByKey(getKeyBalanceQtySupplier(item)) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getKeyItemData (item) = (item + "_description") | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func getKeyItemUserData (item) = "_userdata" | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func getKeyItemUserOrderQty (item) = "_tokens" | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func getValueItemUserOrderQty (item) = getNumberByKey(getKeyItemUserOrderQty(item)) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func getKeyBalanceSupplier (supplier) = "Seller_Balance:_waves" | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func getValueBalanceSupplier (supplier) = getNumberByKey(getKeyBalanceSupplier(supplier)) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func getKeyItemUser (item) = "Project_name:" | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func getValueItemUser (item) = getStrByKey(getKeyItemUser(item)) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func getKeyItemDiscountSupplier (item) = "_%" | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func getValueItemDiscountSupplier (item) = getNumberByKey(getKeyItemDiscountSupplier(item)) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func getKeyItemPriceSupplier (item) = "_waves" | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func getValueItemPriceSupplier (item) = getNumberByKey(getKeyItemPriceSupplier(item)) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Callable(i) | |
100 | 100 | func AddSupplierToken (title,preIcoQty,supplierDiscount,supplierData) = { | |
101 | 101 | let supplier = toBase58String(i.caller.bytes) | |
102 | 102 | let item = getKeyItem(supplier, title) | |
103 | 103 | if ((0 >= preIcoQty)) | |
104 | 104 | then throw("Sorry, insufficient token offer") | |
105 | 105 | else WriteSet([DataEntry(("Ofertante:_" + getKeyItemSupplier(item)), supplier), DataEntry(getKeyBalanceQtySupplier(item), preIcoQty), DataEntry(("Precio_Nominal:" + getKeyItemPriceSupplier(item)), nomPrice), DataEntry(("Max_Descuento_ofrecido:" + getKeyItemDiscountSupplier(item)), supplierDiscount), DataEntry(getKeyItemData(item), supplierData)]) | |
106 | 106 | } | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | 110 | @Callable(i) | |
111 | 111 | func PurchaseToken (item,projectName,userData,userDiscount,orderQty,amount) = { | |
112 | 112 | let pmt = extract(i.payment) | |
113 | 113 | if (isDefined(pmt.assetId)) | |
114 | 114 | then throw("you can adquire cBitCO2 only by Waves tokens") | |
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, getKeyBalanceQtySupplier(item)) { | |
123 | 123 | case a: Int => | |
124 | 124 | a | |
125 | 125 | case _ => | |
126 | 126 | startQty | |
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 buyerTokenPrice = ((nomPrice * (100 - userDiscount)) / 100) | |
136 | 136 | let totalAmount = (orderQty * buyerTokenPrice) | |
137 | 137 | if ((totalAmount > pmt.amount)) | |
138 | 138 | then throw("Payment Amount cannot be less than item Purchase Order") | |
139 | 139 | else if ((pmt.amount > totalAmount)) | |
140 | 140 | then throw("Payment Amount can't be higher than item Purchase Order") | |
141 | - | else ScriptResult(WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyItemUser(item), projectName), DataEntry(getKeyItemUserData(item), userData), DataEntry(("Cantidad_solicitada:" + getKeyItemUserOrderQty(item)), orderQty), DataEntry(("Request_Status:_" + userAddress), "confirmed"), DataEntry(getKeyBalanceQtySupplier(item), (preIcoQty - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (balanceSupplier + pmt.amount))]), TransferSet( | |
141 | + | else ScriptResult(WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyItemUser(item), projectName), DataEntry(getKeyItemUserData(item), userData), DataEntry(("Cantidad_solicitada:" + getKeyItemUserOrderQty(item)), orderQty), DataEntry(("Request_Status:_" + userAddress), "confirmed"), DataEntry(getKeyBalanceQtySupplier(item), (preIcoQty - orderQty)), DataEntry(getKeyBalanceSupplier(supplier), (balanceSupplier + pmt.amount))]), TransferSet(nil)) | |
142 | 142 | } | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | @Verifier(tx) | |
147 | 147 | func verify () = match tx { | |
148 | 148 | case t: SetScriptTransaction => | |
149 | 149 | sigVerify(tx.bodyBytes, tx.proofs[0], OwnerEcoPubKey) | |
150 | 150 | case d: DataTransaction => | |
151 | 151 | true | |
152 | 152 | case tx: TransferTransaction => | |
153 | 153 | let recipient = toBase58String(addressFromRecipient(tx.recipient).bytes) | |
154 | 154 | if ((tx.sender == issuer)) | |
155 | 155 | then true | |
156 | 156 | else throw("You can't transferred this token") | |
157 | 157 | case tx: ExchangeTransaction => | |
158 | 158 | let withWaves = if (!(isDefined(tx.sellOrder.assetPair.priceAsset))) | |
159 | 159 | then true | |
160 | 160 | else !(isDefined(tx.sellOrder.assetPair.amountAsset)) | |
161 | 161 | withWaves | |
162 | 162 | case tx: ExchangeTransaction => | |
163 | 163 | let pk = tx.proofs[1] | |
164 | 164 | let address = addressFromPublicKey(pk) | |
165 | 165 | let fee = 1400000 | |
166 | 166 | let hasMoney = ((wavesBalance(address) - fee) >= tx.buyOrder.price) | |
167 | 167 | let sell = sigVerify(tx.sellOrder.bodyBytes, tx.sellOrder.proofs[0], tx.sellOrder.senderPublicKey) | |
168 | 168 | let buy = sigVerify(tx.buyOrder.bodyBytes, tx.buyOrder.proofs[0], tx.buyOrder.senderPublicKey) | |
169 | 169 | let sellOrderSender = toBase58String(tx.sellOrder.sender.bytes) | |
170 | 170 | let minAmount = 1 | |
171 | 171 | let maxAmount = 4 | |
172 | 172 | let maxPrice = (maxAmount * nomPrice) | |
173 | 173 | if (if (buy) | |
174 | 174 | then if (isDefined((maxPrice >= tx.buyOrder.price))) | |
175 | 175 | then true | |
176 | 176 | else throw("El monto a pagar no puede ser menor que el precio de venta") | |
177 | 177 | else false) | |
178 | 178 | then true | |
179 | 179 | else if (sell) | |
180 | 180 | then if (if (if ((tx.sellOrder.sender == issuer)) | |
181 | 181 | then (tx.amount >= minAmount) | |
182 | 182 | else false) | |
183 | 183 | then (maxAmount >= tx.amount) | |
184 | 184 | else false) | |
185 | 185 | then true | |
186 | 186 | else throw("Error: Minimum amount: 1 aBitCO2; Maximum amount offered: 4 aBitCO2 by User Account") | |
187 | 187 | else false | |
188 | 188 | case c: InvokeScriptTransaction => | |
189 | 189 | true | |
190 | 190 | case _ => | |
191 | 191 | false | |
192 | 192 | } | |
193 | 193 |
github/deemru/w8io/169f3d6 37.96 ms ◑