Skip to content

Commit ab4f0cd

Browse files
authored
Merge pull request #77 from subsquid/chore/import-portal-contracts
Import sqd-portal-contracts into packages/portal-contracts (history preserved)
2 parents 614c58f + 55d4c1c commit ab4f0cd

35 files changed

Lines changed: 5181 additions & 0 deletions
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Sync portal-contracts from upstream
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
upstream_ref:
7+
description: "Upstream branch or tag to pull (default: main)"
8+
required: false
9+
default: "main"
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
sync:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout monorepo with full history
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
persist-credentials: true
24+
25+
- name: Configure git identity
26+
run: |
27+
git config user.name "portal-sync-bot"
28+
git config user.email "portal-sync-bot@users.noreply.github.com"
29+
30+
- name: Add upstream remote and fetch
31+
run: |
32+
git remote add portal https://github.com/subsquid/sqd-portal-contracts.git
33+
git fetch portal "${{ inputs.upstream_ref }}"
34+
35+
- name: Create sync branch
36+
id: branch
37+
run: |
38+
BRANCH="sync/portal-contracts-$(date -u +%Y%m%d-%H%M%S)"
39+
git checkout -b "$BRANCH"
40+
echo "name=$BRANCH" >> "$GITHUB_OUTPUT"
41+
42+
- name: Subtree pull (history preserved, no squash)
43+
id: pull
44+
run: |
45+
set -e
46+
BEFORE=$(git rev-parse HEAD)
47+
git subtree pull --prefix=packages/portal-contracts portal \
48+
"${{ inputs.upstream_ref }}" \
49+
-m "merge: sync packages/portal-contracts with sqd-portal-contracts ${{ inputs.upstream_ref }}"
50+
AFTER=$(git rev-parse HEAD)
51+
if [ "$BEFORE" = "$AFTER" ]; then
52+
echo "Nothing to sync."
53+
echo "changed=false" >> "$GITHUB_OUTPUT"
54+
else
55+
echo "changed=true" >> "$GITHUB_OUTPUT"
56+
fi
57+
58+
- name: Push sync branch
59+
if: steps.pull.outputs.changed == 'true'
60+
run: git push origin "${{ steps.branch.outputs.name }}"
61+
62+
- name: Open PR
63+
if: steps.pull.outputs.changed == 'true'
64+
env:
65+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
gh pr create \
68+
--base main \
69+
--head "${{ steps.branch.outputs.name }}" \
70+
--title "Sync packages/portal-contracts from sqd-portal-contracts ${{ inputs.upstream_ref }}" \
71+
--body "Routine subtree pull from subsquid/sqd-portal-contracts ref ${{ inputs.upstream_ref }}. Merge with a regular merge commit (do not squash) to keep subtree pulls working."
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
jobs:
8+
claude-review:
9+
runs-on: ubuntu-latest
10+
env:
11+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
issues: write
16+
id-token: write
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v5
21+
with:
22+
fetch-depth: 1
23+
24+
- name: Run Claude Code Review
25+
id: claude-review
26+
uses: anthropics/claude-code-action@beta
27+
with:
28+
github_token: ${{ github.token }}
29+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
30+
direct_prompt: |
31+
Review this pull request as a smart contracts change and post actionable findings as PR review comments.
32+
Focus on:
33+
- Security: reentrancy, unsafe external calls, access control, privileged roles, approvals/allowances, oracle and price-manipulation risks, signature replay or malleability, delegatecall/proxy footguns
34+
- Correctness: state invariants, rounding and precision (especially with tokens), edge cases on zero balances, failed transfers, and boundary conditions
35+
- Solidity and design: visibility, immutability vs mutability, events for critical state, upgrade patterns if present, compiler/version assumptions
36+
- Gas and operational impact where it affects on-chain behavior or DoS surfaces
37+
- Tests: coverage of failure paths, fuzz/invariant tests if applicable, and whether changes need new or updated tests
38+
39+
If you find no actionable issues, post a short PR comment saying the review completed and no major issues were found.
40+
Be specific, cite files or symbols when helpful, and keep feedback constructive.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
env:
22+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
23+
permissions:
24+
contents: read
25+
pull-requests: write
26+
issues: write
27+
id-token: write
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v5
32+
with:
33+
fetch-depth: 1
34+
35+
- name: Run Claude Code
36+
id: claude
37+
uses: anthropics/claude-code-action@beta
38+
with:
39+
github_token: ${{ github.token }}
40+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
env:
9+
FOUNDRY_PROFILE: ci
10+
11+
jobs:
12+
check:
13+
name: Foundry project
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
19+
20+
- name: Install Foundry
21+
uses: foundry-rs/foundry-toolchain@v1
22+
23+
- name: Show Forge version
24+
run: |
25+
forge --version
26+
27+
- name: Run Forge fmt
28+
run: |
29+
forge fmt --check
30+
id: fmt
31+
32+
- name: Run Forge build
33+
run: |
34+
forge build --sizes
35+
id: build
36+
37+
- name: Run Forge tests
38+
run: |
39+
forge test -vvv
40+
id: test
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Dependencies
2+
node_modules
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
pnpm-debug.log*
7+
8+
# Build outputs
9+
.next
10+
out
11+
build
12+
dist
13+
14+
# Testing
15+
coverage
16+
.nyc_output
17+
18+
# Misc
19+
.DS_Store
20+
*.pem
21+
22+
# Debug
23+
.vscode
24+
.idea
25+
26+
# Local env files
27+
.env*.local
28+
.env.development.local
29+
.env.test.local
30+
.env.production.local
31+
32+
# Git
33+
.git
34+
.gitignore
35+
36+
# Docker
37+
Dockerfile
38+
.dockerignore
39+
docker-compose*.yml
40+
41+
# CI/CD
42+
.github
43+
.gitlab-ci.yml
44+
45+
# Documentation
46+
README.md
47+
CHANGELOG.md
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM node:20-alpine AS deps
2+
RUN apk add --no-cache libc6-compat
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json* pnpm-lock.yaml* ./
6+
7+
RUN \
8+
if [ -f pnpm-lock.yaml ]; then \
9+
corepack enable pnpm && pnpm install --frozen-lockfile; \
10+
elif [ -f package-lock.json ]; then \
11+
npm ci; \
12+
else \
13+
echo "Warning: No lockfile found. Installing with npm..." && npm install; \
14+
fi
15+
16+
FROM node:20-alpine AS builder
17+
WORKDIR /app
18+
19+
COPY --from=deps /app/node_modules ./node_modules
20+
COPY . .
21+
22+
ENV NEXT_TELEMETRY_DISABLED=1
23+
ENV NODE_ENV=production
24+
ENV NODE_OPTIONS="--max-old-space-size=2048"
25+
26+
RUN \
27+
if [ -f pnpm-lock.yaml ]; then \
28+
corepack enable pnpm && pnpm build; \
29+
else \
30+
npm run build; \
31+
fi
32+
33+
FROM node:20-alpine AS runner
34+
WORKDIR /app
35+
36+
ENV NODE_ENV=production
37+
ENV NEXT_TELEMETRY_DISABLED=1
38+
39+
RUN addgroup --system --gid 1001 nodejs
40+
RUN adduser --system --uid 1001 nextjs
41+
42+
COPY --from=builder /app/.next/standalone ./
43+
COPY --from=builder /app/.next/static ./.next/static
44+
45+
RUN chown -R nextjs:nodejs /app
46+
47+
USER nextjs
48+
49+
EXPOSE 3000
50+
51+
ENV PORT=3000
52+
ENV HOSTNAME="0.0.0.0"
53+
54+
CMD ["node", "server.js"]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
body {
6+
background-color: #ffffff;
7+
color: #0d0d0d;
8+
min-width: 350px;
9+
}
10+
11+
* {
12+
scrollbar-width: thin;
13+
scrollbar-color: #8596ad transparent;
14+
}
15+
16+
*::-webkit-scrollbar {
17+
height: 6px;
18+
width: 6px;
19+
}
20+
21+
*::-webkit-scrollbar-track {
22+
background: transparent;
23+
}
24+
25+
*::-webkit-scrollbar-thumb {
26+
background: #8596ad;
27+
border-radius: 4px;
28+
}
29+
30+
*::-webkit-scrollbar-thumb:hover {
31+
background: #8596ad;
32+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { Metadata } from "next";
2+
import { Inter } from "next/font/google";
3+
import "./globals.css";
4+
import { Providers } from "@/components/Providers";
5+
6+
const inter = Inter({ subsets: ["latin"] });
7+
8+
export const metadata: Metadata = {
9+
title: "SQD Portal Dashboard",
10+
description: "Stake SQD and earn rewards",
11+
};
12+
13+
export default function RootLayout({
14+
children,
15+
}: Readonly<{
16+
children: React.ReactNode;
17+
}>) {
18+
return (
19+
<html lang="en">
20+
<body className={inter.className}>
21+
<Providers>{children}</Providers>
22+
</body>
23+
</html>
24+
);
25+
}

0 commit comments

Comments
 (0)