contract/money: Add wallet SQL schema.

This commit is contained in:
parazyd
2022-11-16 20:31:44 +01:00
parent bbcdb359d2
commit c8642cbde8

View File

@@ -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
);