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:
Old | New | | Differences |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let lpTokenId = base58'HV6n4nFYYYJCYq8n6jLDm8rG1qUps1JeYQgsNPkgJwbB' |
---|
5 | 5 | | |
---|
6 | | - | let rewardAmount = 1000 |
---|
| 6 | + | let rewardTokenId = base58'CTq287qYTyvgyDzaaVYuwWeceZUuTsHSKLEfg9YZQFKu' |
---|
7 | 7 | | |
---|
8 | 8 | | @Callable(i) |
---|
9 | | - | func burnAndReward () = { |
---|
| 9 | + | func reward () = { |
---|
10 | 10 | | let p = value(i.payments[0]) |
---|
11 | 11 | | if ((p.assetId != lpTokenId)) |
---|
12 | 12 | | then throw("Incorrect payment") |
---|
13 | 13 | | 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.") |
---|
16 | 21 | | } |
---|
17 | 22 | | } |
---|
| 23 | + | |
---|
| 24 | + | |
---|
| 25 | + | |
---|
| 26 | + | @Callable(i) |
---|
| 27 | + | func burn (amount) = [Burn(lpTokenId, amount)] |
---|
18 | 28 | | |
---|
19 | 29 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let lpTokenId = base58'HV6n4nFYYYJCYq8n6jLDm8rG1qUps1JeYQgsNPkgJwbB' |
---|
5 | 5 | | |
---|
6 | | - | let rewardAmount = 1000 |
---|
| 6 | + | let rewardTokenId = base58'CTq287qYTyvgyDzaaVYuwWeceZUuTsHSKLEfg9YZQFKu' |
---|
7 | 7 | | |
---|
8 | 8 | | @Callable(i) |
---|
9 | | - | func burnAndReward () = { |
---|
| 9 | + | func reward () = { |
---|
10 | 10 | | let p = value(i.payments[0]) |
---|
11 | 11 | | if ((p.assetId != lpTokenId)) |
---|
12 | 12 | | then throw("Incorrect payment") |
---|
13 | 13 | | 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.") |
---|
16 | 21 | | } |
---|
17 | 22 | | } |
---|
| 23 | + | |
---|
| 24 | + | |
---|
| 25 | + | |
---|
| 26 | + | @Callable(i) |
---|
| 27 | + | func burn (amount) = [Burn(lpTokenId, amount)] |
---|
18 | 28 | | |
---|
19 | 29 | | |
---|