-
Notifications
You must be signed in to change notification settings - Fork 0
/
stability-fund.tz
333 lines (333 loc) · 27.3 KB
/
stability-fund.tz
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
parameter (or (or (or (nat %accrueInterest) (unit %default)) (or (address %liquidate) (or (pair %send mutez address) (pair %sendTokens nat address)))) (or (or (address %setAdministratorContract) (option %setDelegate key_hash)) (or (address %setGovernorContract) (or (address %setOvenRegistryContract) (address %setSavingsAccountContract)))));
storage (pair (pair (address %administratorContractAddress) (address %governorContractAddress)) (pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress))));
code
{
UNPAIR; # @parameter : @storage
IF_LEFT
{
IF_LEFT
{
IF_LEFT
{
SWAP; # @storage : @parameter%accrueInterest
# == accrueInterest ==
# sp.verify(sp.sender == self.data.savingsAccountContractAddress, message = 25) # @storage : @parameter%accrueInterest
DUP; # @storage : @storage : @parameter%accrueInterest
DUG 2; # @storage : @parameter%accrueInterest : @storage
GET 5; # address : @parameter%accrueInterest : @storage
SENDER; # address : address : @parameter%accrueInterest : @storage
COMPARE; # int : @parameter%accrueInterest : @storage
EQ; # bool : @parameter%accrueInterest : @storage
IF
{}
{
PUSH int 25; # int : @parameter%accrueInterest : @storage
FAILWITH; # FAILED
}; # @parameter%accrueInterest : @storage
# sp.transfer(sp.record(from_ = sp.self_address, to_ = self.data.savingsAccountContractAddress, value = params), sp.tez(0), sp.contract(sp.TRecord(from_ = sp.TAddress, to_ = sp.TAddress, value = sp.TNat).layout(("from_ as from", ("to_ as to", "value"))), self.data.tokenContractAddress, entry_point='transfer').open_some()) # @parameter%accrueInterest : @storage
NIL operation; # list operation : @parameter%accrueInterest : @storage
DUP 3; # @storage : list operation : @parameter%accrueInterest : @storage
GET 6; # address : list operation : @parameter%accrueInterest : @storage
CONTRACT %transfer (pair (address %from) (pair (address %to) (nat %value))); # option (contract (pair (address %from) (pair (address %to) (nat %value)))) : list operation : @parameter%accrueInterest : @storage
IF_SOME
{}
{
UNIT; # unit : list operation : @parameter%accrueInterest : @storage
FAILWITH; # FAILED
}; # @some : list operation : @parameter%accrueInterest : @storage
PUSH mutez 0; # mutez : @some : list operation : @parameter%accrueInterest : @storage
DIG 3; # @parameter%accrueInterest : mutez : @some : list operation : @storage
DUP 5; # @storage : @parameter%accrueInterest : mutez : @some : list operation : @storage
GET 5; # address : @parameter%accrueInterest : mutez : @some : list operation : @storage
PAIR %to %value; # pair (address %to) (@parameter%accrueInterest %value) : mutez : @some : list operation : @storage
SELF_ADDRESS; # address : pair (address %to) (@parameter%accrueInterest %value) : mutez : @some : list operation : @storage
PAIR %from; # pair (address %from) (pair (address %to) (@parameter%accrueInterest %value)) : mutez : @some : list operation : @storage
TRANSFER_TOKENS; # operation : list operation : @storage
CONS; # list operation : @storage
}
{
DROP; # @storage
# == default == # @storage
NIL operation; # list operation : @storage
}; # list operation : @storage
}
{
IF_LEFT
{
SWAP; # @storage : @parameter%liquidate
# == liquidate ==
# sp.verify(sp.sender == self.data.administratorContractAddress, message = 8) # @storage : @parameter%liquidate
DUP; # @storage : @storage : @parameter%liquidate
DUG 2; # @storage : @parameter%liquidate : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%liquidate : @storage
CAR; # address : @parameter%liquidate : @storage
SENDER; # address : address : @parameter%liquidate : @storage
COMPARE; # int : @parameter%liquidate : @storage
EQ; # bool : @parameter%liquidate : @storage
IF
{}
{
PUSH int 8; # int : @parameter%liquidate : @storage
FAILWITH; # FAILED
}; # @parameter%liquidate : @storage
# sp.transfer(params, sp.tez(0), sp.contract(sp.TAddress, self.data.ovenRegistryContractAddress, entry_point='isOven').open_some()) # @parameter%liquidate : @storage
NIL operation; # list operation : @parameter%liquidate : @storage
DUP 3; # @storage : list operation : @parameter%liquidate : @storage
GET 3; # address : list operation : @parameter%liquidate : @storage
CONTRACT %isOven address; # option (contract address) : list operation : @parameter%liquidate : @storage
IF_SOME
{}
{
UNIT; # unit : list operation : @parameter%liquidate : @storage
FAILWITH; # FAILED
}; # @some : list operation : @parameter%liquidate : @storage
PUSH mutez 0; # mutez : @some : list operation : @parameter%liquidate : @storage
DUP 4; # @parameter%liquidate : mutez : @some : list operation : @parameter%liquidate : @storage
TRANSFER_TOKENS; # operation : list operation : @parameter%liquidate : @storage
CONS; # list operation : @parameter%liquidate : @storage
SWAP; # @parameter%liquidate : list operation : @storage
# sp.send(params, sp.tez(0)) # @parameter%liquidate : list operation : @storage
CONTRACT %liquidate unit; # option (contract unit) : list operation : @storage
IF_SOME
{}
{
UNIT; # unit : list operation : @storage
FAILWITH; # FAILED
}; # @some : list operation : @storage
PUSH mutez 0; # mutez : @some : list operation : @storage
UNIT; # unit : mutez : @some : list operation : @storage
TRANSFER_TOKENS; # operation : list operation : @storage
CONS; # list operation : @storage
}
{
IF_LEFT
{
SWAP; # @storage : @parameter%send
# == send ==
# sp.verify(sp.sender == self.data.governorContractAddress, message = 4) # @storage : @parameter%send
DUP; # @storage : @storage : @parameter%send
DUG 2; # @storage : @parameter%send : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%send : @storage
CDR; # address : @parameter%send : @storage
SENDER; # address : address : @parameter%send : @storage
COMPARE; # int : @parameter%send : @storage
EQ; # bool : @parameter%send : @storage
IF
{}
{
PUSH int 4; # int : @parameter%send : @storage
FAILWITH; # FAILED
}; # @parameter%send : @storage
# sp.send(sp.snd(params), sp.fst(params)) # @parameter%send : @storage
DUP; # @parameter%send : @parameter%send : @storage
CDR; # address : @parameter%send : @storage
CONTRACT unit; # option (contract unit) : @parameter%send : @storage
IF_SOME
{}
{
UNIT; # unit : @parameter%send : @storage
FAILWITH; # FAILED
}; # @some : @parameter%send : @storage
NIL operation; # list operation : @some : @parameter%send : @storage
SWAP; # @some : list operation : @parameter%send : @storage
DIG 2; # @parameter%send : @some : list operation : @storage
CAR; # mutez : @some : list operation : @storage
UNIT; # unit : mutez : @some : list operation : @storage
TRANSFER_TOKENS; # operation : list operation : @storage
CONS; # list operation : @storage
}
{
SWAP; # @storage : @parameter%sendTokens
# == sendTokens ==
# sp.verify(sp.sender == self.data.governorContractAddress, message = 4) # @storage : @parameter%sendTokens
DUP; # @storage : @storage : @parameter%sendTokens
DUG 2; # @storage : @parameter%sendTokens : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%sendTokens : @storage
CDR; # address : @parameter%sendTokens : @storage
SENDER; # address : address : @parameter%sendTokens : @storage
COMPARE; # int : @parameter%sendTokens : @storage
EQ; # bool : @parameter%sendTokens : @storage
IF
{}
{
PUSH int 4; # int : @parameter%sendTokens : @storage
FAILWITH; # FAILED
}; # @parameter%sendTokens : @storage
# sp.transfer(sp.record(from_ = sp.self_address, to_ = sp.snd(params), value = sp.fst(params)), sp.tez(0), sp.contract(sp.TRecord(from_ = sp.TAddress, to_ = sp.TAddress, value = sp.TNat).layout(("from_ as from", ("to_ as to", "value"))), self.data.tokenContractAddress, entry_point='transfer').open_some()) # @parameter%sendTokens : @storage
NIL operation; # list operation : @parameter%sendTokens : @storage
DUP 3; # @storage : list operation : @parameter%sendTokens : @storage
GET 6; # address : list operation : @parameter%sendTokens : @storage
CONTRACT %transfer (pair (address %from) (pair (address %to) (nat %value))); # option (contract (pair (address %from) (pair (address %to) (nat %value)))) : list operation : @parameter%sendTokens : @storage
IF_SOME
{}
{
UNIT; # unit : list operation : @parameter%sendTokens : @storage
FAILWITH; # FAILED
}; # @some : list operation : @parameter%sendTokens : @storage
PUSH mutez 0; # mutez : @some : list operation : @parameter%sendTokens : @storage
DIG 3; # @parameter%sendTokens : mutez : @some : list operation : @storage
UNPAIR; # nat : address : mutez : @some : list operation : @storage
SWAP; # address : nat : mutez : @some : list operation : @storage
PAIR %to %value; # pair (address %to) (nat %value) : mutez : @some : list operation : @storage
SELF_ADDRESS; # address : pair (address %to) (nat %value) : mutez : @some : list operation : @storage
PAIR %from; # pair (address %from) (pair (address %to) (nat %value)) : mutez : @some : list operation : @storage
TRANSFER_TOKENS; # operation : list operation : @storage
CONS; # list operation : @storage
}; # list operation : @storage
}; # list operation : @storage
}; # list operation : @storage
}
{
IF_LEFT
{
IF_LEFT
{
SWAP; # @storage : @parameter%setAdministratorContract
# == setAdministratorContract ==
# sp.verify(sp.sender == self.data.governorContractAddress, message = 4) # @storage : @parameter%setAdministratorContract
DUP; # @storage : @storage : @parameter%setAdministratorContract
DUG 2; # @storage : @parameter%setAdministratorContract : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setAdministratorContract : @storage
CDR; # address : @parameter%setAdministratorContract : @storage
SENDER; # address : address : @parameter%setAdministratorContract : @storage
COMPARE; # int : @parameter%setAdministratorContract : @storage
EQ; # bool : @parameter%setAdministratorContract : @storage
IF
{}
{
PUSH int 4; # int : @parameter%setAdministratorContract : @storage
FAILWITH; # FAILED
}; # @parameter%setAdministratorContract : @storage
SWAP; # @storage : @parameter%setAdministratorContract
# self.data.administratorContractAddress = params # @storage : @parameter%setAdministratorContract
UNPAIR; # pair (address %administratorContractAddress) (address %governorContractAddress) : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : @parameter%setAdministratorContract
CDR; # address : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : @parameter%setAdministratorContract
DIG 2; # @parameter%setAdministratorContract : address : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress))
PAIR; # pair @parameter%setAdministratorContract address : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress))
PAIR; # pair (pair @parameter%setAdministratorContract address) (pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)))
NIL operation; # list operation : pair (pair @parameter%setAdministratorContract address) (pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)))
}
{
SWAP; # @storage : @parameter%setDelegate
# == setDelegate ==
# sp.verify(sp.sender == self.data.administratorContractAddress, message = 8) # @storage : @parameter%setDelegate
DUP; # @storage : @storage : @parameter%setDelegate
DUG 2; # @storage : @parameter%setDelegate : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setDelegate : @storage
CAR; # address : @parameter%setDelegate : @storage
SENDER; # address : address : @parameter%setDelegate : @storage
COMPARE; # int : @parameter%setDelegate : @storage
EQ; # bool : @parameter%setDelegate : @storage
IF
{}
{
PUSH int 8; # int : @parameter%setDelegate : @storage
FAILWITH; # FAILED
}; # @parameter%setDelegate : @storage
# sp.set_delegate(params) # @parameter%setDelegate : @storage
SET_DELEGATE; # operation : @storage
NIL operation; # list operation : operation : @storage
SWAP; # operation : list operation : @storage
CONS; # list operation : @storage
}; # list operation : pair (pair address address) (pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)))
}
{
IF_LEFT
{
SWAP; # @storage : @parameter%setGovernorContract
# == setGovernorContract ==
# sp.verify(sp.sender == self.data.governorContractAddress, message = 4) # @storage : @parameter%setGovernorContract
DUP; # @storage : @storage : @parameter%setGovernorContract
DUG 2; # @storage : @parameter%setGovernorContract : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setGovernorContract : @storage
CDR; # address : @parameter%setGovernorContract : @storage
SENDER; # address : address : @parameter%setGovernorContract : @storage
COMPARE; # int : @parameter%setGovernorContract : @storage
EQ; # bool : @parameter%setGovernorContract : @storage
IF
{}
{
PUSH int 4; # int : @parameter%setGovernorContract : @storage
FAILWITH; # FAILED
}; # @parameter%setGovernorContract : @storage
SWAP; # @storage : @parameter%setGovernorContract
# self.data.governorContractAddress = params # @storage : @parameter%setGovernorContract
UNPAIR; # pair (address %administratorContractAddress) (address %governorContractAddress) : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : @parameter%setGovernorContract
CAR; # address : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : @parameter%setGovernorContract
DIG 2; # @parameter%setGovernorContract : address : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress))
SWAP; # address : @parameter%setGovernorContract : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress))
PAIR; # pair address @parameter%setGovernorContract : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress))
PAIR; # pair (pair address @parameter%setGovernorContract) (pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)))
}
{
IF_LEFT
{
SWAP; # @storage : @parameter%setOvenRegistryContract
# == setOvenRegistryContract ==
# sp.verify(sp.sender == self.data.governorContractAddress, message = 4) # @storage : @parameter%setOvenRegistryContract
DUP; # @storage : @storage : @parameter%setOvenRegistryContract
DUG 2; # @storage : @parameter%setOvenRegistryContract : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setOvenRegistryContract : @storage
CDR; # address : @parameter%setOvenRegistryContract : @storage
SENDER; # address : address : @parameter%setOvenRegistryContract : @storage
COMPARE; # int : @parameter%setOvenRegistryContract : @storage
EQ; # bool : @parameter%setOvenRegistryContract : @storage
IF
{}
{
PUSH int 4; # int : @parameter%setOvenRegistryContract : @storage
FAILWITH; # FAILED
}; # @parameter%setOvenRegistryContract : @storage
SWAP; # @storage : @parameter%setOvenRegistryContract
# self.data.ovenRegistryContractAddress = params # @storage : @parameter%setOvenRegistryContract
UNPAIR; # pair (address %administratorContractAddress) (address %governorContractAddress) : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : @parameter%setOvenRegistryContract
SWAP; # pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setOvenRegistryContract
CDR; # pair (address %savingsAccountContractAddress) (address %tokenContractAddress) : pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setOvenRegistryContract
DIG 2; # @parameter%setOvenRegistryContract : pair (address %savingsAccountContractAddress) (address %tokenContractAddress) : pair (address %administratorContractAddress) (address %governorContractAddress)
PAIR; # pair @parameter%setOvenRegistryContract (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : pair (address %administratorContractAddress) (address %governorContractAddress)
SWAP; # pair (address %administratorContractAddress) (address %governorContractAddress) : pair @parameter%setOvenRegistryContract (pair (address %savingsAccountContractAddress) (address %tokenContractAddress))
PAIR; # pair (pair (address %administratorContractAddress) (address %governorContractAddress)) (pair @parameter%setOvenRegistryContract (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)))
}
{
SWAP; # @storage : @parameter%setSavingsAccountContract
# == setSavingsAccountContract ==
# sp.verify(sp.sender == self.data.governorContractAddress, message = 4) # @storage : @parameter%setSavingsAccountContract
DUP; # @storage : @storage : @parameter%setSavingsAccountContract
DUG 2; # @storage : @parameter%setSavingsAccountContract : @storage
CAR; # pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setSavingsAccountContract : @storage
CDR; # address : @parameter%setSavingsAccountContract : @storage
SENDER; # address : address : @parameter%setSavingsAccountContract : @storage
COMPARE; # int : @parameter%setSavingsAccountContract : @storage
EQ; # bool : @parameter%setSavingsAccountContract : @storage
IF
{}
{
PUSH int 4; # int : @parameter%setSavingsAccountContract : @storage
FAILWITH; # FAILED
}; # @parameter%setSavingsAccountContract : @storage
SWAP; # @storage : @parameter%setSavingsAccountContract
# self.data.savingsAccountContractAddress = params # @storage : @parameter%setSavingsAccountContract
UNPAIR; # pair (address %administratorContractAddress) (address %governorContractAddress) : pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : @parameter%setSavingsAccountContract
SWAP; # pair (address %ovenRegistryContractAddress) (pair (address %savingsAccountContractAddress) (address %tokenContractAddress)) : pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setSavingsAccountContract
UNPAIR; # address : pair (address %savingsAccountContractAddress) (address %tokenContractAddress) : pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setSavingsAccountContract
SWAP; # pair (address %savingsAccountContractAddress) (address %tokenContractAddress) : address : pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setSavingsAccountContract
CDR; # address : address : pair (address %administratorContractAddress) (address %governorContractAddress) : @parameter%setSavingsAccountContract
DIG 3; # @parameter%setSavingsAccountContract : address : address : pair (address %administratorContractAddress) (address %governorContractAddress)
PAIR; # pair @parameter%setSavingsAccountContract address : address : pair (address %administratorContractAddress) (address %governorContractAddress)
SWAP; # address : pair @parameter%setSavingsAccountContract address : pair (address %administratorContractAddress) (address %governorContractAddress)
PAIR; # pair address (pair @parameter%setSavingsAccountContract address) : pair (address %administratorContractAddress) (address %governorContractAddress)
SWAP; # pair (address %administratorContractAddress) (address %governorContractAddress) : pair address (pair @parameter%setSavingsAccountContract address)
PAIR; # pair (pair (address %administratorContractAddress) (address %governorContractAddress)) (pair address (pair @parameter%setSavingsAccountContract address))
}; # pair (pair (address %administratorContractAddress) (address %governorContractAddress)) (pair address (pair address address))
}; # pair (pair address address) (pair address (pair address address))
NIL operation; # list operation : pair (pair address address) (pair address (pair address address))
}; # list operation : pair (pair address address) (pair address (pair address address))
}; # list operation : pair (pair address address) (pair address (pair address address))
NIL operation; # list operation : list operation : pair (pair address address) (pair address (pair address address))
SWAP; # list operation : list operation : pair (pair address address) (pair address (pair address address))
ITER
{
CONS; # list operation : pair (pair address address) (pair address (pair address address))
}; # list operation : pair (pair address address) (pair address (pair address address))
PAIR; # pair (list operation) (pair (pair address address) (pair address (pair address address)))
};