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+43QDUVrfW8BAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeU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kLWEQ7A2d1 Next: AXTkw6VvDUd4QUXxQnx6sdrBpHqHarBNn8gD2SA7zbxi Diff:
OldNewDifferences
138138 then throw("Payment Amount cannot be less than item Purchase Order")
139139 else if ((pmt.amount > totalAmount))
140140 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([ScriptTransfer(addressFromStringValue(userAddress), orderQty, aBitCO2)]))
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))
142142 }
143143 }
144144
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let aBitCO2 = base58'ETbtNp6MBuSM9EfjmLDwctrYEBBiq8CZ7ti7zbwTktry'
55
66 let startQty = 332800
77
88 let nomPrice = 100000000
99
1010 let supplierDiscount = 12
1111
1212 let OwnerEcoPubKey = base58'4AHsCbS9QYVdKNvxrPWwsMwwy3KqXaCMXeAscExJZk9L'
1313
1414 let wvs = 100000000
1515
1616 let NONE = "none"
1717
1818 let issuer = Address(base58'3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4')
1919
2020 func getNumberByKey (key) = {
2121 let num = match getInteger(this, key) {
2222 case a: Int =>
2323 a
2424 case _ =>
2525 0
2626 }
2727 num
2828 }
2929
3030
3131 func getStrByKey (key) = {
3232 let str = match getString(this, key) {
3333 case a: String =>
3434 a
3535 case _ =>
3636 NONE
3737 }
3838 str
3939 }
4040
4141
4242 func getKeyItem (supplier,title) = ("tokens_Bit-CO2:_" + toBase58String(sha256(toBytes((supplier + title)))))
4343
4444
4545 func getKeyItemSupplier (item) = (item + "_to_Amazonian_Conservation")
4646
4747
4848 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
4949
5050
5151 func getKeyBalanceQtySupplier (item) = "Tokens_ofertados,_Saldo"
5252
5353
5454 func getValueBalanceQtySupplier (item) = getNumberByKey(getKeyBalanceQtySupplier(item))
5555
5656
5757 func getKeyItemData (item) = (item + "_description")
5858
5959
6060 func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
6161
6262
6363 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
6464
6565
6666 func getKeyItemUserData (item) = "_userdata"
6767
6868
6969 func getKeyItemUserOrderQty (item) = "_tokens"
7070
7171
7272 func getValueItemUserOrderQty (item) = getNumberByKey(getKeyItemUserOrderQty(item))
7373
7474
7575 func getKeyBalanceSupplier (supplier) = "Seller_Balance:_waves"
7676
7777
7878 func getValueBalanceSupplier (supplier) = getNumberByKey(getKeyBalanceSupplier(supplier))
7979
8080
8181 func getKeyItemUser (item) = "Project_name:"
8282
8383
8484 func getValueItemUser (item) = getStrByKey(getKeyItemUser(item))
8585
8686
8787 func getKeyItemDiscountSupplier (item) = "_%"
8888
8989
9090 func getValueItemDiscountSupplier (item) = getNumberByKey(getKeyItemDiscountSupplier(item))
9191
9292
9393 func getKeyItemPriceSupplier (item) = "_waves"
9494
9595
9696 func getValueItemPriceSupplier (item) = getNumberByKey(getKeyItemPriceSupplier(item))
9797
9898
9999 @Callable(i)
100100 func AddSupplierToken (title,preIcoQty,supplierDiscount,supplierData) = {
101101 let supplier = toBase58String(i.caller.bytes)
102102 let item = getKeyItem(supplier, title)
103103 if ((0 >= preIcoQty))
104104 then throw("Sorry, insufficient token offer")
105105 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)])
106106 }
107107
108108
109109
110110 @Callable(i)
111111 func PurchaseToken (item,projectName,userData,userDiscount,orderQty,amount) = {
112112 let pmt = extract(i.payment)
113113 if (isDefined(pmt.assetId))
114114 then throw("you can adquire cBitCO2 only by Waves tokens")
115115 else {
116116 let supplier = match getString(this, getKeyItemSupplier(item)) {
117117 case a: String =>
118118 a
119119 case _ =>
120120 NONE
121121 }
122122 let preIcoQty = match getInteger(this, getKeyBalanceQtySupplier(item)) {
123123 case a: Int =>
124124 a
125125 case _ =>
126126 startQty
127127 }
128128 let balanceSupplier = match getInteger(this, getKeyBalanceSupplier(supplier)) {
129129 case a: Int =>
130130 a
131131 case _ =>
132132 0
133133 }
134134 let userAddress = toBase58String(i.caller.bytes)
135135 let buyerTokenPrice = ((nomPrice * (100 - userDiscount)) / 100)
136136 let totalAmount = (orderQty * buyerTokenPrice)
137137 if ((totalAmount > pmt.amount))
138138 then throw("Payment Amount cannot be less than item Purchase Order")
139139 else if ((pmt.amount > totalAmount))
140140 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([ScriptTransfer(addressFromStringValue(userAddress), orderQty, aBitCO2)]))
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))
142142 }
143143 }
144144
145145
146146 @Verifier(tx)
147147 func verify () = match tx {
148148 case t: SetScriptTransaction =>
149149 sigVerify(tx.bodyBytes, tx.proofs[0], OwnerEcoPubKey)
150150 case d: DataTransaction =>
151151 true
152152 case tx: TransferTransaction =>
153153 let recipient = toBase58String(addressFromRecipient(tx.recipient).bytes)
154154 if ((tx.sender == issuer))
155155 then true
156156 else throw("You can't transferred this token")
157157 case tx: ExchangeTransaction =>
158158 let withWaves = if (!(isDefined(tx.sellOrder.assetPair.priceAsset)))
159159 then true
160160 else !(isDefined(tx.sellOrder.assetPair.amountAsset))
161161 withWaves
162162 case tx: ExchangeTransaction =>
163163 let pk = tx.proofs[1]
164164 let address = addressFromPublicKey(pk)
165165 let fee = 1400000
166166 let hasMoney = ((wavesBalance(address) - fee) >= tx.buyOrder.price)
167167 let sell = sigVerify(tx.sellOrder.bodyBytes, tx.sellOrder.proofs[0], tx.sellOrder.senderPublicKey)
168168 let buy = sigVerify(tx.buyOrder.bodyBytes, tx.buyOrder.proofs[0], tx.buyOrder.senderPublicKey)
169169 let sellOrderSender = toBase58String(tx.sellOrder.sender.bytes)
170170 let minAmount = 1
171171 let maxAmount = 4
172172 let maxPrice = (maxAmount * nomPrice)
173173 if (if (buy)
174174 then if (isDefined((maxPrice >= tx.buyOrder.price)))
175175 then true
176176 else throw("El monto a pagar no puede ser menor que el precio de venta")
177177 else false)
178178 then true
179179 else if (sell)
180180 then if (if (if ((tx.sellOrder.sender == issuer))
181181 then (tx.amount >= minAmount)
182182 else false)
183183 then (maxAmount >= tx.amount)
184184 else false)
185185 then true
186186 else throw("Error: Minimum amount: 1 aBitCO2; Maximum amount offered: 4 aBitCO2 by User Account")
187187 else false
188188 case c: InvokeScriptTransaction =>
189189 true
190190 case _ =>
191191 false
192192 }
193193

github/deemru/w8io/169f3d6 
37.96 ms