Class: CreateSolrengineSdpTokenMints

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/solrengine/sdp/templates/create_solrengine_sdp_token_mints.rb

Overview

Engine-owned record of every mint attempted through SDP — the audit trail and the never-double-mint guard. See Solrengine::Sdp::TokenMint.

Instance Method Summary collapse

Instance Method Details

#changeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/solrengine/sdp/templates/create_solrengine_sdp_token_mints.rb', line 4

def change
  create_table :solrengine_sdp_token_mints do |t|
    t.references :token, null: false, foreign_key: { to_table: :solrengine_sdp_tokens }
    t.string :destination, null: false
    t.string :amount, null: false          # decimal token amount — never a float
    t.string :memo                         # app memo (composes with memo_token)
    t.string :memo_token, null: false      # engine reconcile token
    t.string :status, null: false, default: "minting" # minting -> minted | failed | unknown
    t.string :signature
    t.string :sdp_transaction_id
    t.string :token_account
    t.string :sdp_error
    t.datetime :submitted_at
    t.datetime :settled_at

    t.timestamps
  end

  add_index :solrengine_sdp_token_mints, :memo_token, unique: true
  add_index :solrengine_sdp_token_mints, :status
end