Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to testnet #1569

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions app/models/ckb_sync/new_node_data_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ def update_udt_info(local_block)
local_block.cell_outputs.udt.select(:id, :type_hash).each do |udt_output|
type_hashes << udt_output.type_hash
end
local_block.cell_outputs.omiga_inscription.select(:id, :type_hash).each do |udt_output|
local_block.cell_outputs.omiga_inscription.select(:id,
:type_hash).each do |udt_output|
type_hashes << udt_output.type_hash
end
local_block.ckb_transactions.pluck(:id).each do |tx_id|
Expand Down Expand Up @@ -666,7 +667,7 @@ def build_udts!(local_block, outputs, outputs_data)
type_hash = output.type.compute_hash
unless Udt.where(type_hash:).exists?
nft_token_attr = { full_name: nil, icon_file: nil,
published: false, symbol: nil }
published: false, symbol: nil, decimal: nil, nrc_factory_cell_id: nil }
if cell_type == "m_nft_token"
m_nft_class_type = TypeScript.where(code_hash: CkbSync::Api.instance.token_class_script_code_hash,
args: output.type.args[0..49]).first
Expand Down Expand Up @@ -718,6 +719,7 @@ def build_udts!(local_block, outputs, outputs_data)
nrc_721_factory_cell.symbol.to_s[0, 16]
nft_token_attr[:icon_file] =
"#{nrc_721_factory_cell.base_token_uri}/#{factory_cell.token_id}"
# refactor: remove this attribute then add udt_id to NrcFactoryCell
nft_token_attr[:nrc_factory_cell_id] = nrc_721_factory_cell.id
end
nft_token_attr[:published] = true
Expand All @@ -730,27 +732,28 @@ def build_udts!(local_block, outputs, outputs_data)
nft_token_attr[:published] = true
end
# fill issuer_address after publish the token
# udts_attributes << {
# type_hash: type_hash, udt_type: udt_type(cell_type), block_timestamp: local_block.timestamp, args: output.type.args,
# code_hash: output.type.code_hash, hash_type: output.type.hash_type }.merge(nft_token_attr)
udt = Udt.create_or_find_by!({
type_hash:,
udt_type: udt_type(cell_type),
block_timestamp: local_block.timestamp,
args: output.type.args,
code_hash: output.type.code_hash,
hash_type: output.type.hash_type,
}.merge(nft_token_attr))

if cell_type == "omiga_inscription"
info = OmigaInscriptionInfo.find_by(udt_hash: type_hash,
udt_id: nil)
info && info.update!(udt_id: udt.id)
end
udts_attributes << {
type_hash:, udt_type: udt_type(cell_type), block_timestamp: local_block.timestamp, args: output.type.args,
code_hash: output.type.code_hash, hash_type: output.type.hash_type
}.merge(nft_token_attr)
end
end
end
# Udt.insert_all!(udts_attributes.map! { |attr| attr.merge!(created_at: Time.current, updated_at: Time.current) }) if udts_attributes.present?
if udts_attributes.present?
returning_attrs = Udt.insert_all!(udts_attributes.map! do |attr|
attr.merge!(created_at: Time.current, updated_at: Time.current)
end, returning: %w[id udt_type type_hash])
omiga_inscription_info_attrs = returning_attrs.rows.filter do |r|
r[1] == 4
end.map do |k|
{ udt_id: k[0],
udt_hash: k[2] }
end
if omiga_inscription_info_attrs.present?
OmigaInscriptionInfo.upsert_all(omiga_inscription_info_attrs,
unique_by: :udt_hash)
end
end
end

def update_ckb_txs_rel_and_fee(
Expand Down
4 changes: 2 additions & 2 deletions config/settings.mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ spore_cluster_code_hash: ""
spore_cell1_code_hash: ""

# omiga inscription info
omiga_inscription_info_code_hash: ""
omiga_inscription_code_hash: ""
omiga_inscription_info_code_hash: "0x5c33fc69bd72e895a63176147c6ab0bb5758d1c7a32e0914f99f9ec1bed90d41"
omiga_inscription_code_hash: "0x7490970e6af9b9fe63fc19fc523a12b2ec69027e6ae484edffb97334f74e8c97"

# xudt
xudt_code_hash: "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95"
Expand Down
Loading