-
Notifications
You must be signed in to change notification settings - Fork 546
[WIP] ERC20 assets #7321
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
base: main
Are you sure you want to change the base?
[WIP] ERC20 assets #7321
Conversation
🦋 Changeset detectedLatest commit: ca39e62 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA new ABI JSON file for the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AssetsModule
participant CreateTokenStub
User->>AssetsModule: import { createToken } from 'assets'
User->>CreateTokenStub: createToken(params: CreateTokenArgs)
CreateTokenStub-->>User: (no implementation/return)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/thirdweb/src/assets/index.ts (1)
1-4
: Same extension concern & future export growth
- Ensure the
.js
suffix plays nicely with the compiler/bundler (see previous note).- As
assets
utilities grow, consider grouping exports in anindex.ts
barrel only once they stabilise; otherwise tree-shaking may pull in unfinished stubs.packages/thirdweb/scripts/generate/abis/assets/AssetEntrypointERC20.json (1)
1-34
: Nit: store ABI as generated artefact, not sourceCommitted raw ABI arrays bloat the repo (~4 KB here) and create noisy diffs. If this file is generated by a script in
/scripts/generate
, prefer ignoring it in Git and generating during build/publish instead.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (19)
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/events/AssetCreated.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/events/AssetDistributed.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/events/ImplementationAdded.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/events/RewardLockerUpdated.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/events/RouterUpdated.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/read/getImplementation.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/read/getRewardLocker.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/read/getRouter.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/addImplementation.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/buyAsset.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/createAsset.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/createAssetById.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/createAssetByImplementationConfig.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/distributeAsset.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/initialize.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/listAsset.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/sellAsset.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/setRewardLocker.ts
is excluded by!**/__generated__/**
packages/thirdweb/src/extensions/assets/__generated__/AssetEntrypointERC20/write/setRouter.ts
is excluded by!**/__generated__/**
📒 Files selected for processing (4)
packages/thirdweb/scripts/generate/abis/assets/AssetEntrypointERC20.json
(1 hunks)packages/thirdweb/src/assets/create-token.ts
(1 hunks)packages/thirdweb/src/assets/index.ts
(1 hunks)packages/thirdweb/src/exports/assets.ts
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/thirdweb/src/assets/create-token.ts
[error] 1-1: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
[error] 3-3: This parameter is unused.
Unused variables usually are result of incomplete refactoring, typos and other source of bugs.
Unsafe fix: If this is intentional, prepend params with an underscore.
(lint/correctness/noUnusedVariables)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Lint Packages
- GitHub Check: Build Packages
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: Unit Tests
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
packages/thirdweb/src/exports/assets.ts (1)
1-1
: Double-check relative path & extensionThe re-export targets
"../assets/index.js"
, but the source file isindex.ts
in the same tree.
This pattern is okay iftsc
emits.js
files beside.d.ts
and the runtime resolution happens on compiled output. Otherwise you’ll hit module-not-found in tests or ts-node. Verify the build pipeline supports “import with .js extension from TS”.packages/thirdweb/scripts/generate/abis/assets/AssetEntrypointERC20.json (1)
7-12
:❌ Incorrect review comment
Struct/event field size mismatch – potential ABI desync
Struct
addImplementation.config
usesbytes createHookData
, butImplementationAdded
event declaresbytes32 createHookData
.
If the underlying Solidity contract really emitsbytes32
, calls encodingbytes
will still compile but the event parser will truncate data.Confirm the canonical Solidity source and align both the function parameter and event field to the same type.
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "Searching for the ImplementationAdded event in Solidity files..." rg -n "event ImplementationAdded" --glob "*.sol" echo echo "Context around event ImplementationAdded:" rg -A3 -B3 "event ImplementationAdded" --glob "*.sol" echo echo "Searching for function addImplementation in Solidity files..." rg -n "function addImplementation" --glob "*.sol" echo echo "Context around function addImplementation:" rg -A3 -B3 "function addImplementation" --glob "*.sol" echo echo "Searching for structs related to ImplementationConfig or config:" rg -n "struct .*Implementation.*" --glob "*.sol" echo echo "Context around those struct definitions:" rg -A3 -B3 "struct .*Implementation.*" --glob "*.sol"Length of output: 358
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "Searching for the ImplementationAdded event in JSON ABI files..." rg -n '"name":\s*"ImplementationAdded"' --glob "*.json" echo echo "Context around the ImplementationAdded event:" rg -A5 -B5 '"name":\s*"ImplementationAdded"' --glob "*.json" echo echo "Inspecting createHookData field in this event:" rg -A2 -B2 '"createHookData"' --glob "*.json"Length of output: 216
No
ImplementationAdded
event in ABI – review comment can be ignoredThe ABI at
packages/thirdweb/scripts/generate/abis/assets/AssetEntrypointERC20.json
only contains function definitions and does not declare anyImplementationAdded
event (nor abytes32 createHookData
field). There is no mismatch to resolve.Likely an incorrect or invalid review comment.
size-limit report 📦
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7321 +/- ##
=======================================
Coverage 55.57% 55.57%
=======================================
Files 909 909
Lines 58675 58675
Branches 4157 4160 +3
=======================================
+ Hits 32608 32610 +2
+ Misses 25960 25959 -1
+ Partials 107 106 -1
🚀 New features to boost your workflow:
|
PR-Codex overview
This PR focuses on enhancing the
thirdweb
library by introducing new functionality related to ERC20 assets, including event handling, token creation, and infrastructure deployment.Detailed summary
AssetEntrypointERC20
andFeeManager
.getOrDeployERC20AssetImpl
for managing asset implementations.Summary by CodeRabbit