tx · 53sAX32qwPVN2HodRM1PU8mprkhTKunBVwxU6tULu1eh

3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S:  -0.01400000 Waves

2021.03.26 22:49 [1455155] smart account 3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S > SELF 0.00000000 Waves

{ "type": 13, "id": "53sAX32qwPVN2HodRM1PU8mprkhTKunBVwxU6tULu1eh", "fee": 1400000, "feeAssetId": null, "timestamp": 1616788277592, "version": 2, "chainId": 84, "sender": "3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S", "senderPublicKey": "CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M", "proofs": [ "5kZ5U2GPqJ5fHbMFVrrsRwHeaw2KtYesxd5MSxdbrD55FdUKweE6D39iD4usgnrL6PBNjidG43hJDDsZxs7fGPGN" ], "script": "base64:AAIEAAAAAAAAAAYIAhIAEgAAAAAPAAAAAA50b3RhbEZlZUV0aEtleQIAAAANdG90YWxfZmVlX2V0aAAAAAAOdG90YWxGZWVVc2RLZXkCAAAADXRvdGFsX2ZlZV91c2QAAAAAEnRvdGFsRmVlRHl6cmFwdEtleQIAAAARdG90YWxfZmVlX2R5enJhcHQAAAAADnByaWNlT2ZEeXpyYXB0AgAAAANkeXoAAAAACnByaWNlT2ZFdGgCAAAAA2V0aAAAAAANb3JhY2xlQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVL4/7s2JD7wFpgWNJdKO/aqFvcIdJFtzlgAAAAAOZHl6cmFwdEFzc2V0SWQBAAAAIJ8Z6XPZJu9QR4hmGj9/o7LyMJ48jRPQD0CePJOEpwQjAAAAAApldGhBc3NldElkAQAAACAiJlO6kpv9VYDdwqxzfY0rRQ9rtHAOIBs/eo3GguMLoQAAAAALdXNkbkFzc2V0SWQBAAAAIHxpwWtkcIB0JFIbiNXtI38nVRmozWmXoaigru9h4HfCAQAAAAxnZXRGZWVBbW91bnQAAAABAAAABmFtb3VudAQAA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Vc2RuVG9EeXpyYXB0AAAAAAQAAAADcG10CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAdhc3NldElkCAUAAAADcG10AAAAB2Fzc2V0SWQEAAAAC3RvdGFsQW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAIhPQAAAAIFAAAAB2Fzc2V0SWQFAAAAC3VzZG5Bc3NldElkCQAAAgAAAAECAAAAKU9ubHkgdXNkbiB0b2tlbnMgYXJlIGFsbG93ZWQgZm9yIHN3YXBwaW5nBAAAAANmZWUJAQAAAAxnZXRGZWVBbW91bnQAAAABBQAAAAt0b3RhbEFtb3VudAQAAAAGYW1vdW50CQAAZQAAAAIFAAAAC3RvdGFsQW1vdW50BQAAAANmZWUEAAAADWR5enJhcHRBbW91bnQJAQAAAA11c2RuVG9EeXpyYXB0AAAAAQUAAAAGYW1vdW50BAAAAAh0b3RhbEZlZQkBAAAADmdldFRvdGFsRmVlVXNkAAAAAAkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAd0b3RhbDogCQABpAAAAAEFAAAAC3RvdGFsQW1vdW50AgAAAAc7IGZlZTogCQABpAAAAAEFAAAAA2ZlZQIAAAAKOyBhbW91bnQ6IAkAAaQAAAABBQAAAAZhbW91bnQCAAAACzsgZHl6cmFwdDogCQABpAAAAAEFAAAADWR5enJhcHRBbW91bnQCAAAADDsgdG90YWxGZWU6IAkAAaQAAAABBQAAAAh0b3RhbEZlZQAAAAATWv5D", "height": 1455155, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6wG5C4uHb58SdVvwbqPqF4YGmw34DFZh7JP1XXTJNoaz Next: Fm35RrkjvLNf4dZYggTUdmDGAtDW7KV7VRWJWcH1tMFc Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let totalFeeEthKey = "total_fee_eth"
55
66 let totalFeeUsdKey = "total_fee_usd"
77
88 let totalFeeDyzraptKey = "total_fee_dyzrapt"
99
1010 let priceOfDyzrapt = "dyz"
1111
1212 let priceOfEth = "eth"
1313
1414 let oracleAddress = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
1515
1616 let dyzraptAssetId = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
1717
1818 let ethAssetId = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
1919
2020 let usdnAssetId = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
2121
2222 func getFeeAmount (amount) = {
2323 let fee = fraction(amount, 3, 100)
2424 fee
2525 }
2626
2727
2828 func getIntKeyData (key) = {
2929 let v = valueOrElse(getInteger(this, key), 0)
3030 v
3131 }
3232
3333
3434 func getTotalFeeEth () = getIntKeyData(totalFeeEthKey)
3535
3636
3737 func getTotalFeeUsd () = getIntKeyData(totalFeeUsdKey)
3838
3939
4040 func getTotalFeeDyzrapt () = getIntKeyData(totalFeeDyzraptKey)
4141
4242
4343 func usdnToDyzrapt (amount) = {
4444 let dyzraptPrice = valueOrErrorMessage(getInteger(oracleAddress, "dyz"), "Unable to load price")
4545 fraction(amount, 10000, dyzraptPrice)
4646 }
4747
4848
4949 @Callable(i)
5050 func test () = {
5151 let pmt = value(i.payments[0])
5252 let assetId = pmt.assetId
5353 let amount = pmt.amount
5454 if ((assetId == dyzraptAssetId))
5555 then throw(("its a dyzrapt. Amount=" + toString(amount)))
5656 else throw("its not a dyzrapt")
5757 }
5858
5959
6060
6161 @Callable(i)
6262 func swapUsdnToDyzrapt () = {
6363 let pmt = value(i.payments[0])
6464 let assetId = pmt.assetId
6565 let totalAmount = pmt.amount
6666 if ((assetId != usdnAssetId))
6767 then throw("Only usdn tokens are allowed for swapping")
6868 else {
6969 let fee = getFeeAmount(totalAmount)
7070 let amount = (totalAmount - fee)
7171 let dyzraptAmount = usdnToDyzrapt(amount)
7272 let totalFee = getTotalFeeUsd()
7373 throw(((((((((("total: " + toString(totalAmount)) + "; fee: ") + toString(fee)) + "; amount: ") + toString(amount)) + "; dyzrapt: ") + toString(dyzraptAmount)) + "; totalFee: ") + toString(totalFee)))
7474 }
7575 }
7676
7777

github/deemru/w8io/026f985 
39.18 ms