| 1 | // @dart=3.0 |
| 2 | // coverage:ignore-file |
| 3 | // GENERATED CODE - DO NOT MODIFY BY HAND |
| 4 | // ignore_for_file: type=lint |
| 5 | // 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 |
| 6 | // ignore_for_file: no_leading_underscores_for_library_prefixes |
| 7 | import 'dart:typed_data' as _i2; |
| 8 | |
| 9 | import 'package:web3dart/web3dart.dart' as _i1; |
| 10 | |
| 11 | final _contractAbi = _i1.ContractAbi.fromJson( |
| 12 | '[{"inputs":[{"internalType":"contract IDecentralizedEURO","name":"deuro_","type":"address"},{"internalType":"uint24","name":"initialRatePPM","type":"uint24"}],"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":"uint192","name":"amount","type":"uint192"}],"name":"InterestClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"interest","type":"uint256"},{"indexed":false,"internalType":"bool","name":"compounded","type":"bool"}],"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":[{"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"}],"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":[{"internalType":"address","name":"target","type":"address"}],"name":"claimInterest","outputs":[{"internalType":"uint192","name":"","type":"uint192"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimableInterest","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":"address","name":"","type":"address"}],"name":"nonCompounding","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"bool","name":"compound","type":"bool"}],"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":"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"}]', |
| 13 | 'Savings', |
| 14 | ); |
| 15 | |
| 16 | class Savings extends _i1.GeneratedContract { |
| 17 | Savings({ |
| 18 | required _i1.EthereumAddress address, |
| 19 | required _i1.Web3Client client, |
| 20 | int? chainId, |
| 21 | }) : super( |
| 22 | _i1.DeployedContract( |
| 23 | _contractAbi, |
| 24 | address, |
| 25 | ), |
| 26 | client, |
| 27 | chainId, |
| 28 | ); |
| 29 | |
| 30 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 31 | /// set, the function will be evaluated in the specified block. By default, the |
| 32 | /// latest on-chain block will be used. |
| 33 | Future<BigInt> accruedInterest( |
| 34 | {required _i1.EthereumAddress accountOwner, _i1.BlockNum? atBlock}) async { |
| 35 | final function = self.abi.functions[1]; |
| 36 | assert(checkSignature(function, '77267ec3')); |
| 37 | final params = [accountOwner]; |
| 38 | final response = await read( |
| 39 | function, |
| 40 | params, |
| 41 | atBlock, |
| 42 | ); |
| 43 | return (response[0] as BigInt); |
| 44 | } |
| 45 | |
| 46 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 47 | /// set, the function will be evaluated in the specified block. By default, the |
| 48 | /// latest on-chain block will be used. |
| 49 | Future<BigInt> accruedInterest$2( |
| 50 | ({_i1.EthereumAddress accountOwner, BigInt timestamp}) args, { |
| 51 | _i1.BlockNum? atBlock, |
| 52 | }) async { |
| 53 | final function = self.abi.functions[2]; |
| 54 | assert(checkSignature(function, 'a696399d')); |
| 55 | final params = [ |
| 56 | args.accountOwner, |
| 57 | args.timestamp, |
| 58 | ]; |
| 59 | final response = await read( |
| 60 | function, |
| 61 | params, |
| 62 | atBlock, |
| 63 | ); |
| 64 | return (response[0] as BigInt); |
| 65 | } |
| 66 | |
| 67 | /// The optional [transaction] parameter can be used to override parameters |
| 68 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 69 | /// set by the contract. |
| 70 | Future<String> adjust( |
| 71 | ({BigInt targetAmount}) args, { |
| 72 | required _i1.Credentials credentials, |
| 73 | _i1.Transaction? transaction, |
| 74 | }) async { |
| 75 | final function = self.abi.functions[3]; |
| 76 | assert(checkSignature(function, 'bdc65152')); |
| 77 | final params = [args.targetAmount]; |
| 78 | return write( |
| 79 | credentials, |
| 80 | transaction, |
| 81 | function, |
| 82 | params, |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | /// The optional [transaction] parameter can be used to override parameters |
| 87 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 88 | /// set by the contract. |
| 89 | Future<String> applyChange({ |
| 90 | required _i1.Credentials credentials, |
| 91 | _i1.Transaction? transaction, |
| 92 | }) async { |
| 93 | final function = self.abi.functions[4]; |
| 94 | assert(checkSignature(function, '4e65037e')); |
| 95 | final params = []; |
| 96 | return write( |
| 97 | credentials, |
| 98 | transaction, |
| 99 | function, |
| 100 | params, |
| 101 | ); |
| 102 | } |
| 103 | |
| 104 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 105 | /// set, the function will be evaluated in the specified block. By default, the |
| 106 | /// latest on-chain block will be used. |
| 107 | Future<BigInt> calculateInterest( |
| 108 | ({dynamic account, BigInt ticks}) args, { |
| 109 | _i1.BlockNum? atBlock, |
| 110 | }) async { |
| 111 | final function = self.abi.functions[5]; |
| 112 | assert(checkSignature(function, '7915ce20')); |
| 113 | final params = [ |
| 114 | args.account, |
| 115 | args.ticks, |
| 116 | ]; |
| 117 | final response = await read( |
| 118 | function, |
| 119 | params, |
| 120 | atBlock, |
| 121 | ); |
| 122 | return (response[0] as BigInt); |
| 123 | } |
| 124 | |
| 125 | /// The optional [transaction] parameter can be used to override parameters |
| 126 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 127 | /// set by the contract. |
| 128 | Future<String> claimInterest( |
| 129 | ({_i1.EthereumAddress target}) args, { |
| 130 | required _i1.Credentials credentials, |
| 131 | _i1.Transaction? transaction, |
| 132 | }) async { |
| 133 | final function = self.abi.functions[6]; |
| 134 | assert(checkSignature(function, '88d742c2')); |
| 135 | final params = [args.target]; |
| 136 | return write( |
| 137 | credentials, |
| 138 | transaction, |
| 139 | function, |
| 140 | params, |
| 141 | ); |
| 142 | } |
| 143 | |
| 144 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 145 | /// set, the function will be evaluated in the specified block. By default, the |
| 146 | /// latest on-chain block will be used. |
| 147 | Future<BigInt> claimableInterest( |
| 148 | ({_i1.EthereumAddress $param7}) args, { |
| 149 | _i1.BlockNum? atBlock, |
| 150 | }) async { |
| 151 | final function = self.abi.functions[7]; |
| 152 | assert(checkSignature(function, '4f24d20a')); |
| 153 | final params = [args.$param7]; |
| 154 | final response = await read( |
| 155 | function, |
| 156 | params, |
| 157 | atBlock, |
| 158 | ); |
| 159 | return (response[0] as BigInt); |
| 160 | } |
| 161 | |
| 162 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 163 | /// set, the function will be evaluated in the specified block. By default, the |
| 164 | /// latest on-chain block will be used. |
| 165 | Future<BigInt> currentRatePPM({_i1.BlockNum? atBlock}) async { |
| 166 | final function = self.abi.functions[8]; |
| 167 | assert(checkSignature(function, '06a7b376')); |
| 168 | final params = []; |
| 169 | final response = await read( |
| 170 | function, |
| 171 | params, |
| 172 | atBlock, |
| 173 | ); |
| 174 | return (response[0] as BigInt); |
| 175 | } |
| 176 | |
| 177 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 178 | /// set, the function will be evaluated in the specified block. By default, the |
| 179 | /// latest on-chain block will be used. |
| 180 | Future<BigInt> currentTicks({_i1.BlockNum? atBlock}) async { |
| 181 | final function = self.abi.functions[9]; |
| 182 | assert(checkSignature(function, 'b079f163')); |
| 183 | final params = []; |
| 184 | final response = await read( |
| 185 | function, |
| 186 | params, |
| 187 | atBlock, |
| 188 | ); |
| 189 | return (response[0] as BigInt); |
| 190 | } |
| 191 | |
| 192 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 193 | /// set, the function will be evaluated in the specified block. By default, the |
| 194 | /// latest on-chain block will be used. |
| 195 | Future<_i1.EthereumAddress> deuro({_i1.BlockNum? atBlock}) async { |
| 196 | final function = self.abi.functions[10]; |
| 197 | assert(checkSignature(function, '82b8eaf5')); |
| 198 | final params = []; |
| 199 | final response = await read( |
| 200 | function, |
| 201 | params, |
| 202 | atBlock, |
| 203 | ); |
| 204 | return (response[0] as _i1.EthereumAddress); |
| 205 | } |
| 206 | |
| 207 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 208 | /// set, the function will be evaluated in the specified block. By default, the |
| 209 | /// latest on-chain block will be used. |
| 210 | Future<_i1.EthereumAddress> equity({_i1.BlockNum? atBlock}) async { |
| 211 | final function = self.abi.functions[11]; |
| 212 | assert(checkSignature(function, '91a0ac6a')); |
| 213 | final params = []; |
| 214 | final response = await read( |
| 215 | function, |
| 216 | params, |
| 217 | atBlock, |
| 218 | ); |
| 219 | return (response[0] as _i1.EthereumAddress); |
| 220 | } |
| 221 | |
| 222 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 223 | /// set, the function will be evaluated in the specified block. By default, the |
| 224 | /// latest on-chain block will be used. |
| 225 | Future<BigInt> nextChange({_i1.BlockNum? atBlock}) async { |
| 226 | final function = self.abi.functions[12]; |
| 227 | assert(checkSignature(function, 'b6f83c17')); |
| 228 | final params = []; |
| 229 | final response = await read( |
| 230 | function, |
| 231 | params, |
| 232 | atBlock, |
| 233 | ); |
| 234 | return (response[0] as BigInt); |
| 235 | } |
| 236 | |
| 237 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 238 | /// set, the function will be evaluated in the specified block. By default, the |
| 239 | /// latest on-chain block will be used. |
| 240 | Future<BigInt> nextRatePPM({_i1.BlockNum? atBlock}) async { |
| 241 | final function = self.abi.functions[13]; |
| 242 | assert(checkSignature(function, '2e4b20ab')); |
| 243 | final params = []; |
| 244 | final response = await read( |
| 245 | function, |
| 246 | params, |
| 247 | atBlock, |
| 248 | ); |
| 249 | return (response[0] as BigInt); |
| 250 | } |
| 251 | |
| 252 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 253 | /// set, the function will be evaluated in the specified block. By default, the |
| 254 | /// latest on-chain block will be used. |
| 255 | Future<bool> nonCompounding( |
| 256 | ({_i1.EthereumAddress $param8}) args, { |
| 257 | _i1.BlockNum? atBlock, |
| 258 | }) async { |
| 259 | final function = self.abi.functions[14]; |
| 260 | assert(checkSignature(function, 'cdb95c3b')); |
| 261 | final params = [args.$param8]; |
| 262 | final response = await read( |
| 263 | function, |
| 264 | params, |
| 265 | atBlock, |
| 266 | ); |
| 267 | return (response[0] as bool); |
| 268 | } |
| 269 | |
| 270 | /// The optional [transaction] parameter can be used to override parameters |
| 271 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 272 | /// set by the contract. |
| 273 | Future<String> proposeChange( |
| 274 | ({BigInt newRatePPM_, List<_i1.EthereumAddress> helpers}) args, { |
| 275 | required _i1.Credentials credentials, |
| 276 | _i1.Transaction? transaction, |
| 277 | }) async { |
| 278 | final function = self.abi.functions[15]; |
| 279 | assert(checkSignature(function, '1de252e4')); |
| 280 | final params = [ |
| 281 | args.newRatePPM_, |
| 282 | args.helpers, |
| 283 | ]; |
| 284 | return write( |
| 285 | credentials, |
| 286 | transaction, |
| 287 | function, |
| 288 | params, |
| 289 | ); |
| 290 | } |
| 291 | |
| 292 | /// The optional [transaction] parameter can be used to override parameters |
| 293 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 294 | /// set by the contract. |
| 295 | Future<_i2.Uint8List> refreshBalance( |
| 296 | ({_i1.EthereumAddress owner}) args, { |
| 297 | required _i1.Credentials credentials, |
| 298 | _i1.Transaction? transaction, |
| 299 | }) async { |
| 300 | final function = self.abi.functions[16]; |
| 301 | assert(checkSignature(function, 'b77cd1c7')); |
| 302 | final params = [args.owner]; |
| 303 | return writeRaw( |
| 304 | credentials, |
| 305 | transaction, |
| 306 | function, |
| 307 | params, |
| 308 | ); |
| 309 | } |
| 310 | |
| 311 | /// The optional [transaction] parameter can be used to override parameters |
| 312 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 313 | /// set by the contract. |
| 314 | Future<_i2.Uint8List> refreshMyBalance({ |
| 315 | required _i1.Credentials credentials, |
| 316 | _i1.Transaction? transaction, |
| 317 | }) async { |
| 318 | final function = self.abi.functions[17]; |
| 319 | assert(checkSignature(function, '85bd12d1')); |
| 320 | final params = []; |
| 321 | return writeRaw( |
| 322 | credentials, |
| 323 | transaction, |
| 324 | function, |
| 325 | params, |
| 326 | ); |
| 327 | } |
| 328 | |
| 329 | /// The optional [transaction] parameter can be used to override parameters |
| 330 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 331 | /// set by the contract. |
| 332 | Future<_i2.Uint8List> save( |
| 333 | ({BigInt amount, bool compound}) args, { |
| 334 | required _i1.Credentials credentials, |
| 335 | _i1.Transaction? transaction, |
| 336 | }) async { |
| 337 | final function = self.abi.functions[18]; |
| 338 | assert(checkSignature(function, 'a776f78c')); |
| 339 | final params = [ |
| 340 | args.amount, |
| 341 | args.compound, |
| 342 | ]; |
| 343 | return writeRaw( |
| 344 | credentials, |
| 345 | transaction, |
| 346 | function, |
| 347 | params, |
| 348 | ); |
| 349 | } |
| 350 | |
| 351 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 352 | /// set, the function will be evaluated in the specified block. By default, the |
| 353 | /// latest on-chain block will be used. |
| 354 | Future<SavingsData> savings({ |
| 355 | required _i1.EthereumAddress accountOwner, |
| 356 | _i1.BlockNum? atBlock, |
| 357 | }) async { |
| 358 | final function = self.abi.functions[21]; |
| 359 | assert(checkSignature(function, '1f7cdd5f')); |
| 360 | final params = [accountOwner]; |
| 361 | final response = await read( |
| 362 | function, |
| 363 | params, |
| 364 | atBlock, |
| 365 | ); |
| 366 | return SavingsData(response); |
| 367 | } |
| 368 | |
| 369 | /// The optional [atBlock] parameter can be used to view historical data. When |
| 370 | /// set, the function will be evaluated in the specified block. By default, the |
| 371 | /// latest on-chain block will be used. |
| 372 | Future<BigInt> ticks( |
| 373 | ({BigInt timestamp}) args, { |
| 374 | _i1.BlockNum? atBlock, |
| 375 | }) async { |
| 376 | final function = self.abi.functions[22]; |
| 377 | assert(checkSignature(function, '534cb30d')); |
| 378 | final params = [args.timestamp]; |
| 379 | final response = await read( |
| 380 | function, |
| 381 | params, |
| 382 | atBlock, |
| 383 | ); |
| 384 | return (response[0] as BigInt); |
| 385 | } |
| 386 | |
| 387 | /// The optional [transaction] parameter can be used to override parameters |
| 388 | /// like the gas price, nonce and max gas. The `data` and `to` fields will be |
| 389 | /// set by the contract. |
| 390 | Future<_i2.Uint8List> withdraw( |
| 391 | ({_i1.EthereumAddress target, BigInt amount}) args, { |
| 392 | required _i1.Credentials credentials, |
| 393 | _i1.Transaction? transaction, |
| 394 | }) async { |
| 395 | final function = self.abi.functions[23]; |
| 396 | assert(checkSignature(function, '1791dc5e')); |
| 397 | final params = [ |
| 398 | args.target, |
| 399 | args.amount, |
| 400 | ]; |
| 401 | return writeRaw( |
| 402 | credentials, |
| 403 | transaction, |
| 404 | function, |
| 405 | params, |
| 406 | ); |
| 407 | } |
| 408 | |
| 409 | /// Returns a live stream of all InterestClaimed events emitted by this contract. |
| 410 | Stream<InterestClaimed> interestClaimedEvents({ |
| 411 | _i1.BlockNum? fromBlock, |
| 412 | _i1.BlockNum? toBlock, |
| 413 | }) { |
| 414 | final event = self.event('InterestClaimed'); |
| 415 | final filter = _i1.FilterOptions.events( |
| 416 | contract: self, |
| 417 | event: event, |
| 418 | fromBlock: fromBlock, |
| 419 | toBlock: toBlock, |
| 420 | ); |
| 421 | return client.events(filter).map((_i1.FilterEvent result) { |
| 422 | final decoded = event.decodeResults( |
| 423 | result.topics!, |
| 424 | result.data!, |
| 425 | ); |
| 426 | return InterestClaimed( |
| 427 | decoded, |
| 428 | result, |
| 429 | ); |
| 430 | }); |
| 431 | } |
| 432 | |
| 433 | /// Returns a live stream of all InterestCollected events emitted by this contract. |
| 434 | Stream<InterestCollected> interestCollectedEvents({ |
| 435 | _i1.BlockNum? fromBlock, |
| 436 | _i1.BlockNum? toBlock, |
| 437 | }) { |
| 438 | final event = self.event('InterestCollected'); |
| 439 | final filter = _i1.FilterOptions.events( |
| 440 | contract: self, |
| 441 | event: event, |
| 442 | fromBlock: fromBlock, |
| 443 | toBlock: toBlock, |
| 444 | ); |
| 445 | return client.events(filter).map((_i1.FilterEvent result) { |
| 446 | final decoded = event.decodeResults( |
| 447 | result.topics!, |
| 448 | result.data!, |
| 449 | ); |
| 450 | return InterestCollected( |
| 451 | decoded, |
| 452 | result, |
| 453 | ); |
| 454 | }); |
| 455 | } |
| 456 | |
| 457 | /// Returns a live stream of all RateChanged events emitted by this contract. |
| 458 | Stream<RateChanged> rateChangedEvents({ |
| 459 | _i1.BlockNum? fromBlock, |
| 460 | _i1.BlockNum? toBlock, |
| 461 | }) { |
| 462 | final event = self.event('RateChanged'); |
| 463 | final filter = _i1.FilterOptions.events( |
| 464 | contract: self, |
| 465 | event: event, |
| 466 | fromBlock: fromBlock, |
| 467 | toBlock: toBlock, |
| 468 | ); |
| 469 | return client.events(filter).map((_i1.FilterEvent result) { |
| 470 | final decoded = event.decodeResults( |
| 471 | result.topics!, |
| 472 | result.data!, |
| 473 | ); |
| 474 | return RateChanged( |
| 475 | decoded, |
| 476 | result, |
| 477 | ); |
| 478 | }); |
| 479 | } |
| 480 | |
| 481 | /// Returns a live stream of all RateProposed events emitted by this contract. |
| 482 | Stream<RateProposed> rateProposedEvents({ |
| 483 | _i1.BlockNum? fromBlock, |
| 484 | _i1.BlockNum? toBlock, |
| 485 | }) { |
| 486 | final event = self.event('RateProposed'); |
| 487 | final filter = _i1.FilterOptions.events( |
| 488 | contract: self, |
| 489 | event: event, |
| 490 | fromBlock: fromBlock, |
| 491 | toBlock: toBlock, |
| 492 | ); |
| 493 | return client.events(filter).map((_i1.FilterEvent result) { |
| 494 | final decoded = event.decodeResults( |
| 495 | result.topics!, |
| 496 | result.data!, |
| 497 | ); |
| 498 | return RateProposed( |
| 499 | decoded, |
| 500 | result, |
| 501 | ); |
| 502 | }); |
| 503 | } |
| 504 | |
| 505 | /// Returns a live stream of all Saved events emitted by this contract. |
| 506 | Stream<Saved> savedEvents({ |
| 507 | _i1.BlockNum? fromBlock, |
| 508 | _i1.BlockNum? toBlock, |
| 509 | }) { |
| 510 | final event = self.event('Saved'); |
| 511 | final filter = _i1.FilterOptions.events( |
| 512 | contract: self, |
| 513 | event: event, |
| 514 | fromBlock: fromBlock, |
| 515 | toBlock: toBlock, |
| 516 | ); |
| 517 | return client.events(filter).map((_i1.FilterEvent result) { |
| 518 | final decoded = event.decodeResults( |
| 519 | result.topics!, |
| 520 | result.data!, |
| 521 | ); |
| 522 | return Saved( |
| 523 | decoded, |
| 524 | result, |
| 525 | ); |
| 526 | }); |
| 527 | } |
| 528 | |
| 529 | /// Returns a live stream of all Withdrawn events emitted by this contract. |
| 530 | Stream<Withdrawn> withdrawnEvents({ |
| 531 | _i1.BlockNum? fromBlock, |
| 532 | _i1.BlockNum? toBlock, |
| 533 | }) { |
| 534 | final event = self.event('Withdrawn'); |
| 535 | final filter = _i1.FilterOptions.events( |
| 536 | contract: self, |
| 537 | event: event, |
| 538 | fromBlock: fromBlock, |
| 539 | toBlock: toBlock, |
| 540 | ); |
| 541 | return client.events(filter).map((_i1.FilterEvent result) { |
| 542 | final decoded = event.decodeResults( |
| 543 | result.topics!, |
| 544 | result.data!, |
| 545 | ); |
| 546 | return Withdrawn( |
| 547 | decoded, |
| 548 | result, |
| 549 | ); |
| 550 | }); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | class SavingsData { |
| 555 | SavingsData(List<dynamic> response) |
| 556 | : saved = (response[0] as BigInt), |
| 557 | ticks = (response[1] as BigInt); |
| 558 | |
| 559 | final BigInt saved; |
| 560 | |
| 561 | final BigInt ticks; |
| 562 | } |
| 563 | |
| 564 | class InterestClaimed { |
| 565 | InterestClaimed( |
| 566 | List<dynamic> response, |
| 567 | this.event, |
| 568 | ) : account = (response[0] as _i1.EthereumAddress), |
| 569 | amount = (response[1] as BigInt); |
| 570 | |
| 571 | final _i1.EthereumAddress account; |
| 572 | |
| 573 | final BigInt amount; |
| 574 | |
| 575 | final _i1.FilterEvent event; |
| 576 | } |
| 577 | |
| 578 | class InterestCollected { |
| 579 | InterestCollected( |
| 580 | List<dynamic> response, |
| 581 | this.event, |
| 582 | ) : account = (response[0] as _i1.EthereumAddress), |
| 583 | interest = (response[1] as BigInt), |
| 584 | compounded = (response[2] as bool); |
| 585 | |
| 586 | final _i1.EthereumAddress account; |
| 587 | |
| 588 | final BigInt interest; |
| 589 | |
| 590 | final bool compounded; |
| 591 | |
| 592 | final _i1.FilterEvent event; |
| 593 | } |
| 594 | |
| 595 | class RateChanged { |
| 596 | RateChanged( |
| 597 | List<dynamic> response, |
| 598 | this.event, |
| 599 | ) : newRate = (response[0] as BigInt); |
| 600 | |
| 601 | final BigInt newRate; |
| 602 | |
| 603 | final _i1.FilterEvent event; |
| 604 | } |
| 605 | |
| 606 | class RateProposed { |
| 607 | RateProposed( |
| 608 | List<dynamic> response, |
| 609 | this.event, |
| 610 | ) : who = (response[0] as _i1.EthereumAddress), |
| 611 | nextRate = (response[1] as BigInt), |
| 612 | nextChange = (response[2] as BigInt); |
| 613 | |
| 614 | final _i1.EthereumAddress who; |
| 615 | |
| 616 | final BigInt nextRate; |
| 617 | |
| 618 | final BigInt nextChange; |
| 619 | |
| 620 | final _i1.FilterEvent event; |
| 621 | } |
| 622 | |
| 623 | class Saved { |
| 624 | Saved( |
| 625 | List<dynamic> response, |
| 626 | this.event, |
| 627 | ) : account = (response[0] as _i1.EthereumAddress), |
| 628 | amount = (response[1] as BigInt); |
| 629 | |
| 630 | final _i1.EthereumAddress account; |
| 631 | |
| 632 | final BigInt amount; |
| 633 | |
| 634 | final _i1.FilterEvent event; |
| 635 | } |
| 636 | |
| 637 | class Withdrawn { |
| 638 | Withdrawn( |
| 639 | List<dynamic> response, |
| 640 | this.event, |
| 641 | ) : account = (response[0] as _i1.EthereumAddress), |
| 642 | amount = (response[1] as BigInt); |
| 643 | |
| 644 | final _i1.EthereumAddress account; |
| 645 | |
| 646 | final BigInt amount; |
| 647 | |
| 648 | final _i1.FilterEvent event; |
| 649 | } |