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

feat: remove duplicate xudt check #2167

Merged
merged 1 commit into from
Aug 30, 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
6 changes: 0 additions & 6 deletions app/workers/xudt_tag_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def mark_tags(udt)
["out-of-length-range"]
elsif utility_lp_token?(udt.args)
["utility"]
elsif !first_xudt?(udt.symbol, udt.block_timestamp)
["suspicious"]
elsif single_use_lock?(udt.issuer_address)
["supply-limited"]
elsif rgbpp_lock?(udt.issuer_address)
Expand All @@ -49,10 +47,6 @@ def out_of_length?(symbol)
symbol.length > 60
end

def first_xudt?(symbol, block_timestamp)
!Udt.published_xudt.where("LOWER(symbol) = ?", symbol.downcase).where("block_timestamp < ?", block_timestamp).exists?
end

def rgbpp_lock?(issuer_address)
address_code_hash = CkbUtils.parse_address(issuer_address).script.code_hash
issuer_address.present? && CkbSync::Api.instance.rgbpp_code_hash.include?(address_code_hash)
Expand Down
10 changes: 0 additions & 10 deletions test/workers/xudt_tag_worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,4 @@ class XudtTagWorkerTest < ActiveJob::TestCase
end
assert_equal ["utility", "rgb++"], XudtTag.last.tags
end

test "insert suspicious tag when not lp token but duplicate" do
udt = create(:udt, :xudt, symbol: "CKBBB", block_timestamp: 1.day.ago.to_i * 1000)
create(:xudt_tag, udt_id: udt.id, udt_type_hash: udt.type_hash, tags: ["rgb++", "layer-1-asset", "supply-limited"])
create(:udt, :xudt, symbol: "ckbbb", block_timestamp: Time.now.to_i * 1000, issuer_address: @address.address_hash)
assert_changes -> { XudtTag.count }, from: 1, to: 2 do
XudtTagWorker.new.perform
end
assert_equal ["suspicious", "rgb++"], XudtTag.last.tags
end
end
Loading