tx · 9Se83aPHtNhZmZxgFxnaaMLC7oTpseqo3KCKW12sLt7N 3Mx8raFsQfjh2JBeT8MN1Jv5sTvGkx5PDDS: -0.01000000 Waves 2023.08.31 17:26 [2734969] smart account 3Mx8raFsQfjh2JBeT8MN1Jv5sTvGkx5PDDS > SELF 0.00000000 Waves
{ "type": 13, "id": "9Se83aPHtNhZmZxgFxnaaMLC7oTpseqo3KCKW12sLt7N", "fee": 1000000, "feeAssetId": null, "timestamp": 1693492047618, "version": 2, "chainId": 84, "sender": "3Mx8raFsQfjh2JBeT8MN1Jv5sTvGkx5PDDS", "senderPublicKey": "HmWR8GbhBF4LAodJ9xNgR7PpWF79RuCrhPWJWxqdB1KL", "proofs": [ "4tiCUdoPjGyQ562G48rGBCFRaZDf7zvdd6S33W4grZuvUJPxpYDVtAD4uWzLnScwhJAE5yJvBQ3W7SXcWpmBRZ7H" ], "script": "base64:AAIFAAAAAAAAAA4IAhIAEgMKAQESAwoBAQAAAAQAAAAAEWxwX2FkZHJlc3NfcHVia2V5AQAAACD5Ic6hH7prLmpePnu+NHOaX7/pUxioJAxXi6SfYaOBNwAAAAAgbWFzc3RyYW5zZmVyX3doaXRlbGlzdGVkX2FkZHJlc3MJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEFAAAAEWxwX2FkZHJlc3NfcHVia2V5AAAAABRscF9kZXBvc2l0b3JfYWRkcmVzcwEAAAAg463XstSKNtaiPAMTm2AWTDVjxzAiveOx6Vx7CmnuvCMAAAAAFGxwX3doaXRlbGlzdF9hZGRyZXNzCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAABRscF9kZXBvc2l0b3JfYWRkcmVzcwAAAAMAAAABaQEAAAAQQWRkUG9vbExpcXVpZGl0eQAAAAAEAAAADWNhbGxlcmFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAADcG10AwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAA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AIAAAABAgAAAD5QbGFjZWQgV2l0aGRyYXcgQW1vdW50IFNpemUgaXMgbW9yZSB0aGFuIFRvdGFsIFBvb2wgTGlxdWlkaXR5LgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAUVG90YWxfUG9vbF9MaXF1aWRpdHkFAAAAFHVwZGF0ZWRfcG9vbF9iYWxhbmNlCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAABNMUF9XaXRoZHJhd19Db3VudGVyBQAAABZUb3RhbExQV2l0aGRyYXdDb3VudGVyCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAABFUb3RhbF9MUF9XaXRoZHJhdwUAAAAPVG90YWxMUFdpdGhkcmF3CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAGkAAAAAQUAAAAWVG90YWxMUFdpdGhkcmF3Q291bnRlcgIAAAAMX0xQX1dpdGhkcmF3BQAAAA9Ub3RhbExQV2l0aGRyYXcFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAFT3JkZXIGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNFeGNoYW5nZVRyYW5zYWN0aW9uBgkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwBwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkre8G3", "height": 2734969, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F4zqxUGZ554ec6aZMQhghSuG9q1qRrUzqSdpXn1HdY13 Next: Cqr1NRm9yk7gzPsJfNcDekX6t1bSyvQ1e7tvybJSUweU Diff:
Old | New | Differences | |
---|---|---|---|
67 | 67 | let TotalMassTransferSend = (PreviousMassTransferSend + PaidMassTransferAmount) | |
68 | 68 | if ((i.caller != masstransfer_whitelisted_address)) | |
69 | 69 | then throw((("This Address is not Authorized. Only " + toString(masstransfer_whitelisted_address)) + " is Authorized Address to Sign it.")) | |
70 | - | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("Mass_Transfer_Counter", TotalMassTransferCounter), IntegerEntry("Total_Mass_Transfer_Send", TotalMassTransferSend), IntegerEntry((toString(TotalMassTransferCounter) + "_Mass_Transfer_Send"), PaidMassTransferAmount)] | |
70 | + | else if ((PaidMassTransferAmount > read_total_pool_liquidity)) | |
71 | + | then throw("Placed Mass Transfer Amount Size is more than Total Pool Liquidity.") | |
72 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("Mass_Transfer_Counter", TotalMassTransferCounter), IntegerEntry("Total_Mass_Transfer_Send", TotalMassTransferSend), IntegerEntry((toString(TotalMassTransferCounter) + "_Mass_Transfer_Send"), PaidMassTransferAmount)] | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func WithdrawLPBalance (WithdrawAmount) = { | |
79 | + | let read_total_pool_liquidity = valueOrErrorMessage(getInteger(this, "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
80 | + | let updated_pool_balance = (read_total_pool_liquidity - WithdrawAmount) | |
81 | + | let PreviousLPWithdrawCounter = match getInteger(this, "LP_Withdraw_Counter") { | |
82 | + | case a: Int => | |
83 | + | a | |
84 | + | case _ => | |
85 | + | 0 | |
86 | + | } | |
87 | + | let TotalLPWithdrawCounter = (PreviousLPWithdrawCounter + 1) | |
88 | + | let PreviousLPWithdraw = match getInteger(this, "Total_LP_Withdraw") { | |
89 | + | case a: Int => | |
90 | + | a | |
91 | + | case _ => | |
92 | + | 0 | |
93 | + | } | |
94 | + | let TotalLPWithdraw = (PreviousLPWithdraw + WithdrawAmount) | |
95 | + | if ((i.caller != lp_whitelist_address)) | |
96 | + | then throw((("This Address is not Authorized. Only " + toString(masstransfer_whitelisted_address)) + " is Authorized Address to Sign it.")) | |
97 | + | else if ((WithdrawAmount > read_total_pool_liquidity)) | |
98 | + | then throw("Placed Withdraw Amount Size is more than Total Pool Liquidity.") | |
99 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("LP_Withdraw_Counter", TotalLPWithdrawCounter), IntegerEntry("Total_LP_Withdraw", TotalLPWithdraw), IntegerEntry((toString(TotalLPWithdrawCounter) + "_LP_Withdraw"), TotalLPWithdraw)] | |
71 | 100 | } | |
72 | 101 | ||
73 | 102 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lp_address_pubkey = base58'HmWR8GbhBF4LAodJ9xNgR7PpWF79RuCrhPWJWxqdB1KL' | |
5 | 5 | ||
6 | 6 | let masstransfer_whitelisted_address = addressFromPublicKey(lp_address_pubkey) | |
7 | 7 | ||
8 | 8 | let lp_depositor_address = base58'GKmJ6BchUgQfwKp4mp5eX8Y9xLioYRm6e1gDfFgdAcCr' | |
9 | 9 | ||
10 | 10 | let lp_whitelist_address = addressFromPublicKey(lp_depositor_address) | |
11 | 11 | ||
12 | 12 | @Callable(i) | |
13 | 13 | func AddPoolLiquidity () = { | |
14 | 14 | let calleraddress = toBase58String(i.caller.bytes) | |
15 | 15 | let pmt = if ((size(i.payments) == 1)) | |
16 | 16 | then i.payments[0] | |
17 | 17 | else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].") | |
18 | 18 | let PreviousFundsAddedToPoolbyCompany = match getInteger(this, "Total_LP_Added") { | |
19 | 19 | case a: Int => | |
20 | 20 | a | |
21 | 21 | case _ => | |
22 | 22 | 0 | |
23 | 23 | } | |
24 | 24 | let TotalFundsAddedToPoolbyCompany = (PreviousFundsAddedToPoolbyCompany + pmt.amount) | |
25 | 25 | let PreviousPoolLiquidity = match getInteger(this, "Total_Pool_Liquidity") { | |
26 | 26 | case a: Int => | |
27 | 27 | a | |
28 | 28 | case _ => | |
29 | 29 | 0 | |
30 | 30 | } | |
31 | 31 | let TotalPoolLiquidity = (PreviousPoolLiquidity + pmt.amount) | |
32 | 32 | let PreviousLPDepositCounter = match getInteger(this, "LP_Deposit_Counter") { | |
33 | 33 | case a: Int => | |
34 | 34 | a | |
35 | 35 | case _ => | |
36 | 36 | 0 | |
37 | 37 | } | |
38 | 38 | let TotalLPDepositCounter = (PreviousLPDepositCounter + 1) | |
39 | 39 | if ((i.caller != lp_whitelist_address)) | |
40 | 40 | then throw((("This Address is not Authorized. Only " + toString(lp_whitelist_address)) + " is Authorized Address to Sign it.")) | |
41 | 41 | else if (isDefined(pmt.assetId)) | |
42 | 42 | then throw("Only WAVES is allowed to deposit at the moment") | |
43 | 43 | else [IntegerEntry("Total_Pool_Liquidity", TotalPoolLiquidity), IntegerEntry("LP_Deposit_Counter", TotalLPDepositCounter), IntegerEntry("Total_LP_Added", TotalFundsAddedToPoolbyCompany)] | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(i) | |
49 | 49 | func UpdateLPBalance (PaidMassTransferAmount) = { | |
50 | 50 | let read_account_balance = wavesBalance(this).regular | |
51 | 51 | let read_total_pool_liquidity = valueOrErrorMessage(getInteger(this, "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
52 | 52 | let received_order_amount = (read_account_balance - read_total_pool_liquidity) | |
53 | 53 | let updated_pool_balance = ((read_total_pool_liquidity - PaidMassTransferAmount) + received_order_amount) | |
54 | 54 | let PreviousMassTransferCounter = match getInteger(this, "Mass_Transfer_Counter") { | |
55 | 55 | case a: Int => | |
56 | 56 | a | |
57 | 57 | case _ => | |
58 | 58 | 0 | |
59 | 59 | } | |
60 | 60 | let TotalMassTransferCounter = (PreviousMassTransferCounter + 1) | |
61 | 61 | let PreviousMassTransferSend = match getInteger(this, "Total_Mass_Transfer_Send") { | |
62 | 62 | case a: Int => | |
63 | 63 | a | |
64 | 64 | case _ => | |
65 | 65 | 0 | |
66 | 66 | } | |
67 | 67 | let TotalMassTransferSend = (PreviousMassTransferSend + PaidMassTransferAmount) | |
68 | 68 | if ((i.caller != masstransfer_whitelisted_address)) | |
69 | 69 | then throw((("This Address is not Authorized. Only " + toString(masstransfer_whitelisted_address)) + " is Authorized Address to Sign it.")) | |
70 | - | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("Mass_Transfer_Counter", TotalMassTransferCounter), IntegerEntry("Total_Mass_Transfer_Send", TotalMassTransferSend), IntegerEntry((toString(TotalMassTransferCounter) + "_Mass_Transfer_Send"), PaidMassTransferAmount)] | |
70 | + | else if ((PaidMassTransferAmount > read_total_pool_liquidity)) | |
71 | + | then throw("Placed Mass Transfer Amount Size is more than Total Pool Liquidity.") | |
72 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("Mass_Transfer_Counter", TotalMassTransferCounter), IntegerEntry("Total_Mass_Transfer_Send", TotalMassTransferSend), IntegerEntry((toString(TotalMassTransferCounter) + "_Mass_Transfer_Send"), PaidMassTransferAmount)] | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func WithdrawLPBalance (WithdrawAmount) = { | |
79 | + | let read_total_pool_liquidity = valueOrErrorMessage(getInteger(this, "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
80 | + | let updated_pool_balance = (read_total_pool_liquidity - WithdrawAmount) | |
81 | + | let PreviousLPWithdrawCounter = match getInteger(this, "LP_Withdraw_Counter") { | |
82 | + | case a: Int => | |
83 | + | a | |
84 | + | case _ => | |
85 | + | 0 | |
86 | + | } | |
87 | + | let TotalLPWithdrawCounter = (PreviousLPWithdrawCounter + 1) | |
88 | + | let PreviousLPWithdraw = match getInteger(this, "Total_LP_Withdraw") { | |
89 | + | case a: Int => | |
90 | + | a | |
91 | + | case _ => | |
92 | + | 0 | |
93 | + | } | |
94 | + | let TotalLPWithdraw = (PreviousLPWithdraw + WithdrawAmount) | |
95 | + | if ((i.caller != lp_whitelist_address)) | |
96 | + | then throw((("This Address is not Authorized. Only " + toString(masstransfer_whitelisted_address)) + " is Authorized Address to Sign it.")) | |
97 | + | else if ((WithdrawAmount > read_total_pool_liquidity)) | |
98 | + | then throw("Placed Withdraw Amount Size is more than Total Pool Liquidity.") | |
99 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("LP_Withdraw_Counter", TotalLPWithdrawCounter), IntegerEntry("Total_LP_Withdraw", TotalLPWithdraw), IntegerEntry((toString(TotalLPWithdrawCounter) + "_LP_Withdraw"), TotalLPWithdraw)] | |
71 | 100 | } | |
72 | 101 | ||
73 | 102 | ||
74 | 103 | @Verifier(tx) | |
75 | 104 | func verify () = match tx { | |
76 | 105 | case t: Order|ExchangeTransaction|TransferTransaction => | |
77 | 106 | false | |
78 | 107 | case _ => | |
79 | 108 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
80 | 109 | } | |
81 | 110 |
github/deemru/w8io/026f985 26.24 ms ◑