forked from astraly-labs/astraly-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterfaceAll.cairo
More file actions
337 lines (250 loc) · 7.88 KB
/
Copy pathInterfaceAll.cairo
File metadata and controls
337 lines (250 loc) · 7.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
####################################################################################
# SPDX-License-Identifier: MIT
# @title InterfaceAll contract
# @dev put all interfaces here
# Interfaces include
# - IZkIDOContract
# - IERC4626
# - ITask
# - IZkIDOFactory
# @author zkpad
####################################################################################
%lang starknet
from starkware.cairo.common.uint256 import Uint256
struct UserInfo:
member amount : Uint256
member reward_debt : Uint256
end
struct Purchase_Round:
member time_starts : felt
member time_ends : felt
member number_of_purchases : Uint256
end
struct Registration:
member registration_time_starts : felt
member registration_time_ends : felt
member number_of_registrants : Uint256
end
@contract_interface
namespace IZkPadIDOContract:
func get_ido_launch_date() -> (res : felt):
end
func register_user(amount : Uint256, account : felt, nb_quest : felt) -> (res : felt):
end
func get_purchase_round() -> (res : Purchase_Round):
end
func get_registration() -> (res : Registration):
end
func calculate_allocation():
end
end
@contract_interface
namespace IAccount:
func is_valid_signature(hash : felt, sig_len : felt, sig : felt*) -> ():
end
end
@contract_interface
namespace IZKPadIDOFactory:
func get_ido_launch_date(id : felt) -> (res : felt):
end
func get_ido_address(id : felt) -> (res : felt):
end
func set_sale_owner_and_token(sale_owner_address : felt, sale_token_address : felt):
end
func is_sale_created_through_factory(sale_address : felt) -> (res : felt):
end
func get_lottery_ticket_contract_address() -> (lottery_ticket_address : felt):
end
func get_random_number_generator_address() -> (random_number_generator_address : felt):
end
func get_payment_token_address() -> (payment_token_address : felt):
end
func get_merkle_root(id : felt) -> (merkle_root : felt):
end
end
@contract_interface
namespace IERC1155_Receiver:
func onERC1155Received(
operator : felt, _from : felt, id : Uint256, value : Uint256, data_len : felt, data : felt*
) -> (selector : felt):
end
func onERC1155BatchReceived(
operator : felt,
_from : felt,
ids_len : felt,
ids : Uint256*,
values_len : felt,
values : Uint256*,
data_len : felt,
data : felt*,
) -> (selector : felt):
end
func supportsInterface(interfaceId : felt) -> (success : felt):
end
end
@contract_interface
namespace IAdmin:
func is_admin(user_address : felt) -> (res : felt):
end
end
@contract_interface
namespace IZkStakingVault:
func redistribute(pool_id : felt, user_address : felt, amount_to_burn : felt):
end
func deposited(pool_id : felt, user_address : felt) -> (res : felt):
end
func set_tokens_unlock_time(pool_id : felt, user_address : felt, token_unlock_time : felt):
end
end
@contract_interface
namespace IERC4626:
func asset() -> (asset_token_address : felt):
end
func totalAssets() -> (total_managed_assets : Uint256):
end
func convertToShares(assets : Uint256) -> (shares : Uint256):
end
func convertToAssets(shares : Uint256) -> (assets : Uint256):
end
func maxDeposit(receiver : felt) -> (max_assets : Uint256):
end
func previewDeposit(assets : Uint256) -> (shares : Uint256):
end
func deposit(assets : Uint256, receiver : felt) -> (shares : Uint256):
end
func maxMint(receiver : felt) -> (max_shares : Uint256):
end
func previewMint(shares : Uint256) -> (assets : Uint256):
end
func mint(shares : Uint256, receiver : felt) -> (assets : Uint256):
end
func maxWithdraw(owner : felt) -> (max_assets : Uint256):
end
func previewWithdraw(assets : Uint256) -> (shares : Uint256):
end
func withdraw(assets : Uint256, receiver : felt, owner : felt) -> (shares : Uint256):
end
func maxRedeem(owner : felt) -> (max_shares : Uint256):
end
func previewRedeem(shares : Uint256) -> (assets : Uint256):
end
func redeem(shares : Uint256, receiver : felt, owner : felt) -> (assets : Uint256):
end
end
@contract_interface
namespace IERC20:
func name() -> (name : felt):
end
func symbol() -> (symbol : felt):
end
func decimals() -> (decimals : felt):
end
func totalSupply() -> (totalSupply : Uint256):
end
func balanceOf(account : felt) -> (balance : Uint256):
end
func allowance(owner : felt, spender : felt) -> (remaining : Uint256):
end
func transfer(recipient : felt, amount : Uint256) -> (success : felt):
end
func transferFrom(sender : felt, recipient : felt, amount : Uint256) -> (success : felt):
end
func approve(spender : felt, amount : Uint256) -> (success : felt):
end
func mint(to : felt, amount : Uint256):
end
end
const XOROSHIRO_ADDR = 0x0236b6c5722c5b5e78c215d72306f642de0424a6b56f699d43c98683bea7460d
@contract_interface
namespace IXoroshiro:
func next() -> (rnd : felt):
end
end
@contract_interface
namespace ITask:
# # @notice Called by task automators to see if task needs to be executed.
# # @dev Do not return other values as keeper behavior is undefined.
# # @return taskReady Assumes the value 1 if automation is ready to be called and 0 otherwise.
func probeTask() -> (taskReady : felt):
end
# # @notice Main endpoint for task execution. Task automators call this to execute your task.
# # @dev This function should not have access restrictions. However, this function could
# # still be called even if `probeTask` returns 0 and needs to be protected accordingly.
func executeTask() -> ():
end
func setIDOContractAddress(address : felt) -> ():
end
end
@contract_interface
namespace IVault:
func feePercent() -> (fee_percent : felt):
end
func lockedProfit() -> (res : Uint256):
end
func harvestDelay() -> (harvest_delay : felt):
end
func harvestWindow() -> (harvest_window : felt):
end
func targetFloatPercent() -> (float_percent : felt):
end
func canHarvest() -> (yes_no : felt):
end
func lastHarvestWindowStart() -> (last_harvest_window_start : felt):
end
func getWithdrawalStack() -> (strategies_len : felt, strategies : felt*):
end
func rewardPerBlock() -> (reward : Uint256):
end
func startBlock() -> (block : felt):
end
func endBlock() -> (block : felt):
end
func lastRewardBlock() -> (block : felt):
end
func accTokenPerShare() -> (res : Uint256):
end
func getMultiplier(_from : felt, _to : felt) -> (multiplier : felt):
end
func userInfo(user : felt) -> (info : UserInfo):
end
func totalFloat() -> (float : Uint256):
end
func harvest(strategies_len : felt, strategies : felt*):
end
func setFeePercent(new_fee_percent : felt):
end
func setHarvestDelay(new_harvest_delay : felt):
end
func setHarvestWindow(new_harvest_window : felt):
end
func setTargetFloatPercent(float_percent : felt):
end
func setHarvestTaskContract(address : felt):
end
func updateRewardPerBlockAndEndBlock(_reward_per_block : Uint256, new_end_block : felt):
end
func initializer(
name : felt,
symbol : felt,
asset_addr : felt,
owner : felt,
reward_per_block : Uint256,
start_reward_block : felt,
end_reward_block : felt,
):
end
func harvestRewards():
end
func calculatePendingRewards(user : felt) -> (rewards : Uint256):
end
func pushToWithdrawalStack(strategy : felt):
end
func popFromWithdrawalStack():
end
func setWithdrawalStack(stack_len : felt, stack : felt*):
end
func replaceWithdrawalStackIndex(index : felt, address : felt):
end
func swapWithdrawalStackIndexes(index1 : felt, index2 : felt):
end
end