glueby 0.5.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/glueby/contract/templates/timestamp_table.rb.erb +4 -1
- data/lib/glueby/constants.rb +4 -0
- data/lib/glueby/contract/active_record/timestamp.rb +8 -1
- data/lib/glueby/contract/errors.rb +1 -0
- data/lib/glueby/contract/fee_estimator.rb +2 -0
- data/lib/glueby/contract/timestamp.rb +38 -6
- data/lib/glueby/contract/token.rb +21 -11
- data/lib/glueby/contract/tx_builder.rb +28 -11
- 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 +1 -0
- data/lib/tasks/glueby/contract/timestamp.rake +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea6c9da8fdd46b8e2d82e7d403580d160f8eded28723f7ee33c14e002be5428f
|
4
|
+
data.tar.gz: d74cc716d2ce35f19eb0ed5d9eb6d46cd464fa3a19a87073dd61a1e2180ef5fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6c75c349edfd4c5ee5fc0e752ce9c65f1ad2f5b323d38f2a51b2ab5d91de8786daf67f1bfb1fdd221a7cc10cf891b6f6551fd58afe8059593a81536027d25c
|
7
|
+
data.tar.gz: 38c2b4a8e2a085bf238ca37fd1a39930e2b337d0f80a9695adb45116dc8e2cc4478c3c0041c08b0def00cdf15235664bee9d4c6beb9e7a285c1320f8f1b768c2
|
@@ -2,10 +2,13 @@ class CreateTimestamp < ActiveRecord::Migration<%= migration_version %>
|
|
2
2
|
def change
|
3
3
|
create_table :glueby_timestamps<%= table_options %> do |t|
|
4
4
|
t.string :txid
|
5
|
-
t.integer :status
|
5
|
+
t.integer :status, null: false, default: 0
|
6
6
|
t.string :content_hash
|
7
7
|
t.string :prefix
|
8
8
|
t.string :wallet_id
|
9
|
+
t.integer :timestamp_type, null: false, default: 0
|
10
|
+
t.string :p2c_address
|
11
|
+
t.string :payment_base
|
9
12
|
end
|
10
13
|
end
|
11
14
|
end
|
@@ -4,15 +4,22 @@ module Glueby
|
|
4
4
|
class Timestamp < ::ActiveRecord::Base
|
5
5
|
include Glueby::Contract::Timestamp::Util
|
6
6
|
enum status: { init: 0, unconfirmed: 1, confirmed: 2 }
|
7
|
+
enum timestamp_type: { simple: 0, trackable: 1 }
|
7
8
|
|
8
9
|
# @param [Hash] attributes attributes which consist of:
|
9
10
|
# - wallet_id
|
10
11
|
# - content
|
11
12
|
# - prefix(optional)
|
13
|
+
# - timestamp_type(optional)
|
12
14
|
def initialize(attributes = nil)
|
13
15
|
@content_hash = Tapyrus.sha256(attributes[:content]).bth
|
14
16
|
super(wallet_id: attributes[:wallet_id], content_hash: @content_hash,
|
15
|
-
prefix: attributes[:prefix] ? attributes[:prefix] : '', status: :init)
|
17
|
+
prefix: attributes[:prefix] ? attributes[:prefix] : '', status: :init, timestamp_type: attributes[:timestamp_type] || :simple)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Return true if timestamp type is 'trackable' and output in timestamp transaction has not been spent yet, otherwise return false.
|
21
|
+
def latest
|
22
|
+
trackable?
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -5,6 +5,7 @@ module Glueby
|
|
5
5
|
class InsufficientTokens < StandardError; end
|
6
6
|
class InvalidAmount < StandardError; end
|
7
7
|
class InvalidTokenType < StandardError; end
|
8
|
+
class InvalidTimestampType < StandardError; end
|
8
9
|
class TxAlreadyBroadcasted < StandardError; end
|
9
10
|
class UnsupportedTokenType < StandardError; end
|
10
11
|
class UnknownScriptPubkey < StandardError; end
|
@@ -9,6 +9,8 @@ module Glueby
|
|
9
9
|
# Storing timestamp transaction to the blockchain enables everyone to verify that the data existed at that time and a user signed it.
|
10
10
|
class Timestamp
|
11
11
|
include Glueby::Contract::TxBuilder
|
12
|
+
|
13
|
+
P2C_DEFAULT_VALUE = 1_000
|
12
14
|
|
13
15
|
autoload :Syncer, 'glueby/contract/timestamp/syncer'
|
14
16
|
|
@@ -16,9 +18,28 @@ module Glueby
|
|
16
18
|
include Glueby::Internal::Wallet::TapyrusCoreWalletAdapter::Util
|
17
19
|
module_function
|
18
20
|
|
19
|
-
|
21
|
+
# @param [Glueby::Wallet] wallet
|
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]
|
24
|
+
def create_pay_to_contract_address(wallet, contents: nil)
|
25
|
+
pubkey = wallet.internal_wallet.create_pubkey.pubkey
|
26
|
+
# Calculate P + H(P || contents)G
|
27
|
+
group = ECDSA::Group::Secp256k1
|
28
|
+
p = Tapyrus::Key.new(pubkey: pubkey).to_point # P
|
29
|
+
commitment = Tapyrus.sha256(p.to_hex(true).htb + contents.join).bth.to_i(16) % group.order # H(P || contents)
|
30
|
+
point = p + group.generator.multiply_by_scalar(commitment) # P + H(P || contents)G
|
31
|
+
[Tapyrus::Key.new(pubkey: point.to_hex(true)).to_p2pkh, pubkey] # [p2c address, P]
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_txs(wallet, prefix, data, fee_estimator, utxo_provider, type: :simple)
|
20
35
|
txb = Tapyrus::TxBuilder.new
|
21
|
-
|
36
|
+
if type == :simple
|
37
|
+
txb.data(prefix + data)
|
38
|
+
elsif type == :trackable
|
39
|
+
p2c_address, payment_base = create_pay_to_contract_address(wallet, contents: [prefix, data])
|
40
|
+
txb.pay(p2c_address, P2C_DEFAULT_VALUE)
|
41
|
+
end
|
42
|
+
|
22
43
|
fee = fee_estimator.fee(dummy_tx(txb.build))
|
23
44
|
if utxo_provider
|
24
45
|
script_pubkey = Tapyrus::Script.parse_from_addr(wallet.internal_wallet.receive_address)
|
@@ -54,7 +75,7 @@ module Glueby
|
|
54
75
|
end
|
55
76
|
|
56
77
|
txb.fee(fee).change_address(wallet.internal_wallet.change_address)
|
57
|
-
[funding_tx, wallet.internal_wallet.sign_tx(txb.build, prev_txs)]
|
78
|
+
[funding_tx, wallet.internal_wallet.sign_tx(txb.build, prev_txs), p2c_address, payment_base]
|
58
79
|
end
|
59
80
|
|
60
81
|
def get_transaction(tx)
|
@@ -65,6 +86,9 @@ module Glueby
|
|
65
86
|
|
66
87
|
attr_reader :tx, :txid
|
67
88
|
|
89
|
+
# p2c_address and payment_base is used in `trackable` type
|
90
|
+
attr_reader :p2c_address, :payment_base
|
91
|
+
|
68
92
|
# @param [String] content Data to be hashed and stored in blockchain.
|
69
93
|
# @param [String] prefix prefix of op_return data
|
70
94
|
# @param [Glueby::Contract::FeeEstimator] fee_estimator
|
@@ -72,21 +96,29 @@ module Glueby
|
|
72
96
|
# - :sha256
|
73
97
|
# - :double_sha256
|
74
98
|
# - :none
|
75
|
-
# @
|
99
|
+
# @param [Symbol] timestamp_type
|
100
|
+
# - :simple
|
101
|
+
# - :trackable
|
102
|
+
# @raise [Glueby::Contract::Errors::UnsupportedDigestType] if digest is unsupported
|
103
|
+
# @raise [Glueby::Contract::Errors::InvalidTimestampType] if timestamp_type is unsupported
|
76
104
|
def initialize(
|
77
105
|
wallet:,
|
78
106
|
content:,
|
79
107
|
prefix: '',
|
80
108
|
fee_estimator: Glueby::Contract::FixedFeeEstimator.new,
|
81
109
|
digest: :sha256,
|
82
|
-
utxo_provider: nil
|
110
|
+
utxo_provider: nil,
|
111
|
+
timestamp_type: :simple
|
83
112
|
)
|
84
113
|
@wallet = wallet
|
85
114
|
@content = content
|
86
115
|
@prefix = prefix
|
87
116
|
@fee_estimator = fee_estimator
|
117
|
+
raise Glueby::Contract::Errors::UnsupportedDigestType, "#{digest} is invalid digest, supported digest are :sha256, :double_sha256, and :none." unless [:sha256, :double_sha256, :none].include?(digest)
|
88
118
|
@digest = digest
|
89
119
|
@utxo_provider = utxo_provider
|
120
|
+
raise Glueby::Contract::Errors::InvalidTimestampType, "#{timestamp_type} is invalid type, supported types are :simple, and :trackable." unless [:simple, :trackable].include?(timestamp_type)
|
121
|
+
@timestamp_type = timestamp_type
|
90
122
|
end
|
91
123
|
|
92
124
|
# broadcast to Tapyrus Core
|
@@ -96,7 +128,7 @@ module Glueby
|
|
96
128
|
def save!
|
97
129
|
raise Glueby::Contract::Errors::TxAlreadyBroadcasted if @txid
|
98
130
|
|
99
|
-
funding_tx, @tx = create_txs(@wallet, @prefix, digest_content, @fee_estimator, @utxo_provider)
|
131
|
+
funding_tx, @tx, @p2c_address, @payment_base = create_txs(@wallet, @prefix, digest_content, @fee_estimator, @utxo_provider, type: @timestamp_type)
|
100
132
|
@wallet.internal_wallet.broadcast(funding_tx) if funding_tx
|
101
133
|
@txid = @wallet.internal_wallet.broadcast(@tx)
|
102
134
|
end
|
@@ -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)
|
@@ -190,9 +185,24 @@ module Glueby
|
|
190
185
|
# @raise [InvalidAmount] if amount is not positive integer.
|
191
186
|
def burn!(sender:, amount: 0)
|
192
187
|
raise Glueby::Contract::Errors::InvalidAmount unless amount.positive?
|
188
|
+
balance = sender.balances[color_id.to_hex]
|
189
|
+
raise Glueby::Contract::Errors::InsufficientTokens unless balance
|
190
|
+
raise Glueby::Contract::Errors::InsufficientTokens if balance < amount
|
191
|
+
|
192
|
+
burn_all_amount_flag = true if balance - amount == 0
|
193
193
|
|
194
194
|
utxo_provider = Glueby::UtxoProvider.new if Glueby.configuration.use_utxo_provider?
|
195
|
-
|
195
|
+
if utxo_provider
|
196
|
+
funding_tx = create_funding_tx(
|
197
|
+
wallet: sender,
|
198
|
+
# When it burns all the amount of the color id, burn tx is not going to be have any output
|
199
|
+
# because change outputs is not necessary. Transactions needs one output at least.
|
200
|
+
# At that time, set true to this option to get more value to be created change output to
|
201
|
+
# the tx.
|
202
|
+
need_value_for_change_output: burn_all_amount_flag
|
203
|
+
)
|
204
|
+
end
|
205
|
+
|
196
206
|
funding_tx = sender.internal_wallet.broadcast(funding_tx) if funding_tx
|
197
207
|
|
198
208
|
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
|
@@ -189,8 +187,7 @@ module Glueby
|
|
189
187
|
tx.inputs << Tapyrus::TxIn.new(out_point: out_point)
|
190
188
|
funding_tx.outputs.first.value
|
191
189
|
else
|
192
|
-
|
193
|
-
sum_tpc, outputs = sender.internal_wallet.collect_uncolored_outputs(fee + dust)
|
190
|
+
sum_tpc, outputs = sender.internal_wallet.collect_uncolored_outputs(fee + DUST_LIMIT)
|
194
191
|
fill_input(tx, outputs)
|
195
192
|
sum_tpc
|
196
193
|
end
|
@@ -220,7 +217,12 @@ module Glueby
|
|
220
217
|
def fill_change_tpc(tx, wallet, change)
|
221
218
|
return unless change.positive?
|
222
219
|
|
223
|
-
|
220
|
+
if Glueby.configuration.use_utxo_provider?
|
221
|
+
change_script = Tapyrus::Script.parse_from_addr(UtxoProvider.new.wallet.change_address)
|
222
|
+
else
|
223
|
+
change_script = Tapyrus::Script.parse_from_addr(wallet.internal_wallet.change_address)
|
224
|
+
end
|
225
|
+
|
224
226
|
tx.outputs << Tapyrus::TxOut.new(value: change, script_pubkey: change_script)
|
225
227
|
end
|
226
228
|
|
@@ -278,6 +280,21 @@ module Glueby
|
|
278
280
|
tx.outputs << Tapyrus::TxOut.new(value: 0, script_pubkey: receiver_colored_script)
|
279
281
|
dummy_tx(tx)
|
280
282
|
end
|
283
|
+
|
284
|
+
private
|
285
|
+
|
286
|
+
# The amount of output in funding tx
|
287
|
+
# It returns same amount with FixedFeeEstimator's fixed fee. Because it is enough for paying fee for consumer
|
288
|
+
# transactions of the funding transactions.
|
289
|
+
#
|
290
|
+
# @option [Boolean] need_value_for_change_output If it is true, adds more value than the fee for producing change output.
|
291
|
+
def funding_tx_amount(need_value_for_change_output: false)
|
292
|
+
if need_value_for_change_output
|
293
|
+
FixedFeeEstimator.new.fixed_fee + DUST_LIMIT
|
294
|
+
else
|
295
|
+
FixedFeeEstimator.new.fixed_fee
|
296
|
+
end
|
297
|
+
end
|
281
298
|
end
|
282
299
|
end
|
283
300
|
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
@@ -12,7 +12,7 @@ module Glueby
|
|
12
12
|
timestamps.each do |t|
|
13
13
|
begin
|
14
14
|
wallet = Glueby::Wallet.load(t.wallet_id)
|
15
|
-
funding_tx, tx = create_txs(wallet, t.prefix, t.content_hash, Glueby::Contract::FixedFeeEstimator.new, utxo_provider)
|
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
16
|
if funding_tx
|
17
17
|
::ActiveRecord::Base.transaction do
|
18
18
|
wallet.internal_wallet.broadcast(funding_tx)
|
@@ -21,7 +21,7 @@ module Glueby
|
|
21
21
|
end
|
22
22
|
::ActiveRecord::Base.transaction do
|
23
23
|
wallet.internal_wallet.broadcast(tx) do |tx|
|
24
|
-
t.update(txid: tx.txid, status: :unconfirmed)
|
24
|
+
t.update(txid: tx.txid, status: :unconfirmed, p2c_address: p2c_address, payment_base: payment_base)
|
25
25
|
end
|
26
26
|
puts "timestamp tx was broadcasted (id=#{t.id}, txid=#{tx.txid})"
|
27
27
|
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.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-22 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
|