tx · HuaFuVwHbCHtUDS3m47W62oTZNKsCVEqQVhi6ZWLbMYy

3N4rfXV9DbA9Kbngt5qpNXuziAaBRmCrbHZ:  -0.01400000 Waves

2019.08.09 18:19 [623612] smart account 3N4rfXV9DbA9Kbngt5qpNXuziAaBRmCrbHZ > SELF 0.00000000 Waves

{ "type": 13, "id": "HuaFuVwHbCHtUDS3m47W62oTZNKsCVEqQVhi6ZWLbMYy", "fee": 1400000, "feeAssetId": null, "timestamp": 1565363999203, "version": 1, "sender": "3N4rfXV9DbA9Kbngt5qpNXuziAaBRmCrbHZ", "senderPublicKey": "7dgeV8sSzVnj9GqLdFXQktfdiQjrFcWTgDPeQwbs1kyK", "proofs": [ "1M55cM2vUDqbSENbaHut7pQBvsKeYrGHxSM7sAvCgUrc7RVpBnvaRiQzq4aKMTRfB59z8mnkjwyjRuGGyXTjtXg" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FAAAAABFBY2NvdW50QmFsYW5jZUtleQIAAAAIYmFsYW5jZV8AAAAAEE5ldXRyaW5vUHJpY2VLZXkCAAAACm51c2RfcHJpY2UAAAAADEJvbmRDb3VudEtleQIAAAAKYm9uZF9jb3VudAAAAAAMQm9uZFByaWNlS2V5AgAAAApib25kX3ByaWNlAAAAAAxCb25kQmxvY2tLZXkCAAAACmJvbmRfY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2V0Qm9uZFByaWNlAAAAAAQAAAAJbGFzdENvdW50CQEAAAAMZ2V0Qm9uZENvdW50AAAAAAMJAABnAAAAAgUAAAAJbGFzdFByaWNlBQAAAAVwcmljZQkAAAIAAAABAgAAABJib25kIG5vdCBnZW5lcmF0ZWQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAxCb25kUHJpY2VLZXkFAAAABXByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAxCb25kT3duZXJLZXkJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAxCb25kQ291bnRLZXkJAABpAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABCQEAAAAMZ2V0Qm9uZE93bmVyAAAAAAkAAGgAAAACBQAAAAlsYXN0Q291bnQFAAAACWxhc3RQcmljZQUAAAAPTmV1dHJpbm9Bc3NldElkBQAAAANuaWwAAAAA/Vc9Yg==", "chainId": 84, "height": 623612, "spentComplexity": 0 } View: original | compacted Prev: 7eSqFyCqwwp8T3PfJR1mJjrx15aH1djRov75zabXj8qs Next: none Diff:
OldNewDifferences
105105 func swapNeutrinoToWaves () = {
106106 let price = getNeutrinoPrice()
107107 let pmt = extract(i.payment)
108- if ((pmt.assetId == NeutrinoAssetId))
108+ if ((pmt.assetId != NeutrinoAssetId))
109109 then throw("can use neutrino only at the moment")
110110 else {
111111 let account = toBase58String(i.caller.bytes)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "none"
55
66 func getNumberByKey (key) = match getInteger(this, key) {
77 case a: Int =>
88 a
99 case _ =>
1010 0
1111 }
1212
1313
1414 func getStrByKey (key) = match getString(this, key) {
1515 case a: String =>
1616 a
1717 case _ =>
1818 NONE
1919 }
2020
2121
2222 let AccountBalanceKey = "balance_"
2323
2424 let NeutrinoPriceKey = "nusd_price"
2525
2626 let BondCountKey = "bond_count"
2727
2828 let BondPriceKey = "bond_price"
2929
3030 let BondBlockKey = "bond_block"
3131
3232 let BondOwnerKey = "bond_owner"
3333
3434 let BondStatus = "bond_status"
3535
3636 func getAccountBalanceKey (account) = (AccountBalanceKey + account)
3737
3838
3939 func getAccountBalance (account) = getNumberByKey(getAccountBalanceKey(account))
4040
4141
4242 func getNeutrinoPrice () = getNumberByKey(NeutrinoPriceKey)
4343
4444
4545 func getBondCount () = getNumberByKey(BondCountKey)
4646
4747
4848 func getBondPrice () = getNumberByKey(BondPriceKey)
4949
5050
5151 func getBondStatus () = getNumberByKey(BondPriceKey)
5252
5353
5454 func getBondOrderBlock () = getNumberByKey(BondBlockKey)
5555
5656
5757 func getBondOwner () = getStrByKey(BondOwnerKey)
5858
5959
6060 let Wavelet = 100000000
6161
6262 let ExpireBondOrder = 10
6363
6464 let ExcecutedStatus = "excecuted"
6565
6666 let NeutrinoAssetId = base58'4LFQD5CQHi7fpUqNaCyAbaoXPNRuvvdPL6tD7xubtUr4'
6767
6868 let BondAssetIdString = "4LFQD5CQHi7fpUqNaCyAbaoXPNRuvvdPL6tD7xubtUr4"
6969
7070 let BondAssetId = toBytes("")
7171
7272 let NeutrinoName = "Neutrino-USD"
7373
7474 let NeutrinoSymbol = "N-USD"
7575
7676 let MinimalBondOrder = (10 * Wavelet)
7777
7878 func getSupply () = assetBalance(this, NeutrinoAssetId)
7979
8080
8181 func getReserve () = wavesBalance(this)
8282
8383
8484 @Callable(i)
8585 func setCurrentPrice (price) = WriteSet([DataEntry(NeutrinoPriceKey, price)])
8686
8787
8888
8989 @Callable(i)
9090 func swapWavesToNeutrino () = {
9191 let price = getNeutrinoPrice()
9292 let pmt = extract(i.payment)
9393 if (isDefined(pmt.assetId))
9494 then throw("can use waves only at the moment")
9595 else {
9696 let account = toBase58String(i.caller.bytes)
9797 let amount = (pmt.amount * price)
9898 TransferSet([ScriptTransfer(addressFromStringValue(account), amount, NeutrinoAssetId)])
9999 }
100100 }
101101
102102
103103
104104 @Callable(i)
105105 func swapNeutrinoToWaves () = {
106106 let price = getNeutrinoPrice()
107107 let pmt = extract(i.payment)
108- if ((pmt.assetId == NeutrinoAssetId))
108+ if ((pmt.assetId != NeutrinoAssetId))
109109 then throw("can use neutrino only at the moment")
110110 else {
111111 let account = toBase58String(i.caller.bytes)
112112 let amount = (pmt.amount / price)
113113 TransferSet([ScriptTransfer(addressFromStringValue(account), amount, NeutrinoAssetId)])
114114 }
115115 }
116116
117117
118118
119119 @Callable(i)
120120 func setBondOrder (price) = {
121121 let priceNeutrino = getNeutrinoPrice()
122122 let reserve = getReserve()
123123 let supply = getSupply()
124124 let deficit = ((supply / priceNeutrino) - reserve)
125125 let pmt = extract(i.payment)
126126 let boudBlock = getBondOrderBlock()
127127 if (isDefined(pmt.assetId))
128128 then throw("can use waves only at the moment")
129129 else if ((deficit == pmt.amount))
130130 then throw("amount does not cover deficit")
131131 else if ((boudBlock == 0))
132132 then if ((MinimalBondOrder > deficit))
133133 then throw("bond not generated")
134134 else {
135135 let amount = (pmt.amount / price)
136136 ScriptResult(WriteSet([DataEntry(BondBlockKey, height), DataEntry(BondPriceKey, price), DataEntry(BondOwnerKey, toString(i.caller)), DataEntry(BondCountKey, (pmt.amount / price))]), TransferSet([ScriptTransfer(i.caller, amount, NeutrinoAssetId)]))
137137 }
138138 else if (((boudBlock + ExpireBondOrder) > height))
139139 then throw("TODO")
140140 else {
141141 let lastPrice = getBondPrice()
142142 let lastCount = getBondCount()
143143 if ((lastPrice >= price))
144144 then throw("bond not generated")
145145 else ScriptResult(WriteSet([DataEntry(BondPriceKey, price), DataEntry(BondOwnerKey, toString(i.caller)), DataEntry(BondCountKey, (pmt.amount / price))]), TransferSet([ScriptTransfer(addressFromStringValue(getBondOwner()), (lastCount * lastPrice), NeutrinoAssetId)]))
146146 }
147147 }
148148
149149

github/deemru/w8io/169f3d6 
48.60 ms