Initial build for QIE Mainnet Hackathon 3.0 (DeFi & Financial Infrastructure track). Includes: - packages/contracts: constant-product AMM (factory/pair/router), over-collateralized lending vault, and an oracle adapter wrapping QIE's real deployed price-feed contracts. 25/25 Foundry tests pass locally. Clean-room: no existing DEX/lending protocol source was read or copied. - packages/core: TypeScript SDK (viem-based) for QIE's chain, the real (corrected) oracle ABI, a fail-closed QUSDC helper, a Blockscout explorer client, and QIE Wallet connection constants. Live-verified against real testnet (chain 1983) and mainnet (chain 1990) RPCs and the real oracle contracts. - packages/cli: a small CLI built on @qie-forge/core. Real findings from building this, documented in README.md and docs/STATUS.md: the previously-documented testnet RPC URL is dead (replacement found and verified live); QIE's own oracle docs describe a getPrice(string) function that reverts on the real deployed contracts, which actually implement a Chainlink AggregatorV3-style interface (verified live via raw eth_call); the oracle is deployed on Mainnet only, not Testnet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
76 lines
3.0 KiB
YAML
76 lines
3.0 KiB
YAML
name: gas-comment
|
|
|
|
# Posts the gas comparison produced by the `checks` workflow as a sticky PR comment.
|
|
#
|
|
# This has to live in a separate `workflow_run` workflow: the `checks` workflow is
|
|
# triggered by `pull_request`, and for PRs opened from a fork GitHub hands that run a
|
|
# read-only GITHUB_TOKEN -- a job-level `permissions: pull-requests: write` is silently
|
|
# ignored there, which is what produces
|
|
# Error: Resource not accessible by integration
|
|
# A `workflow_run` workflow always runs in the context of the base repository, from the
|
|
# default branch, with a token that can actually be granted write scopes.
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [checks]
|
|
types: [completed]
|
|
|
|
concurrency:
|
|
group: gas-comment-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
comment:
|
|
# Not gated on workflow_run.conclusion: `checks` has several jobs, and we still want
|
|
# the gas comparison posted when an unrelated job failed.
|
|
if: >-
|
|
github.event.workflow_run.event == 'pull_request' &&
|
|
github.event.workflow_run.conclusion != 'cancelled'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
actions: read # download the artifact from the triggering run
|
|
pull-requests: write # required by step-security/sticky-pull-request-comment
|
|
steps:
|
|
- name: Download comparison
|
|
id: download
|
|
continue-on-error: true # no artifact => nothing to compare, not an error
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: gas-comparison
|
|
github-token: ${{ github.token }}
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
|
|
- name: Read PR number
|
|
if: steps.download.outcome == 'success'
|
|
id: pr_number
|
|
# pr-number.txt comes from a run that executed untrusted PR code: keep digits
|
|
# only, so it cannot inject extra lines into GITHUB_OUTPUT.
|
|
run: echo "number=$(head -c 16 pr-number.txt | tr -dc '0-9')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Read comparison
|
|
if: steps.download.outcome == 'success'
|
|
id: gas_report
|
|
run: |
|
|
if [ -f gas-report.md ] && [ -s gas-report.md ]; then
|
|
{
|
|
echo 'markdown<<__GAS_REPORT_EOF__'
|
|
echo '<details>'
|
|
echo '<summary>view gas comparison</summary>'
|
|
echo ''
|
|
cat gas-report.md
|
|
echo ''
|
|
echo '</details>'
|
|
echo '__GAS_REPORT_EOF__'
|
|
} >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Comment comparison
|
|
if: steps.download.outcome == 'success'
|
|
uses: step-security/sticky-pull-request-comment@v3
|
|
with:
|
|
header: gas-comparison
|
|
number: ${{ steps.pr_number.outputs.number }}
|
|
# Empty report (the common case): delete any stale comment from a previous push, post nothing new.
|
|
delete: ${{ !steps.gas_report.outputs.markdown }}
|
|
message: ${{ steps.gas_report.outputs.markdown }}
|