eth contract isar schema

This commit is contained in:
julian 2023-03-02 14:08:29 -06:00
parent b4b4c5e696
commit 4cec54620a
5 changed files with 1573 additions and 0 deletions

View file

@ -27,6 +27,7 @@ class MainDB {
UTXOSchema,
AddressSchema,
AddressLabelSchema,
EthContractSchema,
],
directory: (await StackFileSystem.applicationIsarDirectory()).path,
// inspector: kDebugMode,

View file

@ -0,0 +1,3 @@
abstract class Contract {
// for possible future use
}

View file

@ -0,0 +1,42 @@
import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/models/contract.dart';
part 'eth_contract.g.dart';
@collection
class EthContract extends Contract {
EthContract({
required this.address,
required this.name,
required this.symbol,
required this.decimals,
required this.type,
this.abi,
this.otherData,
});
Id id = Isar.autoIncrement;
@Index(unique: true, replace: true)
late final String address;
late final String name;
late final String symbol;
late final int decimals;
late final String? abi;
@enumerated
late final EthContractType type;
late final String? otherData;
}
// Used in Isar db and stored there as int indexes so adding/removing values
// in this definition should be done extremely carefully in production
enum EthContractType {
erc20,
erc721;
}

File diff suppressed because it is too large Load diff

View file

@ -4,5 +4,6 @@ export 'blockchain_data/input.dart';
export 'blockchain_data/output.dart';
export 'blockchain_data/transaction.dart';
export 'blockchain_data/utxo.dart';
export 'ethereum/eth_contract.dart';
export 'log.dart';
export 'transaction_note.dart';