feat(playground): add GTK faucet flow - #1033
Open
fewensa wants to merge 1 commit into
Open
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Playground-only GTK faucet flow spanning a minimal onchain PlaygroundFaucet, Base-specific deployment/role-grant scripts, and a /faucet web page that resolves the faucet address from Registry apps[].params.
Changes:
- Introduce
PlaygroundFaucet(10 GTK once per address) plus Foundry tests. - Add Base-guarded deployment and
MINTER_ROLEgrant scripts + Makefile targets and Base RPC endpoint. - Add
/faucetweb route, ABI, i18n strings, and config parsing utilities/tests to resolve the faucet address from Registry params.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/src/PlaygroundFaucet.sol | New minimal faucet contract that mints a fixed GTK amount once per address. |
| contracts/test/PlaygroundFaucet.t.sol | Foundry tests covering first claim, second-claim revert, mint failure rollback, and zero-token constructor revert. |
| contracts/script/BasePlaygroundFaucet.s.sol | Base-only scripts to deploy the faucet and grant GTK MINTER_ROLE to it. |
| contracts/Makefile | Adds convenience targets for deploying the Base faucet and granting the role. |
| contracts/foundry.toml | Adds a base RPC endpoint used by the new Makefile targets. |
| apps/web/src/utils/playground-faucet.ts | Resolves faucet address from Registry app params for the Playground DAO. |
| apps/web/src/types/config.ts | Extends AppItem typing to support optional params (including faucet params). |
| apps/web/src/i18n/messages.ts | Registers new faucet message bundle in the message loader. |
| apps/web/src/config/abi/playground-faucet.ts | Adds ABI definition for reading claimed and calling claim(). |
| apps/web/src/app/faucet/page.tsx | New Playground-only faucet page with wallet/network handling + claim/delegate flows. |
| apps/web/src/app/[locale]/faucet/page.tsx | Locale route re-export for the faucet page. |
| apps/web/scripts/playground-faucet.test.ts | Script-level tests for faucet address resolution and “no hardcoded address” constraint. |
| apps/web/messages/en/faucet.json | Faucet UI copy (English). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
+22
| constructor(IMintableToken token_) { | ||
| if (address(token_) == address(0)) revert InvalidToken(); | ||
| token = token_; | ||
| } |
Comment on lines
+18
to
+29
| const apps = config.apps ?? []; | ||
| const explicitAddress = apps | ||
| .map((app) => app.params?.faucetAddress) | ||
| .find((value): value is string => Boolean(value && isAddress(value))); | ||
| if (explicitAddress) return explicitAddress as Address; | ||
|
|
||
| const contractAddress = apps | ||
| .filter(isFaucetLink) | ||
| .map((app) => app.params?.contract) | ||
| .find((value): value is string => Boolean(value && isAddress(value))); | ||
|
|
||
| return contractAddress as Address | undefined; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
PlaygroundFaucetthat mints 10 GTK once per addressMINTER_ROLEgrant scripts/faucetpage with wallet/network handling, transaction states, and self-delegation guidanceapps[].params.faucetAddressor a Faucet appparams.contract; no deployed address is hardcoded in the web appPart of #1010. This PR does not deploy the contract or grant roles.
Registry contract
After deployment, the Playground app entry can provide either:
params.contractis also accepted for a Faucet-linked app.Validation
forge fmt --check src/PlaygroundFaucet.sol test/PlaygroundFaucet.t.sol script/BasePlaygroundFaucet.s.solforge test --match-path test/PlaygroundFaucet.t.sol -vvv(4 passed)pnpm --filter @degov/web exec tsc --noEmitpnpm --filter @degov/web lintpnpm run test:web-scripts(83 passed)pnpm --filter @degov/web build