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 Sparse Merkle tree containing coins nullifiers
  12. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_smt (
  13. smt_key BLOB PRIMARY KEY NOT NULL,
  14. smt_value BLOB NOT NULL
  15. );
  16. -- The keypairs in our wallet
  17. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_keys (
  18. key_id INTEGER PRIMARY KEY NOT NULL,
  19. is_default INTEGER NOT NULL,
  20. public BLOB NOT NULL,
  21. secret BLOB NOT NULL
  22. );
  23. -- The coins we have the information to and can spend
  24. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_coins (
  25. coin BLOB PRIMARY KEY NOT NULL,
  26. is_spent INTEGER NOT NULL,
  27. value BLOB NOT NULL,
  28. token_id BLOB NOT NULL,
  29. spend_hook BLOB NOT NULL,
  30. user_data BLOB NOT NULL,
  31. coin_blind BLOB NOT NULL,
  32. value_blind BLOB NOT NULL,
  33. token_blind BLOB NOT NULL,
  34. secret BLOB NOT NULL,
  35. leaf_position BLOB NOT NULL,
  36. memo BLOB,
  37. spent_tx_hash TEXT DEFAULT '-'
  38. );
  39. -- Arbitrary tokens
  40. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_tokens (
  41. token_id BLOB PRIMARY KEY NOT NULL,
  42. mint_authority BLOB NOT NULL,
  43. token_blind BLOB NOT NULL,
  44. is_frozen INTEGER NOT NULL
  45. );
  46. -- The token aliases in our wallet
  47. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_aliases (
  48. alias BLOB PRIMARY KEY NOT NULL,
  49. token_id BLOB NOT NULL
  50. );