tx · 4WeAzy9U2RjZdiYDXMbaPoViHsBBaNdyQmNNYAzaS3sm

3N62UHvyvvdresjwfsmW4UX2ffDjcDPAkbn:  -0.01500000 Waves

2022.07.27 15:50 [2158244] smart account 3N62UHvyvvdresjwfsmW4UX2ffDjcDPAkbn > SELF 0.00000000 Waves

{ "type": 13, "id": "4WeAzy9U2RjZdiYDXMbaPoViHsBBaNdyQmNNYAzaS3sm", "fee": 1500000, "feeAssetId": null, "timestamp": 1658926237131, "version": 2, "chainId": 84, "sender": "3N62UHvyvvdresjwfsmW4UX2ffDjcDPAkbn", "senderPublicKey": "5XyQhNxDw1J4WdCZJr14webbFVzP2oXx9Z2BxoYpATJa", "proofs": [ "5rTekcazNHxJ1taqeJdVDRxVfQJgHUwuPvZTssZoy7aanBcumBxCdQNSVtkyEQnSejeD1MuaPeRW3JZPxssCnDNa" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAACAAAAAAlscFRva2VuSWQBAAAAIPTtyRjILTF+mu8G6nCn78mULavRR+D9ymHCCDXe2ZtOAAAAAA1yZXdhcmRUb2tlbklkAQAAACCqT/PwWY2xlHOeKCUkm14lKMYYhy6I96TnTvbJ9ReluAAAAAIAAAABaQEAAAAGcmV3YXJkAAAAAAQAAAABcAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAMJAQAAAAIhPQAAAAIIBQAAAAFwAAAAB2Fzc2V0SWQFAAAACWxwVG9rZW5JZAkAAAIAAAABAgAAABFJbmNvcnJlY3QgcGF5bWVudAQAAAAFbHBRdHkICQEAAAAFdmFsdWUAAAABCQAD7AAAAAEFAAAACWxwVG9rZW5JZAAAAAhxdWFudGl0eQQAAAAJcmV3YXJkUXR5CAkBAAAABXZhbHVlAAAAAQkAA+wAAAABBQAAAA1yZXdhcmRUb2tlbklkAAAACHF1YW50aXR5BAAAAAVzaGFyZQkAAGsAAAADCAUAAAABcAAAAAZhbW91bnQFAAAACXJld2FyZFF0eQUAAAAFbHBRdHkEAAAAAXIJAAP8AAAABAUAAAAEdGhpcwIAAAAEYnVybgkABEwAAAACCAUAAAABcAAAAAZhbW91bnQFAAAAA25pbAUAAAADbmlsAwkAAAAAAAACBQAAAAFyBQAAAAFyCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAFc2hhcmUFAAAADXJld2FyZFRva2VuSWQFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABaQEAAAAEYnVybgAAAAEAAAAGYW1vdW50CQAETAAAAAIJAQAAAARCdXJuAAAAAgUAAAAJbHBUb2tlbklkBQAAAAZhbW91bnQFAAAAA25pbAAAAABQjmMb", "height": 2158244, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8cFyMEoz4s7FQ2TKvSqfwyQBQGoWC4pXhtJuLfeEx1mH Next: 4jBKF6N8YpnumZs3u89hdtyKKCT7qxYymwv8whjbVgNW Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let lpTokenId = base58'HV6n4nFYYYJCYq8n6jLDm8rG1qUps1JeYQgsNPkgJwbB'
55
6-let rewardAmount = 1000
6+let rewardTokenId = base58'CTq287qYTyvgyDzaaVYuwWeceZUuTsHSKLEfg9YZQFKu'
77
88 @Callable(i)
9-func burnAndReward () = {
9+func reward () = {
1010 let p = value(i.payments[0])
1111 if ((p.assetId != lpTokenId))
1212 then throw("Incorrect payment")
1313 else {
14- let share = fraction(p.amount, rewardAmount, value(assetInfo(lpTokenId)).quantity)
15-[Burn(lpTokenId, p.amount), IntegerEntry(toBase58String(i.caller.bytes), share)]
14+ let lpQty = value(assetInfo(lpTokenId)).quantity
15+ let rewardQty = value(assetInfo(rewardTokenId)).quantity
16+ let share = fraction(p.amount, rewardQty, lpQty)
17+ let r = invoke(this, "burn", [p.amount], nil)
18+ if ((r == r))
19+ then [ScriptTransfer(i.caller, share, rewardTokenId)]
20+ else throw("Strict value is not equal to itself.")
1621 }
1722 }
23+
24+
25+
26+@Callable(i)
27+func burn (amount) = [Burn(lpTokenId, amount)]
1828
1929
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lpTokenId = base58'HV6n4nFYYYJCYq8n6jLDm8rG1qUps1JeYQgsNPkgJwbB'
55
6-let rewardAmount = 1000
6+let rewardTokenId = base58'CTq287qYTyvgyDzaaVYuwWeceZUuTsHSKLEfg9YZQFKu'
77
88 @Callable(i)
9-func burnAndReward () = {
9+func reward () = {
1010 let p = value(i.payments[0])
1111 if ((p.assetId != lpTokenId))
1212 then throw("Incorrect payment")
1313 else {
14- let share = fraction(p.amount, rewardAmount, value(assetInfo(lpTokenId)).quantity)
15-[Burn(lpTokenId, p.amount), IntegerEntry(toBase58String(i.caller.bytes), share)]
14+ let lpQty = value(assetInfo(lpTokenId)).quantity
15+ let rewardQty = value(assetInfo(rewardTokenId)).quantity
16+ let share = fraction(p.amount, rewardQty, lpQty)
17+ let r = invoke(this, "burn", [p.amount], nil)
18+ if ((r == r))
19+ then [ScriptTransfer(i.caller, share, rewardTokenId)]
20+ else throw("Strict value is not equal to itself.")
1621 }
1722 }
23+
24+
25+
26+@Callable(i)
27+func burn (amount) = [Burn(lpTokenId, amount)]
1828
1929

github/deemru/w8io/026f985 
24.33 ms