tx · DGC7cEkmnc1dYgewuqYXVUBW9auUXZaAkvDsz737TNnL

3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4:  -0.01400000 Waves

2020.03.11 16:23 [904550] smart account 3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4 > SELF 0.00000000 Waves

{ "type": 13, "id": "DGC7cEkmnc1dYgewuqYXVUBW9auUXZaAkvDsz737TNnL", "fee": 1400000, "feeAssetId": null, "timestamp": 1583932967768, "version": 1, "sender": "3N8RGScPyKYySaXd5Z3VcpnttH2uBeMpSy4", "senderPublicKey": "4AHsCbS9QYVdKNvxrPWwsMwwy3KqXaCMXeAscExJZk9L", "proofs": [ "3qkDmgbpNtN7kQ4ccQdHooom7LSbwx7vnKT2fW6F5zdKtgBQVwTH1hM5aNPLjxmQ9buixxwQJryodtdizUKk1nmF" ], "script": "base64:AAIDAAAAAAAAABMIARIGCgQIAQEIEgcKBQgICAEBAAAAHwAAAAAHYUJpdENPMgEAAAAgx/h6AJ03UJ8qMmy7JIhz3VjOE4OL3ofCGi0oG2fBKJYAAAAACHN0YXJ0UXR5AAAAAAAABRQAAAAAAAhub21QcmljZQAAAAAABfXhAAAAAAAQc3VwcGxpZXJEaXNjb3VudAAAAAAAAAAADAAAAAAOT3duZXJFY29QdWJLZXkBAAAAIC70W6NACRoO8DcwW0R46ze+bNGLr0tg3cAkNP8WNkAfAAAAAAN3dnMAAAAAAAX14QAAAAAABE5PTkUCAAAABG5vbmUAAAAABmlzc3VlcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVMr3Oz7nL9FV4g+t+EWzLN77jdANRWt9bwEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN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pd25lckVjb1B1YktleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAACdHgFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNFeGNoYW5nZVRyYW5zYWN0aW9uBAAAAAJ0eAUAAAAHJG1hdGNoMAQAAAAJd2l0aFdhdmVzAwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQgICAUAAAACdHgAAAAJc2VsbE9yZGVyAAAACWFzc2V0UGFpcgAAAApwcmljZUFzc2V0BgkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQgICAUAAAACdHgAAAAJc2VsbE9yZGVyAAAACWFzc2V0UGFpcgAAAAthbW91bnRBc3NldAUAAAAJd2l0aFdhdmVzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgQAAAABYwUAAAAHJG1hdGNoMAYHD9nYfw==", "chainId": 84, "height": 904550, "spentComplexity": 0 } View: original | compacted Prev: GzUhnRSKqKamEgmQ5JBDYvTWGESPFpUEB7wrxrgar7R7 Next: D7zSmUFNJtAR5gmtTPhRHwB7rL2Y9ecmzVadDw4ZJRWD Diff:
OldNewDifferences
7878 func getValueItemUserOrderQty (item) = getNumberByKey(getKeyItemUserOrderQty(item))
7979
8080
81-func getKeyBalanceSupplier (supplier) = "_balance_del_Seller,_waves"
81+func getKeyBalanceSupplier (supplier) = (supplier + "Seller_Balance:_waves")
8282
8383
8484 func getValueBalanceSupplier (supplier) = getNumberByKey(getKeyBalanceSupplier(supplier))
108108 let item = getKeyItem(supplier, title)
109109 if ((0 >= preIcoQty))
110110 then throw("Sorry, insufficient token offer")
111- 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), DataEntry(("Saldo/Balance_Supplier,_waves:_" + getKeyBalanceSupplier(supplier)), 0)])
111+ 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)])
112112 }
113113
114114
144144 then throw("Payment Amount cannot be less than item Purchase Order")
145145 else if ((pmt.amount > totalAmount))
146146 then throw("Payment Amount can't be higher than item Purchase Order")
147- 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(("Saldo:_" + getKeyBalanceSupplier(supplier)), (balanceSupplier + pmt.amount))]), TransferSet(nil))
147+ 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))
148148 }
149149 }
150150
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 getKeyBalanceUser (item) = (item + "_saldwvsuser")
7070
7171
7272 func getValueBalanceUser (item) = getNumberByKey(getKeyBalanceUser(item))
7373
7474
7575 func getKeyItemUserOrderQty (item) = "_tokens"
7676
7777
7878 func getValueItemUserOrderQty (item) = getNumberByKey(getKeyItemUserOrderQty(item))
7979
8080
81-func getKeyBalanceSupplier (supplier) = "_balance_del_Seller,_waves"
81+func getKeyBalanceSupplier (supplier) = (supplier + "Seller_Balance:_waves")
8282
8383
8484 func getValueBalanceSupplier (supplier) = getNumberByKey(getKeyBalanceSupplier(supplier))
8585
8686
8787 func getKeyItemUser (item) = "Project_name:"
8888
8989
9090 func getValueItemUser (item) = getStrByKey(getKeyItemUser(item))
9191
9292
9393 func getKeyItemDiscountSupplier (item) = "_%"
9494
9595
9696 func getValueItemDiscountSupplier (item) = getNumberByKey(getKeyItemDiscountSupplier(item))
9797
9898
9999 func getKeyItemPriceSupplier (item) = "_waves"
100100
101101
102102 func getValueItemPriceSupplier (item) = getNumberByKey(getKeyItemPriceSupplier(item))
103103
104104
105105 @Callable(i)
106106 func AddSupplierToken (title,preIcoQty,supplierDiscount,supplierData) = {
107107 let supplier = toBase58String(i.caller.bytes)
108108 let item = getKeyItem(supplier, title)
109109 if ((0 >= preIcoQty))
110110 then throw("Sorry, insufficient token offer")
111- 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), DataEntry(("Saldo/Balance_Supplier,_waves:_" + getKeyBalanceSupplier(supplier)), 0)])
111+ 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)])
112112 }
113113
114114
115115
116116 @Callable(i)
117117 func PurchaseToken (item,projectName,userData,orderQty,userDiscount) = {
118118 let pmt = extract(i.payment)
119119 if (isDefined(pmt.assetId))
120120 then throw("you can adquire cBitCO2 only by Waves tokens")
121121 else {
122122 let supplier = match getString(this, getKeyItemSupplier(item)) {
123123 case a: String =>
124124 a
125125 case _ =>
126126 NONE
127127 }
128128 let preIcoQty = match getInteger(this, getKeyBalanceQtySupplier(item)) {
129129 case a: Int =>
130130 a
131131 case _ =>
132132 startQty
133133 }
134134 let balanceSupplier = match getInteger(this, getKeyBalanceSupplier(supplier)) {
135135 case a: Int =>
136136 a
137137 case _ =>
138138 0
139139 }
140140 let userAddress = toBase58String(i.caller.bytes)
141141 let buyerTokenPrice = ((nomPrice * (100 - userDiscount)) / 100)
142142 let totalAmount = (orderQty * buyerTokenPrice)
143143 if ((totalAmount > pmt.amount))
144144 then throw("Payment Amount cannot be less than item Purchase Order")
145145 else if ((pmt.amount > totalAmount))
146146 then throw("Payment Amount can't be higher than item Purchase Order")
147- 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(("Saldo:_" + getKeyBalanceSupplier(supplier)), (balanceSupplier + pmt.amount))]), TransferSet(nil))
147+ 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))
148148 }
149149 }
150150
151151
152152 @Verifier(tx)
153153 func verify () = match tx {
154154 case t: SetScriptTransaction =>
155155 sigVerify(tx.bodyBytes, tx.proofs[0], OwnerEcoPubKey)
156156 case d: DataTransaction =>
157157 true
158158 case tx: TransferTransaction =>
159159 true
160160 case tx: ExchangeTransaction =>
161161 let withWaves = if (!(isDefined(tx.sellOrder.assetPair.priceAsset)))
162162 then true
163163 else !(isDefined(tx.sellOrder.assetPair.amountAsset))
164164 withWaves
165165 case c: InvokeScriptTransaction =>
166166 true
167167 case _ =>
168168 false
169169 }
170170

github/deemru/w8io/026f985 
39.30 ms