Sfoglia il codice sorgente

contract/money: Add wallet SQL schema.

parazyd 3 anni fa
parent
commit
c8642cbde8
1 ha cambiato i file con 37 aggiunte e 0 eliminazioni
  1. 37 0
      src/contract/money/wallet.sql

+ 37 - 0
src/contract/money/wallet.sql

@@ -0,0 +1,37 @@
+-- Wallet definitions for this contract.
+-- We store data that is needed to be able to receive and send tokens.
+-- TODO: The tables should be prefixed with ContractId to prevent collision
+
+-- Arbitrary info that is potentially useful
+CREATE TABLE IF NOT EXISTS money_info (
+	last_scanned_slot INTEGER NOT NULL
+);
+
+-- The Merkle tree containing coins
+CREATE TABLE IF NOT EXISTS money_tree (
+	tree BLOB NOT NULL
+);
+
+-- The keypairs in our wallet
+CREATE TABLE IF NOT EXISTS money_keys (
+	key_id INTEGER PRIMARY KEY NOT NULL,
+	is_default BOOLEAN NOT NULL,
+	public BLOB NOT NULL,
+	secret BLOB NOT NULL
+);
+
+-- The coins we have the information to and can spend
+CREATE TABLE IF NOT EXISTS money_coins (
+	coin BLOB PRIMARY KEY NOT NULL,
+	is_spent BOOLEAN NOT NULL,
+	serial BLOB NOT NULL,
+	value BLOB NOT NULL,
+	token_id BLOB NOT NULL,
+	coin_blind BLOB NOT NULL,
+	value_blind BLOB NOT NULL,
+	token_blind BLOB NOT NULL,
+	secret BLOB NOT NULL,
+	nullifier BLOB NOT NULL,
+	leaf_position BLOB NOT NULL,
+	memo BLOB
+);