glueby 0.2.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +35 -0
  3. data/Gemfile +1 -0
  4. data/README.md +224 -16
  5. data/glueby.gemspec +2 -2
  6. data/lib/generators/glueby/contract/block_syncer_generator.rb +26 -0
  7. data/lib/generators/glueby/contract/reissuable_token_generator.rb +26 -0
  8. data/lib/generators/glueby/contract/templates/initializer.rb.erb +4 -2
  9. data/lib/generators/glueby/contract/templates/key_table.rb.erb +4 -3
  10. data/lib/generators/glueby/contract/templates/reissuable_token_table.rb.erb +10 -0
  11. data/lib/generators/glueby/contract/templates/system_information_table.rb.erb +12 -0
  12. data/lib/generators/glueby/contract/templates/timestamp_table.rb.erb +1 -1
  13. data/lib/generators/glueby/contract/templates/utxo_table.rb.erb +3 -2
  14. data/lib/generators/glueby/contract/templates/wallet_table.rb.erb +2 -2
  15. data/lib/glueby.rb +28 -11
  16. data/lib/glueby/active_record.rb +8 -0
  17. data/lib/glueby/active_record/system_information.rb +15 -0
  18. data/lib/glueby/block_syncer.rb +98 -0
  19. data/lib/glueby/configuration.rb +62 -0
  20. data/lib/glueby/contract.rb +2 -2
  21. data/lib/glueby/contract/active_record.rb +1 -0
  22. data/lib/glueby/contract/active_record/reissuable_token.rb +26 -0
  23. data/lib/glueby/contract/fee_estimator.rb +38 -0
  24. data/lib/glueby/contract/payment.rb +10 -6
  25. data/lib/glueby/contract/timestamp.rb +8 -6
  26. data/lib/glueby/contract/timestamp/syncer.rb +13 -0
  27. data/lib/glueby/contract/token.rb +78 -26
  28. data/lib/glueby/contract/tx_builder.rb +23 -20
  29. data/lib/glueby/fee_provider.rb +73 -0
  30. data/lib/glueby/fee_provider/tasks.rb +141 -0
  31. data/lib/glueby/generator/migrate_generator.rb +1 -1
  32. data/lib/glueby/internal/wallet.rb +56 -13
  33. data/lib/glueby/internal/wallet/abstract_wallet_adapter.rb +25 -6
  34. data/lib/glueby/internal/wallet/active_record/utxo.rb +1 -0
  35. data/lib/glueby/internal/wallet/active_record/wallet.rb +15 -5
  36. data/lib/glueby/internal/wallet/active_record_wallet_adapter.rb +25 -8
  37. data/lib/glueby/internal/wallet/active_record_wallet_adapter/syncer.rb +14 -0
  38. data/lib/glueby/internal/wallet/errors.rb +3 -0
  39. data/lib/glueby/internal/wallet/tapyrus_core_wallet_adapter.rb +42 -14
  40. data/lib/glueby/railtie.rb +14 -0
  41. data/lib/glueby/version.rb +1 -1
  42. data/lib/glueby/wallet.rb +3 -2
  43. data/lib/tasks/glueby/block_syncer.rake +29 -0
  44. data/lib/tasks/glueby/contract/timestamp.rake +4 -26
  45. data/lib/tasks/glueby/fee_provider.rake +18 -0
  46. metadata +26 -11
  47. data/.travis.yml +0 -7
  48. data/lib/glueby/contract/fee_provider.rb +0 -21
  49. data/lib/tasks/glueby/contract/wallet_adapter.rake +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d988a55f8acc63e5c2abb8f30ab88030a19c8e42212e372a8eeea6a2c5f3b27d
4
- data.tar.gz: 9cee6ba595dd3ba576d1190350396a4c55923c58620a529ec0ff55cc4249b69b
3
+ metadata.gz: fbaba6627d1c34e6a2de2a3861016995481ad53163764a057c25fca123a8750b
4
+ data.tar.gz: 209020a3b503ac44cc9d4ef51e95d7ce71f17af59b92ffe3bb4863b4ae750604
5
5
  SHA512:
