dev
dart 535 lines 21.3 KB
Raw
1 // ignore_for_file: type=lint
2 // ignore_for_file: unused_local_variable, unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
3 // ignore_for_file: no_leading_underscores_for_library_prefixes
4 import 'package:web3dart/web3dart.dart' as _i1;
5 import 'dart:typed_data' as _i2;
6
7 final _contractAbi = _i1.ContractAbi.fromJson(
8 '[{"inputs":[{"internalType":"contract IDecentralizedEURO","name":"deuro_","type":"address"},{"internalType":"uint24","name":"initialRatePPM","type":"uint24"},{"internalType":"address","name":"gateway_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ChangeNotReady","type":"error"},{"inputs":[],"name":"ModuleDisabled","type":"error"},{"inputs":[],"name":"NoPendingChange","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"interest","type":"uint256"}],"name":"InterestCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint24","name":"newRate","type":"uint24"}],"name":"RateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"who","type":"address"},{"indexed":false,"internalType":"uint24","name":"nextRate","type":"uint24"},{"indexed":false,"internalType":"uint40","name":"nextChange","type":"uint40"}],"name":"RateProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint192","name":"amount","type":"uint192"}],"name":"Saved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint192","name":"amount","type":"uint192"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"GATEWAY","outputs":[{"internalType":"contract IFrontendGateway","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"accountOwner","type":"address"}],"name":"accruedInterest","outputs":[{"internalType":"uint192","name":"","type":"uint192"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"accountOwner","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"accruedInterest","outputs":[{"internalType":"uint192","name":"","type":"uint192"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint192","name":"targetAmount","type":"uint192"},{"internalType":"bytes32","name":"frontendCode","type":"bytes32"}],"name":"adjust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint192","name":"targetAmount","type":"uint192"}],"name":"adjust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"applyChange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint192","name":"saved","type":"uint192"},{"internalType":"uint64","name":"ticks","type":"uint64"}],"internalType":"struct Savings.Account","name":"account","type":"tuple"},{"internalType":"uint64","name":"ticks","type":"uint64"}],"name":"calculateInterest","outputs":[{"internalType":"uint192","name":"","type":"uint192"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRatePPM","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentTicks","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deuro","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"equity","outputs":[{"internalType":"contract IReserve","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextChange","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextRatePPM","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint24","name":"newRatePPM_","type":"uint24"},{"internalType":"address[]","name":"helpers","type":"address[]"}],"name":"proposeChange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"refreshBalance","outputs":[{"internalType":"uint192","name":"","type":"uint192"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"refreshMyBalance","outputs":[{"internalType":"uint192","name":"","type":"uint192"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint192","name":"amount","type":"uint192"},{"internalType":"bytes32","name":"frontendCode","type":"bytes32"}],"name":"save","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint192","name":"amount","type":"uint192"}],"name":"save","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint192","name":"amount","type":"uint192"},{"internalType":"bytes32","name":"frontendCode","type":"bytes32"}],"name":"save","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint192","name":"amount","type":"uint192"}],"name":"save","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"savings","outputs":[{"internalType":"uint192","name":"saved","type":"uint192"},{"internalType":"uint64","name":"ticks","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ticks","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint192","name":"amount","type":"uint192"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint192","name":"amount","type":"uint192"},{"internalType":"bytes32","name":"frontendCode","type":"bytes32"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]',
9 'SavingsGateway',
10 );
11
12 class SavingsGateway extends _i1.GeneratedContract {
13 SavingsGateway({
14 required _i1.EthereumAddress address,
15 required _i1.Web3Client client,
16 int? chainId,
17 }) : super(
18 _i1.DeployedContract(
19 _contractAbi,
20 address,
21 ),
22 client,
23 chainId,
24 );
25
26 /// The optional [atBlock] parameter can be used to view historical data. When
27 /// set, the function will be evaluated in the specified block. By default, the
28 /// latest on-chain block will be used.
29 Future<_i1.EthereumAddress> GATEWAY({_i1.BlockNum? atBlock}) async {
30 final function = self.abi.functions[1];
31 assert(checkSignature(function, '338c5371'));
32 final params = [];
33 final response = await read(
34 function,
35 params,
36 atBlock,
37 );
38 return (response[0] as _i1.EthereumAddress);
39 }
40
41 /// The optional [atBlock] parameter can be used to view historical data. When
42 /// set, the function will be evaluated in the specified block. By default, the
43 /// latest on-chain block will be used.
44 Future<BigInt> accruedInterest({
45 required _i1.EthereumAddress accountOwner,
46 _i1.BlockNum? atBlock,
47 }) async {
48 final function = self.abi.functions[2];
49 assert(checkSignature(function, '77267ec3'));
50 final params = [accountOwner];
51 final response = await read(
52 function,
53 params,
54 atBlock,
55 );
56 return (response[0] as BigInt);
57 }
58
59 /// The optional [atBlock] parameter can be used to view historical data. When
60 /// set, the function will be evaluated in the specified block. By default, the
61 /// latest on-chain block will be used.
62 Future<BigInt> accruedInterest$2(
63 ({_i1.EthereumAddress accountOwner, BigInt timestamp}) args, {
64 _i1.BlockNum? atBlock,
65 }) async {
66 final function = self.abi.functions[3];
67 assert(checkSignature(function, 'a696399d'));
68 final params = [
69 args.accountOwner,
70 args.timestamp,
71 ];
72 final response = await read(
73 function,
74 params,
75 atBlock,
76 );
77 return (response[0] as BigInt);
78 }
79
80 /// The optional [transaction] parameter can be used to override parameters
81 /// like the gas price, nonce and max gas. The `data` and `to` fields will be
82 /// set by the contract.
83 Future<String> adjust(
84 ({BigInt targetAmount, _i2.Uint8List frontendCode}) args, {
85 required _i1.Credentials credentials,
86 _i1.Transaction? transaction,
87 }) async {
88 final function = self.abi.functions[4];
89 assert(checkSignature(function, '753ef93c'));
90 final params = [
91 args.targetAmount,
92 args.frontendCode,
93 ];
94 return write(
95 credentials,
96 transaction,
97 function,
98 params,
99 );
100 }
101
102 /// The optional [atBlock] parameter can be used to view historical data. When
103 /// set, the function will be evaluated in the specified block. By default, the
104 /// latest on-chain block will be used.
105 Future<BigInt> calculateInterest(
106 ({dynamic account, BigInt ticks}) args, {
107 _i1.BlockNum? atBlock,
108 }) async {
109 final function = self.abi.functions[7];
110 assert(checkSignature(function, '7915ce20'));
111 final params = [
112 args.account,
113 args.ticks,
114 ];
115 final response = await read(
116 function,
117 params,
118 atBlock,
119 );
120 return (response[0] as BigInt);
121 }
122
123 /// The optional [atBlock] parameter can be used to view historical data. When
124 /// set, the function will be evaluated in the specified block. By default, the
125 /// latest on-chain block will be used.
126 Future<BigInt> currentRatePPM({_i1.BlockNum? atBlock}) async {
127 final function = self.abi.functions[8];
128 assert(checkSignature(function, '06a7b376'));
129 final params = [];
130 final response = await read(
131 function,
132 params,
133 atBlock,
134 );
135 return (response[0] as BigInt);
136 }
137
138 /// The optional [atBlock] parameter can be used to view historical data. When
139 /// set, the function will be evaluated in the specified block. By default, the
140 /// latest on-chain block will be used.
141 Future<BigInt> currentTicks({_i1.BlockNum? atBlock}) async {
142 final function = self.abi.functions[9];
143 assert(checkSignature(function, 'b079f163'));
144 final params = [];
145 final response = await read(
146 function,
147 params,
148 atBlock,
149 );
150 return (response[0] as BigInt);
151 }
152
153 /// The optional [atBlock] parameter can be used to view historical data. When
154 /// set, the function will be evaluated in the specified block. By default, the
155 /// latest on-chain block will be used.
156 Future<_i1.EthereumAddress> deuro({_i1.BlockNum? atBlock}) async {
157 final function = self.abi.functions[10];
158 assert(checkSignature(function, '82b8eaf5'));
159 final params = [];
160 final response = await read(
161 function,
162 params,
163 atBlock,
164 );
165 return (response[0] as _i1.EthereumAddress);
166 }
167
168 /// The optional [atBlock] parameter can be used to view historical data. When
169 /// set, the function will be evaluated in the specified block. By default, the
170 /// latest on-chain block will be used.
171 Future<_i1.EthereumAddress> equity({_i1.BlockNum? atBlock}) async {
172 final function = self.abi.functions[11];
173 assert(checkSignature(function, '91a0ac6a'));
174 final params = [];
175 final response = await read(
176 function,
177 params,
178 atBlock,
179 );
180 return (response[0] as _i1.EthereumAddress);
181 }
182
183 /// The optional [atBlock] parameter can be used to view historical data. When
184 /// set, the function will be evaluated in the specified block. By default, the
185 /// latest on-chain block will be used.
186 Future<BigInt> nextChange({_i1.BlockNum? atBlock}) async {
187 final function = self.abi.functions[12];
188 assert(checkSignature(function, 'b6f83c17'));
189 final params = [];
190 final response = await read(
191 function,
192 params,
193 atBlock,
194 );
195 return (response[0] as BigInt);
196 }
197
198 /// The optional [atBlock] parameter can be used to view historical data. When
199 /// set, the function will be evaluated in the specified block. By default, the
200 /// latest on-chain block will be used.
201 Future<BigInt> nextRatePPM({_i1.BlockNum? atBlock}) async {
202 final function = self.abi.functions[13];
203 assert(checkSignature(function, '2e4b20ab'));
204 final params = [];
205 final response = await read(
206 function,
207 params,
208 atBlock,
209 );
210 return (response[0] as BigInt);
211 }
212
213 /// The optional [transaction] parameter can be used to override parameters
214 /// like the gas price, nonce and max gas. The `data` and `to` fields will be
215 /// set by the contract.
216 Future<_i2.Uint8List> refreshBalance(
217 ({_i1.EthereumAddress owner}) args, {
218 required _i1.Credentials credentials,
219 _i1.Transaction? transaction,
220 }) async {
221 final function = self.abi.functions[15];
222 assert(checkSignature(function, 'b77cd1c7'));
223 final params = [args.owner];
224 return writeRaw(
225 credentials,
226 transaction,
227 function,
228 params,
229 );
230 }
231
232 /// The optional [transaction] parameter can be used to override parameters
233 /// like the gas price, nonce and max gas. The `data` and `to` fields will be
234 /// set by the contract.
235 Future<_i2.Uint8List> refreshMyBalance({
236 required _i1.Credentials credentials,
237 _i1.Transaction? transaction,
238 }) async {
239 final function = self.abi.functions[16];
240 assert(checkSignature(function, '85bd12d1'));
241 final params = [];
242 return writeRaw(
243 credentials,
244 transaction,
245 function,
246 params,
247 );
248 }
249
250 /// The optional [transaction] parameter can be used to override parameters
251 /// like the gas price, nonce and max gas. The `data` and `to` fields will be
252 /// set by the contract.
253 Future<_i2.Uint8List> save(
254 ({BigInt amount, _i2.Uint8List frontendCode}) args, {
255 required _i1.Credentials credentials,
256 _i1.Transaction? transaction,
257 }) async {
258 final function = self.abi.functions[17];
259 assert(checkSignature(function, '9e2363dc'));
260 final params = [
261 args.amount,
262 args.frontendCode,
263 ];
264 return writeRaw(
265 credentials,
266 transaction,
267 function,
268 params,
269 );
270 }
271
272 /// The optional [transaction] parameter can be used to override parameters
273 /// like the gas price, nonce and max gas. The `data` and `to` fields will be
274 /// set by the contract.
275 Future<_i2.Uint8List> saveTo(
276 ({_i1.EthereumAddress owner, BigInt amount, _i2.Uint8List frontendCode}) args, {
277 required _i1.Credentials credentials,
278 _i1.Transaction? transaction,
279 }) async {
280 final function = self.abi.functions[19];
281 assert(checkSignature(function, 'cbcf9676'));
282 final params = [
283 args.owner,
284 args.amount,
285 args.frontendCode,
286 ];
287 return writeRaw(
288 credentials,
289 transaction,
290 function,
291 params,
292 );
293 }
294
295 /// The optional [atBlock] parameter can be used to view historical data. When
296 /// set, the function will be evaluated in the specified block. By default, the
297 /// latest on-chain block will be used.
298 Future<Savings> savings({
299 required _i1.EthereumAddress accountOwner,
300 _i1.BlockNum? atBlock,
301 }) async {
302 final function = self.abi.functions[21];
303 assert(checkSignature(function, '1f7cdd5f'));
304 final params = [accountOwner];
305 final response = await read(
306 function,
307 params,
308 atBlock,
309 );
310 return Savings(response);
311 }
312
313 /// The optional [transaction] parameter can be used to override parameters
314 /// like the gas price, nonce and max gas. The `data` and `to` fields will be
315 /// set by the contract.
316 Future<_i2.Uint8List> withdraw(
317 ({_i1.EthereumAddress target, BigInt amount, _i2.Uint8List frontendCode}) args, {
318 required _i1.Credentials credentials,
319 _i1.Transaction? transaction,
320 }) async {
321 final function = self.abi.functions[24];
322 assert(checkSignature(function, '829a0476'));
323 final params = [
324 args.target,
325 args.amount,
326 args.frontendCode,
327 ];
328 return writeRaw(
329 credentials,
330 transaction,
331 function,
332 params,
333 );
334 }
335
336 /// Returns a live stream of all InterestCollected events emitted by this contract.
337 Stream<InterestCollected> interestCollectedEvents({
338 _i1.BlockNum? fromBlock,
339 _i1.BlockNum? toBlock,
340 }) {
341 final event = self.event('InterestCollected');
342 final filter = _i1.FilterOptions.events(
343 contract: self,
344 event: event,
345 fromBlock: fromBlock,
346 toBlock: toBlock,
347 );
348 return client.events(filter).map((_i1.FilterEvent result) {
349 final decoded = event.decodeResults(
350 result.topics!,
351 result.data!,
352 );
353 return InterestCollected(
354 decoded,
355 result,
356 );
357 });
358 }
359
360 /// Returns a live stream of all RateChanged events emitted by this contract.
361 Stream<RateChanged> rateChangedEvents({
362 _i1.BlockNum? fromBlock,
363 _i1.BlockNum? toBlock,
364 }) {
365 final event = self.event('RateChanged');
366 final filter = _i1.FilterOptions.events(
367 contract: self,
368 event: event,
369 fromBlock: fromBlock,
370 toBlock: toBlock,
371 );
372 return client.events(filter).map((_i1.FilterEvent result) {
373 final decoded = event.decodeResults(
374 result.topics!,
375 result.data!,
376 );
377 return RateChanged(
378 decoded,
379 result,
380 );
381 });
382 }
383
384 /// Returns a live stream of all RateProposed events emitted by this contract.
385 Stream<RateProposed> rateProposedEvents({
386 _i1.BlockNum? fromBlock,
387 _i1.BlockNum? toBlock,
388 }) {
389 final event = self.event('RateProposed');
390 final filter = _i1.FilterOptions.events(
391 contract: self,
392 event: event,
393 fromBlock: fromBlock,
394 toBlock: toBlock,
395 );
396 return client.events(filter).map((_i1.FilterEvent result) {
397 final decoded = event.decodeResults(
398 result.topics!,
399 result.data!,
400 );
401 return RateProposed(
402 decoded,
403 result,
404 );
405 });
406 }
407
408 /// Returns a live stream of all Saved events emitted by this contract.
409 Stream<Saved> savedEvents({
410 _i1.BlockNum? fromBlock,
411 _i1.BlockNum? toBlock,
412 }) {
413 final event = self.event('Saved');
414 final filter = _i1.FilterOptions.events(
415 contract: self,
416 event: event,
417 fromBlock: fromBlock,
418 toBlock: toBlock,
419 );
420 return client.events(filter).map((_i1.FilterEvent result) {
421 final decoded = event.decodeResults(
422 result.topics!,
423 result.data!,
424 );
425 return Saved(
426 decoded,
427 result,
428 );
429 });
430 }
431
432 /// Returns a live stream of all Withdrawn events emitted by this contract.
433 Stream<Withdrawn> withdrawnEvents({
434 _i1.BlockNum? fromBlock,
435 _i1.BlockNum? toBlock,
436 }) {
437 final event = self.event('Withdrawn');
438 final filter = _i1.FilterOptions.events(
439 contract: self,
440 event: event,
441 fromBlock: fromBlock,
442 toBlock: toBlock,
443 );
444 return client.events(filter).map((_i1.FilterEvent result) {
445 final decoded = event.decodeResults(
446 result.topics!,
447 result.data!,
448 );
449 return Withdrawn(
450 decoded,
451 result,
452 );
453 });
454 }
455 }
456
457 class Savings {
458 Savings(List<dynamic> response)
459 : saved = (response[0] as BigInt),
460 ticks = (response[1] as BigInt);
461
462 final BigInt saved;
463
464 final BigInt ticks;
465 }
466
467 class InterestCollected {
468 InterestCollected(
469 List<dynamic> response,
470 this.event,
471 ) : account = (response[0] as _i1.EthereumAddress),
472 interest = (response[1] as BigInt);
473
474 final _i1.EthereumAddress account;
475
476 final BigInt interest;
477
478 final _i1.FilterEvent event;
479 }
480
481 class RateChanged {
482 RateChanged(
483 List<dynamic> response,
484 this.event,
485 ) : newRate = (response[0] as BigInt);
486
487 final BigInt newRate;
488
489 final _i1.FilterEvent event;
490 }
491
492 class RateProposed {
493 RateProposed(
494 List<dynamic> response,
495 this.event,
496 ) : who = (response[0] as _i1.EthereumAddress),
497 nextRate = (response[1] as BigInt),
498 nextChange = (response[2] as BigInt);
499
500 final _i1.EthereumAddress who;
501
502 final BigInt nextRate;
503
504 final BigInt nextChange;
505
506 final _i1.FilterEvent event;
507 }
508
509 class Saved {
510 Saved(
511 List<dynamic> response,
512 this.event,
513 ) : account = (response[0] as _i1.EthereumAddress),
514 amount = (response[1] as BigInt);
515
516 final _i1.EthereumAddress account;
517
518 final BigInt amount;
519
520 final _i1.FilterEvent event;
521 }
522
523 class Withdrawn {
524 Withdrawn(
525 List<dynamic> response,
526 this.event,
527 ) : account = (response[0] as _i1.EthereumAddress),
528 amount = (response[1] as BigInt);
529
530 final _i1.EthereumAddress account;
531
532 final BigInt amount;
533
534 final _i1.FilterEvent event;
535 }