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 mainnet #1739

Merged
merged 2 commits into from
Apr 2, 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: 3 additions & 3 deletions app/utils/ckb_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -634,16 +634,16 @@ def self.parse_omiga_inscription_info(hex_data)
symbol_len = "0x#{data.slice!(0, 2)}".to_i(16)
symbol = [data.slice!(0, symbol_len * 2)].pack("H*")
udt_hash = "0x#{data.slice!(0, 64)}"
expected_supply = [data.slice!(0, 32)].pack("H*").unpack1("Q<2")
mint_limit = [data.slice!(0, 32)].pack("H*").unpack1("Q<2")
expected_supply = [data.slice!(0, 32)].pack("H*").bytes.reverse.pack("C*").unpack1("H*").hex
mint_limit = [data.slice!(0, 32)].pack("H*").bytes.reverse.pack("C*").unpack1("H*").hex
mint_status = "0x#{data.slice!(0, 2)}".to_i(16)
{ decimal:, name: name.presence, symbol: symbol.presence, udt_hash:, expected_supply:,
mint_limit:, mint_status: }
end

def self.parse_omiga_inscription_data(hex_data)
data = hex_data.delete_prefix("0x")
mint_limit = [data].pack("H*").unpack1("Q<2")
mint_limit = [data].pack("H*").bytes.reverse.pack("C*").unpack1("H*").hex
{ mint_limit: }
end

Expand Down
6 changes: 6 additions & 0 deletions test/utils/ckb_utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ class CkbUtilsTest < ActiveSupport::TestCase
assert_equal info[:mint_limit], 100000000000
end

test "parse another omiga inscrpition data" do
data = "0x000000357ecff647ec5e110000000000 "
info = CkbUtils.parse_omiga_inscription_data(data)
assert_equal info[:mint_limit], 21000000000000000000000000
end

test "parse unique cell" do
data = "0x080a556e697175652042425100"
info = CkbUtils.parse_unique_cell(data)
Expand Down
Loading