glueby 0.3.0 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +35 -0
  3. data/Gemfile +1 -0
  4. data/README.md +227 -16
  5. data/glueby.gemspec +3 -2
  6. data/lib/generators/glueby/contract/reissuable_token_generator.rb +26 -0
  7. data/lib/generators/glueby/contract/templates/initializer.rb.erb +7 -2
  8. data/lib/generators/glueby/contract/templates/key_table.rb.erb +4 -3
  9. data/lib/generators/glueby/contract/templates/reissuable_token_table.rb.erb +10 -0
  10. data/lib/generators/glueby/contract/templates/system_information_table.rb.erb +2 -2
  11. data/lib/generators/glueby/contract/templates/timestamp_table.rb.erb +1 -1
  12. data/lib/generators/glueby/contract/templates/utxo_table.rb.erb +3 -2
  13. data/lib/generators/glueby/contract/templates/wallet_table.rb.erb +2 -2
  14. data/lib/glueby/block_syncer.rb +98 -0
  15. data/lib/glueby/configuration.rb +62 -0
  16. data/lib/glueby/contract/active_record/reissuable_token.rb +26 -0
  17. data/lib/glueby/contract/active_record.rb +1 -0
  18. data/lib/glueby/contract/fee_estimator.rb +38 -0
  19. data/lib/glueby/contract/payment.rb +4 -4
  20. data/lib/glueby/contract/timestamp/syncer.rb +13 -0
  21. data/lib/glueby/contract/timestamp.rb +8 -6
  22. data/lib/glueby/contract/token.rb +70 -22
  23. data/lib/glueby/contract/tx_builder.rb +22 -19
  24. data/lib/glueby/contract.rb +2 -2
  25. data/lib/glueby/fee_provider/tasks.rb +141 -0
  26. data/lib/glueby/fee_provider.rb +73 -0
  27. data/lib/glueby/generator/migrate_generator.rb +1 -1
  28. data/lib/glueby/internal/wallet/abstract_wallet_adapter.rb +25 -6
  29. data/lib/glueby/internal/wallet/active_record/utxo.rb +1 -0
  30. data/lib/glueby/internal/wallet/active_record/wallet.rb +15 -5
  31. data/lib/glueby/internal/wallet/active_record_wallet_adapter/syncer.rb +14 -0
  32. data/lib/glueby/internal/wallet/active_record_wallet_adapter.rb +25 -8
  33. data/lib/glueby/internal/wallet/errors.rb +3 -0
  34. data/lib/glueby/internal/wallet/tapyrus_core_wallet_adapter.rb +42 -14
  35. data/lib/glueby/internal/wallet.rb +56 -13
  36. data/lib/glueby/railtie.rb +10 -0
  37. data/lib/glueby/version.rb +1 -1
  38. data/lib/glueby/wallet.rb +3 -2
  39. data/lib/glueby.rb +27 -12
  40. data/lib/tasks/glueby/block_syncer.rake +29 -0
  41. data/lib/tasks/glueby/contract/timestamp.rake +4 -26
  42. data/lib/tasks/glueby/fee_provider.rake +18 -0
  43. metadata +40 -16
  44. data/.travis.yml +0 -7
  45. data/lib/glueby/contract/fee_provider.rb +0 -21
  46. data/lib/tasks/glueby/contract/block_syncer.rake +0 -36
  47. 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: d0b977d0a922975117e46c6777bf07fb13ad89d03bee8d9785ddec04e311f9c4
4
- data.tar.gz: 5b0472f6ca379fcffd7dac8adcb8fe508237ae8fcf184c1372ba721c4104f13f
3
+ metadata.gz: 49e88ac1268a6ebbe2f075d44126d438f7a86832e1ac538cc3efc3f375e2dd95
4
+ data.tar.gz: de32351857aa1b02f0568a7d3fe94fcbabf884048a00748d79c5a340ad08e20a
5
5
  SHA512:
6
- metadata.gz: 1e2e21b82fe9fcb5ac8433d8f5952718624d7900b09f2ecf789163c3037a26a6b1939dbeb03dcccbf0051e890947f1612fc933c75d8093a3e74d26756ea43642
7
- data.tar.gz: 8c6d28c5432a9e8a7d56072bf6398453da18d69ef564225987649ce6bf91e751ff40b42dba9c23d652a3a2b755539b919ad0c98ae83da6607c35b3a78b7f0fd1
6
+ metadata.gz: b531d1315fcf8fe2810457ac1b5898be2e4aa8f84bae38ab17aec270305ae35420f31ff71b046ee44cd653034991a02527459714e9858b3f32f1e8b1ee2d4400
7
+ data.tar.gz: 24eda6392c8e8e5583818004d585e1715dfe06443df038022b2634b2086bc9373e8a63f2dd92a9798de16311404055621f6950a064d80779c3413ce8ef33f2a3
@@ -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,15 @@ 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
226
+
227
+ # Uncomment next line when using timestamp feature
228
+ # Glueby::BlockSyncer.register_syncer(Glueby::Contract::Timestamp::Syncer)
117
229
  ```
118
230
 
119
231
  If you use timestamp feature, use `glueby:contract:timestamp` generator.
@@ -150,11 +262,110 @@ bin/rails glueby:contract:timestamp:create
150
262
  broadcasted (id=1, txid=8d602ca8ebdd50fa70b5ee6bc6351965b614d0a4843adacf9f43fedd7112fbf4)
151
263
  ```
152
264
 
