Skip to content

Commit

Permalink
Merge pull request #1739 from nervosnetwork/testnet
Browse files Browse the repository at this point in the history
Deploy to mainnet
  • Loading branch information
zmcNotafraid authored Apr 2, 2024
2 parents e7f7f11 + da982dd commit 91a7824
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit 91a7824

Please sign in to comment.