money.sql 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. -- Wallet definitions for this contract.
  2. -- We store data that is needed to be able to receive and send tokens.
  3. -- Arbitrary info that is potentially useful
  4. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_info (
  5. last_scanned_block INTEGER NOT NULL
  6. );
  7. -- The Merkle tree containing coins
  8. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_tree (
  9. tree BLOB NOT NULL
  10. );
  11. -- The keypairs in our wallet
  12. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_keys (
  13. key_id INTEGER PRIMARY KEY NOT NULL,
  14. is_default INTEGER NOT NULL,
  15. public BLOB NOT NULL,
  16. secret BLOB NOT NULL
  17. );
  18. -- The coins we have the information to and can spend
  19. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_coins (
  20. coin BLOB PRIMARY KEY NOT NULL,
  21. is_spent INTEGER NOT NULL,
  22. value BLOB NOT NULL,
  23. token_id BLOB NOT NULL,
  24. spend_hook BLOB NOT NULL,
  25. user_data BLOB NOT NULL,
  26. coin_blind BLOB NOT NULL,
  27. value_blind BLOB NOT NULL,
  28. token_blind BLOB NOT NULL,
  29. secret BLOB NOT NULL,
  30. nullifier BLOB NOT NULL,
  31. leaf_position BLOB NOT NULL,
  32. memo BLOB
  33. );
  34. -- Arbitrary tokens
  35. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_tokens (
  36. mint_authority BLOB PRIMARY KEY NOT NULL,
  37. token_id BLOB NOT NULL,
  38. is_frozen INTEGER NOT NULL
  39. );
  40. -- The token aliases in our wallet
  41. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_aliases (
  42. alias BLOB PRIMARY KEY NOT NULL,
  43. token_id BLOB NOT NULL
  44. );
  45. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_transactions_history (
  46. id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  47. transaction_hash TEXT UNIQUE NOT NULL,
  48. status TEXT NOT NULL,
  49. tx TEXT UNIQUE NOT NULL
  50. );