153
- Run `glueby:contract:timestamp:confirm` task to confirm the transaction and update status(unconfirmed -> confirmded).
265
+ Run `glueby:block_syncer:start` task to confirm the transaction and update status(unconfirmed -> confirmded).
266
+
267
+ ```
268
+ bin/rails glueby:block_syncer:start
269
+ ```
270
+
271
+ ## Use fee provider mode
272
+
273
+ Glueby contracts have two different way of fee provisions.
274
+
275
+ 1. `:sender_pays_itself`
276
+ 2. `:fee_provider_bears`
277
+
278
+ The first one: `:sender_pays_itself`, is the default behavior.
279
+ In the second Fee Provider mode, the Fee Provider module pays a fee instead of the transaction's sender.
280
+
281
+ ### Fee Provider Specification
282
+
283
+ * Fee Provider pays fixed amount fee, and it is configurable.
284
+ * Fee Provider needs to have enough funds into their wallet.
285
+ * Fee Provider is managed to keep some number of UTXOs that have fixed fee value by rake tasks.
286
+
287
+ ### Setting up Fee Provider
288
+
289
+ 1. Set like below
290
+
291
+ ```ruby
292
+ Glueby.configure do |config|
293
+ # Use FeeProvider to supply inputs for fees on each transaction that is created on Glueby.
294
+ config.fee_provider_bears!
295
+ config.fee_provider_config = {
296
+ # The fee that Fee Provider pays on each transaction.
297
+ fixed_fee: 1000,
298
+ # Fee Provider tries to keep the number of utxo in utxo pool as this size using `glueby:fee_provider:manage_utxo_pool` rake task
299
+ utxo_pool_size: 20
300
+ }
301
+ end
302
+ ```
303
+
304
+ 2. Deposit TPC into Fee Provider's wallet
305
+
306
+ Get an address from the wallet.
307
+
308
+ ```
309
+ $ bundle exec rake glueby:fee_provider:address
310
+ mqYTLdLCUCCZkTkcpbVx1GqpvV1gK4euRD
311
+ ```
312
+
313
+ Send TPC to the address.
314
+
315
+ If you use `Glueby::Contract::Payment` to the sending, you can do like this:
316
+
317
+ ```ruby
318
+ Glueby::Contract::Payment.transfer(sender: sender, receiver_address: 'mqYTLdLCUCCZkTkcpbVx1GqpvV1gK4euRD', amount: 1_000_000)
319
+ ```
320
+
321
+ 3. Manage UTXO pool
322
+
323
+ The Fee Provider's wallet has to keep some UTXOs with `fixed_fee` amount for paying fees using `manage_utxo_pool` rake task below.
324
+ 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.
325
+
326
+ ```
327
+ $ bundle exec rake glueby:fee_provider:manage_utxo_pool
328
+ Status: Ready
329
+ TPC amount: 999_000
330
+ UTXO pool size: 20
331
+
332
+ Configuration:
333
+ fixed_fee = 1_000
334
+ utxo_pool_size = 20
335
+ ```
336
+
337
+ 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.
338
+ The sum of all the UTXOs that includes both kinds of UTXO is 999_000 tapyrus.
339
+
340
+ If the wallet doesn't have enough amount, the rake task shows an error like:
341
+
342
+ ```
343
+ $ bundle exec rake glueby:fee_provider:manage_utxo_pool
344
+ Status: Insufficient Amount
345
+ TPC amount: 15_000
346
+ UTXO pool size: 15
347
+
348
+ 1. Please replenishment TPC which is for paying fee to FeeProvider.
349
+ FeeProvider needs 21000 tapyrus at least for paying 20 transaction fees.
350
+ FeeProvider wallet's address is '1DBgMCNBdjQ1Ntz1vpwx2HMYJmc9kw88iT'
351
+ 2. Then create UTXOs for paying in UTXO pool with 'rake glueby:fee_provider:manage_utxo_pool'
352
+
353
+ Configuration:
354
+ fixed_fee = 1_000
355
+ utxo_pool_size = 20
356
+ ```
357
+
358
+ If you want to get the status information, you can use the `status` task.
154
359
 
155
360
  ```
156
- bin/rails glueby:contract:timestamp:confirm
157
- confirmed (id=1, txid=8d602ca8ebdd50fa70b5ee6bc6351965b614d0a4843adacf9f43fedd7112fbf4)
361
+ $ bundle exec rake glueby:fee_provider:status
362
+ Status: Ready
363
+ TPC amount: 999_000
364
+ UTXO pool size: 20
365
+
366
+ Configuration:
367
+ fixed_fee = 1_000
368
+ utxo_pool_size = 20
158
369
  ```
159
370
 
160
371
  ## Development
data/glueby.gemspec CHANGED
@@ -26,7 +26,8 @@ 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', '~> 6.1.3'
31
31
  spec.add_development_dependency 'sqlite3'
32
+ spec.add_development_dependency 'rails', '~> 6.1.3'
32
33
  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,8 @@
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
6
+
7
+ # Uncomment next line when using timestamp feature
8
+ # Glueby::BlockSyncer.register_syncer(Glueby::Contract::Timestamp::Syncer)
@@ -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
@@ -1,11 +1,11 @@
1
1
  class CreateSystemInformation < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
- create_table :system_informations<%= table_options %> do |t|
3
+ create_table :glueby_system_informations<%= table_options %> do |t|
4
4
  t.string :info_key
5
5
  t.string :info_value
6
6
  t.timestamps
7
7
  end
8
- add_index :system_informations, [:info_key], unique: true
8
+ add_index :glueby_system_informations, [:info_key], unique: true
9
9
 
10
10
  Glueby::AR::SystemInformation.create(info_key: "synced_block_number", info_value: "0")
11
11
  end
@@ -1,6 +1,6 @@
1
1
  class CreateTimestamp < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
- create_table :timestamps<%= table_options %> do |t|
3
+ create_table :glueby_timestamps<%= table_options %> do |t|
4
4
  t.string :txid
5
5
  t.integer :status
6
6
  t.string :content_hash