feat: LitkeyPaymentGateway contract + Hardhat project#373
Open
clawdbot-glitch003 wants to merge 1 commit into
Open
feat: LitkeyPaymentGateway contract + Hardhat project#373clawdbot-glitch003 wants to merge 1 commit into
clawdbot-glitch003 wants to merge 1 commit into
Conversation
First slice of Feature 2 from plans/lit-payments-app.md — the on-chain piece that the LITKEY → Stripe credit listener and the payment page will both depend on. Follow-up PRs add the rate poller, the WSS listener, and the Wagmi payment page. What's here: - lit-payments/contracts/ — self-contained Hardhat + TS project at Solidity 0.8.28 (matches the existing lit_node_express conventions). Networks: hardhat (local), baseSepolia, base. - LitkeyPaymentGateway.sol — immutable contract; pay(amount, wallet) pulls LITKEY from msg.sender via SafeERC20.safeTransferFrom, forwards to the treasury (the company Safe on Base), and emits Payment(indexed wallet, indexed payer, amount). Reverts on zero treasury / zero wallet / zero amount via custom errors. - Test-only MockERC20 + 12 unit tests: constructor guards, every revert path, happy path + balance + event args assertions, multi- payer attribution, cross-wallet payments (payer ≠ credited), and topic-filter sanity for the off-chain listener's queries. - scripts/deploy.ts — reads LITKEY_ADDRESS + TREASURY_ADDRESS from env, deploys, optionally Basescan-verifies if BASESCAN_API_KEY is set. - README.md walks through local test + Base Sepolia / mainnet deploy. - .github/workflows/lit-payments-contracts-ci.yml runs `npm ci` + `hardhat compile` + `hardhat test` on every PR touching lit-payments/contracts/. All 12 tests pass locally; clean compile. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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
plans/lit-payments-app.md: the on-chain piece the LITKEY → Stripe credit listener and payment page will both depend on.lit-payments/contracts/(Solidity 0.8.28, matches the existinglit_node_expressconventions).LitkeyPaymentGatewayis immutable —pay(amount, wallet)pulls LITKEY viaSafeERC20.safeTransferFrom, forwards to the treasury (company Safe on Base), and emitsPayment(indexed wallet, indexed payer, amount). Reverts on zero treasury / wallet / amount via custom errors.scripts/deploy.tsdeploys + (optionally) Basescan-verifies. README walks through Base Sepolia → mainnet..github/workflows/lit-payments-contracts-ci.ymlrunshardhat compile+hardhat teston PRs touchinglit-payments/contracts/.Test plan
npm testinlit-payments/contracts/— 12 / 12 passing locallynpx hardhat compilecleanPaymentevent shape via Basescan (manual step before merging)Follow-up PRs (Feature 2 remaining)
litkey_rateschema + admin rate-override UIlitkey_paymentsschema/payWithLitkeypayment page + dashboard "Pay with tokens" link