Skip to content

feat(playground): add GTK faucet flow - #1033

Open
fewensa wants to merge 1 commit into
mainfrom
codex/playground-faucet
Open

feat(playground): add GTK faucet flow#1033
fewensa wants to merge 1 commit into
mainfrom
codex/playground-faucet

Conversation

@fewensa

@fewensa fewensa commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a minimal onchain PlaygroundFaucet that mints 10 GTK once per address
  • add Base-guarded deployment and separate GTK MINTER_ROLE grant scripts
  • add a Playground-only /faucet page with wallet/network handling, transaction states, and self-delegation guidance
  • resolve the Faucet address from Registry apps[].params.faucetAddress or a Faucet app params.contract; no deployed address is hardcoded in the web app

Part of #1010. This PR does not deploy the contract or grant roles.

Registry contract

After deployment, the Playground app entry can provide either:

apps:
  - name: GTK Faucet
    description: Claim Playground governance tokens.
    icon: <icon-url>
    link: /faucet
    params:
      faucetAddress: <deployed-faucet-address>

params.contract is also accepted for a Faucet-linked app.

Validation

  • forge fmt --check src/PlaygroundFaucet.sol test/PlaygroundFaucet.t.sol script/BasePlaygroundFaucet.s.sol
  • forge test --match-path test/PlaygroundFaucet.t.sol -vvv (4 passed)
  • pnpm --filter @degov/web exec tsc --noEmit
  • pnpm --filter @degov/web lint
  • pnpm run test:web-scripts (83 passed)
  • pnpm --filter @degov/web build

Copilot AI review requested due to automatic review settings July 24, 2026 08:17
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ROLE grant scripts + Makefile targets and Base RPC endpoint.
  • Add /faucet web 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants