glueby 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/glueby/constants.rb +4 -0
- data/lib/glueby/contract/active_record/timestamp.rb +30 -0
- data/lib/glueby/contract/fee_estimator.rb +2 -0
- data/lib/glueby/contract/timestamp.rb +2 -3
- data/lib/glueby/contract/token.rb +41 -11
- data/lib/glueby/contract/tx_builder.rb +39 -14
- data/lib/glueby/utxo_provider/tasks.rb +6 -3
- data/lib/glueby/utxo_provider.rb +15 -1
- data/lib/glueby/version.rb +1 -1
- data/lib/glueby.rb +11 -0
- data/lib/tasks/glueby/contract/timestamp.rake +2 -21
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 165b5d6b9fc1cfae9bb7ba852632a0f099ef356bcb52fe0a9937b2c2d1289b51
|
4
|
+
data.tar.gz: 6d1a3b9cc1c3668a40ce11920af51cb8af8fc9d94163e43eca295a40d48889f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7d6f4cf39f9b2c4580d1360817baa960bf72fe77075a038a7784b2f9191bb0cb9925c27d8b697c5d0a75e0d0bc31d35cfda14e3a88e18da88dba09e38aa5246
|
7
|
+
data.tar.gz: 691dd9cec6eb183f537c70efab553bd9224bea93fe21da6cb8ce2afea14549e74bd02fa8e73dd3518703b6b390f217d0b02ad3d85649b8eea4e6b6583c1fd196
|
@@ -2,7 +2,10 @@ module Glueby
|
|
2
2
|
module Contract
|
3
3
|
module AR
|
4
4
|
class Timestamp < ::ActiveRecord::Base
|
5
|
+
include Glueby::GluebyLogger
|
5
6
|
include Glueby::Contract::Timestamp::Util
|
7
|
+
include Glueby::Contract::TxBuilder
|
8
|
+
|
6
9
|
enum status: { init: 0, unconfirmed: 1, confirmed: 2 }
|
7
10
|
enum timestamp_type: { simple: 0, trackable: 1 }
|
8
11
|
|
@@ -21,6 +24,33 @@ module Glueby
|
|
21
24
|
def latest
|
22
25
|
trackable?
|
23
26
|
end
|
27
|
+
|
28
|
+
# Broadcast and save timestamp
|
29
|
+
# @param [Glueby::Contract::FixedFeeEstimator] fee_estimator
|
30
|
+
# @return true if tapyrus transactions were broadcasted and the timestamp was updated successfully, otherwise false.
|
31
|
+
def save_with_broadcast(fee_estimator: Glueby::Contract::FixedFeeEstimator.new)
|
32
|
+
utxo_provider = Glueby::UtxoProvider.new if Glueby.configuration.use_utxo_provider?
|
33
|
+
wallet = Glueby::Wallet.load(wallet_id)
|
34
|
+
funding_tx, tx, p2c_address, payment_base = create_txs(wallet, prefix, content_hash, fee_estimator, utxo_provider, type: timestamp_type.to_sym)
|
35
|
+
if funding_tx
|
36
|
+
::ActiveRecord::Base.transaction(joinable: false, requires_new: true) do
|
37
|
+
wallet.internal_wallet.broadcast(funding_tx)
|
38
|
+
logger.info("funding tx was broadcasted(id=#{id}, funding_tx.txid=#{funding_tx.txid})")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
::ActiveRecord::Base.transaction(joinable: false, requires_new: true) do
|
42
|
+
wallet.internal_wallet.broadcast(tx) do |tx|
|
43
|
+
assign_attributes(txid: tx.txid, status: :unconfirmed, p2c_address: p2c_address, payment_base: payment_base)
|
44
|
+
save!
|
45
|
+
end
|
46
|
+
logger.info("timestamp tx was broadcasted (id=#{id}, txid=#{tx.txid})")
|
47
|
+
end
|
48
|
+
true
|
49
|
+
rescue => e
|
50
|
+
logger.error("failed to broadcast (id=#{id}, reason=#{e.message})")
|
51
|
+
errors.add(:base, "failed to broadcast (id=#{id}, reason=#{e.message})")
|
52
|
+
false
|
53
|
+
end
|
24
54
|
end
|
25
55
|
end
|
26
56
|
end
|
@@ -19,9 +19,8 @@ module Glueby
|
|
19
19
|
module_function
|
20
20
|
|
21
21
|
# @param [Glueby::Wallet] wallet
|
22
|
-
# @param [Array]
|
23
|
-
# @return [
|
24
|
-
# Return (pay-to-contract address, public key used for generating address)
|
22
|
+
# @param [Array] contents The data to be used for generating pay-to-contract address
|
23
|
+
# @return [pay-to-contract address, public key used for generating address]
|
25
24
|
def create_pay_to_contract_address(wallet, contents: nil)
|
26
25
|
pubkey = wallet.internal_wallet.create_pubkey.pubkey
|
27
26
|
# Calculate P + H(P || contents)G
|
@@ -80,8 +80,7 @@ module Glueby
|
|
80
80
|
private
|
81
81
|
|
82
82
|
def issue_reissuable_token(issuer:, amount:)
|
83
|
-
|
84
|
-
funding_tx = create_funding_tx(wallet: issuer, utxo_provider: utxo_provider)
|
83
|
+
funding_tx = create_funding_tx(wallet: issuer)
|
85
84
|
script_pubkey = funding_tx.outputs.first.script_pubkey
|
86
85
|
color_id = Tapyrus::Color::ColorIdentifier.reissuable(script_pubkey)
|
87
86
|
|
@@ -97,8 +96,7 @@ module Glueby
|
|
97
96
|
end
|
98
97
|
|
99
98
|
def issue_non_reissuable_token(issuer:, amount:)
|
100
|
-
|
101
|
-
funding_tx = create_funding_tx(wallet: issuer, utxo_provider: utxo_provider) if utxo_provider
|
99
|
+
funding_tx = create_funding_tx(wallet: issuer) if Glueby.configuration.use_utxo_provider?
|
102
100
|
funding_tx = issuer.internal_wallet.broadcast(funding_tx) if funding_tx
|
103
101
|
|
104
102
|
tx = create_issue_tx_for_non_reissuable_token(funding_tx: funding_tx, issuer: issuer, amount: amount)
|
@@ -114,8 +112,7 @@ module Glueby
|
|
114
112
|
end
|
115
113
|
|
116
114
|
def issue_nft_token(issuer:)
|
117
|
-
|
118
|
-
funding_tx = create_funding_tx(wallet: issuer, utxo_provider: utxo_provider) if utxo_provider
|
115
|
+
funding_tx = create_funding_tx(wallet: issuer) if Glueby.configuration.use_utxo_provider?
|
119
116
|
funding_tx = issuer.internal_wallet.broadcast(funding_tx) if funding_tx
|
120
117
|
|
121
118
|
tx = create_issue_tx_for_nft_token(funding_tx: funding_tx, issuer: issuer)
|
@@ -145,10 +142,9 @@ module Glueby
|
|
145
142
|
def reissue!(issuer:, amount:)
|
146
143
|
raise Glueby::Contract::Errors::InvalidAmount unless amount.positive?
|
147
144
|
raise Glueby::Contract::Errors::InvalidTokenType unless token_type == Tapyrus::Color::TokenTypes::REISSUABLE
|
148
|
-
utxo_provider = Glueby::UtxoProvider.new if Glueby.configuration.use_utxo_provider?
|
149
145
|
|
150
146
|
if validate_reissuer(wallet: issuer)
|
151
|
-
funding_tx = create_funding_tx(wallet: issuer, script: @script_pubkey
|
147
|
+
funding_tx = create_funding_tx(wallet: issuer, script: @script_pubkey)
|
152
148
|
funding_tx = issuer.internal_wallet.broadcast(funding_tx)
|
153
149
|
tx = create_reissue_tx(funding_tx: funding_tx, issuer: issuer, amount: amount, color_id: color_id)
|
154
150
|
tx = issuer.internal_wallet.broadcast(tx)
|
@@ -171,8 +167,7 @@ module Glueby
|
|
171
167
|
def transfer!(sender:, receiver_address:, amount: 1)
|
172
168
|
raise Glueby::Contract::Errors::InvalidAmount unless amount.positive?
|
173
169
|
|
174
|
-
|
175
|
-
funding_tx = create_funding_tx(wallet: sender, utxo_provider: utxo_provider) if utxo_provider
|
170
|
+
funding_tx = create_funding_tx(wallet: sender) if Glueby.configuration.use_utxo_provider?
|
176
171
|
funding_tx = sender.internal_wallet.broadcast(funding_tx) if funding_tx
|
177
172
|
|
178
173
|
tx = create_transfer_tx(funding_tx: funding_tx, color_id: color_id, sender: sender, receiver_address: receiver_address, amount: amount)
|
@@ -180,6 +175,26 @@ module Glueby
|
|
180
175
|
[color_id, tx]
|
181
176
|
end
|
182
177
|
|
178
|
+
# Send the tokens to multiple wallets
|
179
|
+
#
|
180
|
+
# @param sender [Glueby::Wallet] wallet to send this token
|
181
|
+
# @param receivers [Array<Hash>] array of hash, which keys are :address and :amount
|
182
|
+
# @return [Array<String, tx>] Tuple of color_id and tx object
|
183
|
+
# @raise [InsufficientFunds] if wallet does not have enough TPC to send transaction.
|
184
|
+
# @raise [InsufficientTokens] if wallet does not have enough token to send.
|
185
|
+
# @raise [InvalidAmount] if amount is not positive integer.
|
186
|
+
def multi_transfer!(sender:, receivers:)
|
187
|
+
receivers.each do |r|
|
188
|
+
raise Glueby::Contract::Errors::InvalidAmount unless r[:amount].positive?
|
189
|
+
end
|
190
|
+
funding_tx = create_funding_tx(wallet: sender) if Glueby.configuration.use_utxo_provider?
|
191
|
+
funding_tx = sender.internal_wallet.broadcast(funding_tx) if funding_tx
|
192
|
+
|
193
|
+
tx = create_multi_transfer_tx(funding_tx: funding_tx, color_id: color_id, sender: sender, receivers: receivers)
|
194
|
+
sender.internal_wallet.broadcast(tx)
|
195
|
+
[color_id, tx]
|
196
|
+
end
|
197
|
+
|
183
198
|
# Burn token
|
184
199
|
# If amount is not specified or 0, burn all token associated with the wallet.
|
185
200
|
#
|
@@ -190,9 +205,24 @@ module Glueby
|
|
190
205
|
# @raise [InvalidAmount] if amount is not positive integer.
|
191
206
|
def burn!(sender:, amount: 0)
|
192
207
|
raise Glueby::Contract::Errors::InvalidAmount unless amount.positive?
|
208
|
+
balance = sender.balances[color_id.to_hex]
|
209
|
+
raise Glueby::Contract::Errors::InsufficientTokens unless balance
|
210
|
+
raise Glueby::Contract::Errors::InsufficientTokens if balance < amount
|
211
|
+
|
212
|
+
burn_all_amount_flag = true if balance - amount == 0
|
193
213
|
|
194
214
|
utxo_provider = Glueby::UtxoProvider.new if Glueby.configuration.use_utxo_provider?
|
195
|
-
|
215
|
+
if utxo_provider
|
216
|
+
funding_tx = create_funding_tx(
|
217
|
+
wallet: sender,
|
218
|
+
# When it burns all the amount of the color id, burn tx is not going to be have any output
|
219
|
+
# because change outputs is not necessary. Transactions needs one output at least.
|
220
|
+
# At that time, set true to this option to get more value to be created change output to
|
221
|
+
# the tx.
|
222
|
+
need_value_for_change_output: burn_all_amount_flag
|
223
|
+
)
|
224
|
+
end
|
225
|
+
|
196
226
|
funding_tx = sender.internal_wallet.broadcast(funding_tx) if funding_tx
|
197
227
|
|
198
228
|
tx = create_burn_tx(funding_tx: funding_tx, color_id: color_id, sender: sender, amount: amount)
|
@@ -3,24 +3,22 @@
|
|
3
3
|
module Glueby
|
4
4
|
module Contract
|
5
5
|
module TxBuilder
|
6
|
-
# The amount of output in funding tx for Reissuable token.
|
7
|
-
FUNDING_TX_AMOUNT = 10_000
|
8
|
-
|
9
6
|
def receive_address(wallet:)
|
10
7
|
wallet.receive_address
|
11
8
|
end
|
12
9
|
|
13
10
|
# Create new public key, and new transaction that sends TPC to it
|
14
|
-
def create_funding_tx(wallet:, script: nil, fee_estimator: FixedFeeEstimator.new,
|
15
|
-
if
|
11
|
+
def create_funding_tx(wallet:, script: nil, fee_estimator: FixedFeeEstimator.new, need_value_for_change_output: false)
|
12
|
+
if Glueby.configuration.use_utxo_provider?
|
13
|
+
utxo_provider = UtxoProvider.new
|
16
14
|
script_pubkey = script ? script : Tapyrus::Script.parse_from_addr(wallet.internal_wallet.receive_address)
|
17
|
-
funding_tx, _index = utxo_provider.get_utxo(script_pubkey,
|
15
|
+
funding_tx, _index = utxo_provider.get_utxo(script_pubkey, funding_tx_amount(need_value_for_change_output: need_value_for_change_output))
|
18
16
|
utxo_provider.wallet.sign_tx(funding_tx)
|
19
17
|
else
|
20
18
|
txb = Tapyrus::TxBuilder.new
|
21
19
|
fee = fee_estimator.fee(dummy_tx(txb.build))
|
22
20
|
|
23
|
-
sum, outputs = wallet.internal_wallet.collect_uncolored_outputs(fee +
|
21
|
+
sum, outputs = wallet.internal_wallet.collect_uncolored_outputs(fee + funding_tx_amount(need_value_for_change_output: need_value_for_change_output))
|
24
22
|
outputs.each do |utxo|
|
25
23
|
txb.add_utxo({
|
26
24
|
script_pubkey: Tapyrus::Script.parse_from_payload(utxo[:script_pubkey].htb),
|
@@ -31,7 +29,7 @@ module Glueby
|
|
31
29
|
end
|
32
30
|
|
33
31
|
receiver_address = script ? script.addresses.first : wallet.internal_wallet.receive_address
|
34
|
-
tx = txb.pay(receiver_address,
|
32
|
+
tx = txb.pay(receiver_address, funding_tx_amount)
|
35
33
|
.change_address(wallet.internal_wallet.change_address)
|
36
34
|
.fee(fee)
|
37
35
|
.build
|
@@ -135,15 +133,23 @@ module Glueby
|
|
135
133
|
end
|
136
134
|
|
137
135
|
def create_transfer_tx(funding_tx:nil, color_id:, sender:, receiver_address:, amount:, fee_estimator: FixedFeeEstimator.new)
|
136
|
+
receivers = [{ address: receiver_address, amount: amount }]
|
137
|
+
create_multi_transfer_tx(funding_tx: funding_tx, color_id: color_id, sender: sender, receivers: receivers, fee_estimator: fee_estimator)
|
138
|
+
end
|
139
|
+
|
140
|
+
def create_multi_transfer_tx(funding_tx:nil, color_id:, sender:, receivers:, fee_estimator: FixedFeeEstimator.new)
|
138
141
|
tx = Tapyrus::Tx.new
|
139
142
|
|
143
|
+
amount = receivers.reduce(0) { |sum, r| sum + r[:amount].to_i }
|
140
144
|
utxos = sender.internal_wallet.list_unspent
|
141
145
|
sum_token, outputs = collect_colored_outputs(utxos, color_id, amount)
|
142
146
|
fill_input(tx, outputs)
|
143
147
|
|
144
|
-
|
145
|
-
|
146
|
-
|
148
|
+
receivers.each do |r|
|
149
|
+
receiver_script = Tapyrus::Script.parse_from_addr(r[:address])
|
150
|
+
receiver_colored_script = receiver_script.add_color(color_id)
|
151
|
+
tx.outputs << Tapyrus::TxOut.new(value: r[:amount].to_i, script_pubkey: receiver_colored_script)
|
152
|
+
end
|
147
153
|
|
148
154
|
fill_change_token(tx, sender, sum_token - amount, color_id)
|
149
155
|
|
@@ -189,8 +195,7 @@ module Glueby
|
|
189
195
|
tx.inputs << Tapyrus::TxIn.new(out_point: out_point)
|
190
196
|
funding_tx.outputs.first.value
|
191
197
|
else
|
192
|
-
|
193
|
-
sum_tpc, outputs = sender.internal_wallet.collect_uncolored_outputs(fee + dust)
|
198
|
+
sum_tpc, outputs = sender.internal_wallet.collect_uncolored_outputs(fee + DUST_LIMIT)
|
194
199
|
fill_input(tx, outputs)
|
195
200
|
sum_tpc
|
196
201
|
end
|
@@ -220,7 +225,12 @@ module Glueby
|
|
220
225
|
def fill_change_tpc(tx, wallet, change)
|
221
226
|
return unless change.positive?
|
222
227
|
|
223
|
-
|
228
|
+
if Glueby.configuration.use_utxo_provider?
|
229
|
+
change_script = Tapyrus::Script.parse_from_addr(UtxoProvider.new.wallet.change_address)
|
230
|
+
else
|
231
|
+
change_script = Tapyrus::Script.parse_from_addr(wallet.internal_wallet.change_address)
|
232
|
+
end
|
233
|
+
|
224
234
|
tx.outputs << Tapyrus::TxOut.new(value: change, script_pubkey: change_script)
|
225
235
|
end
|
226
236
|
|
@@ -278,6 +288,21 @@ module Glueby
|
|
278
288
|
tx.outputs << Tapyrus::TxOut.new(value: 0, script_pubkey: receiver_colored_script)
|
279
289
|
dummy_tx(tx)
|
280
290
|
end
|
291
|
+
|
292
|
+
private
|
293
|
+
|
294
|
+
# The amount of output in funding tx
|
295
|
+
# It returns same amount with FixedFeeEstimator's fixed fee. Because it is enough for paying fee for consumer
|
296
|
+
# transactions of the funding transactions.
|
297
|
+
#
|
298
|
+
# @option [Boolean] need_value_for_change_output If it is true, adds more value than the fee for producing change output.
|
299
|
+
def funding_tx_amount(need_value_for_change_output: false)
|
300
|
+
if need_value_for_change_output
|
301
|
+
FixedFeeEstimator.new.fixed_fee + DUST_LIMIT
|
302
|
+
else
|
303
|
+
FixedFeeEstimator.new.fixed_fee
|
304
|
+
end
|
305
|
+
end
|
281
306
|
end
|
282
307
|
end
|
283
308
|
end
|
@@ -29,7 +29,6 @@ module Glueby
|
|
29
29
|
return if utxos.empty?
|
30
30
|
|
31
31
|
utxos.each { |utxo| txb.add_utxo(utxo) }
|
32
|
-
address = wallet.receive_address
|
33
32
|
|
34
33
|
shortage = [utxo_provider.utxo_pool_size - current_utxo_pool_size, 0].max
|
35
34
|
return if shortage == 0
|
@@ -65,7 +64,7 @@ module Glueby
|
|
65
64
|
message = <<~MESSAGE
|
66
65
|
1. Please replenishment TPC which is for paying tpc to UtxoProvider.
|
67
66
|
UtxoProvider needs #{value_to_fill_utxo_pool} tapyrus in UTXO pool.
|
68
|
-
UtxoProvider wallet's address is '#{
|
67
|
+
UtxoProvider wallet's address is '#{address}'
|
69
68
|
2. Then create UTXOs for paying in UTXO pool with 'rake glueby:utxo_provider:manage_utxo_pool'
|
70
69
|
MESSAGE
|
71
70
|
else
|
@@ -88,7 +87,7 @@ module Glueby
|
|
88
87
|
|
89
88
|
# Show the address of Utxo Provider
|
90
89
|
def print_address
|
91
|
-
puts
|
90
|
+
puts address
|
92
91
|
end
|
93
92
|
|
94
93
|
private
|
@@ -130,6 +129,10 @@ module Glueby
|
|
130
129
|
def delimit(num)
|
131
130
|
num.to_s.reverse.scan(/.{1,3}/).join('_').reverse
|
132
131
|
end
|
132
|
+
|
133
|
+
def address
|
134
|
+
@address ||= wallet.get_addresses.first || wallet.receive_address
|
135
|
+
end
|
133
136
|
end
|
134
137
|
end
|
135
138
|
end
|
data/lib/glueby/utxo_provider.rb
CHANGED
@@ -44,7 +44,7 @@ module Glueby
|
|
44
44
|
|
45
45
|
fee = fee_estimator.fee(dummy_tx(txb.build))
|
46
46
|
# The outputs need to be shuffled so that no utxos are spent twice as possible.
|
47
|
-
sum, outputs =
|
47
|
+
sum, outputs = collect_uncolored_outputs(wallet, fee + value)
|
48
48
|
|
49
49
|
outputs.each do |utxo|
|
50
50
|
txb.add_utxo({
|
@@ -73,6 +73,20 @@ module Glueby
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
def collect_uncolored_outputs(wallet, amount)
|
77
|
+
utxos = wallet.list_unspent.select { |o| !o[:color_id] && o[:amount] == @default_value }
|
78
|
+
utxos.shuffle!
|
79
|
+
|
80
|
+
utxos.inject([0, []]) do |sum, output|
|
81
|
+
new_sum = sum[0] + output[:amount]
|
82
|
+
new_outputs = sum[1] << output
|
83
|
+
return [new_sum, new_outputs] if new_sum >= amount
|
84
|
+
|
85
|
+
[new_sum, new_outputs]
|
86
|
+
end
|
87
|
+
raise Glueby::Contract::Errors::InsufficientFunds
|
88
|
+
end
|
89
|
+
|
76
90
|
def validate_config!
|
77
91
|
if UtxoProvider.config
|
78
92
|
utxo_pool_size = UtxoProvider.config[:utxo_pool_size]
|
data/lib/glueby/version.rb
CHANGED
data/lib/glueby.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "glueby/version"
|
2
|
+
require "glueby/constants"
|
2
3
|
require 'tapyrus'
|
3
4
|
|
4
5
|
module Glueby
|
@@ -16,6 +17,16 @@ module Glueby
|
|
16
17
|
require 'glueby/railtie'
|
17
18
|
end
|
18
19
|
|
20
|
+
module GluebyLogger
|
21
|
+
def logger
|
22
|
+
if defined?(Rails)
|
23
|
+
Rails.logger
|
24
|
+
else
|
25
|
+
Logger.new(STDOUT)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
19
30
|
# Add prefix to activerecord table names
|
20
31
|
def self.table_name_prefix
|
21
32
|
'glueby_'
|
@@ -8,27 +8,8 @@ module Glueby
|
|
8
8
|
|
9
9
|
def create
|
10
10
|
timestamps = Glueby::Contract::AR::Timestamp.where(status: :init)
|
11
|
-
|
12
|
-
timestamps.each
|
13
|
-
begin
|
14
|
-
wallet = Glueby::Wallet.load(t.wallet_id)
|
15
|
-
funding_tx, tx, p2c_address, payment_base = create_txs(wallet, t.prefix, t.content_hash, Glueby::Contract::FixedFeeEstimator.new, utxo_provider, type: t.timestamp_type.to_sym)
|
16
|
-
if funding_tx
|
17
|
-
::ActiveRecord::Base.transaction do
|
18
|
-
wallet.internal_wallet.broadcast(funding_tx)
|
19
|
-
puts "funding tx was broadcasted(id=#{t.id}, funding_tx.txid=#{funding_tx.txid})"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
::ActiveRecord::Base.transaction do
|
23
|
-
wallet.internal_wallet.broadcast(tx) do |tx|
|
24
|
-
t.update(txid: tx.txid, status: :unconfirmed, p2c_address: p2c_address, payment_base: payment_base)
|
25
|
-
end
|
26
|
-
puts "timestamp tx was broadcasted (id=#{t.id}, txid=#{tx.txid})"
|
27
|
-
end
|
28
|
-
rescue => e
|
29
|
-
puts "failed to broadcast (id=#{t.id}, reason=#{e.message})"
|
30
|
-
end
|
31
|
-
end
|
11
|
+
fee_estimator = Glueby::Contract::FixedFeeEstimator.new
|
12
|
+
timestamps.each { |t| t.save_with_broadcast(fee_estimator: fee_estimator) }
|
32
13
|
end
|
33
14
|
end
|
34
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glueby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tapyrus
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/glueby/active_record/system_information.rb
|
104
104
|
- lib/glueby/block_syncer.rb
|
105
105
|
- lib/glueby/configuration.rb
|
106
|
+
- lib/glueby/constants.rb
|
106
107
|
- lib/glueby/contract.rb
|
107
108
|
- lib/glueby/contract/active_record.rb
|
108
109
|
- lib/glueby/contract/active_record/reissuable_token.rb
|
@@ -147,7 +148,7 @@ metadata:
|
|
147
148
|
homepage_uri: https://github.com/chaintope/glueby
|
148
149
|
source_code_uri: https://github.com/chaintope/glueby
|
149
150
|
changelog_uri: https://github.com/chaintope/glueby
|
150
|
-
post_install_message:
|
151
|
+
post_install_message:
|
151
152
|
rdoc_options: []
|
152
153
|
require_paths:
|
153
154
|
- lib
|
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
164
|
version: '0'
|
164
165
|
requirements: []
|
165
166
|
rubygems_version: 3.2.3
|
166
|
-
signing_key:
|
167
|
+
signing_key:
|
167
168
|
specification_version: 4
|
168
169
|
summary: A Ruby library of smart contracts that can be used on Tapyrus.
|
169
170
|
test_files: []
|