money.sql 1.6 KB

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