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

Issue 548 3 #1646

Merged
merged 1 commit into from
Feb 22, 2024
Merged
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
4 changes: 4 additions & 0 deletions app/workers/token_transfer_detect_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class TokenTransferDetectWorker

def perform(tx_id)
tx = CkbTransaction.includes(:cell_outputs, cell_inputs: :previous_cell_output).find tx_id
puts "==================#{tx.inspect}"
return unless tx

@lock = Redis::Lock.new("token_transfer_#{tx_id}", expiration: 180, timeout: 30)
Expand All @@ -11,6 +12,7 @@ def perform(tx_id)
source_collections = []

tx.cell_inputs.each do |input|
puts input.cell_type
if input.cell_type.in?(%w(m_nft_token nrc_721_token spore_cell))
cell = input.previous_cell_output
type_script = input.type_script
Expand All @@ -20,7 +22,9 @@ def perform(tx_id)
end

tx.cell_outputs.each do |output|
puts output.cell_type
if output.cell_type.in?(%w(m_nft_token nrc_721_token spore_cell))
puts "========================#{output.id}"
type_script = output.type_script
item = find_or_create_item(output, type_script)
attrs = {
Expand Down
Loading