From 98abc2c02e2e5e10d30f6e255ea1e31b2d74e0ab Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 27 Dec 2024 22:29:01 +0800 Subject: [PATCH 1/9] Init corn --- .../daily_spellbook/models/evms/evms_info.sql | 4 +- .../_base_sources/evm/corn_base_sources.yml | 429 ++++++++++++++++++ sources/_base_sources/evm/corn_docs_block.md | 145 ++++++ 3 files changed, 577 insertions(+), 1 deletion(-) create mode 100644 sources/_base_sources/evm/corn_base_sources.yml create mode 100644 sources/_base_sources/evm/corn_docs_block.md diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql index 9a2a98639a3..eafc9d3b719 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql @@ -10,6 +10,7 @@ , "bnb" , "boba" , "celo" + , "corn" , "ethereum" , "fantom" , "flare" @@ -69,7 +70,7 @@ FROM ( , (288, 'boba', 'Boba Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://bobascan.com/', timestamp '2021-10-28 05:03', 'OP Stack', 'Ethereum', 'Ethereum', true) , (7700, 'canto', 'Canto', 'Layer 2', NULL, 'ETH', NULL, 'https://evm.explorer.canto.io/', timestamp '2022-07-26 19:27', NULL, 'Ethereum', 'Ethereum', false) , (420, 'optimism_goerli', 'Optimism Goerli', 'Testnet', 'Optimistic Rollup', 'GTH', 0x4200000000000000000000000000000000000006, 'https://optimism-goerli.blockscout.com/', timestamp '2022-06-09 16:55', 'OP Stack', 'Goerli', 'Goerli', false) - , (1313161554, 'aurora', 'Aurora', 'Layer 2', NULL, 'ETH', 0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB, 'https://explorer.aurora.dev/', timestamp '2020-07-21 21:50:11', NULL, NULL, NULL, false) + , (1313161554, 'aurora', 'Aurora', 'Layer 2', NULL, 'ETH', 0xC9BdeDd158A2e3b13e9badaeABaFc5516e95e8C7, 'https://explorer.aurora.dev/', timestamp '2020-07-21 21:50:11', NULL, NULL, NULL, false) , (8217, 'kaia', 'Kaia', 'Layer 1', NULL, 'KAIA', 0xe4f05a66ec68b54a58b17c22107b02e0232cc817, 'https://kaiascope.com/', timestamp '2019-06-25 13:41:14', NULL, NULL, NULL, true) , (34443, 'mode', 'Mode', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.mode.network/', timestamp '2023-11-16 20:46:23', 'OP Stack', 'Ethereum Blobs', 'Ethereum', true) , (291, 'orderly', 'Orderly Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.orderly.network/', timestamp '2023-10-06 16:03:49', 'OP Stack', 'Ethereum', 'Ethereum', false) @@ -95,4 +96,5 @@ FROM ( , (2020, 'ronin', 'Ronin', 'Layer 1', null, 'RON', 0xe514d9deb7966c8be0ca922de8a064264ea6bcd4, 'https://app.roninchain.com/', timestamp '2021-01-25 10:49', NULL, NULL, NULL, true) , (14, 'flare', 'Flare', 'Layer 1', NULL, 'FLR', NULL, 'https://flare-explorer.flare.network/', timestamp '2022-07-13 15:32', NULL, NULL, NULL, true) , (88, 'viction', 'Viction', 'Layer 1', NULL, 'VIC', 0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce, 'https://vicscan.xyz/', timestamp '2018-12-14 07:50:20', NULL, NULL, NULL, true) + , (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, false) ) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement, is_on_dune) diff --git a/sources/_base_sources/evm/corn_base_sources.yml b/sources/_base_sources/evm/corn_base_sources.yml new file mode 100644 index 00000000000..526d09da75f --- /dev/null +++ b/sources/_base_sources/evm/corn_base_sources.yml @@ -0,0 +1,429 @@ +version: 2 + +sources: + # Corn Tables + - name: corn + description: "raw tables for the chain" + + tables: + - name: transactions + meta: + docs_slug: /evm/corn/raw/transactions + short_description: The transactions table contains detailed information about transactions on the network. + description: '{{ doc("corn_transactions_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: value + description: "Amount of BTCN sent from sender to recipient (if any), measured in wei (1 BTCN = 10^18 wei)" + - name: gas_limit + description: "Maximum number of gas units this transaction can consume" + - name: gas_price + description: "Price per unit of gas for this transaction, denominated in wei" + - name: gas_used + description: "Actual amount of gas units consumed by this transaction's execution" + - name: max_fee_per_gas + description: "Maximum total amount per gas unit the initiator is willing to pay" + - name: max_priority_fee_per_gas + description: "Maximum additional fee per gas unit the initiator is willing to pay as a tip to validators" + - name: priority_fee_per_gas + description: "Actual priority fee per gas paid to validators" + - name: nonce + description: "Sequential number representing the count of transactions sent from the sender's address" + - name: index + description: "Position of this transaction within its containing block" + - name: success + description: "Boolean flag indicating whether the transaction executed successfully (true) or failed (false)" + - name: from + description: "Address of the account that initiated and signed this transaction" + - name: to + description: "Address of the recipient account or contract for this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: data + description: "Input data for the transaction, which may include function calls or contract interaction data" + - name: hash + description: "Unique 256-bit identifier (hash) of this specific transaction" + - name: type + description: "Type of transaction (e.g., legacy, EIP-1559) indicating its structure and fee mechanism" + - name: access_list + description: "List of addresses and storage keys the transaction plans to access, used for gas optimization in EIP-2930 transactions" + - name: chain_id + description: "Chain identifier for the network" + - name: block_date + description: "The UTC date of the block in which this transaction was included" + + - name: traces + meta: + docs_slug: /evm/corn/raw/traces + short_description: The traces table contains information about traces on the network. + description: '{{ doc("corn_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: value + description: "Amount of BTCN sent from sender to recipient (if any), measured in wei (1 BTCN = 10^18 wei)" + - name: gas + description: "Amount of gas allocated for this trace's execution (including gas used by child traces)" + - name: gas_used + description: "Actual amount of gas consumed by this trace's execution" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: success + description: "Boolean flag indicating whether this specific trace was executed successfully (true) or reverted (false)" + - name: tx_index + description: "Position of the parent transaction within its containing block" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: sub_traces + description: "Number of child traces spawned by this trace during execution" + - name: error + description: "Error message or code if the trace execution failed" + - name: tx_success + description: "Boolean flag indicating whether the parent transaction of this trace was successful" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: from + description: "Address that sent this trace" + - name: to + description: "Address that received this trace" + - name: trace_address + description: "Array indicating the exact position of this trace within the trace tree" + - name: type + description: "Type of trace (e.g., call, create, suicide) indicating the nature of the operation" + - name: address + description: "If this trace is a contract creation, this is the address of the deployed contract" + - name: code + description: "If this trace is a contract creation, this is the deployed bytecode of contract" + - name: call_type + description: "Type of call made in this trace (e.g., call, delegatecall, staticcall)" + - name: input + description: "Call data provided to this trace, often containing function signatures and parameters" + - name: output + description: "Data returned by this trace after execution" + - name: refund_address + description: "Address designated to receive any gas refund from this trace" + - name: revert_reason + description: "Reason for reversion if the trace was reverted" + - name: block_date + description: "The UTC date of the block in which this transaction was included" + + - name: traces_decoded + meta: + docs_slug: /evm/corn/decoded/traces_decoded + short_description: The `corn.traces_decoded` table contains decoded traces, including additional information based on submitted smart contracts and their ABIs. + description: '{{ doc("corn_traces_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract involved in this trace" + - name: to + description: "Address of the contract or account receiving this trace" + - name: trace_address + description: "Array indicating the exact position of this trace within the trace tree of the transaction" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: signature + description: "Function signature hash" + - name: function_name + description: "Name of the specific contract function called in this trace" + + - name: logs + meta: + docs_slug: /evm/corn/raw/logs + short_description: The `corn.logs` table contains information about event logs emitted by smart contracts on the corn blockchain. + description: '{{ doc("corn_logs_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: tx_index + description: "Position of the parent transaction within its containing block" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: contract_address + description: "Address of the smart contract that emitted this log" + - name: topic0 + description: "First 32-byte topic, typically containing the event signature hash" + - name: topic1 + description: "Second 32-byte topic, often containing indexed event parameters" + - name: topic2 + description: "Third 32-byte topic, often containing indexed event parameters" + - name: topic3 + description: "Fourth 32-byte topic, often containing indexed event parameters" + - name: data + description: "ABI-encoded data of the log, containing non-indexed event parameters" + - name: index + description: "Position of this log within the block" + - name: tx_from + description: "Address that initiated the transaction which created this log" + - name: tx_to + description: "Recipient address of the transaction which created this log" + + - name: logs_decoded + meta: + docs_slug: /evm/corn/decoded/logs_decoded + short_description: The `corn.logs_decoded` table contains a subset of all logs for which Dune has the ABI. + description: '{{ doc("corn_logs_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract" + - name: contract_address + description: "Address of the smart contract that emitted this log" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: tx_from + description: "Address that initiated the transaction which created this log" + - name: tx_to + description: "Recipient address of the transaction which created this log" + - name: index + description: "Position of this log within the block" + - name: signature + description: "Event signature hash" + - name: event_name + description: "Human-readable name of the event" + + - name: contracts + meta: + docs_slug: /evm/corn/raw/contracts + short_description: The `corn.contracts` table tracks decoded contracts on corn, including associated metadata such as namespace, name, address, ABI. It is populated manually by the Dune Community via [contract decoding submissions](https://dune.com/contracts/new). + description: '{{ doc("corn_contracts_doc") }}' + columns: + - name: address + description: "Unique address of the contract on the blockchain" + - name: bytecode + description: "Compiled bytecode of the contract" + - name: name + description: "Human-readable name of the contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: abi + description: "JSON representation of the contract's Application Binary Interface" + - name: created_at + description: "Timestamp when this contract entry was created in the table" + + - name: contracts_submitted + meta: + docs_slug: /evm/corn/decoded/contracts_submitted + short_description: The `corn.contracts_submitted` table contains information about contracts submitted for decoding. + description: '{{ doc("corn_contracts_submitted_doc") }}' + columns: + - name: address + description: "Address of the submitted contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: name + description: "Name of the submitted contract" + - name: submitted_at + description: "Timestamp when the contract was submitted for decoding" + - name: submitted_by + description: "Address or identifier of the user who submitted the contract" + + - name: creation_traces + meta: + docs_slug: /evm/corn/raw/creation_traces + short_description: The `corn.creation_traces` table contains information about contract creation traces. + description: '{{ doc("corn_creation_traces_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: address + description: "Address of the created contract" + - name: from + description: "Address that created the contract" + - name: code + description: "Contract bytecode" + - name: success + description: "Whether the contract creation was successful" + - name: block_month + description: "The month of the block date" + + - name: blocks + meta: + docs_slug: /evm/corn/raw/blocks + short_description: The `corn.blocks` table contains information about blocks on the corn blockchain. + description: '{{ doc("corn_blocks_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: parent_hash + description: "Hash of the parent block" + - name: nonce + description: "Block nonce value" + - name: difficulty + description: "Block mining difficulty" + - name: gas_limit + description: "Maximum gas allowed in this block" + - name: gas_used + description: "Total gas used by all transactions in this block" + - name: miner + description: "Address of the miner/validator who produced this block" + - name: size + description: "Size of the block in bytes" + - name: total_difficulty + description: "Total chain difficulty up to this block" + - name: base_fee_per_gas + description: "Base fee per gas in this block (EIP-1559)" + - name: state_root + description: "Root hash of the state trie after this block" + - name: transactions_root + description: "Root hash of the transactions trie of this block" + - name: receipts_root + description: "Root hash of the receipts trie of this block" + - name: blob_gas_used + description: "Total blob gas used in this block" + - name: excess_blob_gas + description: "Excess blob gas in this block" + - name: parent_beacon_block_root + description: "Root hash of the parent beacon block" + + - name: erc20_corn + description: "Transfer events for ERC20 tokens on Corn blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/corn/raw/erc20_transfers + short_description: The evt_transfer table contains all ERC20 token transfer events on the Corn blockchain. + description: '{{ doc("erc20_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC20 token contract" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: value + description: "The amount of tokens transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: erc721_corn + description: "Transfer events for ERC721 tokens on Corn blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/corn/raw/erc721_transfers + short_description: The evt_transfer table contains all ERC721 token transfer events on the Corn blockchain. + description: '{{ doc("erc721_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC721 token contract" + - name: from + description: "The address sending the NFT" + - name: to + description: "The address receiving the NFT" + - name: tokenId + description: "The unique identifier of the NFT being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: erc1155_corn + description: "Transfer events for ERC1155 tokens on Corn blockchain" + tables: + - name: evt_transfersingle + meta: + docs_slug: /evm/corn/raw/erc1155_transfers_single + short_description: The evt_transfersingle table contains single token transfer events from ERC1155 contracts on the Corn blockchain. + description: '{{ doc("erc1155_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: id + description: "The identifier for the token being transferred" + - name: value + description: "The amount of tokens being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: evt_transferbatch + meta: + docs_slug: /evm/corn/raw/erc1155_transfers_batch + short_description: The evt_transferbatch table contains batch token transfer events from ERC1155 contracts on the Corn blockchain. + description: '{{ doc("erc1155_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: ids + description: "The array of token identifiers being transferred" + - name: values + description: "The array of amounts being transferred for each token id" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" diff --git a/sources/_base_sources/evm/corn_docs_block.md b/sources/_base_sources/evm/corn_docs_block.md new file mode 100644 index 00000000000..cd6437dd55c --- /dev/null +++ b/sources/_base_sources/evm/corn_docs_block.md @@ -0,0 +1,145 @@ +{% docs corn_transactions_doc %} + +The `corn.transactions` table contains detailed information about transactions on the Corn blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, from_address, to_address, value +- Gas data: gas_price, gas_limit, gas_used, max_fee_per_gas, priority_fee_per_gas +- Status: success or failure +- Input data for contract interactions +- Nonce and chain_id +- Transaction type and access list + +This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on Corn. + +{% enddocs %} + +{% docs corn_traces_doc %} + +The `corn.traces` table contains records of execution steps for transactions on the Corn blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: + +- Transaction hash and block information +- From and to addresses +- Value transferred +- Gas metrics (gas, gas_used) +- Input and output data +- Call type (e.g., CALL, DELEGATECALL, CREATE) +- Error information and revert reasons +- Trace address for nested calls +- Sub-traces count + +This table is essential for: +- Analyzing internal transactions +- Debugging smart contract interactions +- Tracking value flows through complex transactions +- Understanding contract creation and deployment + +{% enddocs %} + +{% docs corn_traces_decoded_doc %} + +The `corn.traces_decoded` table contains a subset of decoded traces from the Corn blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block information and transaction details +- Contract name and namespace +- Decoded function names and signatures +- Trace address for execution path tracking +- Transaction origin and destination + +This table is used for high level analysis of smart contract interactions. For fully decoded function calls and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs corn_logs_doc %} + +The `corn.logs` table contains event logs emitted by smart contracts on the Corn blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, index, from, to +- Contract address (emitting the event) +- Topic0 (event signature) +- Additional topics (indexed parameters) +- Data field (non-indexed parameters) +- Log index and transaction index + +This table is crucial for: +- Tracking on-chain events +- Monitoring contract activity +- Analyzing token transfers +- Following protocol-specific events + +{% enddocs %} + +{% docs corn_logs_decoded_doc %} + +The `corn.logs_decoded` table contains a subset of decoded logs from the Corn blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block and transaction information +- Contract details (name, namespace, address) +- Decoded event names and signatures +- Transaction origin and destination +- Event parameters (when available) + +This table is used for high level analysis of smart contract events. For fully decoded events and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs corn_blocks_doc %} + +The `corn.blocks` table contains information about Corn blocks. It provides essential data about each block in the Corn blockchain, including: + +- Block identifiers and timestamps +- Gas metrics and size +- Consensus information (difficulty, nonce) +- State roots and receipts +- Parent block information +- Blob gas information +- Parent beacon block root + +This table is used for analyzing block production, network capacity, and chain state. + +{% enddocs %} + +{% docs corn_contracts_doc %} + +The `corn.contracts` table contains information about verified smart contracts on the Corn blockchain. It includes: + +- Contract address +- Contract bytecode +- Contract name and namespace +- Contract ABI +- Creation timestamp + +This table is used for contract verification and analysis. + +{% enddocs %} + +{% docs corn_contracts_submitted_doc %} + +The `corn.contracts_submitted` table tracks contracts submitted for decoding on the Corn blockchain. It includes: + +- Contract address +- Contract name and namespace +- Submission details (timestamp, submitter) + +This table is used for managing contract submissions and decoding status. + +{% enddocs %} + +{% docs corn_creation_traces_doc %} + +The `corn.creation_traces` table contains information about contract creation events on the Corn blockchain. It includes: + +- Block and transaction information +- Creator address +- Created contract address +- Contract bytecode +- Creation success status +- Gas consumption + +This table is used for: +- Analyzing contract deployment patterns +- Tracking new contract deployments +- Understanding contract creation success rates + +{% enddocs %} From e12926caea18869a683b8545f4f89dee084619e6 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 27 Dec 2024 22:34:41 +0800 Subject: [PATCH 2/9] Recover aurora --- dbt_subprojects/daily_spellbook/models/evms/evms_info.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql index eafc9d3b719..c9b239f1fa1 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql @@ -70,7 +70,7 @@ FROM ( , (288, 'boba', 'Boba Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://bobascan.com/', timestamp '2021-10-28 05:03', 'OP Stack', 'Ethereum', 'Ethereum', true) , (7700, 'canto', 'Canto', 'Layer 2', NULL, 'ETH', NULL, 'https://evm.explorer.canto.io/', timestamp '2022-07-26 19:27', NULL, 'Ethereum', 'Ethereum', false) , (420, 'optimism_goerli', 'Optimism Goerli', 'Testnet', 'Optimistic Rollup', 'GTH', 0x4200000000000000000000000000000000000006, 'https://optimism-goerli.blockscout.com/', timestamp '2022-06-09 16:55', 'OP Stack', 'Goerli', 'Goerli', false) - , (1313161554, 'aurora', 'Aurora', 'Layer 2', NULL, 'ETH', 0xC9BdeDd158A2e3b13e9badaeABaFc5516e95e8C7, 'https://explorer.aurora.dev/', timestamp '2020-07-21 21:50:11', NULL, NULL, NULL, false) + , (1313161554, 'aurora', 'Aurora', 'Layer 2', NULL, 'ETH', 0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB, 'https://explorer.aurora.dev/', timestamp '2020-07-21 21:50:11', NULL, NULL, NULL, false) , (8217, 'kaia', 'Kaia', 'Layer 1', NULL, 'KAIA', 0xe4f05a66ec68b54a58b17c22107b02e0232cc817, 'https://kaiascope.com/', timestamp '2019-06-25 13:41:14', NULL, NULL, NULL, true) , (34443, 'mode', 'Mode', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.mode.network/', timestamp '2023-11-16 20:46:23', 'OP Stack', 'Ethereum Blobs', 'Ethereum', true) , (291, 'orderly', 'Orderly Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.orderly.network/', timestamp '2023-10-06 16:03:49', 'OP Stack', 'Ethereum', 'Ethereum', false) From b43843ca65a08b665f5951a30103fc99352574df Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 27 Dec 2024 23:27:37 +0800 Subject: [PATCH 3/9] Update docs --- sources/_base_sources/evm/corn_docs_block.md | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/sources/_base_sources/evm/corn_docs_block.md b/sources/_base_sources/evm/corn_docs_block.md index cd6437dd55c..a78e8b71ad4 100644 --- a/sources/_base_sources/evm/corn_docs_block.md +++ b/sources/_base_sources/evm/corn_docs_block.md @@ -143,3 +143,61 @@ This table is used for: - Understanding contract creation success rates {% enddocs %} + +{% docs erc20_corn_evt_transfer_doc %} + +The `erc20_corn.evt_transfer` table contains Transfer events from ERC20 token contracts on the Corn blockchain. Each record represents a token transfer and includes: + +- Token contract address +- Sender and recipient addresses +- Amount of tokens transferred +- Block and transaction information +- Event log details + +This table is essential for: +- Tracking token transfers and holder activity +- Analyzing token distribution patterns +- Monitoring token holder behavior +- Calculating token balances +- Understanding token velocity and liquidity + +{% enddocs %} + +{% docs erc721_corn_evt_transfer_doc %} + +The `erc721_corn.evt_transfer` table contains Transfer events from ERC721 (NFT) token contracts on the Corn blockchain. Each record represents an NFT transfer and includes: + +- NFT contract address +- Token ID +- Sender and recipient addresses +- Block and transaction information +- Event log details + +This table is used for: +- Tracking NFT ownership changes +- Analyzing NFT trading patterns +- Monitoring NFT collection activity +- Building NFT holder histories +- Understanding NFT market dynamics + +{% enddocs %} + +{% docs erc1155_corn_evt_transfer_doc %} + +The `erc1155_corn.evt_transfersingle` and `erc1155_corn.evt_transferbatch` tables contain Transfer events from ERC1155 token contracts on the Corn blockchain. These tables track both fungible and non-fungible token transfers within the same contract. They include: + +- Token contract address +- Token IDs +- Amounts transferred +- Sender, operator, and recipient addresses +- Block and transaction information +- Event log details + +These tables are essential for: +- Tracking multi-token transfers +- Analyzing gaming asset movements +- Monitoring hybrid token systems +- Understanding complex token ecosystems +- Building token holder analytics + +{% enddocs %} From 8b414d336c5d86ef5cc7992fcf6cb26660ae2ace Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 3 Jan 2025 15:41:54 +0800 Subject: [PATCH 4/9] Add corn trusted tokens --- .../tokens/models/prices/prices_trusted_tokens.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql index cb20a76eda0..1adb25c8472 100644 --- a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql @@ -61,6 +61,10 @@ WITH trusted_tokens AS ( , ('celo', 0xd629eb00deced2a080b7ec630ef6ac117e614f1b) , ('celo', 0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c) , ('celo', 0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e) + , ('corn', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2) -- WBTCN + , ('corn', 0xecac9c5f704e954931349da37f60e39f515c11c1) -- LBTC + , ('corn', 0xdf0b24095e15044538866576754f3c964e902ee6) -- USDC.e + , ('corn', 0xf469fbd2abcd6b9de8e169d128226c0fc90a012e) -- pumpBTC , ('ethereum', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) , ('ethereum', 0xdac17f958d2ee523a2206206994597c13d831ec7) , ('ethereum', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) From de4ccf4c85f24600f1858cb9a72a4067f5c105da Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 3 Jan 2025 15:50:55 +0800 Subject: [PATCH 5/9] Add prices_corn_tokens --- .../tokens/models/prices/corn/_schema.yml | 29 +++++++++++++++++++ .../models/prices/corn/prices_corn_tokens.sql | 25 ++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 dbt_subprojects/tokens/models/prices/corn/_schema.yml create mode 100644 dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql diff --git a/dbt_subprojects/tokens/models/prices/corn/_schema.yml b/dbt_subprojects/tokens/models/prices/corn/_schema.yml new file mode 100644 index 00000000000..db32a0ff44c --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/corn/_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: prices_corn_tokens + meta: + blockchain: corn + sector: prices + contributors: hosuke + config: + tags: ['prices', 'tokens', 'usd', 'corn'] + description: "Price tokens on Corn EVM chain" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - name: token_id + description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika." + - name: blockchain + description: "Native blockchain of the token, if any" + data_tests: + - accepted_values: + values: [ "corn" ] + - name: contract_address + description: "Contract address of the token, if any" + - name: symbol + description: "Token symbol" + - name: decimals + description: "Number of decimals for the token contract" \ No newline at end of file diff --git a/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql b/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql new file mode 100644 index 00000000000..484e6758742 --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql @@ -0,0 +1,25 @@ +{% set blockchain = 'corn' %} + +{{ config( + schema = 'prices_' + blockchain, + alias = 'tokens', + materialized = 'table', + file_format = 'delta', + tags = ['static'] + ) +}} + +SELECT + token_id + , '{{ blockchain }}' as blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('wbtc-wrapped-bitcoin', 'wBTCN', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 18) + , ('lbtc-lombard-staked-btc', 'LBTC', 0xecAc9C5F704e954931349Da37F60E39f515c11c1, 8) + , ('usdce-usd-coine', 'USDC.e', 0xDF0B24095e15044538866576754F3C964e902Ee6, 6) + , ('pumpbtc-pumpbtc', 'pumpBTC', 0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 8) +) as temp (token_id, symbol, contract_address, decimals) From 1c1da363809bad0ceab563563caf9d8122955ebd Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 3 Jan 2025 15:55:57 +0800 Subject: [PATCH 6/9] Update prices_tokens --- dbt_subprojects/tokens/models/prices/prices_tokens.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbt_subprojects/tokens/models/prices/prices_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_tokens.sql index 0f38cb25f82..cdd7fa82816 100644 --- a/dbt_subprojects/tokens/models/prices/prices_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_tokens.sql @@ -14,6 +14,7 @@ , "boba" , "cardano" , "celo" + , "corn" , "ethereum" , "fantom" , "flare" @@ -70,6 +71,7 @@ ref('prices_native_tokens') ,ref('prices_ronin_tokens') ,ref('prices_boba_tokens') ,ref('prices_viction_tokens') +,ref('prices_corn_tokens') ] %} From d8e8b7d543c691de1c71f5ad16249d1c89fc1172 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 3 Jan 2025 16:01:03 +0800 Subject: [PATCH 7/9] Add tokens_corn_erc20 --- .../tokens/models/tokens/corn/schema.yml | 25 +++++++++++++++++++ .../models/tokens/corn/tokens_corn_erc20.sql | 19 ++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 dbt_subprojects/tokens/models/tokens/corn/schema.yml create mode 100644 dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql diff --git a/dbt_subprojects/tokens/models/tokens/corn/schema.yml b/dbt_subprojects/tokens/models/tokens/corn/schema.yml new file mode 100644 index 00000000000..ae4fc75cb9d --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/corn/schema.yml @@ -0,0 +1,25 @@ +version: 2 + +models: + - name: tokens_corn_erc20 + meta: + blockchain: corn + sector: tokens + contributors: hosuke + config: + tags: ['tokens', 'corn', 'erc20'] + description: "Known CORN ERC20 tokens" + columns: + - name: contract_address + description: "Contract address of the ERC20 token" + data_tests: + - unique + - not_null + - name: symbol + description: "Symbol of the token" + data_tests: + - not_null + - name: decimals + description: "Number of decimals the token has" + data_tests: + - not_null diff --git a/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql b/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql new file mode 100644 index 00000000000..c9f598adb97 --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'tokens_corn' + ,alias = 'erc20' + ,tags = ['static'] + ,materialized = 'table' + ) +}} + +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 'wBTCN', 18) + , (0xecAc9C5F704e954931349Da37F60E39f515c11c1, 'LBTC', 8) + , (0xDF0B24095e15044538866576754F3C964e902Ee6, 'USDC.e', 6) + , (0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 'pumpBTC', 8) +) as temp (contract_address, symbol, decimals) From 48d995dd3e3184d27bacc969fb5920b0168cb949 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Fri, 3 Jan 2025 16:02:18 +0800 Subject: [PATCH 8/9] update tokens_erc20 --- dbt_subprojects/tokens/models/tokens/tokens_erc20.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql index e8854fb8cca..35e414bf635 100644 --- a/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql @@ -12,6 +12,7 @@ ,"bnb" ,"boba" ,"celo" + ,"corn" ,"ethereum" ,"fantom" ,"fuse" @@ -77,6 +78,7 @@ ,'tokens_boba': {'blockchain': 'boba', 'model': ref('tokens_boba_erc20')} ,'tokens_viction': {'blockchain': 'viction', 'model': ref('tokens_viction_erc20')} ,'tokens_sonic': {'blockchain': 'sonic', 'model': ref('tokens_sonic_erc20')} + ,'tokens_corn': {'blockchain': 'corn', 'model': ref('tokens_corn_erc20')} } %} with automated_source as ( From 961ad11f777281e5eb1a28c71bae8522e7a694a8 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Sat, 4 Jan 2025 17:31:51 +0800 Subject: [PATCH 9/9] Update dbt_subprojects/daily_spellbook/models/evms/evms_info.sql Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- dbt_subprojects/daily_spellbook/models/evms/evms_info.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql index 2735b263cf1..754a83957ed 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql @@ -97,6 +97,6 @@ FROM ( , (2020, 'ronin', 'Ronin', 'Layer 1', null, 'RON', 0xe514d9deb7966c8be0ca922de8a064264ea6bcd4, 'https://app.roninchain.com/', timestamp '2021-01-25 10:49', NULL, NULL, NULL, true) , (14, 'flare', 'Flare', 'Layer 1', NULL, 'FLR', NULL, 'https://flare-explorer.flare.network/', timestamp '2022-07-13 15:32', NULL, NULL, NULL, true) , (88, 'viction', 'Viction', 'Layer 1', NULL, 'VIC', 0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce, 'https://vicscan.xyz/', timestamp '2018-12-14 07:50:20', NULL, NULL, NULL, true) - , (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, false) + , (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, true) , (146, 'sonic', 'Sonic', 'Layer 1', NULL, 'SONIC', NULL, 'https://sonicscan.org/', timestamp '2024-12-01 00:00', NULL, NULL, NULL, true) ) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement, is_on_dune)