6
- metadata.gz: 610751093275239e15a70726033be9a3eb4ca65e65c1b86874f09471f4391fbc764463f76da36619b7429dac7c2b70b1f6596e2e3b2eacb397f11029018fb8e1
7
- data.tar.gz: c48b89c3b4a61f652b051642420f1d8b3aa08ad3d90f8807ec8803f63d64e675a924a56990f42fc3d4201d6a90c99fa8101f423bbe66143ae735efdfae758cbf
6
+ metadata.gz: 559e4f224359df179cafc4f20c19f3f7c9723f6411103532ad6fd7d9727b5063c369b44e4e6c7872bc49d9355ec0cedd4f720c195302546cab7a5e5b429f6676
7
+ data.tar.gz: b4a4a1641820f23513ea56e1c240db966bcb9b0d62fd463d54f08e09f454125cdca4a087bc8db8c9b0181cd867ee667ec1b2bf5fbe1b95329541b3dd5fe2538b
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [master]
13
+ pull_request:
14
+ branches: [master]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby-version: ["2.6", "2.7", "3.0"]
22
+
23
+ steps:
24
+ - run: docker pull tapyrus/tapyrusd:edge
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
+ gem "docker-api", "~> 2.1.0"
data/README.md CHANGED
@@ -1,8 +1,31 @@
1
- # Glueby [![Build Status](https://travis-ci.org/chaintope/glueby.svg?branch=master)](https://travis-ci.org/chaintope/glueby) [![Gem Version](https://badge.fury.io/rb/glueby.svg)](https://badge.fury.io/rb/glueby) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
1
+ # Glueby [![Ruby](https://github.com/chaintope/glueby/actions/workflows/ruby.yml/badge.svg)](https://github.com/chaintope/glueby/actions/workflows/ruby.yml) [![Gem Version](https://badge.fury.io/rb/glueby.svg)](https://badge.fury.io/rb/glueby) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/glueby`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Glueby is a smart contract library on the [Tapyrus blockchain](https://github.com/chaintope/tapyrus-core). This is
4
+ designed as you can use without any deep blockchain understanding.
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ ## Features
7
+
8
+ Glueby has below features.
9
+
10
+ 1. Wallet
11
+ You can manage wallets for application users. This wallet feature is a foundation of Contracts below to specify tx
12
+ sender and so on.
13
+ You can choose two sorts of wallet implementation :activerecord and :core. :activerecord is implemented using
14
+ ActiveRecord on RDB. :core uses the wallet that bundled with Tapyrus Core.
15
+
16
+ 2. Contracts
17
+ You can use some smart contracts easily
18
+ - [Timestamp](#Timestamp): Record any data as a timestamp to a tapyrus blockchain.
19
+ - [Payment](./lib/glueby/contract/payment.rb): Transfer TPC.
20
+ - [Token](./lib/glueby/contract/token.rb): Issue, transfer and burn colored coin.
21
+
22
+ 3. Sync blocks with your application
23
+ You can use BlockSyncer when you need to synchronize the state of an application with the state of a blockchain.
24
+ See more details at [BlockSyncer](./lib/glueby/block_syncer.rb).
25
+
26
+ 4. Take over tx sender's fees
27
+ FeeProvider module can bear payments of sender's fees. You should provide funds for fees to FeeProvider before use.
28
+ See how to set up at [Use fee provider mode](#use-fee-provider-mode)
6
29
 
7
30
  ## Installation
8
31
 
@@ -20,18 +43,102 @@ Or install it yourself as:
20
43
 
21
44
  $ gem install glueby
22
45
 
23
- ## Usage
46
+ ### Setup for Ruby on Rails application development
24
47
 
25
- Glueby has below features.
48
+ 1. Add this line to your application's Gemfile
49
+
50
+ ```ruby
51
+ gem 'glueby'
52
+ ```
53
+
54
+ and then execute
55
+
56
+ $ bundle install
57
+
58
+ 2. Run installation rake task
59
+
60
+ $ rails glueby:contract:install
61
+
62
+ 3. Run Tapyrus Core as dev mode
63
+
64
+ We recommend to run as a Docker container.
65
+ Docker image is here.
66
+
67
+ * [tapyus/tapyrusd](https://hub.docker.com/repository/docker/tapyrus/tapyrusd)
68
+
69
+ Starts tapryusd container
70
+
71
+ $ docker run -d --name 'tapyrus_node_dev' -p 12381:12381 -e GENESIS_BLOCK_WITH_SIG='0100000000000000000000000000000000000000000000000000000000000000000000002b5331139c6bc8646bb4e5737c51378133f70b9712b75548cb3c05f9188670e7440d295e7300c5640730c4634402a3e66fb5d921f76b48d8972a484cc0361e66ef74f45e012103af80b90d25145da28c583359beb47b21796b2fe1a23c1511e443e7a64dfdb27d40e05f064662d6b9acf65ae416379d82e11a9b78cdeb3a316d1057cd2780e3727f70a61f901d10acbe349cd11e04aa6b4351e782c44670aefbe138e99a5ce75ace01010000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100f2052a010000001976a91445d405b9ed450fec89044f9b7a99a4ef6fe2cd3f88ac00000000' tapyrus/tapyrusd:edge
72
+
73
+ 4. Modify the glueby configuration
74
+
75
+ ```ruby
76
+ # Use tapyrus dev network
77
+ Tapyrus.chain_params = :dev
78
+ Glueby.configure do |config|
79
+ config.wallet_adapter = :activerecord
80
+ # Modify rpc connection info in config/initializers/glueby.rb that is created in step 3.
81
+ config.rpc_config = { schema: 'http', host: '127.0.0.1', port: 12381, user: 'rpcuser', password: 'rpcpassword' }
82
+ end
83
+ ```
84
+
85
+ 5. Generate db migration files for wallet feature
86
+
87
+ These are essential if you use `config.wallet_adapter = :activerecord` configuration.
88
+
89
+ $ rails g glueby:contract:block_syncer
90
+ $ rails g glueby:contract:wallet_adapter
26
91
 
27
- - [Timestamp](#Timestamp)
92
+ If you want to use reissuable token or timestamp, you need to do below generators.
28
93
 
29
- ### Timestamp
94
+ $ rails g glueby:contract:reissuable_token
95
+ $ rails g glueby:contract:timestamp
96
+
97
+ Then, run the migrations.
98
+
99
+ $ rails db:migrate
100
+
101
+ ### Provide initial TPC (Tapyrus Coin) to wallets
102
+
103
+ To use contracts, wallets need to have TPC and it can be provided from coinbase tx.
104
+
105
+ 1. Create a wallet and get receive address
106
+
107
+ ```ruby
108
+ wallet = Glueby::Wallet.create
109
+ wallet.balances # => {}
110
+ address = wallet.internal_wallet.receive_address
111
+ puts address
112
+ ```
113
+
114
+ 2. Generate a block
115
+
116
+ Set an address you got in previous step to `[Your address]`
117
+
118
+ $ docker exec tapyrus_node_dev tapyrus-cli -conf=/etc/tapyrus/tapyrus.conf generatetoaddress 1 "[Your address]" "cUJN5RVzYWFoeY8rUztd47jzXCu1p57Ay8V7pqCzsBD3PEXN7Dd4"
119
+
120
+ 3. Sync blocks if you use `:activerecord` wallet adapter
121
+
122
+ You don't need to do this if you are using `:core` wallet_adapter.
123
+
124
+ $ rails glueby:contract:block_syncer:start
125
+
126
+ Here the wallet created in step 1 have 50 TPC and you can see like this:
127
+
128
+ ```ruby
129
+ wallet.balances # => {""=>5000000000}
130
+ ```
131
+
132
+ TPC amount is shown as tapyrus unit. 1 TPC = 100000000 tapyrus.
133
+
134
+ ## Timestamp
30
135
 
31
136
  ```ruby
32
137
 
33
- config = {adapter: 'core', schema: 'http', host: '127.0.0.1', port: 12381, user: 'user', password: 'pass'}
34
- Glueby::Wallet.configure(config)
138
+ Glurby.configure do |config|
139
+ config.wallet_adapter = :activerecord
140
+ config.rpc_config = { schema: 'http', host: '127.0.0.1', port: 12381, user: 'user', password: 'pass' }
141
+ end
35
142
 
36
143
  wallet = Glueby::Wallet.create
37
144
  timestamp = Glueby::Contract::Timestamp.new(wallet: wallet, content: "\x01\x02\x03")
@@ -96,7 +203,7 @@ We can see the timestamp transaction using getrawblockchain command
96
203
  }
97
204
  ```
98
205
 
99
- #### Rails support
206
+ ### Rails support
100
207
 
101
208
  Glueby supports ruby on rails integration.
102
209
 
@@ -110,10 +217,12 @@ bin/rails glueby:contract:install
110
217
 
111
218
  Install task creates a file `glueby.rb` in `config/initializers` directory like this.
112
219
 
113
- ```
220
+ ```ruby
114
221
  # Edit configuration for connection to tapyrus core
115
- config = {adapter: 'core', schema: 'http', host: '127.0.0.1', port: 12381, user: 'user', password: 'pass'}
116
- Glueby::Wallet.configure(config)
222
+ Glueby.configure do |config|
223
+ config.wallet_adapter = :activerecord
224
+ config.rpc_config = { schema: 'http', host: '127.0.0.1', port: 12381, user: 'user', password: 'pass' }
225
+ end
117
226
  ```
118
227
 
119
228
  If you use timestamp feature, use `glueby:contract:timestamp` generator.
@@ -150,11 +259,110 @@ bin/rails glueby:contract:timestamp:create
150
259
  broadcasted (id=1, txid=8d602ca8ebdd50fa70b5ee6bc6351965b614d0a4843adacf9f43fedd7112fbf4)
151
260
  ```
152
261
 
153
- Run `glueby:contract:timestamp:confirm` task to confirm the transaction and update status(unconfirmed -> confirmded).
262
+ Run `glueby:block_syncer:start` task to confirm the transaction and update status(unconfirmed -> confirmded).
263
+
264
+ ```
265
+ bin/rails glueby:block_syncer:start
266
+ ```
267
+
268
+ ## Use fee provider mode
269
+
270
+ Glueby contracts have two different way of fee provisions.
271
+
272
+ 1. `:sender_pays_itself`
273
+ 2. `:fee_provider_bears`
274
+
275
+ The first one: `:sender_pays_itself`, is the default behavior.
276
+ In the second Fee Provider mode, the Fee Provider module pays a fee instead of the transaction's sender.
277
+
278
+ ### Fee Provider Specification
279
+
280
+ * Fee Provider pays fixed amount fee, and it is configurable.
281
+ * Fee Provider needs to have enough funds into their wallet.
282
+ * Fee Provider is managed to keep some number of UTXOs that have fixed fee value by rake tasks.
283
+
284
+ ### Setting up Fee Provider
285
+
286
+ 1. Set like below
287
+
288
+ ```ruby
289
+ Glueby.configure do |config|
290
+ # Use FeeProvider to supply inputs for fees on each transaction that is created on Glueby.
291
+ config.fee_provider_bears!
292
+ config.fee_provider_config = {
293
+ # The fee that Fee Provider pays on each transaction.
294
+ fixed_fee: 1000,
295
+ # Fee Provider tries to keep the number of utxo in utxo pool as this size using `glueby:fee_provider:manage_utxo_pool` rake task
296
+ utxo_pool_size: 20
297
+ }
298
+ end
299
+ ```
300
+
301
+ 2. Deposit TPC into Fee Provider's wallet
302
+
303
+ Get an address from the wallet.
304
+
305
+ ```
306
+ $ bundle exec rake glueby:fee_provider:address
307
+ mqYTLdLCUCCZkTkcpbVx1GqpvV1gK4euRD
308
+ ```
309
+
310
+ Send TPC to the address.
311
+
312
+ If you use `Glueby::Contract::Payment` to the sending, you can do like this:
313
+
314
+ ```ruby
315
+ Glueby::Contract::Payment.transfer(sender: sender, receiver_address: 'mqYTLdLCUCCZkTkcpbVx1GqpvV1gK4euRD', amount: 1_000_000)
316
+ ```
317
+
318
+ 3. Manage UTXO pool
319
+
320
+ The Fee Provider's wallet has to keep some UTXOs with `fixed_fee` amount for paying fees using `manage_utxo_pool` rake task below.
321
+ This rake task tries to split UTOXs up to `utxo_pool_size`. If the pool has more than `utxo_pool_size` UTXOs, it does nothing.
322
+
323
+ ```
324
+ $ bundle exec rake glueby:fee_provider:manage_utxo_pool
325
+ Status: Ready
326
+ TPC amount: 999_000
327
+ UTXO pool size: 20
328
+
329
+ Configuration:
330
+ fixed_fee = 1_000
331
+ utxo_pool_size = 20
332
+ ```
333
+
334
+ This shows that the UTXO pool has 20 UTXOs with `fixed_fee` amount for paying fees and has other UTXOs that never use for paying fees.
335
+ The sum of all the UTXOs that includes both kinds of UTXO is 999_000 tapyrus.
336
+
337
+ If the wallet doesn't have enough amount, the rake task shows an error like:
338
+
339
+ ```
340
+ $ bundle exec rake glueby:fee_provider:manage_utxo_pool
341
+ Status: Insufficient Amount
342
+ TPC amount: 15_000
343
+ UTXO pool size: 15
344
+
345
+ 1. Please replenishment TPC which is for paying fee to FeeProvider.
346
+ FeeProvider needs 21000 tapyrus at least for paying 20 transaction fees.
347
+ FeeProvider wallet's address is '1DBgMCNBdjQ1Ntz1vpwx2HMYJmc9kw88iT'
348
+ 2. Then create UTXOs for paying in UTXO pool with 'rake glueby:fee_provider:manage_utxo_pool'
349
+
350
+ Configuration:
351
+ fixed_fee = 1_000
352
+ utxo_pool_size = 20
353
+ ```
354
+
355
+ If you want to get the status information, you can use the `status` task.
154
356
 
155
357
  ```
156
- bin/rails glueby:contract:timestamp:confirm
157
- confirmed (id=1, txid=8d602ca8ebdd50fa70b5ee6bc6351965b614d0a4843adacf9f43fedd7112fbf4)
358
+ $ bundle exec rake glueby:fee_provider:status
359
+ Status: Ready
360
+ TPC amount: 999_000
361
+ UTXO pool size: 20
362
+
363
+ Configuration:
364
+ fixed_fee = 1_000
365
+ utxo_pool_size = 20
158
366
  ```
159
367
 
160
368
  ## Development
data/glueby.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_runtime_dependency 'tapyrus', '>= 0.2.6'
30
- spec.add_development_dependency 'activerecord'
29
+ spec.add_runtime_dependency 'tapyrus', '>= 0.2.9'
30
+ spec.add_runtime_dependency 'activerecord'
31
31
  spec.add_development_dependency 'sqlite3'
32
32
  end
@@ -0,0 +1,26 @@
1
+ module Glueby
2
+ module Contract
3
+ class BlockSyncerGenerator < Rails::Generators::Base
4
+ include ::Rails::Generators::Migration
5
+ include Glueby::Generator::MigrateGenerator
6
+ extend Glueby::Generator::MigrateGenerator::ClassMethod
7
+
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ def create_migration_file
11
+ migration_dir = File.expand_path("db/migrate")
12
+
13
+ if self.class.migration_exists?(migration_dir, "create_system_information")
14
+ ::Kernel.warn "Migration already exists: create_system_information"
15
+ else
16
+ migration_template(
17
+ "system_information_table.rb.erb",
18
+ "db/migrate/create_system_information.rb",
19
+ migration_version: migration_version,
20
+ table_options: table_options,
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Glueby
2
+ module Contract
3
+ class ReissuableTokenGenerator < Rails::Generators::Base
4
+ include ::Rails::Generators::Migration
5
+ include Glueby::Generator::MigrateGenerator
6
+ extend Glueby::Generator::MigrateGenerator::ClassMethod
7
+
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ def create_migration_file
11
+ migration_dir = File.expand_path("db/migrate")
12
+
13
+ if self.class.migration_exists?(migration_dir, "create_reissuable_token")
14
+ ::Kernel.warn "Migration already exists: create_reissuable_token"
15
+ else
16
+ migration_template(
17
+ "reissuable_token_table.rb.erb",
18
+ "db/migrate/create_reissuable_token.rb",
19
+ migration_version: migration_version,
20
+ table_options: table_options,
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,5 @@
1
1
  # Edit configuration for connection to tapyrus core
2
- config = {adapter: 'core', schema: 'http', host: '127.0.0.1', port: 12381, user: 'user', password: 'pass'}
3
- Glueby::Wallet.configure(config)
2
+ Glueby.configure do |config|
3
+ config.wallet_adapter = :activerecord
4
+ config.rpc_config = { schema: 'http', host: '127.0.0.1', port: 12381, user: 'user', password: 'pass' }
5
+ end
@@ -1,15 +1,16 @@
1
1
  class CreateKey < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
- create_table :keys<%= table_options %> do |t|
3
+ create_table :glueby_keys<%= table_options %> do |t|
4
4
  t.string :private_key
5
5
  t.string :public_key
6
6
  t.string :script_pubkey
7
+ t.string :label, index: true
7
8
  t.integer :purpose
8
9
  t.belongs_to :wallet
9
10
  t.timestamps
10
11
  end
11
12
 
12
- add_index :keys, [:script_pubkey], unique: true
13
- add_index :keys, [:private_key], unique: true
13
+ add_index :glueby_keys, [:script_pubkey], unique: true
14
+ add_index :glueby_keys, [:private_key], unique: true
14
15
  end
15
16
  end
@@ -0,0 +1,10 @@
1
+ class CreateReissuableToken < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ create_table :glueby_reissuable_tokens<%= table_options %> do |t|
4
+ t.string :color_id, null: false
5
+ t.string :script_pubkey, null: false
6
+ t.timestamps
7
+ end
8
+ add_index :glueby_reissuable_tokens, [:color_id], unique: true
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateSystemInformation < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ create_table :glueby_system_informations<%= table_options %> do |t|
4
+ t.string :info_key
5
+ t.string :info_value
6
+ t.timestamps
7
+ end
8
+ add_index :glueby_system_informations, [:info_key], unique: true
9
+
10
+ Glueby::AR::SystemInformation.create(info_key: "synced_block_number", info_value: "0")
11
+ end
12
+ end