tx · AXTkw6VvDUd4QUXxQnx6sdrBpHqHarBNn8gD2SA7zbxi

3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4:  -0.01400000 Waves

2020.03.14 14:28 [908802] smart account 3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4 > SELF 0.00000000 Waves

{ "type": 13, "id": "AXTkw6VvDUd4QUXxQnx6sdrBpHqHarBNn8gD2SA7zbxi", "fee": 1400000, "feeAssetId": null, "timestamp": 1584185303590, "version": 1, "sender": "3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4", "senderPublicKey": "4AHsCbS9QYVdKNvxrPWwsMwwy3KqXaCMXeAscExJZk9L", "proofs": [ "2x2NLoMxHgK3gTnxkJswKDjvYZXBjSXdM33JcQ12RcZ2aDN4g6pNZeBFEMmUdvQetn53Bm8Qs8wQtdrtdzg5wsAa" ], "script": "base64:AAIDAAAAAAAAABMIARIGCgQIAQEIEgcKBQgICAEBAAAAHQAAAAAHYUJpdENPMgEAAAAgx/h6AJ03UJ8qMmy7JIhz3VjOE4OL3ofCGi0oG2fBKJYAAAAACHN0YXJ0UXR5AAAAAAAABRQAAAAAAAhub21QcmljZQAAAAAABfXhAAAAAAAQc3VwcGxpZXJEaXNjb3VudAAAAAAAAAAADAAAAAAOT3duZXJFY29QdWJLZXkBAAAAIC70W6NACRoO8DcwW0R46ze+bNGLr0tg3cAkNP8WNkAfAAAAAAN3dnMAAAAAAAX14QAAAAAABE5PTkUCAAAABG5vbmUAAAAABmlzc3VlcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVMr3Oz7nL9FV4g+t+EWzLN77jdANRWt9bwEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0B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AAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWMFAAAAByRtYXRjaDAGB6K4lXQ=", "chainId": 84, "height": 908802, "spentComplexity": 0 } View: original | compacted Prev: FjHrTUeTBVtd8d51Uo6NSBhru8fgRdHosCPMKozSxPoV Next: 77irqrcJnUgULEFERuPLsfLGVETj4E6jwF5ZaSduQJZp Diff:
OldNewDifferences
108108
109109
110110 @Callable(i)
111-func PurchaseToken (item,projectName,userData,userDiscount,orderQty,amount) = {
111+func purchase (item,projectName,userData,userDiscount,orderQty) = {
112112 let pmt = extract(i.payment)
113113 if (isDefined(pmt.assetId))
114114 then throw("you can adquire cBitCO2 only by Waves tokens")
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(nil))
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)]))
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)
111-func PurchaseToken (item,projectName,userData,userDiscount,orderQty,amount) = {
111+func purchase (item,projectName,userData,userDiscount,orderQty) = {
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(nil))
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)]))
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 
50.66 ms