diff --git a/app/models/ckb_sync/api.rb b/app/models/ckb_sync/api.rb index 168bafe65..578879118 100644 --- a/app/models/ckb_sync/api.rb +++ b/app/models/ckb_sync/api.rb @@ -75,7 +75,7 @@ def spore_cluster_code_hashes if mode == CKB::MODE::MAINNET [Settings.spore_cluster1_code_hash] else - [Settings.spore_cluster1_code_hash, Settings.spore_cluster2_code_hash, Settings.spore_cluster3_code_hash] + [Settings.spore_cluster1_code_hash, Settings.spore_cluster2_code_hash] end end @@ -83,7 +83,7 @@ def spore_cell_code_hashes if mode == CKB::MODE::MAINNET [Settings.spore_cell1_code_hash] else - [Settings.spore_cell1_code_hash, Settings.spore_cell2_code_hash, Settings.spore_cell3_code_hash] + [Settings.spore_cell1_code_hash, Settings.spore_cell2_code_hash] end end diff --git a/app/workers/analyze_contract_from_cell_dependency_worker.rb b/app/workers/analyze_contract_from_cell_dependency_worker.rb index bba54d8f7..46aba2687 100644 --- a/app/workers/analyze_contract_from_cell_dependency_worker.rb +++ b/app/workers/analyze_contract_from_cell_dependency_worker.rb @@ -4,7 +4,7 @@ class AnalyzeContractFromCellDependencyWorker def perform cell_deps_out_points_attrs = Set.new contract_attrs = Set.new - cell_deps_attrs = [] + cell_deps_attrs = Set.new CellDependency.where(contract_analyzed: false).where.not(block_number: nil).order("block_number desc").limit(1000).each do |cell_dep| cell_deps_attrs << { contract_analyzed: true, ckb_transaction_id: cell_dep.ckb_transaction_id, contract_cell_id: cell_dep.contract_cell_id, dep_type: cell_dep.dep_type } @@ -16,7 +16,7 @@ def perform type_script_hashes = Set.new lock_script_hashes = Set.new - cell_outputs = ckb_transaction.cell_outputs.includes(:type_script).to_a + cell_outputs = ckb_transaction.cell_outputs.includes(:type_script, :input_script).to_a cell_inputs = ckb_transaction.cell_inputs.includes(:previous_cell_output).map(&:previous_cell_output) cell_inputs.each do |input| lock_script_hashes << input.lock_script.code_hash @@ -24,6 +24,7 @@ def perform end cell_outputs.each do |output| + lock_script_hashes << output.lock_script.code_hash type_script_hashes << output.type_script.code_hash if output.type_script end diff --git a/app/workers/contract_statistic_worker.rb b/app/workers/contract_statistic_worker.rb index fad3f1a84..58e67ee31 100644 --- a/app/workers/contract_statistic_worker.rb +++ b/app/workers/contract_statistic_worker.rb @@ -5,7 +5,7 @@ class ContractStatisticWorker def perform h24_tx_ids = CkbTransaction.h24.pluck(:id) ActiveRecord::Base.connection.execute("SET statement_timeout = 0") - Contract.find_each do |contract| + Contract.where(verified: true).find_each do |contract| contract_cell_ids = CellDepsOutPoint.list_contract_cell_ids_by_contract([contract.id]) ckb_transactions_count = CellDependency.where(contract_cell_id: contract_cell_ids).select(:ckb_transaction_id).distinct.count h24_ckb_transactions_count = CellDependency.where(contract_cell_id: contract_cell_ids, ckb_transaction_id: h24_tx_ids).select(:ckb_transaction_id).distinct.count diff --git a/config/settings.testnet.yml b/config/settings.testnet.yml index 035fee2c1..3a6c5d389 100644 --- a/config/settings.testnet.yml +++ b/config/settings.testnet.yml @@ -21,12 +21,10 @@ nrc_721_factory_output_data_header: "0x24ff5a9ab8c38d195ce2b4ea75ca8987" nrc_721_token_output_data_header: "0x0ddeff3e8ee03cbf6a2c6920d05c381e" # spore nft code hash -spore_cluster1_code_hash: "0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075" # tag: v2 preview +spore_cluster1_code_hash: "0x0bbe768b519d8ea7b96d58f1182eb7e6ef96c541fbd9526975077ee09f049058" # tag: v2 preview spore_cluster2_code_hash: "0x598d793defef36e2eeba54a9b45130e4ca92822e1d193671f490950c3b856080" # tag: v1 latest -spore_cluster3_code_hash: "0x0bbe768b519d8ea7b96d58f1182eb7e6ef96c541fbd9526975077ee09f049058" # tag: 0.2.2-beta.2 -spore_cell1_code_hash: "0x5e063b4c0e7abeaa6a428df3b693521a3050934cf3b0ae97a800d1bc31449398" # tag: v2 preview +spore_cell1_code_hash: "0x685a60219309029d01310311dba953d67029170ca4848a4ff638e57002130a0d" # tag: v2 preview spore_cell2_code_hash: "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494" # tag: v1 latest -spore_cell3_code_hash: "0x685a60219309029d01310311dba953d67029170ca4848a4ff638e57002130a0d" # tag: 0.2.2-beta.2 #did cell did_cell_code_hash: "0x0b1f412fbae26853ff7d082d422c2bdd9e2ff94ee8aaec11240a5b34cc6e890f" diff --git a/lib/tasks/migration/fill_contracts_info.rake b/lib/tasks/migration/fill_contracts_info.rake new file mode 100644 index 000000000..bbc6933d0 --- /dev/null +++ b/lib/tasks/migration/fill_contracts_info.rake @@ -0,0 +1,483 @@ +namespace :migration do + desc "Usage: RAILS_ENV=production bundle exec rake migration:fill_contracts_info" + task fill_contracts_info: :environment do + hashes = + if ENV["CKB_NET_MODE"] == "mainnet" + [ + { code_hash: "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", hash_type: "type", + name: "SECP256K1/blake160", + tx_hashes: ["0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c-0"], + dep_type: "dep_group", + description: "SECP256K1/blake160 is the default lock script to verify CKB transaction signature." }, + { code_hash: "0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8", hash_type: "type", + name: "SECP256K1/multisig", + tx_hashes: ["0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c-1"], + dep_type: "dep_group", + description: "SECP256K1/multisig is a script which allows a group of users to sign a single transaction." }, + { code_hash: "0x0fb343953ee78c9986b091defb6252154e0bb51044fd2879fde5b27314506111", hash_type: "type", + name: "Anyone-Can-Pay Lock", + tx_hashes: ["0xa05f28c9b867f8c5682039c10d8e864cf661685252aa74a008d255c33813bb81-0"], + dep_type: "dep_group", + description: "anyone_can_pay allows a recipient to provide cell capacity in asset transfer.", + deprecated: true }, + { code_hash: "0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354", hash_type: "type", + name: "Anyone-Can-Pay Lock", + tx_hashes: ["0x4153a2014952d7cac45f285ce9a7c5c0c0e1b21f2d378b82ac1433cb11c25c4d-0"], + dep_type: "dep_group", + description: "anyone_can_pay allows a recipient to provide cell capacity in asset transfer." }, + { code_hash: "0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e", hash_type: "type", + name: "Nervos DAO", + tx_hashes: ["0xe2fb199810d49a4d8beec56718ba2593b665db9d52299a0f9e6e75416d73ff5c-2"], + dep_type: "code", + description: "Nervos DAO is a smart contract with which users can interact the same way as any smart contract on CKB." }, + { code_hash: "0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5", hash_type: "type", + name: "Simple UDT", + tx_hashes: ["0xc7813f6a415144643970c2e88e0bb6ca6a8edc5dd7c1022746f628284a9936d5-0"], + dep_type: "code", + description: "Simple UDT provides a way for dapp developers to issue custom tokens on Nervos CKB." }, + { code_hash: "0xbf43c3602455798c1a61a596e0d95278864c552fafe231c063b3fabf97a8febc", hash_type: "type", + name: "PW Lock", + dep_type: "code", + tx_hashes: ["0x1d60cb8f4666e039f418ea94730b1a8c5aa0bf2f7781474406387462924d15d4-0"], + description: "Forked from CKB's system scripts, and currently supports signature generated by personalSign and signTypedData from ethereum wallets." }, + { code_hash: "0x614d40a86e1b29a8f4d8d93b9f3b390bf740803fa19a69f1c95716e029ea09b3", hash_type: "type", + name: "Unipass V2", + tx_hashes: ["0x1a04142a2a745fb3b7e0e9b61241676c1c94ad8cdacb36f223661130a23fb007-0"], dep_type: "code", + description: "UniPass Wallet is a smart contract wallet solution that supports on-chain Email social recovery." }, + { code_hash: "0xd01f5152c267b7f33b9795140c2467742e8424e49ebe2331caec197f7281b60a", hash_type: "type", + name: "Unipass V3", + tx_hashes: ["0x86a5e91ad93475caf30a3d3b0258786dd463984f71e8471abc5574f206f6207a-0"], dep_type: "code", + description: "UniPass Wallet is a smart contract wallet solution that supports on-chain Email social recovery." }, + { code_hash: "0xe4d4ecc6e5f9a059bf2f7a82cca292083aebc0c421566a52484fe2ec51a9fb0c", hash_type: "type", + name: "CHEQUE", + tx_hashes: ["0x04632cc459459cf5c9d384b43dee3e36f542a464bdd4127be7d6618ac6f8d268-0"], + dep_type: "code", + description: "" }, + { code_hash: "0x1122a4fb54697cf2e6e3a96c9d80fd398a936559b90954c6e88eb7ba0cf652df", hash_type: "type", + name: "CoTA", + tx_hashes: [ + "0x875db3381ebe7a730676c110e1c0d78ae1bdd0c11beacb7db4db08e368c2cd95-0", + "0xae2d5838730fc096e68fe839aea50d294493e10054513c10ca35e77e82e9243b-0", + ], + dep_type: "dep_group", + description: "A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs." }, + { code_hash: "0x90ca618be6c15f5857d3cbd09f9f24ca6770af047ba9ee70989ec3b229419ac7", hash_type: "type", + name: "CoTA Registry", + tx_hashes: [ + "0x875db3381ebe7a730676c110e1c0d78ae1bdd0c11beacb7db4db08e368c2cd95-0", + "0xae2d5838730fc096e68fe839aea50d294493e10054513c10ca35e77e82e9243b-0", + ], + dep_type: "dep_group", + description: "A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs." }, + { code_hash: "0x081dbffa88dab54ba426d231ca64eb760cea2fe9e16761a1da400da1b2cbe128", hash_type: "type", + name: "Flash Signer", + tx_hashes: ["0x0f0c22372a05f3c5f47acb066c65f9bae86bdce043762310e50309cc5a77abd4-0"], + dep_type: "dep_group", + description: "" }, + + { code_hash: "0x000f87062a2fe9bb4a6cc475212ea11014b84deb32e0375ee51e6ec4a553e009", hash_type: "type", + name: "Godwoken Custodian Lock", + tx_hashes: ["0x71b55e3641fdc8d00d9943a93b2c6e6ab42f7e57909009c2a1ad5c234956cdc5-0"], + dep_type: "code", + description: "Rollup uses the custodian lock to hold the deposited assets." }, + { code_hash: "0xff602581f07667eef54232cce850cbca2c418b3418611c132fca849d1edcd775", hash_type: "type", + name: "Godwoken Deposit Lock", + tx_hashes: ["0x61e576a7e5d2398ecc5b1a969d1af0142c87db0996c2f6fce41bf28f68d805b2-0"], + dep_type: "code", + description: "A layer1 user can join the Rollup by creating a deposit cell." }, + { code_hash: "0x3714af858b8b82b2bb8f13d51f3cffede2dd8d352a6938334bb79e6b845e3658", hash_type: "type", + name: "Godwoken Withdrawal Lock", + tx_hashes: ["0xe6389b5cf63eec1e2592e930414bc43f92508e529bdd5f5a07fa1dd140f4f20a-0"], + dep_type: "code", + description: "Withdrawal cells are generated in the RollupSubmitBlock action according to the block.withdrawals field." }, + { code_hash: "0x628b5f956b46ae27b50819a9ebab79ce5f957e6899ba0c75b8e142de2ed0dcd2", hash_type: "type", + name: "Godwoken Challenge Lock", + tx_hashes: ["0x8eca99207a462a9005bd91d04e24911627769096220f867d1cc0a32e75a287a6-0"], + dep_type: "code", + description: "When a Godwoken node found that an invalid state exists in the Rollup, the node can send the RollupEnterChallenge action to the Rollup cell and generate a challenging cell." }, + { code_hash: "0xb619184ab9142c51b0ee75f4e24bcec3d077eefe513115bad68836d06738fd2c", hash_type: "type", + name: "Godwoken Stake Lock", + tx_hashes: ["0x2e46a10a67987594d4eaee2d5f9ac96ce651f7bfb44e82c286a12a1950ad4f29-0"], + dep_type: "code", + description: "A block producer is required to provide a stake cell to perform the RollupSubmitBlock action." }, + { code_hash: "0xfef1d086d9f74d143c60bf03bd04bab29200dbf484c801c72774f2056d4c6718", hash_type: "type", + name: "Godwoken State Validator", + tx_hashes: ["0x9f8e73e096f1583696760281004d71dc0cebd3c9aa6fb584949facde6e543e67-0"], + dep_type: "code", + description: "State validator is the major script to verify the on-chain Rollup cell. Rollup cell is an identity cell on CKB, it stores the structure GlobalState which represents the layer-2 state." }, + { code_hash: "0x096df264f38fff07f3acd318995abc2c71ae0e504036fe32bc38d5b6037364d4", hash_type: "type", + name: "Godwoken Eth Account Lock", + tx_hashes: ["0xf0cfb02fb435bf2f061cbf33b1b024a4944b3f4a95968a9d997d95dd2f76a7f9-0"], + dep_type: "code", + description: "A layer-2 lock script, ETH account lock is a script that verifies the layer-2 account signature." }, + { code_hash: "0xa4398768d87bd17aea1361edc3accd6a0117774dc4ebc813bfa173e8ac0d086d", hash_type: "type", + name: "OMNI Lock V1", + tx_hashes: ["0x625696834db4320214a8af09de74fd51fc8a83be69d920243f8ccd219071473b-0"], + dep_type: "code", + description: "Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future." }, + { code_hash: "0x9b819793a64463aed77c615d6cb226eea5487ccfc0783043a587254cda2b6f26", hash_type: "type", + name: "OMNI Lock V2", + tx_hashes: [ + "0xc76edf469816aa22f416503c38d0b533d2a018e253e379f134c3985b3472c842-0", + "0xdfdb40f5d229536915f2d5403c66047e162e25dedd70a79ef5164356e1facdc8-0", + ], + dep_type: "code", + description: "Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future." }, + { code_hash: "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323", hash_type: "type", + name: "JoyID", + dep_type: "dep_group", + description: "An universal Account Protocol for Web3 Mass-adoption.", + tx_hashes: ["0xf05188e5f3a6767fc4687faf45ba5f1a6e25d3ada6129dae8722cb282f262493-0"] }, + { code_hash: "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95", hash_type: "data1", + name: "xUDT", + description: "Extensible UDT that derived from sUDT's programmability to support a wider range of scenarios", + dep_type: "code", + tx_hashes: ["0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7-0"] }, + { code_hash: "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494", hash_type: "data1", + name: "Spore", + dep_type: "code", + tx_hashes: ["0x96b198fb5ddbd1eed57ed667068f1f1e55d07907b4c0dbd38675a69ea1b69824-0"], + description: "Spore Protocol infuses digital assets with enduring value backed by tokenomics, redeemable at any time. Ensures true on-chain ownership, privacy, creative freedom and frictionless interaction." }, + { code_hash: "0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075", hash_type: "data1", + name: "Spore Cluster", + dep_type: "code", + tx_hashes: ["0xe464b7fb9311c5e2820e61c99afc615d6b98bdefbe318c34868c010cbd0dc938-0"], + description: "" }, + { code_hash: "0x9f3aeaf2fc439549cbc870c653374943af96a0658bd6b51be8d8983183e6f52f", hash_type: "type", + name: "Force Bridge", + dep_type: "code", + tx_hashes: ["0xaa8ab7e97ed6a268be5d7e26d63d115fa77230e51ae437fc532988dd0c3ce10a-1"], + description: "" }, + { code_hash: "0xbc6c568a1a0d0a09f6844dc9d74ddb4343c32143ff25f727c59edf4fb72d6936", hash_type: "type", + name: "RGB++", + dep_type: "code", + description: "RGB++ Lock", + tx_hashes: ["0x04c5c3e69f1aa6ee27fb9de3d15a81704e387ab3b453965adbe0b6ca343c6f41-0"] }, + { code_hash: "0x2c8c11c985da60b0a330c61a85507416d6382c130ba67f0c47ab071e00aec628", hash_type: "data1", + name: "Unique Cell", + dep_type: "code", + tx_hashes: ["0x67524c01c0cb5492e499c7c7e406f2f9d823e162d6b0cf432eacde0c9808c2ad-0"], + description: "A unique cell can be created on the Nervos CKB through TypeID which makes sure the unique cell cannot be updated or destroyed." }, + { code_hash: "0x70d64497a075bd651e98ac030455ea200637ee325a12ad08aff03f1a117e5a62", hash_type: "type", + name: "Btc Time Lock", + dep_type: "code", + tx_hashes: ["0x6257bf4297ee75fcebe2654d8c5f8d93bc9fc1b3dc62b8cef54ffe166162e996-0"], + description: "A lock require n confirmations of Bitcoin transaction to unlock the cell." }, + { code_hash: "0xcfba73b58b6f30e70caed8a999748781b164ef9a1e218424a6fb55ebf641cb33", hash_type: "type", + tx_hashes: ["0xeda235b56aa422c497b9b9bcfde7af289376e7fe12449ade99176609005994ba-0"], + name: "DID", + dep_type: "code", + description: "" }, + { code_hash: "0x641a89ad2f77721b803cd50d01351c1f308444072d5fa20088567196c0574c68", hash_type: "type", + name: "Nostr", + dep_type: "code", + tx_hashes: ["0x1911208b136957d5f7c1708a8835edfe8ae1d02700d5cb2c3a6aacf4d5906306-0"], + description: "The Nostr lock script is designed for interoperability with Nostr." }, + { code_hash: "0x8290467a512e5b9a6b816469b0edabba1f4ac474e28ffdd604c2a7c76446bbaf", hash_type: "data1", + name: "Single Use Lock", + dep_type: "code", + tx_hashes: ["0x10d63a996157d32c01078058000052674ca58d15f921bec7f1dcdac2160eb66b-4"], + description: "A lock script that can only be used once." }, + { code_hash: "0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3", hash_type: "data1", + name: "iCKB Logic", + dep_type: "dep_group", + tx_hashes: ["0x621a6f38de3b9f453016780edac3b26bfcbfa3e2ecb47c2da275471a5d3ed165-0"], + description: "iCKB Logic tokenizes NervosDAO deposits into the iCKB xUDT token." }, + { code_hash: "0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0", hash_type: "data1", + name: "WR Owned-Owner", + dep_type: "dep_group", + tx_hashes: ["0x621a6f38de3b9f453016780edac3b26bfcbfa3e2ecb47c2da275471a5d3ed165-0"], + description: + "WR Owned-Owner enable to create Withdrawals Request from NervosDAO deposits locked with zero length args locks, developed as part of iCKB." }, + { code_hash: "0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a", hash_type: "data1", + name: "UDT Limit Orderr", + dep_type: "dep_group", + tx_hashes: ["0x621a6f38de3b9f453016780edac3b26bfcbfa3e2ecb47c2da275471a5d3ed165-0"], + description: "UDT Limit Order is a general purpose UDT based Limit Order, developed as part of iCKB." }, + ] + else + [ + { code_hash: "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", hash_type: "type", + name: "SECP256K1/blake160", + dep_type: "dep_group", + tx_hashes: ["0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37-0"], + description: "SECP256K1/blake160 is the default lock script to verify CKB transaction signature.", + rfc: "https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0024-ckb-genesis-script-list/0024-ckb-genesis-script-list.md#secp256k1blake160", + code: "https://github.com/nervosnetwork/ckb-system-scripts/blob/master/c/secp256k1_blake160_sighash_all.c" }, + { code_hash: "0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8", hash_type: "type", + name: "SECP256K1/multisig", + dep_type: "dep_group", + tx_hashes: ["0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37-1"], + description: "SECP256K1/multisig is a script which allows a group of users to sign a single transaction.", + rfc: "https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0024-ckb-genesis-script-list/0024-ckb-genesis-script-list.md#secp256k1multisig", + code: "https://github.com/nervosnetwork/ckb-system-scripts/blob/master/c/secp256k1_blake160_multisig_all.c" }, + { code_hash: "0x86a1c6987a4acbe1a887cca4c9dd2ac9fcb07405bbeda51b861b18bbf7492c4b", hash_type: "type", name: "Anyone-Can-Pay Lock", + dep_type: "dep_group", + description: "anyone_can_pay allows a recipient to provide cell capacity in asset transfer.", + tx_hashes: ["0x4f32b3e39bd1b6350d326fdfafdfe05e5221865c3098ae323096f0bfc69e0a8c-0"], + rfc: "https://github.com/nervosnetwork/rfcs/blob/30980b378fdaccc6e9d21a1c6b53363364fb4abc/rfcs/0026-anyone-can-pay/0026-anyone-can-pay.md", + code: "https://github.com/nervosnetwork/ckb-production-scripts/tree/deac6801a95596d74e2da8f2f1a6727309d36100", + deprecated: true }, + { code_hash: "0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356", hash_type: "type", name: "Anyone-Can-Pay Lock", + description: "anyone_can_pay allows a recipient to provide cell capacity in asset transfer.", + tx_hashes: ["0xec26b0f85ed839ece5f11c4c4e837ec359f5adc4420410f6453b1f6b60fb96a6-0"], + rfc: "https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0026-anyone-can-pay/0026-anyone-can-pay.md", + code: "https://github.com/nervosnetwork/ckb-production-scripts/blob/e570c11aff3eca12a47237c21598429088c610d5/c/anyone_can_pay.c" }, + { code_hash: "0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e", hash_type: "type", + name: "Nervos DAO", + dep_type: "code", + tx_hashes: ["0x8f8c79eb6671709633fe6a46de93c0fedc9c1b8a6527a18d3983879542635c9f-2"], + description: "Nervos DAO is a smart contract with which users can interact the same way as any smart contract on CKB.", rfc: "https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0023-dao-deposit-withdraw/0023-dao-deposit-withdraw.md", + code: "https://github.com/nervosnetwork/ckb-system-scripts/blob/master/c/dao.c" }, + { code_hash: "0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4", hash_type: "type", name: "Simple UDT", + description: "Simple UDT provides a way for dapp developers to issue custom tokens on Nervos CKB.", + tx_hashes: ["0xe12877ebd2c3c364dc46c5c992bcfaf4fee33fa13eebdf82c591fc9825aab769-0"], + dep_type: "code", + rfc: "https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0025-simple-udt/0025-simple-udt.md", + code: "https://github.com/nervosnetwork/ckb-production-scripts/blob/e570c11aff3eca12a47237c21598429088c610d5/c/simple_udt.c" }, + { code_hash: "0x58c5f491aba6d61678b7cf7edf4910b1f5e00ec0cde2f42e0abb4fd9aff25a63", hash_type: "type", name: "PW Lock", + description: "Forked from CKB's system scripts, and currently supports signature generated by personalSign and signTypedData from ethereum wallets.", + dep_type: "code", + tx_hashes: ["0x57a62003daeab9d54aa29b944fc3b451213a5ebdf2e232216a3cfed0dde61b38-0"] }, + { code_hash: "0x124a60cd799e1fbca664196de46b3f7f0ecb7138133dcaea4893c51df5b02be6", hash_type: "type", + name: "Unipass V2", + dep_type: "code", + description: "UniPass Wallet is a smart contract wallet solution that supports on-chain Email social recovery.", + tx_hashes: ["0x3d41e1c543f0fddcbb17157d15a2845d7c5fb0363561cd8f50ecd0e118b34f84-0"] }, + { code_hash: "0x3e1eb7ed4809b2d60650be96a40abfbdafb3fb942b7b37ec7709e64e2cd0a783", hash_type: "type", name: "Unipass V3", + description: "UniPass Wallet is a smart contract wallet solution that supports on-chain Email social recovery.", + dep_type: "code", + tx_hashes: ["0x8b98ede6bf7b5baba767b1d2d46a13749fc810375b14152abbc259a7fc98e46d-0"] }, + { code_hash: "0x60d5f39efce409c587cb9ea359cefdead650ca128f0bd9cb3855348f98c70d5b", hash_type: "type", name: "CHEQUE", + dep_type: "dep_group", + description: "", + tx_hashes: ["0x7f96858be0a9d584b4a9ea190e0420835156a6010a5fde15ffcdc9d9c721ccab-0"] }, + { code_hash: "0xb59879b6ea6fff985223117fa499ce84f8cfb028c4ffdfdf5d3ec19e905a11ed", hash_type: "type", + name: "M-NFT Issuer", + dep_type: "code", + tx_hashes: [ + "0x744d2c4c4e6fabe66cfb08cb818532c50fffc682a7614746328c5d691a811c06-0", + "0xbd262c87a84c08ea3bc141700cf55c1a285009de0e22c247a8d9597b4fc491e6-0", + "0x194a0f84de41d006a07ece07c96a8130100818599fcf0b2ecf49e512b873ed6e-0", + "0x3ecf42927509645dec38667d557dd9ba20d0d07267d769983495c1b6b9c70cc4-0", + "0xf11ccb6079c1a4b3d86abe2c574c5db8d2fd3505fdc1d5970b69b31864a4bd1c-0", + ], + description: "" }, + { code_hash: "0x095b8c0b4e51a45f953acd1fcd1e39489f2675b4bc94e7af27bb38958790e3fc", hash_type: "type", + name: "M-NFT Class", + dep_type: "code", + tx_hashes: [ + "0x4f27e40b302bcb3bf0af3deae460f46076de2b4db30c0212b14b341c20fcb330-0", + "0xbd262c87a84c08ea3bc141700cf55c1a285009de0e22c247a8d9597b4fc491e6-1", + "0x194a0f84de41d006a07ece07c96a8130100818599fcf0b2ecf49e512b873ed6e-1", + "0x3ecf42927509645dec38667d557dd9ba20d0d07267d769983495c1b6b9c70cc4-1", + "0xf11ccb6079c1a4b3d86abe2c574c5db8d2fd3505fdc1d5970b69b31864a4bd1c-1", + ] }, + { code_hash: "0xb1837b5ad01a88558731953062d1f5cb547adf89ece01e8934a9f0aeed2d959f", hash_type: "type", + name: "M-NFT", + dep_type: "code", + tx_hashes: [ + "0x7f9e3c1a2fc90411eb90fc2363101f6bd7b33875c3535117db5e52cd8a78b313-0", + "0xbd262c87a84c08ea3bc141700cf55c1a285009de0e22c247a8d9597b4fc491e6-2", + "0x194a0f84de41d006a07ece07c96a8130100818599fcf0b2ecf49e512b873ed6e-2", + "0x3ecf42927509645dec38667d557dd9ba20d0d07267d769983495c1b6b9c70cc4-2", + "0xf11ccb6079c1a4b3d86abe2c574c5db8d2fd3505fdc1d5970b69b31864a4bd1c-2", + ] }, + { code_hash: "0x577a5e5930e2ecdd6200765f3442e6119dc99e87df474f22f13cab819c80b242", hash_type: "type", + name: "FlashSigner", + dep_type: "dep_group", + tx_hashes: ["0xb66776ff3244033fcd15312ae8b17d384c11bebbb923fce3bd896d89f4744d48-0"] }, + { code_hash: "0x89cd8003a0eaf8e65e0c31525b7d1d5c1becefd2ea75bb4cff87810ae37764d8", hash_type: "type", + name: "CoTA", + dep_type: "dep_group", + description: "A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs.", + tx_hashes: [ + "0xd8c7396f955348bd74a8ed4398d896dad931977b7c1e3f117649765cd3d75b86-0", + ] }, + { code_hash: "0x9302db6cc1344b81a5efee06962abcb40427ecfcbe69d471b01b2658ed948075", hash_type: "type", + name: "CoTA Registry", + dep_type: "dep_group", + description: "A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs.", + tx_hashes: [ + "0xd8c7396f955348bd74a8ed4398d896dad931977b7c1e3f117649765cd3d75b86-0", + ] }, + { code_hash: "0x85ae4db0dd83f428a31deb342e4000af37ce2c9645d9e619df00096e3c50a2bb", hash_type: "type", + name: "Godwoken Custodian Lock", + dep_type: "code", + description: "Rollup uses the custodian lock to hold the deposited assets.", + tx_hashes: ["0x7aed145beb6984fff008ca6224d0726d06a19959c4f01d15e49942d76e28747a-0"] }, + { code_hash: "0x50704b84ecb4c4b12b43c7acb260ddd69171c21b4c0ba15f3c469b7d143f6f18", hash_type: "type", + name: "Godwoken Deposit Lock", + dep_type: "code", + description: "A layer1 user can join the Rollup by creating a deposit cell.", tx_hashes: ["0x9caeec735f3cd2a60b9d12be59bb161f7c61ddab1ac22c4383a94c33ba6404a2-0"] }, + { code_hash: "0x06ae0706bb2d7997d66224741d3ec7c173dbb2854a6d2cf97088796b677269c6", hash_type: "type", + name: "Godwoken Withdrawal Lock", + dep_type: "code", + description: "Withdrawal cells are generated in the RollupSubmitBlock action according to the block.withdrawals field.", + tx_hashes: ["0x9c607a9a75ea4699dd01b1c2a478002343998cac8346d2aa582f35b532bd2b93-0"] }, + { code_hash: "0x5a86c3bf1e8648b6a6f8abe6875720ccf9745ab225b68fa7c195f9d6635dea80", hash_type: "type", + dep_type: "code", + name: "Godwoken Challenge Lock", + description: "When a Godwoken node found that an invalid state exists in the Rollup, the node can send the RollupEnterChallenge action to the Rollup cell and generate a challenging cell.", + tx_hashes: ["0x15598fb4d3fc4b7e0afcffc80ed0c02b62edb3f7875771f0397f17eef712b65d-0"] }, + { code_hash: "0x7f5a09b8bd0e85bcf2ccad96411ccba2f289748a1c16900b0635c2ed9126f288", hash_type: "type", + name: "Godwoken Stake Lock", + dep_type: "code", + description: "A block producer is required to provide a stake cell to perform the RollupSubmitBlock action.", + tx_hashes: ["0x053fdb4ed3181eab3a3a5f05693b53a8cdec0a24569e16369f444bac48be7de9-0"] }, + { code_hash: "0x1e44736436b406f8e48a30dfbddcf044feb0c9eebfe63b0f81cb5bb727d84854", hash_type: "type", + name: "Godwoken State Validator", + dep_type: "code", + description: "State validator is the major script to verify the on-chain Rollup cell. Rollup cell is an identity cell on CKB, it stores the structure GlobalState which represents the layer-2 state.", + tx_hashes: ["0xbcd73881ba53f1cd95d0c855395c4ffe6f54e041765d9ab7602d48a7cb71612e-0"] }, + { code_hash: "0x07521d0aa8e66ef441ebc31204d86bb23fc83e9edc58c19dbb1b0ebe64336ec0", hash_type: "type", + name: "Godwoken ETH Account Lock", + dep_type: "code", + description: "A layer-2 lock script, ETH account lock is a script that verifies the layer-2 account signature.", + tx_hashes: ["0x21da20f275af89ca7172cb1cd7fcb8676056e4212ba3782e8c77afebae57c6ed-0"] }, + { code_hash: "0x79f90bb5e892d80dd213439eeab551120eb417678824f282b4ffb5f21bad2e1e", hash_type: "type", + name: "OMNI Lock V1", + dep_type: "code", + tx_hashes: ["0x9154df4f7336402114d04495175b37390ce86a4906d2d4001cf02c3e6d97f39c-0"], + description: "Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future." }, + { code_hash: "0xf329effd1c475a2978453c8600e1eaf0bc2087ee093c3ee64cc96ec6847752cb", hash_type: "type", + name: "OMNI Lock V2", + tx_hashes: ["0xec18bf0d857c981c3d1f4e17999b9b90c484b303378e94de1a57b0872f5d4602-0"], + dep_type: "code", + description: "Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future." }, + { code_hash: "0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac", hash_type: "type", + name: "JoyID", + dep_type: "dep_group", + description: "An universal Account Protocol for Web3 Mass-adoption.", + tx_hashes: ["0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263-0"] }, + { code_hash: "0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb", hash_type: "type", + name: "xUDT(final_rls)", + description: "Extensible UDT that derived from sUDT's programmability to support a wider range of scenarios", + dep_type: "code", + tx_hashes: ["0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f-0"] }, + { code_hash: "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494", hash_type: "data1", + name: "Spore(v1 latest)", + dep_type: "code", + tx_hashes: ["0xfd694382e621f175ddf81ce91ce2ecf8bfc027d53d7d31b8438f7d26fc37fd19-0"], + description: "Spore Protocol infuses digital assets with enduring value backed by tokenomics, redeemable at any time. Ensures true on-chain ownership, privacy, creative freedom and frictionless interaction." }, + { code_hash: "0x685a60219309029d01310311dba953d67029170ca4848a4ff638e57002130a0d", hash_type: "data1", + name: "Spore(v2 preview)", + dep_type: "code", + tx_hashes: ["0x5e8d2a517d50fd4bb4d01737a7952a1f1d35c8afc77240695bb569cd7d9d5a1f-0"], + description: "Spore Protocol infuses digital assets with enduring value backed by tokenomics, redeemable at any time. Ensures true on-chain ownership, privacy, creative freedom and frictionless interaction." }, + { code_hash: "0x598d793defef36e2eeba54a9b45130e4ca92822e1d193671f490950c3b856080", hash_type: "data1", + name: "Spore Cluster(v1 latest)", + dep_type: "code", + tx_hashes: ["0x49551a20dfe39231e7db49431d26c9c08ceec96a29024eef3acc936deeb2ca76-0"], + description: "" }, + { code_hash: "0x0bbe768b519d8ea7b96d58f1182eb7e6ef96c541fbd9526975077ee09f049058", hash_type: "data1", + name: "Spore Cluster(v2 preview)", + dep_type: "code", + tx_hashes: ["0xcebb174d6e300e26074aea2f5dbd7f694bb4fe3de52b6dfe205e54f90164510a-0"], + description: "" }, + { code_hash: "0x923e997654b2697ee3f77052cb884e98f28799a4270fd412c3edb8f3987ca622", hash_type: "data1", + name: "Spore Cluster Agent(v2 preview)", + dep_type: "code", + tx_hashes: ["0x52210232292d10c51b48e72a2cea60d8f0a08c2680a97a8ee7ca0a39379f0036-0"], + description: "" }, + { code_hash: "0x4349889bda064adab8f49f7dd8810d217917f7df28e9b2a1df0b74442399670a", hash_type: "data1", + name: "Spore Cluster Proxy(v2 preview)", + dep_type: "code", + tx_hashes: ["0xc5a41d58155b11ecd87a5a49fdcb6e83bd6684d3b72b2f3686f081945461c156-0"], + description: "" }, + { code_hash: "0x61ca7a4796a4eb19ca4f0d065cb9b10ddcf002f10f7cbb810c706cb6bb5c3248", hash_type: "type", + name: "RGB++", + dep_type: "code", + description: "RGB++ Lock", + tx_hashes: ["0xf1de59e973b85791ec32debbba08dff80c63197e895eb95d67fc1e9f6b413e00-0"] }, + { code_hash: "0xd07598deec7ce7b5665310386b4abd06a6d48843e953c5cc2112ad0d5a220364", hash_type: "type", + name: "RGB++", + dep_type: "code", + tx_hashes: ["0x61efdeddbaa0bb4132c0eb174b3e8002ff5ec430f61ba46f30768d683c516eec-0"], + description: "RGB++ Lock" }, + { code_hash: "0x8e341bcfec6393dcd41e635733ff2dca00a6af546949f70c57a706c0f344df8b", hash_type: "data1", + name: "Unique Cell", + dep_type: "code", + tx_hashes: ["0xff91b063c78ed06f10a1ed436122bd7d671f9a72ef5f5fa28d05252c17cf4cef-0"], + description: "A unique cell can be created on the Nervos CKB through TypeID which makes sure the unique cell cannot be updated or destroyed." }, + { code_hash: "0x00cdf8fab0f8ac638758ebf5ea5e4052b1d71e8a77b9f43139718621f6849326", hash_type: "type", + name: "Btc Time Lock", + dep_type: "code", + tx_hashes: ["0xde0f87878a97500f549418e5d46d2f7704c565a262aa17036c9c1c13ad638529-0"], + description: "A lock require n confirmations of Bitcoin transaction to unlock the cell." }, + { code_hash: "0x80a09eca26d77cea1f5a69471c59481be7404febf40ee90f886c36a948385b55", hash_type: "type", + name: "Btc Time Lock", + dep_type: "code", + tx_hashes: ["0x5364b3535965e9eac9a35dd7af8e9e45a61d30a16e115923c032f80b28783e21-0"], + description: "A lock require n confirmations of Bitcoin transaction to unlock the cell." }, + { code_hash: "0x0b1f412fbae26853ff7d082d422c2bdd9e2ff94ee8aaec11240a5b34cc6e890f", hash_type: "type", + tx_hashes: ["0x37f82dd30435575954cc7a9e2292f238ed24d71b0d57a55d8a2fc8a08aa1accf-0"], + name: "DID", + dep_type: "code", + description: "" }, + { code_hash: "0x6ae5ee0cb887b2df5a9a18137315b9bdc55be8d52637b2de0624092d5f0c91d5", hash_type: "type", + name: "Nostr", + dep_type: "code", + tx_hashes: ["0xa2a434dcdbe280b9ed75bb7d6c7d68186a842456aba0fc506657dc5ed7c01d68-0"], + description: "The Nostr lock script is designed for interoperability with Nostr." }, + { code_hash: "0x8290467a512e5b9a6b816469b0edabba1f4ac474e28ffdd604c2a7c76446bbaf", hash_type: "data1", + name: "Single Use Lock", + dep_type: "code", + tx_hashes: ["0xb4f171c9c9caf7401f54a8e56225ae21d95032150a87a4678eac3f66a3137b93-4"], + description: "A lock script that can only be used once." }, + { code_hash: "0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3", hash_type: "data1", + name: "iCKB Logic", + dep_type: "dep_group", + tx_hashes: ["0xf7ece4fb33d8378344cab11fcd6a4c6f382fd4207ac921cf5821f30712dcd311-0"], + description: "iCKB Logic tokenizes NervosDAO deposits into the iCKB xUDT token." }, + { code_hash: "0xacc79e07d107831feef4c70c9e683dac5644d5993b9cb106dca6e74baa381bd0", hash_type: "data1", + name: "WR Owned-Owner", + dep_type: "dep_group", + tx_hashes: ["0xf7ece4fb33d8378344cab11fcd6a4c6f382fd4207ac921cf5821f30712dcd311-0"], + description: + "WR Owned-Owner enable to create Withdrawals Request from NervosDAO deposits locked with zero length args locks, developed as part of iCKB." }, + { code_hash: "0x49dfb6afee5cc8ac4225aeea8cb8928b150caf3cd92fea33750683c74b13254a", hash_type: "data1", + name: "UDT Limit Orderr", + dep_type: "dep_group", + tx_hashes: ["0xf7ece4fb33d8378344cab11fcd6a4c6f382fd4207ac921cf5821f30712dcd311-0"], + description: "UDT Limit Order is a general purpose UDT based Limit Order, developed as part of iCKB." }, + ] + end + + error_hashes = [] + hashes.each do |hash| + case hash[:dep_type] + when "code" + hash[:tx_hashes].each do |tx| + tx_hash, cell_index = tx.split("-") + co = CellOutput.find_by(tx_hash:, cell_index:) + contract = Contract.find_by(deployed_cell_output_id: co.id) + contract.update(verified: true, name: hash[:name], description: hash[:description], hash_type: hash[:hash_type], deprecated: hash[:deprecated]) + end + when "dep_group" + hash[:tx_hashes].each do |tx| + tx_hash, cell_index = tx.split("-") + contract_cell = CellOutput.find_by(tx_hash:, cell_index:) + deployed_ids = CellDepsOutPoint.where(contract_cell_id: contract_cell.id).pluck(:deployed_cell_output_id) + contract = + if hash[:hash_type] == "type" + Contract.where(deployed_cell_output_id: deployed_ids).where(type_hash: hash[:code_hash]) + else + Contract.where(deployed_cell_output_id: deployed_ids).where(data_hash: hash[:code_hash]) + end + if contract.length == 1 + contract.first.update(verified: true, name: hash[:name], description: hash[:description], hash_type: hash[:hash_type], deprecated: hash[:deprecated]) + else + error_hashes << hash[:code_hash] + end + end + end + rescue StandardError => e + puts e.inspect + error_hashes << hash[:tx_hashes] + end + puts error_hashes.join(",") + end + + puts "done" +end diff --git a/lib/tasks/migration/init_contracts.rake b/lib/tasks/migration/init_contracts.rake deleted file mode 100644 index 47b26ca12..000000000 --- a/lib/tasks/migration/init_contracts.rake +++ /dev/null @@ -1,54 +0,0 @@ -namespace :migration do - desc "Usage: RAILS_ENV=production bundle exec rake migration:init_contracts" - task init_contracts: :environment do - ApplicationRecord.transaction do - if ENV['CKB_NET_MODE'] == 'mainnet' - hashes = [ - { code_hash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8', hash_type: 'type', name: 'SECP256K1/blake160', description: 'SECP256K1/blake160 is the default lock script to verify CKB transaction signature.', role: 'lock_script' }, - { code_hash: '0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8', hash_type: 'type', name: 'SECP256K1/multisig', description: 'SECP256K1/multisig is a script which allows a group of users to sign a single transaction.', role: 'lock_script' }, - { code_hash: '0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354', hash_type: 'type', name: 'Anyone-Can-Pay Lock', description: 'anyone_can_pay allows a recipient to provide cell capacity in asset transfer.', role: 'type_script' }, - { code_hash: '0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e', hash_type: 'type', name: 'Nervos DAO', description: 'Nervos DAO is a smart contract with which users can interact the same way as any smart contract on CKB.', role: 'type_script' }, - { code_hash: '0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5', hash_type: 'type', name: 'Simple UDT', description: 'Simple UDT provides a way for dapp developers to issue custom tokens on Nervos CKB.', role: 'type_script' }, - { code_hash: '0xd01f5152c267b7f33b9795140c2467742e8424e49ebe2331caec197f7281b60a', hash_type: 'type', name: 'Unipass', description: 'Simple UDT provides a way for dapp developers to issue custom tokens on Nervos CKB.', role: 'type_script' }, - { code_hash: '0x1122a4fb54697cf2e6e3a96c9d80fd398a936559b90954c6e88eb7ba0cf652df', hash_type: 'type', name: 'CoTA', description: 'A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs.', role: 'type_script' }, - { code_hash: '0x90ca618be6c15f5857d3cbd09f9f24ca6770af047ba9ee70989ec3b229419ac7', hash_type: 'type', name: 'CoTA Registry', description: 'A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs.', role: 'type_script' }, - { code_hash: '0xbf43c3602455798c1a61a596e0d95278864c552fafe231c063b3fabf97a8febc', hash_type: 'type', name: 'PW Lock', description: "Forked from CKB's system scripts, and currently supports signature generated by personalSign and signTypedData from ethereum wallets.", role: 'type_script' }, - { code_hash: '0x000f87062a2fe9bb4a6cc475212ea11014b84deb32e0375ee51e6ec4a553e009', hash_type: 'type', name: 'godwoken_custodian_lock', description: 'Rollup uses the custodian lock to hold the deposited assets.', role: 'type_script' }, - { code_hash: '0xff602581f07667eef54232cce850cbca2c418b3418611c132fca849d1edcd775', hash_type: 'type', name: 'godwoken_deposit_lock', description: 'A layer1 user can join the Rollup by creating a deposit cell.', role: 'type_script' }, - { code_hash: '0x3714af858b8b82b2bb8f13d51f3cffede2dd8d352a6938334bb79e6b845e3658', hash_type: 'type', name: 'godwoken_withdrawal_lock', description: 'Withdrawal cells are generated in the RollupSubmitBlock action according to the block.withdrawals field.', role: 'type_script' }, - { code_hash: '0x628b5f956b46ae27b50819a9ebab79ce5f957e6899ba0c75b8e142de2ed0dcd2', hash_type: 'type', name: 'godwoken_challenge_lock', description: 'When a Godwoken node found that an invalid state exists in the Rollup, the node can send the RollupEnterChallenge action to the Rollup cell and generate a challenging cell.' }, - { code_hash: '0xb619184ab9142c51b0ee75f4e24bcec3d077eefe513115bad68836d06738fd2c', hash_type: 'type', name: 'godwoken_stake_lock', description: 'A block producer is required to provide a stake cell to perform the RollupSubmitBlock action.', role: 'type_script' }, - { code_hash: '0xa4398768d87bd17aea1361edc3accd6a0117774dc4ebc813bfa173e8ac0d086d', hash_type: 'type', name: 'omni_lock v1', description: 'Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future.', role: 'lock_script' }, - { code_hash: '0x9b819793a64463aed77c615d6cb226eea5487ccfc0783043a587254cda2b6f26', hash_type: 'type', name: 'omni_lock v2', description: 'Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future.', role: 'lock_script' }, - { code_hash: '0xfef1d086d9f74d143c60bf03bd04bab29200dbf484c801c72774f2056d4c6718', hash_type: 'type', name: 'godwoken_state_validator', description: 'State validator is the major script to verify the on-chain Rollup cell. Rollup cell is an identity cell on CKB, it stores the structure GlobalState which represents the layer-2 state.', role: 'type_script' }, - { code_hash: '0x096df264f38fff07f3acd318995abc2c71ae0e504036fe32bc38d5b6037364d4', hash_type: 'type', name: 'godwoken_eth_account_lock', description: 'A layer-2 lock script, ETH account lock is a script that verifies the layer-2 account signature.', role: 'type_script' } - ] - else - hashes = [ - { code_hash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8', hash_type: 'type', name: 'SECP256K1/blake160', description: 'SECP256K1/blake160 is the default lock script to verify CKB transaction signature.', role:'lock_script' }, - { code_hash: '0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8', hash_type: 'type', name: 'SECP256K1/multisig', description: 'SECP256K1/multisig is a script which allows a group of users to sign a single transaction.', role:'lock_script' }, - { code_hash: '0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356', hash_type: 'type', name: 'Anyone-Can-Pay Lock', description: 'anyone_can_pay allows a recipient to provide cell capacity in asset transfer.', role: 'type_script' }, - { code_hash: '0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e', hash_type: 'type', name: 'Nervos DAO', description: 'Nervos DAO is a smart contract with which users can interact the same way as any smart contract on CKB.', role: 'type_script' }, - { code_hash: '0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4', hash_type: 'type', name: 'Simple UDT', description: 'Simple UDT provides a way for dapp developers to issue custom tokens on Nervos CKB.' , role: 'type_script'}, - { code_hash: '0x3e1eb7ed4809b2d60650be96a40abfbdafb3fb942b7b37ec7709e64e2cd0a783', hash_type: 'type', name: 'Unipass', description: 'Simple UDT provides a way for dapp developers to issue custom tokens on Nervos CKB.', role: 'type_script' }, - { code_hash: '0x89cd8003a0eaf8e65e0c31525b7d1d5c1becefd2ea75bb4cff87810ae37764d8', hash_type: 'type', name: 'CoTA', description: 'A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs.', role: 'type_script' }, - { code_hash: '0x9302db6cc1344b81a5efee06962abcb40427ecfcbe69d471b01b2658ed948075', hash_type: 'type', name: 'CoTA Registry', description: 'A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs.', role: 'type_script', role: 'type_script' }, - { code_hash: '0x58c5f491aba6d61678b7cf7edf4910b1f5e00ec0cde2f42e0abb4fd9aff25a63', hash_type: 'type', name: 'PW Lock', description: "Forked from CKB's system scripts, and currently supports signature generated by personalSign and signTypedData from ethereum wallets.", role: 'type_script' }, - { code_hash: '0x85ae4db0dd83f428a31deb342e4000af37ce2c9645d9e619df00096e3c50a2bb', hash_type: 'type', name: 'godwoken_custodian_lock', description: 'Rollup uses the custodian lock to hold the deposited assets.', role: 'type_script' }, - { code_hash: '0x50704b84ecb4c4b12b43c7acb260ddd69171c21b4c0ba15f3c469b7d143f6f18', hash_type: 'type', name: 'godwoken_deposit_lock', description: 'A layer1 user can join the Rollup by creating a deposit cell.', role: 'type_script' }, - { code_hash: '0x06ae0706bb2d7997d66224741d3ec7c173dbb2854a6d2cf97088796b677269c6', hash_type: 'type', name: 'godwoken_withdrawal_lock', description: 'Withdrawal cells are generated in the RollupSubmitBlock action according to the block.withdrawals field.', role: 'type_script' }, - { code_hash: '0x5a86c3bf1e8648b6a6f8abe6875720ccf9745ab225b68fa7c195f9d6635dea80', hash_type: 'type', name: 'godwoken_challenge_lock', description: 'When a Godwoken node found that an invalid state exists in the Rollup, the node can send the RollupEnterChallenge action to the Rollup cell and generate a challenging cell.', role: 'type_script', role: 'type_script' }, - { code_hash: '0x7f5a09b8bd0e85bcf2ccad96411ccba2f289748a1c16900b0635c2ed9126f288', hash_type: 'type', name: 'godwoken_stake_lock', description: 'A block producer is required to provide a stake cell to perform the RollupSubmitBlock action.', role: 'type_script' }, - { code_hash: '0x79f90bb5e892d80dd213439eeab551120eb417678824f282b4ffb5f21bad2e1e', hash_type: 'type', name: 'omni_lock v1', description: 'Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future.', role: 'lock_script' }, - { code_hash: '0xf329effd1c475a2978453c8600e1eaf0bc2087ee093c3ee64cc96ec6847752cb', hash_type: 'type', name: 'omni_lock v2', description: 'Omnilock is a lock script designed for interoperability. It comes with built-in support for verification of transaction signing methods used in Bitcoin, Ethereum, EOS, and Dogecoin. Omnilock is also extensible, so more verification algorithms can be added in future.', role: 'lock_script' }, - { code_hash: '0x1e44736436b406f8e48a30dfbddcf044feb0c9eebfe63b0f81cb5bb727d84854', hash_type: 'type', name: 'godwoken_state_validator', description: 'State validator is the major script to verify the on-chain Rollup cell. Rollup cell is an identity cell on CKB, it stores the structure GlobalState which represents the layer-2 state.', role: 'type_script' }, - { code_hash: '0x07521d0aa8e66ef441ebc31204d86bb23fc83e9edc58c19dbb1b0ebe64336ec0', hash_type: 'type', name: 'godwoken_eth_account_lock', description: 'A layer-2 lock script, ETH account lock is a script that verifies the layer-2 account signature.', role: 'type_script' } - ] - end - - hashes.each {|hash| Contract.create(hash) unless Contract.exists?(code_hash: hash[:code_hash]) } - end - - puts "done" - end -end