money.sql 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. token_id BLOB PRIMARY KEY NOT NULL,
  37. mint_authority BLOB NOT NULL,
  38. token_blind BLOB NOT NULL,
  39. is_frozen INTEGER NOT NULL
  40. );
  41. -- The token aliases in our wallet
  42. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_money_aliases (
  43. alias BLOB PRIMARY KEY NOT NULL,
  44. token_id BLOB NOT NULL
  45. );
  46. CREATE TABLE IF NOT EXISTS BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o_transactions_history (
  47. id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  48. transaction_hash TEXT UNIQUE NOT NULL,
  49. status TEXT NOT NULL,
  50. tx TEXT UNIQUE NOT NULL
  51. );