-
Notifications
You must be signed in to change notification settings - Fork 25
EVM Backend Demo for Ethscriptions #100
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
Open
RogerPodacter
wants to merge
214
commits into
main
Choose a base branch
from
evm-backend-demo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
214 commits
Select commit
Hold shift + click to select a range
d815dd6
EVM backend demo for Ethscriptions
RogerPodacter 6e65804
Add ERC-20 token functionality to Ethscriptions
RogerPodacter 0e19880
Add L1 provability system for Ethscriptions via OP Stack
RogerPodacter f1ff6b0
Update contracts/src/Ethscriptions.sol
RogerPodacter 20a96e4
Add compression support for Ethscriptions storage
RogerPodacter 842276f
Use soldeer, don't use via_ir
RogerPodacter 91983af
Add L2 genesis state generation with minimal OP Stack predeploys
RogerPodacter 51563f5
Add Ethscriptions contracts to L2 genesis
RogerPodacter 8115052
Add genesis ethscription data
RogerPodacter ada1d75
Support burning Ethscriptions via transfer to address(0)
RogerPodacter 2a9c5c8
Initial geth communication and tx creation logic
RogerPodacter 3a99810
Refactor Ethscriptions to use token ID as ethscription number
RogerPodacter db8890a
Give Ethscriptions.sol predeploy a cooler address
RogerPodacter 4de0e5e
Refactor Ethscriptions storage architecture for 33% gas savings
RogerPodacter 7e3270d
Refactor Ethscriptions contract to use updated predeploy address and …
RogerPodacter de278ab
Helper contract failure shouldn't abort ethscription action
RogerPodacter 48ba566
Emit events for Genesis ethscriptions
RogerPodacter 5fa7eea
Fix text ethscription display
RogerPodacter bfcb920
Fix erc-20 token params extraction
RogerPodacter a77e637
Fix block validation string comparison encoding bug
RogerPodacter 89c2954
Add image building gh action
RogerPodacter 59d0343
Add Dockerfile
RogerPodacter d1bd3fe
Remove database dependency
RogerPodacter 5ecaf30
Remove db dep
RogerPodacter 939c6e4
Add docker-compose.yml
RogerPodacter cc22fbd
Improve import validation
RogerPodacter eda82ab
Set exact 0.8.30 version on all contracts
RogerPodacter 026b1ae
Refactor ethscription transaction building architecture
RogerPodacter e779d04
Merge pull request #104 from ethscriptions-protocol/refactor_ethscrip…
RogerPodacter a299d80
Move to supported Solidity version + housekeeping
RogerPodacter 808251d
Simplify
RogerPodacter 52944b7
Make import faster
RogerPodacter f560d0b
Merge pull request #105 from ethscriptions-protocol/make_import_faster
RogerPodacter 9cd4344
Various
RogerPodacter 1386b82
Add combined getEthscriptionWithContent method
RogerPodacter 3e26e67
Handle duplicate ethscription prevention at the contract level
RogerPodacter ed9d2cd
Fixes
RogerPodacter 56ac4c1
Clean up
RogerPodacter 0b40c0c
Merge pull request #106 from ethscriptions-protocol/remove_already_seen
RogerPodacter acd61e0
Remove old Rails files
RogerPodacter 64a1ae8
Merge pull request #107 from ethscriptions-protocol/evm-backend-demo
RogerPodacter fd95c00
Decouple validation from import
RogerPodacter a233ccd
Update app/jobs/gap_detection_job.rb
RogerPodacter 65acb7c
Improve validation error visibility
RogerPodacter f8cbc48
Update lib/l1_rpc_prefetcher.rb
RogerPodacter b90f970
Fixes
RogerPodacter 8e8f10e
Improve logging, add misc files
RogerPodacter 521a4b7
Merge pull request #108 from ethscriptions-protocol/decouple
RogerPodacter 1356618
Fix docker setup
RogerPodacter e358bf2
Remove old tests
RogerPodacter 3ec8afd
Misc changes
RogerPodacter da9739e
Add tests
RogerPodacter 1a829b1
Merge pull request #110 from ethscriptions-protocol/add_tests
RogerPodacter 6e551c0
Remove old scripts
RogerPodacter 1e43457
Test-related fixes
RogerPodacter c70b9b8
Validate in docker
RogerPodacter 74ab212
Better handlng of transient validation errors
RogerPodacter 7f5854b
Cleanup
RogerPodacter 737752e
Fix method name
RogerPodacter d36d05d
Add backtrace
RogerPodacter bd6d0d7
Merge pull request #111 from ethscriptions-protocol/transient_validat…
RogerPodacter 62596f4
Fix genesis
RogerPodacter ac50f90
Fix error type
RogerPodacter 23f1c6f
Instrument gap count
RogerPodacter 0accdc9
Improve prover setup
RogerPodacter 824ac43
Simplify
RogerPodacter 4bf7e1f
Update contracts/test/EthscriptionsProver.t.sol
RogerPodacter f159468
Storage => memory
RogerPodacter b7f39cd
Merge pull request #112 from ethscriptions-protocol/improve_prover
RogerPodacter 29d3ec9
Implement collections and more generic protocol framework
RogerPodacter 3314f16
Retry validation in more cases
RogerPodacter 18be21d
Fix errors
RogerPodacter c44d362
Merge pull request #114 from ethscriptions-protocol/retry_validation
RogerPodacter 0c328be
Update docker compose
RogerPodacter 93b33a2
Merge branch 'evm-backend-demo' into collection_protocol
RogerPodacter 88d6def
Cleanup
RogerPodacter 823f06e
Generic protocol framework
RogerPodacter 24b4aa6
Simplify
RogerPodacter 9d5ecff
Disable collections by default
RogerPodacter 4af6943
ESIP6 fix
RogerPodacter cac6d49
Fixes
RogerPodacter 28d6bf9
Fixes
RogerPodacter ae9d933
Merge pull request #113 from ethscriptions-protocol/collection_protocol
RogerPodacter b260fa9
Improve prefetcher
RogerPodacter d86287e
Merge pull request #117 from ethscriptions-protocol/improve_prefetcher
RogerPodacter 19f33c6
Fix data uri normalization bug
RogerPodacter 3922db3
Simplify
RogerPodacter 623256c
Merge pull request #118 from ethscriptions-protocol/fix_data_uri
RogerPodacter 232e539
Predeploys should be proxies
RogerPodacter 30bf95c
Merge pull request #119 from ethscriptions-protocol/predeploy_proxies
RogerPodacter 5dcdcf2
Improve text viewer
RogerPodacter 2279f2d
Update token mint logic
RogerPodacter 29dc822
Use IPC instead of HTTP for performance
RogerPodacter 47034f0
Merge pull request #120 from ethscriptions-protocol/use_ipc
RogerPodacter 2dd7fcb
Fix test
RogerPodacter 73cebe7
Don't prove historical ethscription transfers
RogerPodacter 9a41741
Cleanup
RogerPodacter c92961d
Enable address(0) erc20 balances to match ethscription behavior
RogerPodacter dd5038f
Move files around
RogerPodacter 9d82ffe
Fix _mint / _update semantics
RogerPodacter d1523b5
Merge pull request #121 from ethscriptions-protocol/fix_erc20
RogerPodacter 7f16c80
Update docker-compose/docker-compose.yml
RogerPodacter a9d6846
Update docker compose
RogerPodacter 96c5e5e
Fix access and entrypoint
RogerPodacter a303cc0
Remove old files
RogerPodacter cc0073a
Refactor contracts
RogerPodacter 01567bb
Refactor other contracts
RogerPodacter e28f496
Fix test
RogerPodacter 3be3820
Merge pull request #122 from ethscriptions-protocol/refactor
RogerPodacter fe5c2b5
Cleanup
RogerPodacter 3ba345a
Optimize contracts
RogerPodacter 33c8891
Simplify
RogerPodacter d970ae2
Merge pull request #123 from ethscriptions-protocol/optimize
RogerPodacter 887867f
Simplify tokens
RogerPodacter 9d57d6e
Merge pull request #124 from ethscriptions-protocol/simplify
RogerPodacter 8aacf4b
Fix comment
RogerPodacter 03500ae
Remove genesis allocs
RogerPodacter 2d9a931
Remove unused gems
RogerPodacter 8210799
Refactor
RogerPodacter 8f833bd
Add file
RogerPodacter 0f47d8d
Merge pull request #125 from ethscriptions-protocol/recator
RogerPodacter 13fe018
Big rename and reorg
RogerPodacter 1fe37ed
Merge branch 'evm-backend-demo' into recator
RogerPodacter 3260421
Cleanup
RogerPodacter b13cd10
Merge pull request #126 from ethscriptions-protocol/recator
RogerPodacter b17f2a9
Log less
RogerPodacter 9e2df38
Update Proxy
RogerPodacter a308e2c
Update README
RogerPodacter 3e8b000
Big rename
RogerPodacter 83e4f49
Fixes
RogerPodacter 5bea0d5
Merge pull request #127 from ethscriptions-protocol/rename
RogerPodacter 660b651
Use upgradeable proxies for tokens and collections
RogerPodacter 79e6dc0
Merge branch 'evm-backend-demo' into rename
RogerPodacter e3106d2
Merge pull request #128 from ethscriptions-protocol/rename
RogerPodacter 822408e
More efficient enumerable
RogerPodacter f2a74db
Merge branch 'evm-backend-demo' into rename
RogerPodacter c0b8975
Fix slot
RogerPodacter 91cb359
Merge pull request #129 from ethscriptions-protocol/rename
RogerPodacter a52fa7e
Simplify example config
RogerPodacter 3043a3e
Big rename
RogerPodacter 76920d7
Fixes
RogerPodacter 7c5e457
Update spec/integration/token_protocol_e2e_spec.rb
RogerPodacter 8992c1d
Merge pull request #130 from ethscriptions-protocol/rename
RogerPodacter 1e5c78f
Update docker env example
RogerPodacter c168c91
Validation fixes
RogerPodacter 557a7ff
Be more lenient about base64 data uris
RogerPodacter 356f2c7
Remove SSTORE2 chunking now that we removed the contract size cap in …
RogerPodacter 51cc758
Merge pull request #131 from ethscriptions-protocol/uncapped_sstore2
RogerPodacter 54da1d1
Add BytePackLib for efficient content storage
RogerPodacter 346a704
Fixes and tests
RogerPodacter 08d416c
Cleanup
RogerPodacter 9bcb6e3
Merge pull request #132 from ethscriptions-protocol/byte_pack
RogerPodacter f264670
Refactor Ethscription structure and retrieval methods
RogerPodacter 7b46837
Update ABI
RogerPodacter 4dbd5c9
Merge pull request #133 from ethscriptions-protocol/improve_reading
RogerPodacter 7fe0239
Add Multicall3 deployment and pagination support for Ethscriptions
RogerPodacter 7d61c9f
Fix and add tests
RogerPodacter 33dc2cb
Merge pull request #134 from ethscriptions-protocol/improve_reading
RogerPodacter 800bf7f
Update proof start time
RogerPodacter 364e827
Fix test
RogerPodacter 09dbf24
Fix tests
RogerPodacter 9e20f57
Refactor ERC721 Ethscriptions Collection Management
RogerPodacter 2ffa46e
Enhance ERC721 Ethscriptions Collection Parser and Manager
RogerPodacter 466e4fc
Refactor ERC721 Ethscriptions Collection Parser and Protocol Extractor
RogerPodacter 194c621
Merge pull request #135 from ethscriptions-protocol/fix_collections
RogerPodacter fa90c78
Refactor Protocol Handling and Update Dependencies
RogerPodacter 13c1e7e
Update spec/models/erc721_ethscriptions_collection_parser_spec.rb
RogerPodacter a908067
Implement structured parameter handling and calldata encoding in Erc2…
RogerPodacter fb2b911
Merge pull request #136 from ethscriptions-protocol/fix_collections
RogerPodacter 847d5de
Refactor Ethscription Content Handling and Metadata Storage
RogerPodacter 0ab3868
Merge pull request #137 from ethscriptions-protocol/fix_collections
RogerPodacter f7f0997
Refactor ERC721 Ethscriptions Collection and Manager Contracts
RogerPodacter c75340f
Merge pull request #138 from ethscriptions-protocol/fix_collections
RogerPodacter 772146b
Add URI resolution for Ethscriptions in ERC721 Collection
RogerPodacter 71d2611
Merge pull request #139 from ethscriptions-protocol/fix_collections
RogerPodacter aa6679c
Refactor Protocol Parsing and Introduce Word Domains Support
RogerPodacter 1aa1898
Remove MIN_LENGTH and MAX_LENGTH constants from NameRegistry contract…
RogerPodacter 6d02714
Merge pull request #140 from ethscriptions-protocol/fix_collections
RogerPodacter 154f4f3
Enhance Ethscriptions Metadata Handling and URI Resolution
RogerPodacter fa71121
Update L2Genesis to Include NameRegistry Implementation
RogerPodacter 9e9b9c8
Update lib/ethscriptions_api_client.rb
RogerPodacter c6d238e
Merge pull request #141 from ethscriptions-protocol/fix_collections
RogerPodacter 9f25b1a
Enhance ERC721 Contracts with Base64 Metadata Encoding
RogerPodacter 64230ae
Implement Ownership Transfer and Renouncement in ERC721 Ethscriptions
RogerPodacter 124b55e
Merge pull request #142 from ethscriptions-protocol/fix_collections
RogerPodacter 423fd7c
Update Address Validation and Metadata Descriptions in Contracts
RogerPodacter f4d16ea
Merge pull request #143 from ethscriptions-protocol/fix_collections
RogerPodacter 4f0811b
Implement Compression and Extraction for Collection JSON Files
RogerPodacter 035e154
Fix collection symbol initialization and update test assertions for E…
RogerPodacter a732296
Merge pull request #144 from ethscriptions-protocol/fix_collections
RogerPodacter 7e55b6c
Enhance ERC721 Ethscriptions Collection Parser with Initial Owner Sup…
RogerPodacter 76710a3
Refactor ERC721 Ethscriptions Collection Parser for Address Handling
RogerPodacter 9fa81fa
Merge pull request #145 from ethscriptions-protocol/fix_collections
RogerPodacter 45e7482
Refactor ERC20FixedDenomination and Manager for Hybrid NFT Support
RogerPodacter d2d9b33
Fix unauthorized transfer check in ERC404NullOwnerCappedUpgradeable c…
RogerPodacter 8d4e965
Refactor tokenURI function in ERC20FixedDenomination for improved met…
RogerPodacter 6b89550
Merge pull request #146 from ethscriptions-protocol/fix_collections
RogerPodacter 7ab3767
Refactor token ID handling in ERC20FixedDenomination and ERC404NullOw…
RogerPodacter 83ef4a3
Refactor token ID handling and improve metadata functions in ERC20Fix…
RogerPodacter a6af08c
Merge pull request #147 from ethscriptions-protocol/fix_collections
RogerPodacter 2a0b6ee
Remove legacy word-domains protocol support and associated parser
RogerPodacter 77f0636
Merge pull request #148 from ethscriptions-protocol/fix_collections
RogerPodacter 7bb3566
Remove unused ERC20NullOwnerCappedUpgradeable contract and simplify t…
RogerPodacter d5a888b
Merge pull request #149 from ethscriptions-protocol/fix_collections
RogerPodacter 3437a18
Update historicalBackfillApproxDoneAt constant in Constants.sol to re…
RogerPodacter e9175b8
Implement header-based collections protocol with merkle proof enforce…
RogerPodacter 870e2e1
Refactor ERC404NullOwnerCappedUpgradeable contract by removing unused…
RogerPodacter 0cfdbd6
Merge pull request #150 from ethscriptions-protocol/cleanup
RogerPodacter 1283c40
Enhance JSON metadata generation in ERC20FixedDenomination and update…
RogerPodacter 5b1cea8
Fix DataUri handling of legacy behavior of esip6?
RogerPodacter 0fdc2af
Update collections
RogerPodacter ef4e3f7
Correctly decode percent encoded utf8 data uris
RogerPodacter b887b9d
Fix collections
RogerPodacter 6e160cc
Update README.md to enhance documentation structure and clarity
RogerPodacter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,3 +31,5 @@ | |
|
|
||
| # Ignore master key for decrypting credentials and more. | ||
| /config/master.key | ||
|
|
||
| .DS_Store | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [submodule "contracts/lib/forge-std"] | ||
| path = contracts/lib/forge-std | ||
| url = https://github.com/foundry-rs/forge-std | ||
| [submodule "contracts/lib/openzeppelin-contracts"] | ||
| path = contracts/lib/openzeppelin-contracts | ||
| url = https://github.com/OpenZeppelin/openzeppelin-contracts | ||
| [submodule "contracts/lib/solady"] | ||
| path = contracts/lib/solady | ||
| url = https://github.com/vectorized/solady | ||
| [submodule "contracts/lib/openzeppelin-contracts-upgradeable"] | ||
| path = contracts/lib/openzeppelin-contracts-upgradeable | ||
| url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,185 @@ | ||
| # Module to handle EVM-based ethscription processing | ||
| # Replaces direct database writes with contract calls | ||
| module EvmEthscriptionProcessor | ||
| extend ActiveSupport::Concern | ||
|
|
||
| # Create ethscription from input via EVM | ||
| def create_ethscription_from_input! | ||
| # Protocol signal detection - both conditions must be met for a valid creation attempt: | ||
| # 1. Valid data URI format (user is using the protocol) | ||
| # 2. Has a recipient (required for ethscription creation) | ||
| return unless DataUri.valid?(utf8_input) && to_address.present? | ||
|
|
||
| # Check if this is a token operation | ||
| token_op = detect_token_operation(utf8_input) | ||
|
|
||
| # Build parameters - just translate what the user provided | ||
| params = if token_op | ||
| EthscriptionsParamMapper.build_create_params_from_input(self, token_op) | ||
| else | ||
| EthscriptionsParamMapper.build_create_params_from_input(self) | ||
| end | ||
|
|
||
| # Skip if params are malformed (shouldn't happen with valid data URI) | ||
| return unless EthscriptionsParamMapper.params_well_formed?(params, :createEthscription) | ||
|
|
||
| # Send to contract | ||
| send_to_ethscriptions_contract(:createEthscription, params, from_address: from_address) | ||
| end | ||
|
|
||
| # Create ethscription from events via EVM | ||
| def create_ethscription_from_events! | ||
| ethscription_creation_events.each do |creation_event| | ||
| next if creation_event['topics'].length != 2 | ||
|
|
||
| begin | ||
| initial_owner = Eth::Abi.decode(['address'], creation_event['topics'].second).first | ||
| content_uri_data = Eth::Abi.decode(['string'], creation_event['data']).first | ||
| content_uri = HexDataProcessor.clean_utf8(content_uri_data) | ||
| rescue Eth::Abi::DecodingError | ||
| # Can't decode the event - skip it | ||
| next | ||
| end | ||
|
|
||
| # Build parameters - just translate what's in the event | ||
| params = EthscriptionsParamMapper.build_create_params( | ||
| self, | ||
| creator: creation_event['address'], | ||
| initial_owner: initial_owner, | ||
| content_uri: content_uri | ||
| ) | ||
|
|
||
| # Skip if params are malformed | ||
| next unless EthscriptionsParamMapper.params_well_formed?(params, :createEthscription) | ||
|
|
||
| # Send to contract | ||
| send_to_ethscriptions_contract(:createEthscription, params, from_address: creation_event['address']) | ||
| end | ||
| end | ||
|
|
||
| # Create transfers from input via EVM | ||
| def create_ethscription_transfers_from_input! | ||
| return unless transfers_ethscription_via_input? | ||
|
|
||
| concatenated_hashes = input_no_prefix.scan(/.{64}/).map { |hash| "0x#{hash}" } | ||
|
|
||
| # Process each transfer individually to allow partial success | ||
| # (some transfers may fail while others succeed) | ||
| concatenated_hashes.each do |ethscription_tx_hash| | ||
| params = EthscriptionsParamMapper.build_transfer_params( | ||
| ethscription_tx_hash: ethscription_tx_hash, | ||
| to_address: to_address | ||
| ) | ||
|
|
||
| # Skip if params are malformed | ||
| next unless EthscriptionsParamMapper.params_well_formed?(params, :transferEthscription) | ||
|
|
||
| # Send individual transfer to contract | ||
| send_to_ethscriptions_contract(:transferEthscription, params, from_address: from_address) | ||
| end | ||
| end | ||
|
|
||
| # Create transfers from events via EVM | ||
| def create_ethscription_transfers_from_events! | ||
| ethscription_transfer_events.each do |log| | ||
| topics = log['topics'] | ||
| event_type = topics.first | ||
|
|
||
| ethscription_tx_hash = nil | ||
| to_address = nil | ||
| from_address = log['address'] | ||
|
|
||
| if event_type == Esip1EventSig | ||
| next if topics.length != 3 | ||
|
|
||
| begin | ||
| to_address = Eth::Abi.decode(['address'], topics.second).first | ||
| ethscription_tx_hash = Eth::Util.bin_to_prefixed_hex( | ||
| Eth::Abi.decode(['bytes32'], topics.third).first | ||
| ) | ||
| rescue Eth::Abi::DecodingError | ||
| next | ||
| end | ||
| elsif event_type == Esip2EventSig | ||
| next if topics.length != 4 | ||
|
|
||
| begin | ||
| event_previous_owner = Eth::Abi.decode(['address'], topics.second).first | ||
| to_address = Eth::Abi.decode(['address'], topics.third).first | ||
| ethscription_tx_hash = Eth::Util.bin_to_prefixed_hex( | ||
| Eth::Abi.decode(['bytes32'], topics.fourth).first | ||
| ) | ||
| rescue Eth::Abi::DecodingError | ||
| next | ||
| end | ||
|
|
||
| # ESIP-2: Transfer for previous owner - use different contract method | ||
| params = EthscriptionsParamMapper.build_transfer_for_previous_owner_params( | ||
| ethscription_tx_hash: ethscription_tx_hash, | ||
| to_address: to_address, | ||
| previous_owner: event_previous_owner | ||
| ) | ||
|
|
||
| # Skip if params are malformed | ||
| next unless EthscriptionsParamMapper.params_well_formed?(params, :transferEthscriptionForPreviousOwner) | ||
|
|
||
| # Send to contract | ||
| send_to_ethscriptions_contract(:transferEthscriptionForPreviousOwner, params, from_address: from_address) | ||
| next | ||
| end | ||
|
|
||
| next unless ethscription_tx_hash && to_address | ||
|
|
||
| # ESIP-1: Regular transfer | ||
| params = EthscriptionsParamMapper.build_transfer_params( | ||
| ethscription_tx_hash: ethscription_tx_hash, | ||
| to_address: to_address | ||
| ) | ||
|
|
||
| # Skip if params are malformed | ||
| next unless EthscriptionsParamMapper.params_well_formed?(params, :transferEthscription) | ||
|
|
||
| # Send to contract | ||
| send_to_ethscriptions_contract(:transferEthscription, params, from_address: from_address) | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| # Detect if this is a token operation (deploy or mint) | ||
| def detect_token_operation(content_uri) | ||
| return nil unless content_uri.start_with?('data:,') | ||
|
|
||
| begin | ||
| json_str = content_uri.sub('data:,', '') | ||
| json = JSON.parse(json_str) | ||
cursor[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Check if it's a token operation | ||
| return nil unless json['p'].present? && (json['op'] == 'deploy' || json['op'] == 'mint') | ||
|
|
||
| { | ||
| protocol: json['p'], | ||
| operation: json['op'], | ||
| tick: json['tick'], | ||
| max: json['max']&.to_i, | ||
| lim: json['lim']&.to_i, | ||
| id: json['id']&.to_i, | ||
| amt: json['amt']&.to_i | ||
| } | ||
| rescue JSON::ParserError | ||
| nil | ||
| end | ||
| end | ||
|
|
||
| # Simplified contract call - in production this would use the engine API | ||
| def send_to_ethscriptions_contract(method, params, from_address:) | ||
RogerPodacter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Rails.logger.info({ | ||
| event: "evm_call", | ||
| method: method, | ||
| params: params, | ||
| from_address: from_address, | ||
| block_number: block_number, | ||
| transaction_hash: transaction_hash | ||
| }.to_json) | ||
| end | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noticed it only support
data:,based tokens? there may be with application/json contemt type, for sure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more complicated to recognize multiple (unlimited?) ways of expressing the same idea. It's nice to have tick and protocol be unique. Tokens are just a "view" anyway; anyone can index whatever protocol they want (just as what happens today)