tx · 5Ycjr7zDvSnC97yakyTgq9HZtnVpZWAF6tpM996uvy28 3NA2sejUzEcL7Gg8WfhrcqxP22fHk2SS9pK: -0.00700000 Waves 2022.08.28 00:12 [2203409] smart account 3NA2sejUzEcL7Gg8WfhrcqxP22fHk2SS9pK > SELF 0.00000000 Waves
{ "type": 13, "id": "5Ycjr7zDvSnC97yakyTgq9HZtnVpZWAF6tpM996uvy28", "fee": 700000, "feeAssetId": null, "timestamp": 1661634730894, "version": 2, "chainId": 84, "sender": "3NA2sejUzEcL7Gg8WfhrcqxP22fHk2SS9pK", "senderPublicKey": "HMzDczZUThMMhE2Grm1ZmpN3QNZ9N7CUCYnsqh4utSDJ", "proofs": [ "3LEpVnaPpa8E3pLZGycKHfcU94CK3L2oi9QhEMKhvyBMwZPjWTC6Eh8TWUj3KiqNPq5KVqssUnNtt9nn3zh53egu" ], "script": "base64:BgIeCAISAwoBCBIDCgEIEgMKAQESAwoBARIAEgASABIABgAEdXNkbgEg11KRGPRfT6VehNuJvBkobHB7OMalzc+gLp7N2ofv42AABHVzZGMBIPQcuTcYg4l4Uh6IaJaLWyiuNgmUbeQfgPZEel3eCXgMAAxhZG1pbl93YWxsZXQCIzNOM0RDbmdqaWRpdmtKYlRKd0ZURXZiWVJUZmZDV1ZCTENMAA5hbGZhcmtfdGVzdG5ldAAFAAp2aXJlc19kYXBwARoBVHjn3floRCovnhXY1SHCQGibEg7rsYrFrAENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAgBaQEPYnV5X3VzZG5fdGlja2V0AQhyZWZlcnJhbAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdXNkbgkAAgECH1BsZWFzZSBkZXBvc2l0IFVTRC1OIHRva2VuIG9ubHkEC3VzZXJfY3JlZGl0CQENdHJ5R2V0SW50ZWdlcgEJAKwC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UDbmlsAWkBF3VzZGNfc2VuZF9wcm9maXRfYW1vdW50AAQXdXNkY19wcm9maXRfbGFzdF9hbW91bnQJAQ10cnlHZXRJbnRlZ2VyAQIXdXNkY19wcm9maXRfbGFzdF9hbW91bnQDCQBnAgAABRd1c2RjX3Byb2ZpdF9sYXN0X2Ftb3VudAkAAgEJAKwCAgIceW91IGRvbnQgaGF2ZSBwcm9maXQgYW1vdW50IAkApAMBBRd1c2RjX3Byb2ZpdF9sYXN0X2Ftb3VudAQIdHJhbnNmZXIJAQ5TY3JpcHRUcmFuc2ZlcgMJARFAZXh0ck5hdGl2ZSgxMDYyKQEFDGFkbWluX3dhbGxldAUXdXNkY19wcm9maXRfbGFzdF9hbW91bnQFBHVzZGMEEXRyYW5zYWN0aW9uX2Jsb2NrBAckbWF0Y2gwCAUJbGFzdEJsb2NrBmhlaWdodAMJAAECBQckbWF0Y2gwAgNJbnQEAWEFByRtYXRjaDAFAWEJAAIBAhJFcnJvciBibG9jayBudW1iZXIJAMwIAgUIdHJhbnNmZXIJAMwIAgkBDEludGVnZXJFbnRyeQICF3VzZG5fcHJvZml0X2xhc3RfYW1vdW50AAAJAMwIAgkBDEludGVnZXJFbnRyeQICFnVzZG5fcHJvZml0X2xhc3RfYmxvY2sFEXRyYW5zYWN0aW9uX2Jsb2NrBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5mwvtkw==", "height": 2203409, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GHUr75suPFacRdHFdTxxUrGdvcRBUCgi7Z7QfdfSAdCL Next: none Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | ||
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | - | func buy_usdn_ticket () = if ((i.payments[0].assetId != usdn)) | |
23 | + | func buy_usdn_ticket (referral) = if ((i.payments[0].assetId != usdn)) | |
24 | 24 | then throw("Please deposit USD-N token only") | |
25 | 25 | else { | |
26 | 26 | let user_credit = tryGetInteger((("usdn_" + toString(i.originCaller)) + "_credit")) | |
36 | 36 | } | |
37 | 37 | let res = invoke(Address(vires_dapp), "usdN_stake", nil, [AttachedPayment(usdn, deposit_amount)]) | |
38 | 38 | if ((res == res)) | |
39 | - | then [IntegerEntry((("usdn_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdn_all_credit", new_all_credit), IntegerEntry("usdn_all_block", transaction_block)] | |
39 | + | then [StringEntry((("usdn_" + toString(i.originCaller)) + "_referral"), referral), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdn_all_credit", new_all_credit), IntegerEntry("usdn_all_block", transaction_block)] | |
40 | 40 | else throw("Strict value is not equal to itself.") | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | - | func buy_usdc_ticket () = if ((i.payments[0].assetId != usdc)) | |
46 | + | func buy_usdc_ticket (referral) = if ((i.payments[0].assetId != usdc)) | |
47 | 47 | then throw("Please deposit USD-N token only") | |
48 | 48 | else { | |
49 | 49 | let user_credit = tryGetInteger((("usdc_" + toString(i.originCaller)) + "_credit")) | |
59 | 59 | } | |
60 | 60 | let res = invoke(Address(vires_dapp), "usdC_stake", nil, [AttachedPayment(usdc, deposit_amount)]) | |
61 | 61 | if ((res == res)) | |
62 | - | then [IntegerEntry((("usdc_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdc_all_credit", new_all_credit), IntegerEntry("usdc_all_block", transaction_block)] | |
62 | + | then [StringEntry((("usdc_" + toString(i.originCaller)) + "_referral"), referral), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdc_all_credit", new_all_credit), IntegerEntry("usdc_all_block", transaction_block)] | |
63 | 63 | else throw("Strict value is not equal to itself.") | |
64 | 64 | } | |
65 | 65 | ||
117 | 117 | func usdn_calc_profit_amount () = if ((toString(i.originCaller) != admin_wallet)) | |
118 | 118 | then throw("Sorry! you are not allowed to use this funaction") | |
119 | 119 | else { | |
120 | - | let usdn_profit_last_block = tryGetInteger("usdn_profit_last_block") | |
120 | + | let usdn_calc_profit_last_block = tryGetInteger("usdn_calc_profit_last_block") | |
121 | 121 | let usdn_profit_last_amount = tryGetInteger("usdn_profit_last_amount") | |
122 | 122 | let transaction_block = match lastBlock.height { | |
123 | 123 | case a: Int => | |
125 | 125 | case _ => | |
126 | 126 | throw("Error block number") | |
127 | 127 | } | |
128 | - | let alfark = (transaction_block - usdn_profit_last_block) | |
128 | + | let alfark = (transaction_block - usdn_calc_profit_last_block) | |
129 | 129 | if ((alfark_testnet > alfark)) | |
130 | 130 | then throw((("Please try again after " + toString((alfark_testnet - alfark))) + " block")) | |
131 | 131 | else { | |
132 | 132 | let usdn_balance = assetBalance(this, usdn) | |
133 | - | [IntegerEntry("usdn_profit_last_block", transaction_block), IntegerEntry("usdn_profit_last_amount", usdn_balance)] | |
133 | + | [IntegerEntry("usdn_calc_profit_last_block", transaction_block), IntegerEntry("usdn_profit_last_amount", usdn_balance)] | |
134 | 134 | } | |
135 | 135 | } | |
136 | 136 | ||
143 | 143 | then throw(("you dont have profit amount " + toString(usdn_profit_last_amount))) | |
144 | 144 | else { | |
145 | 145 | let transfer = ScriptTransfer(addressFromStringValue(admin_wallet), usdn_profit_last_amount, usdn) | |
146 | - | [transfer] | |
146 | + | let transaction_block = match lastBlock.height { | |
147 | + | case a: Int => | |
148 | + | a | |
149 | + | case _ => | |
150 | + | throw("Error block number") | |
151 | + | } | |
152 | + | [transfer, IntegerEntry("usdn_profit_last_amount", 0), IntegerEntry("usdn_profit_last_block", transaction_block)] | |
147 | 153 | } | |
148 | 154 | } | |
149 | 155 | ||
153 | 159 | func usdc_calc_profit_amount () = if ((toString(i.originCaller) != admin_wallet)) | |
154 | 160 | then throw("Sorry! you are not allowed to use this funaction") | |
155 | 161 | else { | |
156 | - | let usdc_profit_last_block = tryGetInteger("usdc_profit_last_block") | |
162 | + | let usdc_calc_profit_last_block = tryGetInteger("usdc_calc_profit_last_block") | |
157 | 163 | let usdc_profit_last_amount = tryGetInteger("usdc_profit_last_amount") | |
158 | 164 | let transaction_block = match lastBlock.height { | |
159 | 165 | case a: Int => | |
161 | 167 | case _ => | |
162 | 168 | throw("Error block number") | |
163 | 169 | } | |
164 | - | let alfark = (transaction_block - usdc_profit_last_block) | |
170 | + | let alfark = (transaction_block - usdc_calc_profit_last_block) | |
165 | 171 | if ((alfark_testnet > alfark)) | |
166 | 172 | then throw((("Please try again after " + toString((alfark_testnet - alfark))) + " block")) | |
167 | 173 | else { | |
168 | 174 | let usdc_balance = assetBalance(this, usdc) | |
169 | - | [IntegerEntry("usdc_profit_last_block", transaction_block), IntegerEntry("usdc_profit_last_amount", usdc_balance)] | |
175 | + | [IntegerEntry("usdc_calc_profit_last_block", transaction_block), IntegerEntry("usdc_profit_last_amount", usdc_balance)] | |
170 | 176 | } | |
171 | 177 | } | |
172 | 178 | ||
179 | 185 | then throw(("you dont have profit amount " + toString(usdc_profit_last_amount))) | |
180 | 186 | else { | |
181 | 187 | let transfer = ScriptTransfer(addressFromStringValue(admin_wallet), usdc_profit_last_amount, usdc) | |
182 | - | [transfer] | |
188 | + | let transaction_block = match lastBlock.height { | |
189 | + | case a: Int => | |
190 | + | a | |
191 | + | case _ => | |
192 | + | throw("Error block number") | |
193 | + | } | |
194 | + | [transfer, IntegerEntry("usdn_profit_last_amount", 0), IntegerEntry("usdn_profit_last_block", transaction_block)] | |
183 | 195 | } | |
184 | 196 | } | |
185 | 197 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let usdn = base58'FVXgJ86erBw5GAMeAw1CnYXwQn48BFAEAhRyHPUjbMQB' | |
5 | 5 | ||
6 | 6 | let usdc = base58'HRut8ESAGXxwvsKJky1V96qRtqyXQd4Apq4GY7TE5yGP' | |
7 | 7 | ||
8 | 8 | let admin_wallet = "3N3DCngjidivkJbTJwFTEvbYRTffCWVBLCL" | |
9 | 9 | ||
10 | 10 | let alfark_testnet = 5 | |
11 | 11 | ||
12 | 12 | let vires_dapp = base58'3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD' | |
13 | 13 | ||
14 | 14 | func tryGetInteger (key) = match getInteger(this, key) { | |
15 | 15 | case b: Int => | |
16 | 16 | b | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | - | func buy_usdn_ticket () = if ((i.payments[0].assetId != usdn)) | |
23 | + | func buy_usdn_ticket (referral) = if ((i.payments[0].assetId != usdn)) | |
24 | 24 | then throw("Please deposit USD-N token only") | |
25 | 25 | else { | |
26 | 26 | let user_credit = tryGetInteger((("usdn_" + toString(i.originCaller)) + "_credit")) | |
27 | 27 | let deposit_amount = i.payments[0].amount | |
28 | 28 | let new_user_credit = (user_credit + deposit_amount) | |
29 | 29 | let all_credit = tryGetInteger("usdn_all_credit") | |
30 | 30 | let new_all_credit = (all_credit + deposit_amount) | |
31 | 31 | let transaction_block = match lastBlock.height { | |
32 | 32 | case a: Int => | |
33 | 33 | a | |
34 | 34 | case _ => | |
35 | 35 | throw("Error! with blochchain height") | |
36 | 36 | } | |
37 | 37 | let res = invoke(Address(vires_dapp), "usdN_stake", nil, [AttachedPayment(usdn, deposit_amount)]) | |
38 | 38 | if ((res == res)) | |
39 | - | then [IntegerEntry((("usdn_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdn_all_credit", new_all_credit), IntegerEntry("usdn_all_block", transaction_block)] | |
39 | + | then [StringEntry((("usdn_" + toString(i.originCaller)) + "_referral"), referral), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdn_all_credit", new_all_credit), IntegerEntry("usdn_all_block", transaction_block)] | |
40 | 40 | else throw("Strict value is not equal to itself.") | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | - | func buy_usdc_ticket () = if ((i.payments[0].assetId != usdc)) | |
46 | + | func buy_usdc_ticket (referral) = if ((i.payments[0].assetId != usdc)) | |
47 | 47 | then throw("Please deposit USD-N token only") | |
48 | 48 | else { | |
49 | 49 | let user_credit = tryGetInteger((("usdc_" + toString(i.originCaller)) + "_credit")) | |
50 | 50 | let deposit_amount = i.payments[0].amount | |
51 | 51 | let new_user_credit = (user_credit + deposit_amount) | |
52 | 52 | let all_credit = tryGetInteger("usdc_all_credit") | |
53 | 53 | let new_all_credit = (all_credit + deposit_amount) | |
54 | 54 | let transaction_block = match lastBlock.height { | |
55 | 55 | case a: Int => | |
56 | 56 | a | |
57 | 57 | case _ => | |
58 | 58 | throw("Error block number") | |
59 | 59 | } | |
60 | 60 | let res = invoke(Address(vires_dapp), "usdC_stake", nil, [AttachedPayment(usdc, deposit_amount)]) | |
61 | 61 | if ((res == res)) | |
62 | - | then [IntegerEntry((("usdc_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdc_all_credit", new_all_credit), IntegerEntry("usdc_all_block", transaction_block)] | |
62 | + | then [StringEntry((("usdc_" + toString(i.originCaller)) + "_referral"), referral), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdc_all_credit", new_all_credit), IntegerEntry("usdc_all_block", transaction_block)] | |
63 | 63 | else throw("Strict value is not equal to itself.") | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func sell_usdn_ticket (amount) = { | |
70 | 70 | let user_credit = tryGetInteger((("usdn_" + toString(i.originCaller)) + "_credit")) | |
71 | 71 | if ((amount > user_credit)) | |
72 | 72 | then throw(("sorry you can't withdraw this amount, because u=you have only " + toString(user_credit))) | |
73 | 73 | else { | |
74 | 74 | let new_user_credit = (user_credit - amount) | |
75 | 75 | let all_credit = tryGetInteger("usdn_all_credit") | |
76 | 76 | let new_all_credit = (all_credit - amount) | |
77 | 77 | let transaction_block = match lastBlock.height { | |
78 | 78 | case a: Int => | |
79 | 79 | a | |
80 | 80 | case _ => | |
81 | 81 | throw("Error block number") | |
82 | 82 | } | |
83 | 83 | let res = invoke(Address(vires_dapp), "usdN_cancelStake", [amount], nil) | |
84 | 84 | if ((res == res)) | |
85 | 85 | then [IntegerEntry((("usdn_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdn_all_credit", new_all_credit), IntegerEntry("usdn_all_block", transaction_block)] | |
86 | 86 | else throw("Strict value is not equal to itself.") | |
87 | 87 | } | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | ||
92 | 92 | @Callable(i) | |
93 | 93 | func sell_usdc_ticket (amount) = { | |
94 | 94 | let user_credit = tryGetInteger((("usdc_" + toString(i.originCaller)) + "_credit")) | |
95 | 95 | if ((amount > user_credit)) | |
96 | 96 | then throw(("sorry you can't withdraw this amount, because u=you have only " + toString(user_credit))) | |
97 | 97 | else { | |
98 | 98 | let new_user_credit = (user_credit - amount) | |
99 | 99 | let all_credit = tryGetInteger("usdc_all_credit") | |
100 | 100 | let new_all_credit = (all_credit - amount) | |
101 | 101 | let transaction_block = match lastBlock.height { | |
102 | 102 | case a: Int => | |
103 | 103 | a | |
104 | 104 | case _ => | |
105 | 105 | throw("Error block number") | |
106 | 106 | } | |
107 | 107 | let res = invoke(Address(vires_dapp), "usdC_cancelStake", [amount], nil) | |
108 | 108 | if ((res == res)) | |
109 | 109 | then [IntegerEntry((("usdc_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdc_all_credit", new_all_credit), IntegerEntry("usdc_all_block", transaction_block)] | |
110 | 110 | else throw("Strict value is not equal to itself.") | |
111 | 111 | } | |
112 | 112 | } | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | ||
116 | 116 | @Callable(i) | |
117 | 117 | func usdn_calc_profit_amount () = if ((toString(i.originCaller) != admin_wallet)) | |
118 | 118 | then throw("Sorry! you are not allowed to use this funaction") | |
119 | 119 | else { | |
120 | - | let usdn_profit_last_block = tryGetInteger("usdn_profit_last_block") | |
120 | + | let usdn_calc_profit_last_block = tryGetInteger("usdn_calc_profit_last_block") | |
121 | 121 | let usdn_profit_last_amount = tryGetInteger("usdn_profit_last_amount") | |
122 | 122 | let transaction_block = match lastBlock.height { | |
123 | 123 | case a: Int => | |
124 | 124 | a | |
125 | 125 | case _ => | |
126 | 126 | throw("Error block number") | |
127 | 127 | } | |
128 | - | let alfark = (transaction_block - usdn_profit_last_block) | |
128 | + | let alfark = (transaction_block - usdn_calc_profit_last_block) | |
129 | 129 | if ((alfark_testnet > alfark)) | |
130 | 130 | then throw((("Please try again after " + toString((alfark_testnet - alfark))) + " block")) | |
131 | 131 | else { | |
132 | 132 | let usdn_balance = assetBalance(this, usdn) | |
133 | - | [IntegerEntry("usdn_profit_last_block", transaction_block), IntegerEntry("usdn_profit_last_amount", usdn_balance)] | |
133 | + | [IntegerEntry("usdn_calc_profit_last_block", transaction_block), IntegerEntry("usdn_profit_last_amount", usdn_balance)] | |
134 | 134 | } | |
135 | 135 | } | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | ||
139 | 139 | @Callable(i) | |
140 | 140 | func usdn_send_profit_amount () = { | |
141 | 141 | let usdn_profit_last_amount = tryGetInteger("usdn_profit_last_amount") | |
142 | 142 | if ((0 >= usdn_profit_last_amount)) | |
143 | 143 | then throw(("you dont have profit amount " + toString(usdn_profit_last_amount))) | |
144 | 144 | else { | |
145 | 145 | let transfer = ScriptTransfer(addressFromStringValue(admin_wallet), usdn_profit_last_amount, usdn) | |
146 | - | [transfer] | |
146 | + | let transaction_block = match lastBlock.height { | |
147 | + | case a: Int => | |
148 | + | a | |
149 | + | case _ => | |
150 | + | throw("Error block number") | |
151 | + | } | |
152 | + | [transfer, IntegerEntry("usdn_profit_last_amount", 0), IntegerEntry("usdn_profit_last_block", transaction_block)] | |
147 | 153 | } | |
148 | 154 | } | |
149 | 155 | ||
150 | 156 | ||
151 | 157 | ||
152 | 158 | @Callable(i) | |
153 | 159 | func usdc_calc_profit_amount () = if ((toString(i.originCaller) != admin_wallet)) | |
154 | 160 | then throw("Sorry! you are not allowed to use this funaction") | |
155 | 161 | else { | |
156 | - | let usdc_profit_last_block = tryGetInteger("usdc_profit_last_block") | |
162 | + | let usdc_calc_profit_last_block = tryGetInteger("usdc_calc_profit_last_block") | |
157 | 163 | let usdc_profit_last_amount = tryGetInteger("usdc_profit_last_amount") | |
158 | 164 | let transaction_block = match lastBlock.height { | |
159 | 165 | case a: Int => | |
160 | 166 | a | |
161 | 167 | case _ => | |
162 | 168 | throw("Error block number") | |
163 | 169 | } | |
164 | - | let alfark = (transaction_block - usdc_profit_last_block) | |
170 | + | let alfark = (transaction_block - usdc_calc_profit_last_block) | |
165 | 171 | if ((alfark_testnet > alfark)) | |
166 | 172 | then throw((("Please try again after " + toString((alfark_testnet - alfark))) + " block")) | |
167 | 173 | else { | |
168 | 174 | let usdc_balance = assetBalance(this, usdc) | |
169 | - | [IntegerEntry("usdc_profit_last_block", transaction_block), IntegerEntry("usdc_profit_last_amount", usdc_balance)] | |
175 | + | [IntegerEntry("usdc_calc_profit_last_block", transaction_block), IntegerEntry("usdc_profit_last_amount", usdc_balance)] | |
170 | 176 | } | |
171 | 177 | } | |
172 | 178 | ||
173 | 179 | ||
174 | 180 | ||
175 | 181 | @Callable(i) | |
176 | 182 | func usdc_send_profit_amount () = { | |
177 | 183 | let usdc_profit_last_amount = tryGetInteger("usdc_profit_last_amount") | |
178 | 184 | if ((0 >= usdc_profit_last_amount)) | |
179 | 185 | then throw(("you dont have profit amount " + toString(usdc_profit_last_amount))) | |
180 | 186 | else { | |
181 | 187 | let transfer = ScriptTransfer(addressFromStringValue(admin_wallet), usdc_profit_last_amount, usdc) | |
182 | - | [transfer] | |
188 | + | let transaction_block = match lastBlock.height { | |
189 | + | case a: Int => | |
190 | + | a | |
191 | + | case _ => | |
192 | + | throw("Error block number") | |
193 | + | } | |
194 | + | [transfer, IntegerEntry("usdn_profit_last_amount", 0), IntegerEntry("usdn_profit_last_block", transaction_block)] | |
183 | 195 | } | |
184 | 196 | } | |
185 | 197 | ||
186 | 198 | ||
187 | 199 | @Verifier(tx) | |
188 | 200 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
189 | 201 |
github/deemru/w8io/169f3d6 48.50 ms ◑